-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy path__init__.py
60 lines (52 loc) · 1.74 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# This code is part of Qiskit.
#
# (C) Copyright IBM 2022-2023.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.
from collections.abc import Iterable
from zne import __version__
def test_version():
assert __version__ == "1.3.1"
################################################################################
## DEFINITIONS
################################################################################
TYPES = [
INT := 0,
FLOAT := 0.0,
NAN := float("NaN"),
INF := float("Inf"),
MINF := float("-Inf"),
COMPLEX := complex(0, 0),
STR := "0",
BOOL := True,
NONE := None,
LIST := [0],
TUPLE := (0,),
DICT := {0: 0},
]
NO_INTS = [t for t in TYPES if not isinstance(t, int)]
NO_NONE = [t for t in TYPES if t is not None]
NO_INTS_NONE = [t for t in NO_INTS if t is not None]
NO_REAL = [t for t in NO_INTS if not isinstance(t, float)]
NO_NUM = [t for t in NO_REAL if not isinstance(t, complex)]
ITERS = [t for t in TYPES if isinstance(t, Iterable)]
NO_ITERS = [t for t in TYPES if not isinstance(t, Iterable)]
NO_ITERS_NONE = [t for t in NO_ITERS if t is not None]
################################################################################
## ALL
################################################################################
__all__ = [
"TYPES",
"NO_INTS",
"NO_INTS_NONE",
"NO_REAL",
"NO_NUM",
"ITERS",
"NO_ITERS",
]