ccxt 4.3.70__py2.py3-none-any.whl → 4.3.71__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ccxt/__init__.py +3 -1
- ccxt/abstract/paradex.py +40 -0
- ccxt/async_support/__init__.py +3 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/paradex.py +1966 -0
- ccxt/async_support/woo.py +4 -2
- ccxt/base/exchange.py +58 -1
- ccxt/paradex.py +1966 -0
- ccxt/pro/__init__.py +3 -1
- ccxt/pro/bequant.py +4 -0
- ccxt/pro/paradex.py +340 -0
- ccxt/static_dependencies/__init__.py +1 -1
- ccxt/static_dependencies/lark/__init__.py +38 -0
- ccxt/static_dependencies/lark/__pyinstaller/__init__.py +6 -0
- ccxt/static_dependencies/lark/__pyinstaller/hook-lark.py +14 -0
- ccxt/static_dependencies/lark/ast_utils.py +59 -0
- ccxt/static_dependencies/lark/common.py +86 -0
- ccxt/static_dependencies/lark/exceptions.py +292 -0
- ccxt/static_dependencies/lark/grammar.py +130 -0
- ccxt/static_dependencies/lark/grammars/__init__.py +0 -0
- ccxt/static_dependencies/lark/indenter.py +143 -0
- ccxt/static_dependencies/lark/lark.py +658 -0
- ccxt/static_dependencies/lark/lexer.py +678 -0
- ccxt/static_dependencies/lark/load_grammar.py +1428 -0
- ccxt/static_dependencies/lark/parse_tree_builder.py +391 -0
- ccxt/static_dependencies/lark/parser_frontends.py +257 -0
- ccxt/static_dependencies/lark/parsers/__init__.py +0 -0
- ccxt/static_dependencies/lark/parsers/cyk.py +340 -0
- ccxt/static_dependencies/lark/parsers/earley.py +314 -0
- ccxt/static_dependencies/lark/parsers/earley_common.py +42 -0
- ccxt/static_dependencies/lark/parsers/earley_forest.py +801 -0
- ccxt/static_dependencies/lark/parsers/grammar_analysis.py +203 -0
- ccxt/static_dependencies/lark/parsers/lalr_analysis.py +332 -0
- ccxt/static_dependencies/lark/parsers/lalr_interactive_parser.py +158 -0
- ccxt/static_dependencies/lark/parsers/lalr_parser.py +122 -0
- ccxt/static_dependencies/lark/parsers/lalr_parser_state.py +110 -0
- ccxt/static_dependencies/lark/parsers/xearley.py +165 -0
- ccxt/static_dependencies/lark/py.typed +0 -0
- ccxt/static_dependencies/lark/reconstruct.py +107 -0
- ccxt/static_dependencies/lark/tools/__init__.py +70 -0
- ccxt/static_dependencies/lark/tools/nearley.py +202 -0
- ccxt/static_dependencies/lark/tools/serialize.py +32 -0
- ccxt/static_dependencies/lark/tools/standalone.py +196 -0
- ccxt/static_dependencies/lark/tree.py +267 -0
- ccxt/static_dependencies/lark/tree_matcher.py +186 -0
- ccxt/static_dependencies/lark/tree_templates.py +180 -0
- ccxt/static_dependencies/lark/utils.py +343 -0
- ccxt/static_dependencies/lark/visitors.py +596 -0
- ccxt/static_dependencies/marshmallow/__init__.py +81 -0
- ccxt/static_dependencies/marshmallow/base.py +65 -0
- ccxt/static_dependencies/marshmallow/class_registry.py +94 -0
- ccxt/static_dependencies/marshmallow/decorators.py +231 -0
- ccxt/static_dependencies/marshmallow/error_store.py +60 -0
- ccxt/static_dependencies/marshmallow/exceptions.py +71 -0
- ccxt/static_dependencies/marshmallow/fields.py +2114 -0
- ccxt/static_dependencies/marshmallow/orderedset.py +89 -0
- ccxt/static_dependencies/marshmallow/py.typed +0 -0
- ccxt/static_dependencies/marshmallow/schema.py +1228 -0
- ccxt/static_dependencies/marshmallow/types.py +12 -0
- ccxt/static_dependencies/marshmallow/utils.py +378 -0
- ccxt/static_dependencies/marshmallow/validate.py +678 -0
- ccxt/static_dependencies/marshmallow/warnings.py +2 -0
- ccxt/static_dependencies/marshmallow_dataclass/__init__.py +1047 -0
- ccxt/static_dependencies/marshmallow_dataclass/collection_field.py +51 -0
- ccxt/static_dependencies/marshmallow_dataclass/lazy_class_attribute.py +45 -0
- ccxt/static_dependencies/marshmallow_dataclass/mypy.py +71 -0
- ccxt/static_dependencies/marshmallow_dataclass/py.typed +0 -0
- ccxt/static_dependencies/marshmallow_dataclass/typing.py +14 -0
- ccxt/static_dependencies/marshmallow_dataclass/union_field.py +82 -0
- ccxt/static_dependencies/marshmallow_oneofschema/__init__.py +1 -0
- ccxt/static_dependencies/marshmallow_oneofschema/one_of_schema.py +193 -0
- ccxt/static_dependencies/marshmallow_oneofschema/py.typed +0 -0
- ccxt/static_dependencies/starknet/__init__.py +0 -0
- ccxt/static_dependencies/starknet/cairo/__init__.py +0 -0
- ccxt/static_dependencies/starknet/cairo/data_types.py +123 -0
- ccxt/static_dependencies/starknet/cairo/deprecated_parse/__init__.py +0 -0
- ccxt/static_dependencies/starknet/cairo/deprecated_parse/cairo_types.py +77 -0
- ccxt/static_dependencies/starknet/cairo/deprecated_parse/parser.py +46 -0
- ccxt/static_dependencies/starknet/cairo/deprecated_parse/parser_transformer.py +138 -0
- ccxt/static_dependencies/starknet/cairo/felt.py +64 -0
- ccxt/static_dependencies/starknet/cairo/type_parser.py +121 -0
- ccxt/static_dependencies/starknet/cairo/v1/__init__.py +0 -0
- ccxt/static_dependencies/starknet/cairo/v1/type_parser.py +59 -0
- ccxt/static_dependencies/starknet/cairo/v2/__init__.py +0 -0
- ccxt/static_dependencies/starknet/cairo/v2/type_parser.py +77 -0
- ccxt/static_dependencies/starknet/ccxt_utils.py +7 -0
- ccxt/static_dependencies/starknet/common.py +15 -0
- ccxt/static_dependencies/starknet/constants.py +39 -0
- ccxt/static_dependencies/starknet/hash/__init__.py +0 -0
- ccxt/static_dependencies/starknet/hash/address.py +79 -0
- ccxt/static_dependencies/starknet/hash/compiled_class_hash_objects.py +111 -0
- ccxt/static_dependencies/starknet/hash/selector.py +16 -0
- ccxt/static_dependencies/starknet/hash/storage.py +12 -0
- ccxt/static_dependencies/starknet/hash/utils.py +78 -0
- ccxt/static_dependencies/starknet/serialization/__init__.py +24 -0
- ccxt/static_dependencies/starknet/serialization/_calldata_reader.py +40 -0
- ccxt/static_dependencies/starknet/serialization/_context.py +142 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/__init__.py +10 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/_common.py +82 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/array_serializer.py +43 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/bool_serializer.py +37 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/byte_array_serializer.py +66 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/cairo_data_serializer.py +71 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/enum_serializer.py +71 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/felt_serializer.py +50 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/named_tuple_serializer.py +58 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/option_serializer.py +43 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/output_serializer.py +40 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/payload_serializer.py +72 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/struct_serializer.py +36 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/tuple_serializer.py +36 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/uint256_serializer.py +76 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/uint_serializer.py +100 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/unit_serializer.py +32 -0
- ccxt/static_dependencies/starknet/serialization/errors.py +10 -0
- ccxt/static_dependencies/starknet/serialization/factory.py +229 -0
- ccxt/static_dependencies/starknet/serialization/function_serialization_adapter.py +110 -0
- ccxt/static_dependencies/starknet/serialization/tuple_dataclass.py +59 -0
- ccxt/static_dependencies/starknet/utils/__init__.py +0 -0
- ccxt/static_dependencies/starknet/utils/constructor_args_translator.py +86 -0
- ccxt/static_dependencies/starknet/utils/iterable.py +13 -0
- ccxt/static_dependencies/starknet/utils/schema.py +13 -0
- ccxt/static_dependencies/starknet/utils/typed_data.py +182 -0
- ccxt/static_dependencies/sympy/__init__.py +0 -0
- ccxt/static_dependencies/sympy/external/__init__.py +0 -0
- ccxt/static_dependencies/sympy/external/gmpy.py +345 -0
- ccxt/static_dependencies/sympy/external/importtools.py +187 -0
- ccxt/static_dependencies/sympy/external/ntheory.py +637 -0
- ccxt/static_dependencies/sympy/external/pythonmpq.py +341 -0
- ccxt/static_dependencies/typing_extensions/__init__.py +0 -0
- ccxt/static_dependencies/typing_extensions/typing_extensions.py +3839 -0
- ccxt/static_dependencies/typing_inspect/__init__.py +0 -0
- ccxt/static_dependencies/typing_inspect/typing_inspect.py +851 -0
- ccxt/test/tests_async.py +43 -1
- ccxt/test/tests_sync.py +43 -1
- ccxt/woo.py +4 -2
- {ccxt-4.3.70.dist-info → ccxt-4.3.71.dist-info}/METADATA +7 -6
- {ccxt-4.3.70.dist-info → ccxt-4.3.71.dist-info}/RECORD +141 -16
- {ccxt-4.3.70.dist-info → ccxt-4.3.71.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.3.70.dist-info → ccxt-4.3.71.dist-info}/WHEEL +0 -0
- {ccxt-4.3.70.dist-info → ccxt-4.3.71.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,187 @@
|
|
1
|
+
"""Tools to assist importing optional external modules."""
|
2
|
+
|
3
|
+
import sys
|
4
|
+
import re
|
5
|
+
|
6
|
+
# Override these in the module to change the default warning behavior.
|
7
|
+
# For example, you might set both to False before running the tests so that
|
8
|
+
# warnings are not printed to the console, or set both to True for debugging.
|
9
|
+
|
10
|
+
WARN_NOT_INSTALLED = None # Default is False
|
11
|
+
WARN_OLD_VERSION = None # Default is True
|
12
|
+
|
13
|
+
|
14
|
+
def __sympy_debug():
|
15
|
+
# helper function from sympy/__init__.py
|
16
|
+
# We don't just import SYMPY_DEBUG from that file because we don't want to
|
17
|
+
# import all of SymPy just to use this module.
|
18
|
+
import os
|
19
|
+
debug_str = os.getenv('SYMPY_DEBUG', 'False')
|
20
|
+
if debug_str in ('True', 'False'):
|
21
|
+
return eval(debug_str)
|
22
|
+
else:
|
23
|
+
raise RuntimeError("unrecognized value for SYMPY_DEBUG: %s" %
|
24
|
+
debug_str)
|
25
|
+
|
26
|
+
if __sympy_debug():
|
27
|
+
WARN_OLD_VERSION = True
|
28
|
+
WARN_NOT_INSTALLED = True
|
29
|
+
|
30
|
+
|
31
|
+
_component_re = re.compile(r'(\d+ | [a-z]+ | \.)', re.VERBOSE)
|
32
|
+
|
33
|
+
def version_tuple(vstring):
|
34
|
+
# Parse a version string to a tuple e.g. '1.2' -> (1, 2)
|
35
|
+
# Simplified from distutils.version.LooseVersion which was deprecated in
|
36
|
+
# Python 3.10.
|
37
|
+
components = []
|
38
|
+
for x in _component_re.split(vstring):
|
39
|
+
if x and x != '.':
|
40
|
+
try:
|
41
|
+
x = int(x)
|
42
|
+
except ValueError:
|
43
|
+
pass
|
44
|
+
components.append(x)
|
45
|
+
return tuple(components)
|
46
|
+
|
47
|
+
|
48
|
+
def import_module(module, min_module_version=None, min_python_version=None,
|
49
|
+
warn_not_installed=None, warn_old_version=None,
|
50
|
+
module_version_attr='__version__', module_version_attr_call_args=None,
|
51
|
+
import_kwargs={}, catch=()):
|
52
|
+
"""
|
53
|
+
Import and return a module if it is installed.
|
54
|
+
|
55
|
+
If the module is not installed, it returns None.
|
56
|
+
|
57
|
+
A minimum version for the module can be given as the keyword argument
|
58
|
+
min_module_version. This should be comparable against the module version.
|
59
|
+
By default, module.__version__ is used to get the module version. To
|
60
|
+
override this, set the module_version_attr keyword argument. If the
|
61
|
+
attribute of the module to get the version should be called (e.g.,
|
62
|
+
module.version()), then set module_version_attr_call_args to the args such
|
63
|
+
that module.module_version_attr(*module_version_attr_call_args) returns the
|
64
|
+
module's version.
|
65
|
+
|
66
|
+
If the module version is less than min_module_version using the Python <
|
67
|
+
comparison, None will be returned, even if the module is installed. You can
|
68
|
+
use this to keep from importing an incompatible older version of a module.
|
69
|
+
|
70
|
+
You can also specify a minimum Python version by using the
|
71
|
+
min_python_version keyword argument. This should be comparable against
|
72
|
+
sys.version_info.
|
73
|
+
|
74
|
+
If the keyword argument warn_not_installed is set to True, the function will
|
75
|
+
emit a UserWarning when the module is not installed.
|
76
|
+
|
77
|
+
If the keyword argument warn_old_version is set to True, the function will
|
78
|
+
emit a UserWarning when the library is installed, but cannot be imported
|
79
|
+
because of the min_module_version or min_python_version options.
|
80
|
+
|
81
|
+
Note that because of the way warnings are handled, a warning will be
|
82
|
+
emitted for each module only once. You can change the default warning
|
83
|
+
behavior by overriding the values of WARN_NOT_INSTALLED and WARN_OLD_VERSION
|
84
|
+
in sympy.external.importtools. By default, WARN_NOT_INSTALLED is False and
|
85
|
+
WARN_OLD_VERSION is True.
|
86
|
+
|
87
|
+
This function uses __import__() to import the module. To pass additional
|
88
|
+
options to __import__(), use the import_kwargs keyword argument. For
|
89
|
+
example, to import a submodule A.B, you must pass a nonempty fromlist option
|
90
|
+
to __import__. See the docstring of __import__().
|
91
|
+
|
92
|
+
This catches ImportError to determine if the module is not installed. To
|
93
|
+
catch additional errors, pass them as a tuple to the catch keyword
|
94
|
+
argument.
|
95
|
+
|
96
|
+
Examples
|
97
|
+
========
|
98
|
+
|
99
|
+
>>> from sympy.external import import_module
|
100
|
+
|
101
|
+
>>> numpy = import_module('numpy')
|
102
|
+
|
103
|
+
>>> numpy = import_module('numpy', min_python_version=(2, 7),
|
104
|
+
... warn_old_version=False)
|
105
|
+
|
106
|
+
>>> numpy = import_module('numpy', min_module_version='1.5',
|
107
|
+
... warn_old_version=False) # numpy.__version__ is a string
|
108
|
+
|
109
|
+
>>> # gmpy does not have __version__, but it does have gmpy.version()
|
110
|
+
|
111
|
+
>>> gmpy = import_module('gmpy', min_module_version='1.14',
|
112
|
+
... module_version_attr='version', module_version_attr_call_args=(),
|
113
|
+
... warn_old_version=False)
|
114
|
+
|
115
|
+
>>> # To import a submodule, you must pass a nonempty fromlist to
|
116
|
+
>>> # __import__(). The values do not matter.
|
117
|
+
>>> p3 = import_module('mpl_toolkits.mplot3d',
|
118
|
+
... import_kwargs={'fromlist':['something']})
|
119
|
+
|
120
|
+
>>> # matplotlib.pyplot can raise RuntimeError when the display cannot be opened
|
121
|
+
>>> matplotlib = import_module('matplotlib',
|
122
|
+
... import_kwargs={'fromlist':['pyplot']}, catch=(RuntimeError,))
|
123
|
+
|
124
|
+
"""
|
125
|
+
# keyword argument overrides default, and global variable overrides
|
126
|
+
# keyword argument.
|
127
|
+
warn_old_version = (WARN_OLD_VERSION if WARN_OLD_VERSION is not None
|
128
|
+
else warn_old_version or True)
|
129
|
+
warn_not_installed = (WARN_NOT_INSTALLED if WARN_NOT_INSTALLED is not None
|
130
|
+
else warn_not_installed or False)
|
131
|
+
|
132
|
+
import warnings
|
133
|
+
|
134
|
+
# Check Python first so we don't waste time importing a module we can't use
|
135
|
+
if min_python_version:
|
136
|
+
if sys.version_info < min_python_version:
|
137
|
+
if warn_old_version:
|
138
|
+
warnings.warn("Python version is too old to use %s "
|
139
|
+
"(%s or newer required)" % (
|
140
|
+
module, '.'.join(map(str, min_python_version))),
|
141
|
+
UserWarning, stacklevel=2)
|
142
|
+
return
|
143
|
+
|
144
|
+
try:
|
145
|
+
mod = __import__(module, **import_kwargs)
|
146
|
+
|
147
|
+
## there's something funny about imports with matplotlib and py3k. doing
|
148
|
+
## from matplotlib import collections
|
149
|
+
## gives python's stdlib collections module. explicitly re-importing
|
150
|
+
## the module fixes this.
|
151
|
+
from_list = import_kwargs.get('fromlist', ())
|
152
|
+
for submod in from_list:
|
153
|
+
if submod == 'collections' and mod.__name__ == 'matplotlib':
|
154
|
+
__import__(module + '.' + submod)
|
155
|
+
except ImportError:
|
156
|
+
if warn_not_installed:
|
157
|
+
warnings.warn("%s module is not installed" % module, UserWarning,
|
158
|
+
stacklevel=2)
|
159
|
+
return
|
160
|
+
except catch as e:
|
161
|
+
if warn_not_installed:
|
162
|
+
warnings.warn(
|
163
|
+
"%s module could not be used (%s)" % (module, repr(e)),
|
164
|
+
stacklevel=2)
|
165
|
+
return
|
166
|
+
|
167
|
+
if min_module_version:
|
168
|
+
modversion = getattr(mod, module_version_attr)
|
169
|
+
if module_version_attr_call_args is not None:
|
170
|
+
modversion = modversion(*module_version_attr_call_args)
|
171
|
+
if version_tuple(modversion) < version_tuple(min_module_version):
|
172
|
+
if warn_old_version:
|
173
|
+
# Attempt to create a pretty string version of the version
|
174
|
+
if isinstance(min_module_version, str):
|
175
|
+
verstr = min_module_version
|
176
|
+
elif isinstance(min_module_version, (tuple, list)):
|
177
|
+
verstr = '.'.join(map(str, min_module_version))
|
178
|
+
else:
|
179
|
+
# Either don't know what this is. Hopefully
|
180
|
+
# it's something that has a nice str version, like an int.
|
181
|
+
verstr = str(min_module_version)
|
182
|
+
warnings.warn("%s version is too old to use "
|
183
|
+
"(%s or newer required)" % (module, verstr),
|
184
|
+
UserWarning, stacklevel=2)
|
185
|
+
return
|
186
|
+
|
187
|
+
return mod
|