Datasets:
Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +2 -0
- material/dataset/Datasets/Electron Microscopy Image Masks/TiO2_Masks_Manual_4connected_4Classes/1908318_cm.tif +3 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/h5py.libs/libaec-7e9d22b8.so.0.1.3 +3 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/httpx/__pycache__/__init__.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/httpx/__pycache__/_api.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/httpx/__pycache__/_client.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/httpx/__pycache__/_config.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/httpx/__pycache__/_content.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/httpx/__pycache__/_exceptions.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/httpx/__pycache__/_models.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/httpx/__pycache__/_status_codes.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/httpx/__pycache__/_types.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/httpx/__pycache__/_urlparse.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/inference/__pycache__/helpers.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/inference/__pycache__/imports.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/inference/__pycache__/param.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/plugins/__init__.py +47 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/plugins/__pycache__/flask.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/plugins/django.py +296 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/plugins/flask.py +21 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/plugins/pytest.py +269 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/plugins/registry.py +12 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/plugins/stdlib.py +879 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/third_party/django-stubs/django-stubs/db/backends/base/base.pyi +102 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/third_party/django-stubs/django-stubs/db/backends/base/client.pyi +9 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/third_party/django-stubs/django-stubs/db/backends/base/creation.pyi +24 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/third_party/django-stubs/django-stubs/db/backends/base/introspection.pyi +27 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/third_party/django-stubs/django-stubs/db/backends/base/operations.pyi +104 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/third_party/django-stubs/django-stubs/db/backends/dummy/__init__.pyi +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/third_party/django-stubs/django-stubs/db/backends/dummy/base.pyi +31 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/third_party/django-stubs/django-stubs/db/backends/sqlite3/features.pyi +3 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/third_party/django-stubs/django-stubs/db/backends/sqlite3/operations.pyi +3 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/third_party/typeshed/stdlib/3/asyncio/base_futures.pyi +22 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/third_party/typeshed/stdlib/3/asyncio/events.pyi +502 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/third_party/typeshed/stdlib/3/asyncio/format_helpers.pyi +20 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/third_party/typeshed/stdlib/3/asyncio/log.pyi +3 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/third_party/typeshed/stdlib/3/asyncio/queues.pyi +36 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/third_party/typeshed/stdlib/3/html/parser.pyi +20 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jupyter_events/__pycache__/__init__.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jupyter_events/__pycache__/_version.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jupyter_events/__pycache__/cli.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jupyter_events/__pycache__/logger.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jupyter_events/__pycache__/pytest_plugin.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jupyter_events/__pycache__/schema.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jupyter_events/__pycache__/schema_registry.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jupyter_events/__pycache__/traits.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jupyter_events/__pycache__/utils.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jupyter_events/__pycache__/validators.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jupyter_events/__pycache__/yaml.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jupyter_events/schemas/event-core-schema.yml +27 -0
.gitattributes
CHANGED
|
@@ -496,3 +496,5 @@ material/dataset/Datasets/Electron[[:space:]]Microscopy[[:space:]]Image[[:space:
|
|
| 496 |
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pillow.libs/libxcb-55eab65a.so.1.1.0 filter=lfs diff=lfs merge=lfs -text
|
| 497 |
material/dataset/Datasets/Electron[[:space:]]Microscopy[[:space:]]Image[[:space:]]Masks/TiO2_Masks_Manual_4connected/1908304_m.tif filter=lfs diff=lfs merge=lfs -text
|
| 498 |
material/dataset/Datasets/Electron[[:space:]]Microscopy[[:space:]]Image[[:space:]]Masks/TiO2_Masks_Manual_4connected_4Classes/1908276_cm.tif filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 496 |
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pillow.libs/libxcb-55eab65a.so.1.1.0 filter=lfs diff=lfs merge=lfs -text
|
| 497 |
material/dataset/Datasets/Electron[[:space:]]Microscopy[[:space:]]Image[[:space:]]Masks/TiO2_Masks_Manual_4connected/1908304_m.tif filter=lfs diff=lfs merge=lfs -text
|
| 498 |
material/dataset/Datasets/Electron[[:space:]]Microscopy[[:space:]]Image[[:space:]]Masks/TiO2_Masks_Manual_4connected_4Classes/1908276_cm.tif filter=lfs diff=lfs merge=lfs -text
|
| 499 |
+
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/h5py.libs/libaec-7e9d22b8.so.0.1.3 filter=lfs diff=lfs merge=lfs -text
|
| 500 |
+
material/dataset/Datasets/Electron[[:space:]]Microscopy[[:space:]]Image[[:space:]]Masks/TiO2_Masks_Manual_4connected_4Classes/1908318_cm.tif filter=lfs diff=lfs merge=lfs -text
|
material/dataset/Datasets/Electron Microscopy Image Masks/TiO2_Masks_Manual_4connected_4Classes/1908318_cm.tif
ADDED
|
|
Git LFS Details
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/h5py.libs/libaec-7e9d22b8.so.0.1.3
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0788adca6f4440b7f72f1520c90a9bf19fb3c0a28202a6a3fbeda3fe525dd9d8
|
| 3 |
+
size 135913
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/httpx/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (1.94 kB). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/httpx/__pycache__/_api.cpython-310.pyc
ADDED
|
Binary file (7.72 kB). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/httpx/__pycache__/_client.cpython-310.pyc
ADDED
|
Binary file (41.5 kB). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/httpx/__pycache__/_config.cpython-310.pyc
ADDED
|
Binary file (7.17 kB). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/httpx/__pycache__/_content.cpython-310.pyc
ADDED
|
Binary file (7.37 kB). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/httpx/__pycache__/_exceptions.cpython-310.pyc
ADDED
|
Binary file (10.4 kB). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/httpx/__pycache__/_models.cpython-310.pyc
ADDED
|
Binary file (39.2 kB). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/httpx/__pycache__/_status_codes.cpython-310.pyc
ADDED
|
Binary file (6.37 kB). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/httpx/__pycache__/_types.cpython-310.pyc
ADDED
|
Binary file (2.91 kB). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/httpx/__pycache__/_urlparse.cpython-310.pyc
ADDED
|
Binary file (11.1 kB). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/inference/__pycache__/helpers.cpython-310.pyc
ADDED
|
Binary file (5.26 kB). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/inference/__pycache__/imports.cpython-310.pyc
ADDED
|
Binary file (14.3 kB). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/inference/__pycache__/param.cpython-310.pyc
ADDED
|
Binary file (7.08 kB). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/plugins/__init__.py
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from functools import wraps
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
class _PluginManager:
|
| 5 |
+
def __init__(self):
|
| 6 |
+
self._registered_plugins = []
|
| 7 |
+
self._cached_base_callbacks = {}
|
| 8 |
+
self._built_functions = {}
|
| 9 |
+
|
| 10 |
+
def register(self, *plugins):
|
| 11 |
+
"""
|
| 12 |
+
Makes it possible to register your plugin.
|
| 13 |
+
"""
|
| 14 |
+
self._registered_plugins.extend(plugins)
|
| 15 |
+
self._build_functions()
|
| 16 |
+
|
| 17 |
+
def decorate(self, name=None):
|
| 18 |
+
def decorator(callback):
|
| 19 |
+
@wraps(callback)
|
| 20 |
+
def wrapper(*args, **kwargs):
|
| 21 |
+
return built_functions[public_name](*args, **kwargs)
|
| 22 |
+
|
| 23 |
+
public_name = name or callback.__name__
|
| 24 |
+
|
| 25 |
+
assert public_name not in self._built_functions
|
| 26 |
+
built_functions = self._built_functions
|
| 27 |
+
built_functions[public_name] = callback
|
| 28 |
+
self._cached_base_callbacks[public_name] = callback
|
| 29 |
+
|
| 30 |
+
return wrapper
|
| 31 |
+
|
| 32 |
+
return decorator
|
| 33 |
+
|
| 34 |
+
def _build_functions(self):
|
| 35 |
+
for name, callback in self._cached_base_callbacks.items():
|
| 36 |
+
for plugin in reversed(self._registered_plugins):
|
| 37 |
+
# Need to reverse so the first plugin is run first.
|
| 38 |
+
try:
|
| 39 |
+
func = getattr(plugin, name)
|
| 40 |
+
except AttributeError:
|
| 41 |
+
pass
|
| 42 |
+
else:
|
| 43 |
+
callback = func(callback)
|
| 44 |
+
self._built_functions[name] = callback
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
plugin_manager = _PluginManager()
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/plugins/__pycache__/flask.cpython-310.pyc
ADDED
|
Binary file (929 Bytes). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/plugins/django.py
ADDED
|
@@ -0,0 +1,296 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Module is used to infer Django model fields.
|
| 3 |
+
"""
|
| 4 |
+
from inspect import Parameter
|
| 5 |
+
|
| 6 |
+
from jedi import debug
|
| 7 |
+
from jedi.inference.cache import inference_state_function_cache
|
| 8 |
+
from jedi.inference.base_value import ValueSet, iterator_to_value_set, ValueWrapper
|
| 9 |
+
from jedi.inference.filters import DictFilter, AttributeOverwrite
|
| 10 |
+
from jedi.inference.names import NameWrapper, BaseTreeParamName
|
| 11 |
+
from jedi.inference.compiled.value import EmptyCompiledName
|
| 12 |
+
from jedi.inference.value.instance import TreeInstance
|
| 13 |
+
from jedi.inference.value.klass import ClassMixin
|
| 14 |
+
from jedi.inference.gradual.base import GenericClass
|
| 15 |
+
from jedi.inference.gradual.generics import TupleGenericManager
|
| 16 |
+
from jedi.inference.signature import AbstractSignature
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
mapping = {
|
| 20 |
+
'IntegerField': (None, 'int'),
|
| 21 |
+
'BigIntegerField': (None, 'int'),
|
| 22 |
+
'PositiveIntegerField': (None, 'int'),
|
| 23 |
+
'SmallIntegerField': (None, 'int'),
|
| 24 |
+
'CharField': (None, 'str'),
|
| 25 |
+
'TextField': (None, 'str'),
|
| 26 |
+
'EmailField': (None, 'str'),
|
| 27 |
+
'GenericIPAddressField': (None, 'str'),
|
| 28 |
+
'URLField': (None, 'str'),
|
| 29 |
+
'FloatField': (None, 'float'),
|
| 30 |
+
'BinaryField': (None, 'bytes'),
|
| 31 |
+
'BooleanField': (None, 'bool'),
|
| 32 |
+
'DecimalField': ('decimal', 'Decimal'),
|
| 33 |
+
'TimeField': ('datetime', 'time'),
|
| 34 |
+
'DurationField': ('datetime', 'timedelta'),
|
| 35 |
+
'DateField': ('datetime', 'date'),
|
| 36 |
+
'DateTimeField': ('datetime', 'datetime'),
|
| 37 |
+
'UUIDField': ('uuid', 'UUID'),
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
_FILTER_LIKE_METHODS = ('create', 'filter', 'exclude', 'update', 'get',
|
| 41 |
+
'get_or_create', 'update_or_create')
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
@inference_state_function_cache()
|
| 45 |
+
def _get_deferred_attributes(inference_state):
|
| 46 |
+
return inference_state.import_module(
|
| 47 |
+
('django', 'db', 'models', 'query_utils')
|
| 48 |
+
).py__getattribute__('DeferredAttribute').execute_annotation()
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def _infer_scalar_field(inference_state, field_name, field_tree_instance, is_instance):
|
| 52 |
+
try:
|
| 53 |
+
module_name, attribute_name = mapping[field_tree_instance.py__name__()]
|
| 54 |
+
except KeyError:
|
| 55 |
+
return None
|
| 56 |
+
|
| 57 |
+
if not is_instance:
|
| 58 |
+
return _get_deferred_attributes(inference_state)
|
| 59 |
+
|
| 60 |
+
if module_name is None:
|
| 61 |
+
module = inference_state.builtins_module
|
| 62 |
+
else:
|
| 63 |
+
module = inference_state.import_module((module_name,))
|
| 64 |
+
|
| 65 |
+
for attribute in module.py__getattribute__(attribute_name):
|
| 66 |
+
return attribute.execute_with_values()
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
@iterator_to_value_set
|
| 70 |
+
def _get_foreign_key_values(cls, field_tree_instance):
|
| 71 |
+
if isinstance(field_tree_instance, TreeInstance):
|
| 72 |
+
# TODO private access..
|
| 73 |
+
argument_iterator = field_tree_instance._arguments.unpack()
|
| 74 |
+
key, lazy_values = next(argument_iterator, (None, None))
|
| 75 |
+
if key is None and lazy_values is not None:
|
| 76 |
+
for value in lazy_values.infer():
|
| 77 |
+
if value.py__name__() == 'str':
|
| 78 |
+
foreign_key_class_name = value.get_safe_value()
|
| 79 |
+
module = cls.get_root_context()
|
| 80 |
+
for v in module.py__getattribute__(foreign_key_class_name):
|
| 81 |
+
if v.is_class():
|
| 82 |
+
yield v
|
| 83 |
+
elif value.is_class():
|
| 84 |
+
yield value
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
def _infer_field(cls, field_name, is_instance):
|
| 88 |
+
inference_state = cls.inference_state
|
| 89 |
+
result = field_name.infer()
|
| 90 |
+
for field_tree_instance in result:
|
| 91 |
+
scalar_field = _infer_scalar_field(
|
| 92 |
+
inference_state, field_name, field_tree_instance, is_instance)
|
| 93 |
+
if scalar_field is not None:
|
| 94 |
+
return scalar_field
|
| 95 |
+
|
| 96 |
+
name = field_tree_instance.py__name__()
|
| 97 |
+
is_many_to_many = name == 'ManyToManyField'
|
| 98 |
+
if name in ('ForeignKey', 'OneToOneField') or is_many_to_many:
|
| 99 |
+
if not is_instance:
|
| 100 |
+
return _get_deferred_attributes(inference_state)
|
| 101 |
+
|
| 102 |
+
values = _get_foreign_key_values(cls, field_tree_instance)
|
| 103 |
+
if is_many_to_many:
|
| 104 |
+
return ValueSet(filter(None, [
|
| 105 |
+
_create_manager_for(v, 'RelatedManager') for v in values
|
| 106 |
+
]))
|
| 107 |
+
else:
|
| 108 |
+
return values.execute_with_values()
|
| 109 |
+
|
| 110 |
+
debug.dbg('django plugin: fail to infer `%s` from class `%s`',
|
| 111 |
+
field_name.string_name, cls.py__name__())
|
| 112 |
+
return result
|
| 113 |
+
|
| 114 |
+
|
| 115 |
+
class DjangoModelName(NameWrapper):
|
| 116 |
+
def __init__(self, cls, name, is_instance):
|
| 117 |
+
super().__init__(name)
|
| 118 |
+
self._cls = cls
|
| 119 |
+
self._is_instance = is_instance
|
| 120 |
+
|
| 121 |
+
def infer(self):
|
| 122 |
+
return _infer_field(self._cls, self._wrapped_name, self._is_instance)
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
def _create_manager_for(cls, manager_cls='BaseManager'):
|
| 126 |
+
managers = cls.inference_state.import_module(
|
| 127 |
+
('django', 'db', 'models', 'manager')
|
| 128 |
+
).py__getattribute__(manager_cls)
|
| 129 |
+
for m in managers:
|
| 130 |
+
if m.is_class_mixin():
|
| 131 |
+
generics_manager = TupleGenericManager((ValueSet([cls]),))
|
| 132 |
+
for c in GenericClass(m, generics_manager).execute_annotation():
|
| 133 |
+
return c
|
| 134 |
+
return None
|
| 135 |
+
|
| 136 |
+
|
| 137 |
+
def _new_dict_filter(cls, is_instance):
|
| 138 |
+
filters = list(cls.get_filters(
|
| 139 |
+
is_instance=is_instance,
|
| 140 |
+
include_metaclasses=False,
|
| 141 |
+
include_type_when_class=False)
|
| 142 |
+
)
|
| 143 |
+
dct = {
|
| 144 |
+
name.string_name: DjangoModelName(cls, name, is_instance)
|
| 145 |
+
for filter_ in reversed(filters)
|
| 146 |
+
for name in filter_.values()
|
| 147 |
+
}
|
| 148 |
+
if is_instance:
|
| 149 |
+
# Replace the objects with a name that amounts to nothing when accessed
|
| 150 |
+
# in an instance. This is not perfect and still completes "objects" in
|
| 151 |
+
# that case, but it at least not inferes stuff like `.objects.filter`.
|
| 152 |
+
# It would be nicer to do that in a better way, so that it also doesn't
|
| 153 |
+
# show up in completions, but it's probably just not worth doing that
|
| 154 |
+
# for the extra amount of work.
|
| 155 |
+
dct['objects'] = EmptyCompiledName(cls.inference_state, 'objects')
|
| 156 |
+
|
| 157 |
+
return DictFilter(dct)
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
def is_django_model_base(value):
|
| 161 |
+
return value.py__name__() == 'ModelBase' \
|
| 162 |
+
and value.get_root_context().py__name__() == 'django.db.models.base'
|
| 163 |
+
|
| 164 |
+
|
| 165 |
+
def get_metaclass_filters(func):
|
| 166 |
+
def wrapper(cls, metaclasses, is_instance):
|
| 167 |
+
for metaclass in metaclasses:
|
| 168 |
+
if is_django_model_base(metaclass):
|
| 169 |
+
return [_new_dict_filter(cls, is_instance)]
|
| 170 |
+
|
| 171 |
+
return func(cls, metaclasses, is_instance)
|
| 172 |
+
return wrapper
|
| 173 |
+
|
| 174 |
+
|
| 175 |
+
def tree_name_to_values(func):
|
| 176 |
+
def wrapper(inference_state, context, tree_name):
|
| 177 |
+
result = func(inference_state, context, tree_name)
|
| 178 |
+
if tree_name.value in _FILTER_LIKE_METHODS:
|
| 179 |
+
# Here we try to overwrite stuff like User.objects.filter. We need
|
| 180 |
+
# this to make sure that keyword param completion works on these
|
| 181 |
+
# kind of methods.
|
| 182 |
+
for v in result:
|
| 183 |
+
if v.get_qualified_names() == ('_BaseQuerySet', tree_name.value) \
|
| 184 |
+
and v.parent_context.is_module() \
|
| 185 |
+
and v.parent_context.py__name__() == 'django.db.models.query':
|
| 186 |
+
qs = context.get_value()
|
| 187 |
+
generics = qs.get_generics()
|
| 188 |
+
if len(generics) >= 1:
|
| 189 |
+
return ValueSet(QuerySetMethodWrapper(v, model)
|
| 190 |
+
for model in generics[0])
|
| 191 |
+
|
| 192 |
+
elif tree_name.value == 'BaseManager' and context.is_module() \
|
| 193 |
+
and context.py__name__() == 'django.db.models.manager':
|
| 194 |
+
return ValueSet(ManagerWrapper(r) for r in result)
|
| 195 |
+
|
| 196 |
+
elif tree_name.value == 'Field' and context.is_module() \
|
| 197 |
+
and context.py__name__() == 'django.db.models.fields':
|
| 198 |
+
return ValueSet(FieldWrapper(r) for r in result)
|
| 199 |
+
return result
|
| 200 |
+
return wrapper
|
| 201 |
+
|
| 202 |
+
|
| 203 |
+
def _find_fields(cls):
|
| 204 |
+
for name in _new_dict_filter(cls, is_instance=False).values():
|
| 205 |
+
for value in name.infer():
|
| 206 |
+
if value.name.get_qualified_names(include_module_names=True) \
|
| 207 |
+
== ('django', 'db', 'models', 'query_utils', 'DeferredAttribute'):
|
| 208 |
+
yield name
|
| 209 |
+
|
| 210 |
+
|
| 211 |
+
def _get_signatures(cls):
|
| 212 |
+
return [DjangoModelSignature(cls, field_names=list(_find_fields(cls)))]
|
| 213 |
+
|
| 214 |
+
|
| 215 |
+
def get_metaclass_signatures(func):
|
| 216 |
+
def wrapper(cls, metaclasses):
|
| 217 |
+
for metaclass in metaclasses:
|
| 218 |
+
if is_django_model_base(metaclass):
|
| 219 |
+
return _get_signatures(cls)
|
| 220 |
+
return func(cls, metaclass)
|
| 221 |
+
return wrapper
|
| 222 |
+
|
| 223 |
+
|
| 224 |
+
class ManagerWrapper(ValueWrapper):
|
| 225 |
+
def py__getitem__(self, index_value_set, contextualized_node):
|
| 226 |
+
return ValueSet(
|
| 227 |
+
GenericManagerWrapper(generic)
|
| 228 |
+
for generic in self._wrapped_value.py__getitem__(
|
| 229 |
+
index_value_set, contextualized_node)
|
| 230 |
+
)
|
| 231 |
+
|
| 232 |
+
|
| 233 |
+
class GenericManagerWrapper(AttributeOverwrite, ClassMixin):
|
| 234 |
+
def py__get__on_class(self, calling_instance, instance, class_value):
|
| 235 |
+
return calling_instance.class_value.with_generics(
|
| 236 |
+
(ValueSet({class_value}),)
|
| 237 |
+
).py__call__(calling_instance._arguments)
|
| 238 |
+
|
| 239 |
+
def with_generics(self, generics_tuple):
|
| 240 |
+
return self._wrapped_value.with_generics(generics_tuple)
|
| 241 |
+
|
| 242 |
+
|
| 243 |
+
class FieldWrapper(ValueWrapper):
|
| 244 |
+
def py__getitem__(self, index_value_set, contextualized_node):
|
| 245 |
+
return ValueSet(
|
| 246 |
+
GenericFieldWrapper(generic)
|
| 247 |
+
for generic in self._wrapped_value.py__getitem__(
|
| 248 |
+
index_value_set, contextualized_node)
|
| 249 |
+
)
|
| 250 |
+
|
| 251 |
+
|
| 252 |
+
class GenericFieldWrapper(AttributeOverwrite, ClassMixin):
|
| 253 |
+
def py__get__on_class(self, calling_instance, instance, class_value):
|
| 254 |
+
# This is mostly an optimization to avoid Jedi aborting inference,
|
| 255 |
+
# because of too many function executions of Field.__get__.
|
| 256 |
+
return ValueSet({calling_instance})
|
| 257 |
+
|
| 258 |
+
|
| 259 |
+
class DjangoModelSignature(AbstractSignature):
|
| 260 |
+
def __init__(self, value, field_names):
|
| 261 |
+
super().__init__(value)
|
| 262 |
+
self._field_names = field_names
|
| 263 |
+
|
| 264 |
+
def get_param_names(self, resolve_stars=False):
|
| 265 |
+
return [DjangoParamName(name) for name in self._field_names]
|
| 266 |
+
|
| 267 |
+
|
| 268 |
+
class DjangoParamName(BaseTreeParamName):
|
| 269 |
+
def __init__(self, field_name):
|
| 270 |
+
super().__init__(field_name.parent_context, field_name.tree_name)
|
| 271 |
+
self._field_name = field_name
|
| 272 |
+
|
| 273 |
+
def get_kind(self):
|
| 274 |
+
return Parameter.KEYWORD_ONLY
|
| 275 |
+
|
| 276 |
+
def infer(self):
|
| 277 |
+
return self._field_name.infer()
|
| 278 |
+
|
| 279 |
+
|
| 280 |
+
class QuerySetMethodWrapper(ValueWrapper):
|
| 281 |
+
def __init__(self, method, model_cls):
|
| 282 |
+
super().__init__(method)
|
| 283 |
+
self._model_cls = model_cls
|
| 284 |
+
|
| 285 |
+
def py__get__(self, instance, class_value):
|
| 286 |
+
return ValueSet({QuerySetBoundMethodWrapper(v, self._model_cls)
|
| 287 |
+
for v in self._wrapped_value.py__get__(instance, class_value)})
|
| 288 |
+
|
| 289 |
+
|
| 290 |
+
class QuerySetBoundMethodWrapper(ValueWrapper):
|
| 291 |
+
def __init__(self, method, model_cls):
|
| 292 |
+
super().__init__(method)
|
| 293 |
+
self._model_cls = model_cls
|
| 294 |
+
|
| 295 |
+
def get_signatures(self):
|
| 296 |
+
return _get_signatures(self._model_cls)
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/plugins/flask.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
def import_module(callback):
|
| 2 |
+
"""
|
| 3 |
+
Handle "magic" Flask extension imports:
|
| 4 |
+
``flask.ext.foo`` is really ``flask_foo`` or ``flaskext.foo``.
|
| 5 |
+
"""
|
| 6 |
+
def wrapper(inference_state, import_names, module_context, *args, **kwargs):
|
| 7 |
+
if len(import_names) == 3 and import_names[:2] == ('flask', 'ext'):
|
| 8 |
+
# New style.
|
| 9 |
+
ipath = ('flask_' + import_names[2]),
|
| 10 |
+
value_set = callback(inference_state, ipath, None, *args, **kwargs)
|
| 11 |
+
if value_set:
|
| 12 |
+
return value_set
|
| 13 |
+
value_set = callback(inference_state, ('flaskext',), None, *args, **kwargs)
|
| 14 |
+
return callback(
|
| 15 |
+
inference_state,
|
| 16 |
+
('flaskext', import_names[2]),
|
| 17 |
+
next(iter(value_set)),
|
| 18 |
+
*args, **kwargs
|
| 19 |
+
)
|
| 20 |
+
return callback(inference_state, import_names, module_context, *args, **kwargs)
|
| 21 |
+
return wrapper
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/plugins/pytest.py
ADDED
|
@@ -0,0 +1,269 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
from typing import List
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
|
| 5 |
+
from parso.tree import search_ancestor
|
| 6 |
+
from jedi.inference.cache import inference_state_method_cache
|
| 7 |
+
from jedi.inference.imports import goto_import, load_module_from_path
|
| 8 |
+
from jedi.inference.filters import ParserTreeFilter
|
| 9 |
+
from jedi.inference.base_value import NO_VALUES, ValueSet
|
| 10 |
+
from jedi.inference.helpers import infer_call_of_leaf
|
| 11 |
+
|
| 12 |
+
_PYTEST_FIXTURE_MODULES = [
|
| 13 |
+
('_pytest', 'monkeypatch'),
|
| 14 |
+
('_pytest', 'capture'),
|
| 15 |
+
('_pytest', 'logging'),
|
| 16 |
+
('_pytest', 'tmpdir'),
|
| 17 |
+
('_pytest', 'pytester'),
|
| 18 |
+
]
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def execute(callback):
|
| 22 |
+
def wrapper(value, arguments):
|
| 23 |
+
# This might not be necessary anymore in pytest 4/5, definitely needed
|
| 24 |
+
# for pytest 3.
|
| 25 |
+
if value.py__name__() == 'fixture' \
|
| 26 |
+
and value.parent_context.py__name__() == '_pytest.fixtures':
|
| 27 |
+
return NO_VALUES
|
| 28 |
+
|
| 29 |
+
return callback(value, arguments)
|
| 30 |
+
return wrapper
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
def infer_anonymous_param(func):
|
| 34 |
+
def get_returns(value):
|
| 35 |
+
if value.tree_node.annotation is not None:
|
| 36 |
+
result = value.execute_with_values()
|
| 37 |
+
if any(v.name.get_qualified_names(include_module_names=True)
|
| 38 |
+
== ('typing', 'Generator')
|
| 39 |
+
for v in result):
|
| 40 |
+
return ValueSet.from_sets(
|
| 41 |
+
v.py__getattribute__('__next__').execute_annotation()
|
| 42 |
+
for v in result
|
| 43 |
+
)
|
| 44 |
+
return result
|
| 45 |
+
|
| 46 |
+
# In pytest we need to differentiate between generators and normal
|
| 47 |
+
# returns.
|
| 48 |
+
# Parameters still need to be anonymous, .as_context() ensures that.
|
| 49 |
+
function_context = value.as_context()
|
| 50 |
+
if function_context.is_generator():
|
| 51 |
+
return function_context.merge_yield_values()
|
| 52 |
+
else:
|
| 53 |
+
return function_context.get_return_values()
|
| 54 |
+
|
| 55 |
+
def wrapper(param_name):
|
| 56 |
+
# parameters with an annotation do not need special handling
|
| 57 |
+
if param_name.annotation_node:
|
| 58 |
+
return func(param_name)
|
| 59 |
+
is_pytest_param, param_name_is_function_name = \
|
| 60 |
+
_is_a_pytest_param_and_inherited(param_name)
|
| 61 |
+
if is_pytest_param:
|
| 62 |
+
module = param_name.get_root_context()
|
| 63 |
+
fixtures = _goto_pytest_fixture(
|
| 64 |
+
module,
|
| 65 |
+
param_name.string_name,
|
| 66 |
+
# This skips the current module, because we are basically
|
| 67 |
+
# inheriting a fixture from somewhere else.
|
| 68 |
+
skip_own_module=param_name_is_function_name,
|
| 69 |
+
)
|
| 70 |
+
if fixtures:
|
| 71 |
+
return ValueSet.from_sets(
|
| 72 |
+
get_returns(value)
|
| 73 |
+
for fixture in fixtures
|
| 74 |
+
for value in fixture.infer()
|
| 75 |
+
)
|
| 76 |
+
return func(param_name)
|
| 77 |
+
return wrapper
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
def goto_anonymous_param(func):
|
| 81 |
+
def wrapper(param_name):
|
| 82 |
+
is_pytest_param, param_name_is_function_name = \
|
| 83 |
+
_is_a_pytest_param_and_inherited(param_name)
|
| 84 |
+
if is_pytest_param:
|
| 85 |
+
names = _goto_pytest_fixture(
|
| 86 |
+
param_name.get_root_context(),
|
| 87 |
+
param_name.string_name,
|
| 88 |
+
skip_own_module=param_name_is_function_name,
|
| 89 |
+
)
|
| 90 |
+
if names:
|
| 91 |
+
return names
|
| 92 |
+
return func(param_name)
|
| 93 |
+
return wrapper
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
def complete_param_names(func):
|
| 97 |
+
def wrapper(context, func_name, decorator_nodes):
|
| 98 |
+
module_context = context.get_root_context()
|
| 99 |
+
if _is_pytest_func(func_name, decorator_nodes):
|
| 100 |
+
names = []
|
| 101 |
+
for module_context in _iter_pytest_modules(module_context):
|
| 102 |
+
names += FixtureFilter(module_context).values()
|
| 103 |
+
if names:
|
| 104 |
+
return names
|
| 105 |
+
return func(context, func_name, decorator_nodes)
|
| 106 |
+
return wrapper
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
def _goto_pytest_fixture(module_context, name, skip_own_module):
|
| 110 |
+
for module_context in _iter_pytest_modules(module_context, skip_own_module=skip_own_module):
|
| 111 |
+
names = FixtureFilter(module_context).get(name)
|
| 112 |
+
if names:
|
| 113 |
+
return names
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
def _is_a_pytest_param_and_inherited(param_name):
|
| 117 |
+
"""
|
| 118 |
+
Pytest params are either in a `test_*` function or have a pytest fixture
|
| 119 |
+
with the decorator @pytest.fixture.
|
| 120 |
+
|
| 121 |
+
This is a heuristic and will work in most cases.
|
| 122 |
+
"""
|
| 123 |
+
funcdef = search_ancestor(param_name.tree_name, 'funcdef')
|
| 124 |
+
if funcdef is None: # A lambda
|
| 125 |
+
return False, False
|
| 126 |
+
decorators = funcdef.get_decorators()
|
| 127 |
+
return _is_pytest_func(funcdef.name.value, decorators), \
|
| 128 |
+
funcdef.name.value == param_name.string_name
|
| 129 |
+
|
| 130 |
+
|
| 131 |
+
def _is_pytest_func(func_name, decorator_nodes):
|
| 132 |
+
return func_name.startswith('test') \
|
| 133 |
+
or any('fixture' in n.get_code() for n in decorator_nodes)
|
| 134 |
+
|
| 135 |
+
|
| 136 |
+
def _find_pytest_plugin_modules() -> List[List[str]]:
|
| 137 |
+
"""
|
| 138 |
+
Finds pytest plugin modules hooked by setuptools entry points
|
| 139 |
+
|
| 140 |
+
See https://docs.pytest.org/en/stable/how-to/writing_plugins.html#setuptools-entry-points
|
| 141 |
+
"""
|
| 142 |
+
if sys.version_info >= (3, 8):
|
| 143 |
+
from importlib.metadata import entry_points
|
| 144 |
+
|
| 145 |
+
if sys.version_info >= (3, 10):
|
| 146 |
+
pytest_entry_points = entry_points(group="pytest11")
|
| 147 |
+
else:
|
| 148 |
+
pytest_entry_points = entry_points().get("pytest11", ())
|
| 149 |
+
|
| 150 |
+
if sys.version_info >= (3, 9):
|
| 151 |
+
return [ep.module.split(".") for ep in pytest_entry_points]
|
| 152 |
+
else:
|
| 153 |
+
# Python 3.8 doesn't have `EntryPoint.module`. Implement equivalent
|
| 154 |
+
# to what Python 3.9 does (with additional None check to placate `mypy`)
|
| 155 |
+
matches = [
|
| 156 |
+
ep.pattern.match(ep.value)
|
| 157 |
+
for ep in pytest_entry_points
|
| 158 |
+
]
|
| 159 |
+
return [x.group('module').split(".") for x in matches if x]
|
| 160 |
+
|
| 161 |
+
else:
|
| 162 |
+
from pkg_resources import iter_entry_points
|
| 163 |
+
return [ep.module_name.split(".") for ep in iter_entry_points(group="pytest11")]
|
| 164 |
+
|
| 165 |
+
|
| 166 |
+
@inference_state_method_cache()
|
| 167 |
+
def _iter_pytest_modules(module_context, skip_own_module=False):
|
| 168 |
+
if not skip_own_module:
|
| 169 |
+
yield module_context
|
| 170 |
+
|
| 171 |
+
file_io = module_context.get_value().file_io
|
| 172 |
+
if file_io is not None:
|
| 173 |
+
folder = file_io.get_parent_folder()
|
| 174 |
+
sys_path = module_context.inference_state.get_sys_path()
|
| 175 |
+
|
| 176 |
+
# prevent an infinite loop when reaching the root of the current drive
|
| 177 |
+
last_folder = None
|
| 178 |
+
|
| 179 |
+
while any(folder.path.startswith(p) for p in sys_path):
|
| 180 |
+
file_io = folder.get_file_io('conftest.py')
|
| 181 |
+
if Path(file_io.path) != module_context.py__file__():
|
| 182 |
+
try:
|
| 183 |
+
m = load_module_from_path(module_context.inference_state, file_io)
|
| 184 |
+
conftest_module = m.as_context()
|
| 185 |
+
yield conftest_module
|
| 186 |
+
|
| 187 |
+
plugins_list = m.tree_node.get_used_names().get("pytest_plugins")
|
| 188 |
+
if plugins_list:
|
| 189 |
+
name = conftest_module.create_name(plugins_list[0])
|
| 190 |
+
yield from _load_pytest_plugins(module_context, name)
|
| 191 |
+
except FileNotFoundError:
|
| 192 |
+
pass
|
| 193 |
+
folder = folder.get_parent_folder()
|
| 194 |
+
|
| 195 |
+
# prevent an infinite for loop if the same parent folder is return twice
|
| 196 |
+
if last_folder is not None and folder.path == last_folder.path:
|
| 197 |
+
break
|
| 198 |
+
last_folder = folder # keep track of the last found parent name
|
| 199 |
+
|
| 200 |
+
for names in _PYTEST_FIXTURE_MODULES + _find_pytest_plugin_modules():
|
| 201 |
+
for module_value in module_context.inference_state.import_module(names):
|
| 202 |
+
yield module_value.as_context()
|
| 203 |
+
|
| 204 |
+
|
| 205 |
+
def _load_pytest_plugins(module_context, name):
|
| 206 |
+
from jedi.inference.helpers import get_str_or_none
|
| 207 |
+
|
| 208 |
+
for inferred in name.infer():
|
| 209 |
+
for seq_value in inferred.py__iter__():
|
| 210 |
+
for value in seq_value.infer():
|
| 211 |
+
fq_name = get_str_or_none(value)
|
| 212 |
+
if fq_name:
|
| 213 |
+
names = fq_name.split(".")
|
| 214 |
+
for module_value in module_context.inference_state.import_module(names):
|
| 215 |
+
yield module_value.as_context()
|
| 216 |
+
|
| 217 |
+
|
| 218 |
+
class FixtureFilter(ParserTreeFilter):
|
| 219 |
+
def _filter(self, names):
|
| 220 |
+
for name in super()._filter(names):
|
| 221 |
+
# look for fixture definitions of imported names
|
| 222 |
+
if name.parent.type == "import_from":
|
| 223 |
+
imported_names = goto_import(self.parent_context, name)
|
| 224 |
+
if any(
|
| 225 |
+
self._is_fixture(iname.parent_context, iname.tree_name)
|
| 226 |
+
for iname in imported_names
|
| 227 |
+
# discard imports of whole modules, that have no tree_name
|
| 228 |
+
if iname.tree_name
|
| 229 |
+
):
|
| 230 |
+
yield name
|
| 231 |
+
|
| 232 |
+
elif self._is_fixture(self.parent_context, name):
|
| 233 |
+
yield name
|
| 234 |
+
|
| 235 |
+
def _is_fixture(self, context, name):
|
| 236 |
+
funcdef = name.parent
|
| 237 |
+
# Class fixtures are not supported
|
| 238 |
+
if funcdef.type != "funcdef":
|
| 239 |
+
return False
|
| 240 |
+
decorated = funcdef.parent
|
| 241 |
+
if decorated.type != "decorated":
|
| 242 |
+
return False
|
| 243 |
+
decorators = decorated.children[0]
|
| 244 |
+
if decorators.type == 'decorators':
|
| 245 |
+
decorators = decorators.children
|
| 246 |
+
else:
|
| 247 |
+
decorators = [decorators]
|
| 248 |
+
for decorator in decorators:
|
| 249 |
+
dotted_name = decorator.children[1]
|
| 250 |
+
# A heuristic, this makes it faster.
|
| 251 |
+
if 'fixture' in dotted_name.get_code():
|
| 252 |
+
if dotted_name.type == 'atom_expr':
|
| 253 |
+
# Since Python3.9 a decorator does not have dotted names
|
| 254 |
+
# anymore.
|
| 255 |
+
last_trailer = dotted_name.children[-1]
|
| 256 |
+
last_leaf = last_trailer.get_last_leaf()
|
| 257 |
+
if last_leaf == ')':
|
| 258 |
+
values = infer_call_of_leaf(
|
| 259 |
+
context, last_leaf, cut_own_trailer=True
|
| 260 |
+
)
|
| 261 |
+
else:
|
| 262 |
+
values = context.infer_node(dotted_name)
|
| 263 |
+
else:
|
| 264 |
+
values = context.infer_node(dotted_name)
|
| 265 |
+
for value in values:
|
| 266 |
+
if value.name.get_qualified_names(include_module_names=True) \
|
| 267 |
+
== ('_pytest', 'fixtures', 'fixture'):
|
| 268 |
+
return True
|
| 269 |
+
return False
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/plugins/registry.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
This is not a plugin, this is just the place were plugins are registered.
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
from jedi.plugins import stdlib
|
| 6 |
+
from jedi.plugins import flask
|
| 7 |
+
from jedi.plugins import pytest
|
| 8 |
+
from jedi.plugins import django
|
| 9 |
+
from jedi.plugins import plugin_manager
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
plugin_manager.register(stdlib, flask, pytest, django)
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/plugins/stdlib.py
ADDED
|
@@ -0,0 +1,879 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Implementations of standard library functions, because it's not possible to
|
| 3 |
+
understand them with Jedi.
|
| 4 |
+
|
| 5 |
+
To add a new implementation, create a function and add it to the
|
| 6 |
+
``_implemented`` dict at the bottom of this module.
|
| 7 |
+
|
| 8 |
+
Note that this module exists only to implement very specific functionality in
|
| 9 |
+
the standard library. The usual way to understand the standard library is the
|
| 10 |
+
compiled module that returns the types for C-builtins.
|
| 11 |
+
"""
|
| 12 |
+
import parso
|
| 13 |
+
import os
|
| 14 |
+
from inspect import Parameter
|
| 15 |
+
|
| 16 |
+
from jedi import debug
|
| 17 |
+
from jedi.inference.utils import safe_property
|
| 18 |
+
from jedi.inference.helpers import get_str_or_none
|
| 19 |
+
from jedi.inference.arguments import iterate_argument_clinic, ParamIssue, \
|
| 20 |
+
repack_with_argument_clinic, AbstractArguments, TreeArgumentsWrapper
|
| 21 |
+
from jedi.inference import analysis
|
| 22 |
+
from jedi.inference import compiled
|
| 23 |
+
from jedi.inference.value.instance import \
|
| 24 |
+
AnonymousMethodExecutionContext, MethodExecutionContext
|
| 25 |
+
from jedi.inference.base_value import ContextualizedNode, \
|
| 26 |
+
NO_VALUES, ValueSet, ValueWrapper, LazyValueWrapper
|
| 27 |
+
from jedi.inference.value import ClassValue, ModuleValue
|
| 28 |
+
from jedi.inference.value.klass import ClassMixin
|
| 29 |
+
from jedi.inference.value.function import FunctionMixin
|
| 30 |
+
from jedi.inference.value import iterable
|
| 31 |
+
from jedi.inference.lazy_value import LazyTreeValue, LazyKnownValue, \
|
| 32 |
+
LazyKnownValues
|
| 33 |
+
from jedi.inference.names import ValueName, BaseTreeParamName
|
| 34 |
+
from jedi.inference.filters import AttributeOverwrite, publish_method, \
|
| 35 |
+
ParserTreeFilter, DictFilter
|
| 36 |
+
from jedi.inference.signature import AbstractSignature, SignatureWrapper
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
# Copied from Python 3.6's stdlib.
|
| 40 |
+
_NAMEDTUPLE_CLASS_TEMPLATE = """\
|
| 41 |
+
_property = property
|
| 42 |
+
_tuple = tuple
|
| 43 |
+
from operator import itemgetter as _itemgetter
|
| 44 |
+
from collections import OrderedDict
|
| 45 |
+
|
| 46 |
+
class {typename}(tuple):
|
| 47 |
+
__slots__ = ()
|
| 48 |
+
|
| 49 |
+
_fields = {field_names!r}
|
| 50 |
+
|
| 51 |
+
def __new__(_cls, {arg_list}):
|
| 52 |
+
'Create new instance of {typename}({arg_list})'
|
| 53 |
+
return _tuple.__new__(_cls, ({arg_list}))
|
| 54 |
+
|
| 55 |
+
@classmethod
|
| 56 |
+
def _make(cls, iterable, new=tuple.__new__, len=len):
|
| 57 |
+
'Make a new {typename} object from a sequence or iterable'
|
| 58 |
+
result = new(cls, iterable)
|
| 59 |
+
if len(result) != {num_fields:d}:
|
| 60 |
+
raise TypeError('Expected {num_fields:d} arguments, got %d' % len(result))
|
| 61 |
+
return result
|
| 62 |
+
|
| 63 |
+
def _replace(_self, **kwds):
|
| 64 |
+
'Return a new {typename} object replacing specified fields with new values'
|
| 65 |
+
result = _self._make(map(kwds.pop, {field_names!r}, _self))
|
| 66 |
+
if kwds:
|
| 67 |
+
raise ValueError('Got unexpected field names: %r' % list(kwds))
|
| 68 |
+
return result
|
| 69 |
+
|
| 70 |
+
def __repr__(self):
|
| 71 |
+
'Return a nicely formatted representation string'
|
| 72 |
+
return self.__class__.__name__ + '({repr_fmt})' % self
|
| 73 |
+
|
| 74 |
+
def _asdict(self):
|
| 75 |
+
'Return a new OrderedDict which maps field names to their values.'
|
| 76 |
+
return OrderedDict(zip(self._fields, self))
|
| 77 |
+
|
| 78 |
+
def __getnewargs__(self):
|
| 79 |
+
'Return self as a plain tuple. Used by copy and pickle.'
|
| 80 |
+
return tuple(self)
|
| 81 |
+
|
| 82 |
+
# These methods were added by Jedi.
|
| 83 |
+
# __new__ doesn't really work with Jedi. So adding this to nametuples seems
|
| 84 |
+
# like the easiest way.
|
| 85 |
+
def __init__(self, {arg_list}):
|
| 86 |
+
'A helper function for namedtuple.'
|
| 87 |
+
self.__iterable = ({arg_list})
|
| 88 |
+
|
| 89 |
+
def __iter__(self):
|
| 90 |
+
for i in self.__iterable:
|
| 91 |
+
yield i
|
| 92 |
+
|
| 93 |
+
def __getitem__(self, y):
|
| 94 |
+
return self.__iterable[y]
|
| 95 |
+
|
| 96 |
+
{field_defs}
|
| 97 |
+
"""
|
| 98 |
+
|
| 99 |
+
_NAMEDTUPLE_FIELD_TEMPLATE = '''\
|
| 100 |
+
{name} = _property(_itemgetter({index:d}), doc='Alias for field number {index:d}')
|
| 101 |
+
'''
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
def execute(callback):
|
| 105 |
+
def wrapper(value, arguments):
|
| 106 |
+
def call():
|
| 107 |
+
return callback(value, arguments=arguments)
|
| 108 |
+
|
| 109 |
+
try:
|
| 110 |
+
obj_name = value.name.string_name
|
| 111 |
+
except AttributeError:
|
| 112 |
+
pass
|
| 113 |
+
else:
|
| 114 |
+
p = value.parent_context
|
| 115 |
+
if p is not None and p.is_builtins_module():
|
| 116 |
+
module_name = 'builtins'
|
| 117 |
+
elif p is not None and p.is_module():
|
| 118 |
+
module_name = p.py__name__()
|
| 119 |
+
else:
|
| 120 |
+
return call()
|
| 121 |
+
|
| 122 |
+
if value.is_bound_method() or value.is_instance():
|
| 123 |
+
# value can be an instance for example if it is a partial
|
| 124 |
+
# object.
|
| 125 |
+
return call()
|
| 126 |
+
|
| 127 |
+
# for now we just support builtin functions.
|
| 128 |
+
try:
|
| 129 |
+
func = _implemented[module_name][obj_name]
|
| 130 |
+
except KeyError:
|
| 131 |
+
pass
|
| 132 |
+
else:
|
| 133 |
+
return func(value, arguments=arguments, callback=call)
|
| 134 |
+
return call()
|
| 135 |
+
|
| 136 |
+
return wrapper
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
def _follow_param(inference_state, arguments, index):
|
| 140 |
+
try:
|
| 141 |
+
key, lazy_value = list(arguments.unpack())[index]
|
| 142 |
+
except IndexError:
|
| 143 |
+
return NO_VALUES
|
| 144 |
+
else:
|
| 145 |
+
return lazy_value.infer()
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
def argument_clinic(clinic_string, want_value=False, want_context=False,
|
| 149 |
+
want_arguments=False, want_inference_state=False,
|
| 150 |
+
want_callback=False):
|
| 151 |
+
"""
|
| 152 |
+
Works like Argument Clinic (PEP 436), to validate function params.
|
| 153 |
+
"""
|
| 154 |
+
|
| 155 |
+
def f(func):
|
| 156 |
+
def wrapper(value, arguments, callback):
|
| 157 |
+
try:
|
| 158 |
+
args = tuple(iterate_argument_clinic(
|
| 159 |
+
value.inference_state, arguments, clinic_string))
|
| 160 |
+
except ParamIssue:
|
| 161 |
+
return NO_VALUES
|
| 162 |
+
|
| 163 |
+
debug.dbg('builtin start %s' % value, color='MAGENTA')
|
| 164 |
+
kwargs = {}
|
| 165 |
+
if want_context:
|
| 166 |
+
kwargs['context'] = arguments.context
|
| 167 |
+
if want_value:
|
| 168 |
+
kwargs['value'] = value
|
| 169 |
+
if want_inference_state:
|
| 170 |
+
kwargs['inference_state'] = value.inference_state
|
| 171 |
+
if want_arguments:
|
| 172 |
+
kwargs['arguments'] = arguments
|
| 173 |
+
if want_callback:
|
| 174 |
+
kwargs['callback'] = callback
|
| 175 |
+
result = func(*args, **kwargs)
|
| 176 |
+
debug.dbg('builtin end: %s', result, color='MAGENTA')
|
| 177 |
+
return result
|
| 178 |
+
|
| 179 |
+
return wrapper
|
| 180 |
+
return f
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
@argument_clinic('iterator[, default], /', want_inference_state=True)
|
| 184 |
+
def builtins_next(iterators, defaults, inference_state):
|
| 185 |
+
# TODO theoretically we have to check here if something is an iterator.
|
| 186 |
+
# That is probably done by checking if it's not a class.
|
| 187 |
+
return defaults | iterators.py__getattribute__('__next__').execute_with_values()
|
| 188 |
+
|
| 189 |
+
|
| 190 |
+
@argument_clinic('iterator[, default], /')
|
| 191 |
+
def builtins_iter(iterators_or_callables, defaults):
|
| 192 |
+
# TODO implement this if it's a callable.
|
| 193 |
+
return iterators_or_callables.py__getattribute__('__iter__').execute_with_values()
|
| 194 |
+
|
| 195 |
+
|
| 196 |
+
@argument_clinic('object, name[, default], /')
|
| 197 |
+
def builtins_getattr(objects, names, defaults=None):
|
| 198 |
+
# follow the first param
|
| 199 |
+
for value in objects:
|
| 200 |
+
for name in names:
|
| 201 |
+
string = get_str_or_none(name)
|
| 202 |
+
if string is None:
|
| 203 |
+
debug.warning('getattr called without str')
|
| 204 |
+
continue
|
| 205 |
+
else:
|
| 206 |
+
return value.py__getattribute__(string)
|
| 207 |
+
return NO_VALUES
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
@argument_clinic('object[, bases, dict], /')
|
| 211 |
+
def builtins_type(objects, bases, dicts):
|
| 212 |
+
if bases or dicts:
|
| 213 |
+
# It's a type creation... maybe someday...
|
| 214 |
+
return NO_VALUES
|
| 215 |
+
else:
|
| 216 |
+
return objects.py__class__()
|
| 217 |
+
|
| 218 |
+
|
| 219 |
+
class SuperInstance(LazyValueWrapper):
|
| 220 |
+
"""To be used like the object ``super`` returns."""
|
| 221 |
+
def __init__(self, inference_state, instance):
|
| 222 |
+
self.inference_state = inference_state
|
| 223 |
+
self._instance = instance # Corresponds to super().__self__
|
| 224 |
+
|
| 225 |
+
def _get_bases(self):
|
| 226 |
+
return self._instance.py__class__().py__bases__()
|
| 227 |
+
|
| 228 |
+
def _get_wrapped_value(self):
|
| 229 |
+
objs = self._get_bases()[0].infer().execute_with_values()
|
| 230 |
+
if not objs:
|
| 231 |
+
# This is just a fallback and will only be used, if it's not
|
| 232 |
+
# possible to find a class
|
| 233 |
+
return self._instance
|
| 234 |
+
return next(iter(objs))
|
| 235 |
+
|
| 236 |
+
def get_filters(self, origin_scope=None):
|
| 237 |
+
for b in self._get_bases():
|
| 238 |
+
for value in b.infer().execute_with_values():
|
| 239 |
+
for f in value.get_filters():
|
| 240 |
+
yield f
|
| 241 |
+
|
| 242 |
+
|
| 243 |
+
@argument_clinic('[type[, value]], /', want_context=True)
|
| 244 |
+
def builtins_super(types, objects, context):
|
| 245 |
+
instance = None
|
| 246 |
+
if isinstance(context, AnonymousMethodExecutionContext):
|
| 247 |
+
instance = context.instance
|
| 248 |
+
elif isinstance(context, MethodExecutionContext):
|
| 249 |
+
instance = context.instance
|
| 250 |
+
if instance is None:
|
| 251 |
+
return NO_VALUES
|
| 252 |
+
return ValueSet({SuperInstance(instance.inference_state, instance)})
|
| 253 |
+
|
| 254 |
+
|
| 255 |
+
class ReversedObject(AttributeOverwrite):
|
| 256 |
+
def __init__(self, reversed_obj, iter_list):
|
| 257 |
+
super().__init__(reversed_obj)
|
| 258 |
+
self._iter_list = iter_list
|
| 259 |
+
|
| 260 |
+
def py__iter__(self, contextualized_node=None):
|
| 261 |
+
return self._iter_list
|
| 262 |
+
|
| 263 |
+
@publish_method('__next__')
|
| 264 |
+
def _next(self, arguments):
|
| 265 |
+
return ValueSet.from_sets(
|
| 266 |
+
lazy_value.infer() for lazy_value in self._iter_list
|
| 267 |
+
)
|
| 268 |
+
|
| 269 |
+
|
| 270 |
+
@argument_clinic('sequence, /', want_value=True, want_arguments=True)
|
| 271 |
+
def builtins_reversed(sequences, value, arguments):
|
| 272 |
+
# While we could do without this variable (just by using sequences), we
|
| 273 |
+
# want static analysis to work well. Therefore we need to generated the
|
| 274 |
+
# values again.
|
| 275 |
+
key, lazy_value = next(arguments.unpack())
|
| 276 |
+
cn = None
|
| 277 |
+
if isinstance(lazy_value, LazyTreeValue):
|
| 278 |
+
cn = ContextualizedNode(lazy_value.context, lazy_value.data)
|
| 279 |
+
ordered = list(sequences.iterate(cn))
|
| 280 |
+
|
| 281 |
+
# Repack iterator values and then run it the normal way. This is
|
| 282 |
+
# necessary, because `reversed` is a function and autocompletion
|
| 283 |
+
# would fail in certain cases like `reversed(x).__iter__` if we
|
| 284 |
+
# just returned the result directly.
|
| 285 |
+
seq, = value.inference_state.typing_module.py__getattribute__('Iterator').execute_with_values()
|
| 286 |
+
return ValueSet([ReversedObject(seq, list(reversed(ordered)))])
|
| 287 |
+
|
| 288 |
+
|
| 289 |
+
@argument_clinic('value, type, /', want_arguments=True, want_inference_state=True)
|
| 290 |
+
def builtins_isinstance(objects, types, arguments, inference_state):
|
| 291 |
+
bool_results = set()
|
| 292 |
+
for o in objects:
|
| 293 |
+
cls = o.py__class__()
|
| 294 |
+
try:
|
| 295 |
+
cls.py__bases__
|
| 296 |
+
except AttributeError:
|
| 297 |
+
# This is temporary. Everything should have a class attribute in
|
| 298 |
+
# Python?! Maybe we'll leave it here, because some numpy objects or
|
| 299 |
+
# whatever might not.
|
| 300 |
+
bool_results = set([True, False])
|
| 301 |
+
break
|
| 302 |
+
|
| 303 |
+
mro = list(cls.py__mro__())
|
| 304 |
+
|
| 305 |
+
for cls_or_tup in types:
|
| 306 |
+
if cls_or_tup.is_class():
|
| 307 |
+
bool_results.add(cls_or_tup in mro)
|
| 308 |
+
elif cls_or_tup.name.string_name == 'tuple' \
|
| 309 |
+
and cls_or_tup.get_root_context().is_builtins_module():
|
| 310 |
+
# Check for tuples.
|
| 311 |
+
classes = ValueSet.from_sets(
|
| 312 |
+
lazy_value.infer()
|
| 313 |
+
for lazy_value in cls_or_tup.iterate()
|
| 314 |
+
)
|
| 315 |
+
bool_results.add(any(cls in mro for cls in classes))
|
| 316 |
+
else:
|
| 317 |
+
_, lazy_value = list(arguments.unpack())[1]
|
| 318 |
+
if isinstance(lazy_value, LazyTreeValue):
|
| 319 |
+
node = lazy_value.data
|
| 320 |
+
message = 'TypeError: isinstance() arg 2 must be a ' \
|
| 321 |
+
'class, type, or tuple of classes and types, ' \
|
| 322 |
+
'not %s.' % cls_or_tup
|
| 323 |
+
analysis.add(lazy_value.context, 'type-error-isinstance', node, message)
|
| 324 |
+
|
| 325 |
+
return ValueSet(
|
| 326 |
+
compiled.builtin_from_name(inference_state, str(b))
|
| 327 |
+
for b in bool_results
|
| 328 |
+
)
|
| 329 |
+
|
| 330 |
+
|
| 331 |
+
class StaticMethodObject(ValueWrapper):
|
| 332 |
+
def py__get__(self, instance, class_value):
|
| 333 |
+
return ValueSet([self._wrapped_value])
|
| 334 |
+
|
| 335 |
+
|
| 336 |
+
@argument_clinic('sequence, /')
|
| 337 |
+
def builtins_staticmethod(functions):
|
| 338 |
+
return ValueSet(StaticMethodObject(f) for f in functions)
|
| 339 |
+
|
| 340 |
+
|
| 341 |
+
class ClassMethodObject(ValueWrapper):
|
| 342 |
+
def __init__(self, class_method_obj, function):
|
| 343 |
+
super().__init__(class_method_obj)
|
| 344 |
+
self._function = function
|
| 345 |
+
|
| 346 |
+
def py__get__(self, instance, class_value):
|
| 347 |
+
return ValueSet([
|
| 348 |
+
ClassMethodGet(__get__, class_value, self._function)
|
| 349 |
+
for __get__ in self._wrapped_value.py__getattribute__('__get__')
|
| 350 |
+
])
|
| 351 |
+
|
| 352 |
+
|
| 353 |
+
class ClassMethodGet(ValueWrapper):
|
| 354 |
+
def __init__(self, get_method, klass, function):
|
| 355 |
+
super().__init__(get_method)
|
| 356 |
+
self._class = klass
|
| 357 |
+
self._function = function
|
| 358 |
+
|
| 359 |
+
def get_signatures(self):
|
| 360 |
+
return [sig.bind(self._function) for sig in self._function.get_signatures()]
|
| 361 |
+
|
| 362 |
+
def py__call__(self, arguments):
|
| 363 |
+
return self._function.execute(ClassMethodArguments(self._class, arguments))
|
| 364 |
+
|
| 365 |
+
|
| 366 |
+
class ClassMethodArguments(TreeArgumentsWrapper):
|
| 367 |
+
def __init__(self, klass, arguments):
|
| 368 |
+
super().__init__(arguments)
|
| 369 |
+
self._class = klass
|
| 370 |
+
|
| 371 |
+
def unpack(self, func=None):
|
| 372 |
+
yield None, LazyKnownValue(self._class)
|
| 373 |
+
for values in self._wrapped_arguments.unpack(func):
|
| 374 |
+
yield values
|
| 375 |
+
|
| 376 |
+
|
| 377 |
+
@argument_clinic('sequence, /', want_value=True, want_arguments=True)
|
| 378 |
+
def builtins_classmethod(functions, value, arguments):
|
| 379 |
+
return ValueSet(
|
| 380 |
+
ClassMethodObject(class_method_object, function)
|
| 381 |
+
for class_method_object in value.py__call__(arguments=arguments)
|
| 382 |
+
for function in functions
|
| 383 |
+
)
|
| 384 |
+
|
| 385 |
+
|
| 386 |
+
class PropertyObject(AttributeOverwrite, ValueWrapper):
|
| 387 |
+
api_type = 'property'
|
| 388 |
+
|
| 389 |
+
def __init__(self, property_obj, function):
|
| 390 |
+
super().__init__(property_obj)
|
| 391 |
+
self._function = function
|
| 392 |
+
|
| 393 |
+
def py__get__(self, instance, class_value):
|
| 394 |
+
if instance is None:
|
| 395 |
+
return ValueSet([self])
|
| 396 |
+
return self._function.execute_with_values(instance)
|
| 397 |
+
|
| 398 |
+
@publish_method('deleter')
|
| 399 |
+
@publish_method('getter')
|
| 400 |
+
@publish_method('setter')
|
| 401 |
+
def _return_self(self, arguments):
|
| 402 |
+
return ValueSet({self})
|
| 403 |
+
|
| 404 |
+
|
| 405 |
+
@argument_clinic('func, /', want_callback=True)
|
| 406 |
+
def builtins_property(functions, callback):
|
| 407 |
+
return ValueSet(
|
| 408 |
+
PropertyObject(property_value, function)
|
| 409 |
+
for property_value in callback()
|
| 410 |
+
for function in functions
|
| 411 |
+
)
|
| 412 |
+
|
| 413 |
+
|
| 414 |
+
def collections_namedtuple(value, arguments, callback):
|
| 415 |
+
"""
|
| 416 |
+
Implementation of the namedtuple function.
|
| 417 |
+
|
| 418 |
+
This has to be done by processing the namedtuple class template and
|
| 419 |
+
inferring the result.
|
| 420 |
+
|
| 421 |
+
"""
|
| 422 |
+
inference_state = value.inference_state
|
| 423 |
+
|
| 424 |
+
# Process arguments
|
| 425 |
+
name = 'jedi_unknown_namedtuple'
|
| 426 |
+
for c in _follow_param(inference_state, arguments, 0):
|
| 427 |
+
x = get_str_or_none(c)
|
| 428 |
+
if x is not None:
|
| 429 |
+
name = x
|
| 430 |
+
break
|
| 431 |
+
|
| 432 |
+
# TODO here we only use one of the types, we should use all.
|
| 433 |
+
param_values = _follow_param(inference_state, arguments, 1)
|
| 434 |
+
if not param_values:
|
| 435 |
+
return NO_VALUES
|
| 436 |
+
_fields = list(param_values)[0]
|
| 437 |
+
string = get_str_or_none(_fields)
|
| 438 |
+
if string is not None:
|
| 439 |
+
fields = string.replace(',', ' ').split()
|
| 440 |
+
elif isinstance(_fields, iterable.Sequence):
|
| 441 |
+
fields = [
|
| 442 |
+
get_str_or_none(v)
|
| 443 |
+
for lazy_value in _fields.py__iter__()
|
| 444 |
+
for v in lazy_value.infer()
|
| 445 |
+
]
|
| 446 |
+
fields = [f for f in fields if f is not None]
|
| 447 |
+
else:
|
| 448 |
+
return NO_VALUES
|
| 449 |
+
|
| 450 |
+
# Build source code
|
| 451 |
+
code = _NAMEDTUPLE_CLASS_TEMPLATE.format(
|
| 452 |
+
typename=name,
|
| 453 |
+
field_names=tuple(fields),
|
| 454 |
+
num_fields=len(fields),
|
| 455 |
+
arg_list=repr(tuple(fields)).replace("'", "")[1:-1],
|
| 456 |
+
repr_fmt='',
|
| 457 |
+
field_defs='\n'.join(_NAMEDTUPLE_FIELD_TEMPLATE.format(index=index, name=name)
|
| 458 |
+
for index, name in enumerate(fields))
|
| 459 |
+
)
|
| 460 |
+
|
| 461 |
+
# Parse source code
|
| 462 |
+
module = inference_state.grammar.parse(code)
|
| 463 |
+
generated_class = next(module.iter_classdefs())
|
| 464 |
+
parent_context = ModuleValue(
|
| 465 |
+
inference_state, module,
|
| 466 |
+
code_lines=parso.split_lines(code, keepends=True),
|
| 467 |
+
).as_context()
|
| 468 |
+
|
| 469 |
+
return ValueSet([ClassValue(inference_state, parent_context, generated_class)])
|
| 470 |
+
|
| 471 |
+
|
| 472 |
+
class PartialObject(ValueWrapper):
|
| 473 |
+
def __init__(self, actual_value, arguments, instance=None):
|
| 474 |
+
super().__init__(actual_value)
|
| 475 |
+
self._arguments = arguments
|
| 476 |
+
self._instance = instance
|
| 477 |
+
|
| 478 |
+
def _get_functions(self, unpacked_arguments):
|
| 479 |
+
key, lazy_value = next(unpacked_arguments, (None, None))
|
| 480 |
+
if key is not None or lazy_value is None:
|
| 481 |
+
debug.warning("Partial should have a proper function %s", self._arguments)
|
| 482 |
+
return None
|
| 483 |
+
return lazy_value.infer()
|
| 484 |
+
|
| 485 |
+
def get_signatures(self):
|
| 486 |
+
unpacked_arguments = self._arguments.unpack()
|
| 487 |
+
funcs = self._get_functions(unpacked_arguments)
|
| 488 |
+
if funcs is None:
|
| 489 |
+
return []
|
| 490 |
+
|
| 491 |
+
arg_count = 0
|
| 492 |
+
if self._instance is not None:
|
| 493 |
+
arg_count = 1
|
| 494 |
+
keys = set()
|
| 495 |
+
for key, _ in unpacked_arguments:
|
| 496 |
+
if key is None:
|
| 497 |
+
arg_count += 1
|
| 498 |
+
else:
|
| 499 |
+
keys.add(key)
|
| 500 |
+
return [PartialSignature(s, arg_count, keys) for s in funcs.get_signatures()]
|
| 501 |
+
|
| 502 |
+
def py__call__(self, arguments):
|
| 503 |
+
funcs = self._get_functions(self._arguments.unpack())
|
| 504 |
+
if funcs is None:
|
| 505 |
+
return NO_VALUES
|
| 506 |
+
|
| 507 |
+
return funcs.execute(
|
| 508 |
+
MergedPartialArguments(self._arguments, arguments, self._instance)
|
| 509 |
+
)
|
| 510 |
+
|
| 511 |
+
def py__doc__(self):
|
| 512 |
+
"""
|
| 513 |
+
In CPython partial does not replace the docstring. However we are still
|
| 514 |
+
imitating it here, because we want this docstring to be worth something
|
| 515 |
+
for the user.
|
| 516 |
+
"""
|
| 517 |
+
callables = self._get_functions(self._arguments.unpack())
|
| 518 |
+
if callables is None:
|
| 519 |
+
return ''
|
| 520 |
+
for callable_ in callables:
|
| 521 |
+
return callable_.py__doc__()
|
| 522 |
+
return ''
|
| 523 |
+
|
| 524 |
+
def py__get__(self, instance, class_value):
|
| 525 |
+
return ValueSet([self])
|
| 526 |
+
|
| 527 |
+
|
| 528 |
+
class PartialMethodObject(PartialObject):
|
| 529 |
+
def py__get__(self, instance, class_value):
|
| 530 |
+
if instance is None:
|
| 531 |
+
return ValueSet([self])
|
| 532 |
+
return ValueSet([PartialObject(self._wrapped_value, self._arguments, instance)])
|
| 533 |
+
|
| 534 |
+
|
| 535 |
+
class PartialSignature(SignatureWrapper):
|
| 536 |
+
def __init__(self, wrapped_signature, skipped_arg_count, skipped_arg_set):
|
| 537 |
+
super().__init__(wrapped_signature)
|
| 538 |
+
self._skipped_arg_count = skipped_arg_count
|
| 539 |
+
self._skipped_arg_set = skipped_arg_set
|
| 540 |
+
|
| 541 |
+
def get_param_names(self, resolve_stars=False):
|
| 542 |
+
names = self._wrapped_signature.get_param_names()[self._skipped_arg_count:]
|
| 543 |
+
return [n for n in names if n.string_name not in self._skipped_arg_set]
|
| 544 |
+
|
| 545 |
+
|
| 546 |
+
class MergedPartialArguments(AbstractArguments):
|
| 547 |
+
def __init__(self, partial_arguments, call_arguments, instance=None):
|
| 548 |
+
self._partial_arguments = partial_arguments
|
| 549 |
+
self._call_arguments = call_arguments
|
| 550 |
+
self._instance = instance
|
| 551 |
+
|
| 552 |
+
def unpack(self, funcdef=None):
|
| 553 |
+
unpacked = self._partial_arguments.unpack(funcdef)
|
| 554 |
+
# Ignore this one, it's the function. It was checked before that it's
|
| 555 |
+
# there.
|
| 556 |
+
next(unpacked, None)
|
| 557 |
+
if self._instance is not None:
|
| 558 |
+
yield None, LazyKnownValue(self._instance)
|
| 559 |
+
for key_lazy_value in unpacked:
|
| 560 |
+
yield key_lazy_value
|
| 561 |
+
for key_lazy_value in self._call_arguments.unpack(funcdef):
|
| 562 |
+
yield key_lazy_value
|
| 563 |
+
|
| 564 |
+
|
| 565 |
+
def functools_partial(value, arguments, callback):
|
| 566 |
+
return ValueSet(
|
| 567 |
+
PartialObject(instance, arguments)
|
| 568 |
+
for instance in value.py__call__(arguments)
|
| 569 |
+
)
|
| 570 |
+
|
| 571 |
+
|
| 572 |
+
def functools_partialmethod(value, arguments, callback):
|
| 573 |
+
return ValueSet(
|
| 574 |
+
PartialMethodObject(instance, arguments)
|
| 575 |
+
for instance in value.py__call__(arguments)
|
| 576 |
+
)
|
| 577 |
+
|
| 578 |
+
|
| 579 |
+
@argument_clinic('first, /')
|
| 580 |
+
def _return_first_param(firsts):
|
| 581 |
+
return firsts
|
| 582 |
+
|
| 583 |
+
|
| 584 |
+
@argument_clinic('seq')
|
| 585 |
+
def _random_choice(sequences):
|
| 586 |
+
return ValueSet.from_sets(
|
| 587 |
+
lazy_value.infer()
|
| 588 |
+
for sequence in sequences
|
| 589 |
+
for lazy_value in sequence.py__iter__()
|
| 590 |
+
)
|
| 591 |
+
|
| 592 |
+
|
| 593 |
+
def _dataclass(value, arguments, callback):
|
| 594 |
+
for c in _follow_param(value.inference_state, arguments, 0):
|
| 595 |
+
if c.is_class():
|
| 596 |
+
return ValueSet([DataclassWrapper(c)])
|
| 597 |
+
else:
|
| 598 |
+
return ValueSet([value])
|
| 599 |
+
return NO_VALUES
|
| 600 |
+
|
| 601 |
+
|
| 602 |
+
class DataclassWrapper(ValueWrapper, ClassMixin):
|
| 603 |
+
def get_signatures(self):
|
| 604 |
+
param_names = []
|
| 605 |
+
for cls in reversed(list(self.py__mro__())):
|
| 606 |
+
if isinstance(cls, DataclassWrapper):
|
| 607 |
+
filter_ = cls.as_context().get_global_filter()
|
| 608 |
+
# .values ordering is not guaranteed, at least not in
|
| 609 |
+
# Python < 3.6, when dicts where not ordered, which is an
|
| 610 |
+
# implementation detail anyway.
|
| 611 |
+
for name in sorted(filter_.values(), key=lambda name: name.start_pos):
|
| 612 |
+
d = name.tree_name.get_definition()
|
| 613 |
+
annassign = d.children[1]
|
| 614 |
+
if d.type == 'expr_stmt' and annassign.type == 'annassign':
|
| 615 |
+
if len(annassign.children) < 4:
|
| 616 |
+
default = None
|
| 617 |
+
else:
|
| 618 |
+
default = annassign.children[3]
|
| 619 |
+
param_names.append(DataclassParamName(
|
| 620 |
+
parent_context=cls.parent_context,
|
| 621 |
+
tree_name=name.tree_name,
|
| 622 |
+
annotation_node=annassign.children[1],
|
| 623 |
+
default_node=default,
|
| 624 |
+
))
|
| 625 |
+
return [DataclassSignature(cls, param_names)]
|
| 626 |
+
|
| 627 |
+
|
| 628 |
+
class DataclassSignature(AbstractSignature):
|
| 629 |
+
def __init__(self, value, param_names):
|
| 630 |
+
super().__init__(value)
|
| 631 |
+
self._param_names = param_names
|
| 632 |
+
|
| 633 |
+
def get_param_names(self, resolve_stars=False):
|
| 634 |
+
return self._param_names
|
| 635 |
+
|
| 636 |
+
|
| 637 |
+
class DataclassParamName(BaseTreeParamName):
|
| 638 |
+
def __init__(self, parent_context, tree_name, annotation_node, default_node):
|
| 639 |
+
super().__init__(parent_context, tree_name)
|
| 640 |
+
self.annotation_node = annotation_node
|
| 641 |
+
self.default_node = default_node
|
| 642 |
+
|
| 643 |
+
def get_kind(self):
|
| 644 |
+
return Parameter.POSITIONAL_OR_KEYWORD
|
| 645 |
+
|
| 646 |
+
def infer(self):
|
| 647 |
+
if self.annotation_node is None:
|
| 648 |
+
return NO_VALUES
|
| 649 |
+
else:
|
| 650 |
+
return self.parent_context.infer_node(self.annotation_node)
|
| 651 |
+
|
| 652 |
+
|
| 653 |
+
class ItemGetterCallable(ValueWrapper):
|
| 654 |
+
def __init__(self, instance, args_value_set):
|
| 655 |
+
super().__init__(instance)
|
| 656 |
+
self._args_value_set = args_value_set
|
| 657 |
+
|
| 658 |
+
@repack_with_argument_clinic('item, /')
|
| 659 |
+
def py__call__(self, item_value_set):
|
| 660 |
+
value_set = NO_VALUES
|
| 661 |
+
for args_value in self._args_value_set:
|
| 662 |
+
lazy_values = list(args_value.py__iter__())
|
| 663 |
+
if len(lazy_values) == 1:
|
| 664 |
+
# TODO we need to add the contextualized value.
|
| 665 |
+
value_set |= item_value_set.get_item(lazy_values[0].infer(), None)
|
| 666 |
+
else:
|
| 667 |
+
value_set |= ValueSet([iterable.FakeList(
|
| 668 |
+
self._wrapped_value.inference_state,
|
| 669 |
+
[
|
| 670 |
+
LazyKnownValues(item_value_set.get_item(lazy_value.infer(), None))
|
| 671 |
+
for lazy_value in lazy_values
|
| 672 |
+
],
|
| 673 |
+
)])
|
| 674 |
+
return value_set
|
| 675 |
+
|
| 676 |
+
|
| 677 |
+
@argument_clinic('func, /')
|
| 678 |
+
def _functools_wraps(funcs):
|
| 679 |
+
return ValueSet(WrapsCallable(func) for func in funcs)
|
| 680 |
+
|
| 681 |
+
|
| 682 |
+
class WrapsCallable(ValueWrapper):
|
| 683 |
+
# XXX this is not the correct wrapped value, it should be a weird
|
| 684 |
+
# partials object, but it doesn't matter, because it's always used as a
|
| 685 |
+
# decorator anyway.
|
| 686 |
+
@repack_with_argument_clinic('func, /')
|
| 687 |
+
def py__call__(self, funcs):
|
| 688 |
+
return ValueSet({Wrapped(func, self._wrapped_value) for func in funcs})
|
| 689 |
+
|
| 690 |
+
|
| 691 |
+
class Wrapped(ValueWrapper, FunctionMixin):
|
| 692 |
+
def __init__(self, func, original_function):
|
| 693 |
+
super().__init__(func)
|
| 694 |
+
self._original_function = original_function
|
| 695 |
+
|
| 696 |
+
@property
|
| 697 |
+
def name(self):
|
| 698 |
+
return self._original_function.name
|
| 699 |
+
|
| 700 |
+
def get_signature_functions(self):
|
| 701 |
+
return [self]
|
| 702 |
+
|
| 703 |
+
|
| 704 |
+
@argument_clinic('*args, /', want_value=True, want_arguments=True)
|
| 705 |
+
def _operator_itemgetter(args_value_set, value, arguments):
|
| 706 |
+
return ValueSet([
|
| 707 |
+
ItemGetterCallable(instance, args_value_set)
|
| 708 |
+
for instance in value.py__call__(arguments)
|
| 709 |
+
])
|
| 710 |
+
|
| 711 |
+
|
| 712 |
+
def _create_string_input_function(func):
|
| 713 |
+
@argument_clinic('string, /', want_value=True, want_arguments=True)
|
| 714 |
+
def wrapper(strings, value, arguments):
|
| 715 |
+
def iterate():
|
| 716 |
+
for value in strings:
|
| 717 |
+
s = get_str_or_none(value)
|
| 718 |
+
if s is not None:
|
| 719 |
+
s = func(s)
|
| 720 |
+
yield compiled.create_simple_object(value.inference_state, s)
|
| 721 |
+
values = ValueSet(iterate())
|
| 722 |
+
if values:
|
| 723 |
+
return values
|
| 724 |
+
return value.py__call__(arguments)
|
| 725 |
+
return wrapper
|
| 726 |
+
|
| 727 |
+
|
| 728 |
+
@argument_clinic('*args, /', want_callback=True)
|
| 729 |
+
def _os_path_join(args_set, callback):
|
| 730 |
+
if len(args_set) == 1:
|
| 731 |
+
string = ''
|
| 732 |
+
sequence, = args_set
|
| 733 |
+
is_first = True
|
| 734 |
+
for lazy_value in sequence.py__iter__():
|
| 735 |
+
string_values = lazy_value.infer()
|
| 736 |
+
if len(string_values) != 1:
|
| 737 |
+
break
|
| 738 |
+
s = get_str_or_none(next(iter(string_values)))
|
| 739 |
+
if s is None:
|
| 740 |
+
break
|
| 741 |
+
if not is_first:
|
| 742 |
+
string += os.path.sep
|
| 743 |
+
string += s
|
| 744 |
+
is_first = False
|
| 745 |
+
else:
|
| 746 |
+
return ValueSet([compiled.create_simple_object(sequence.inference_state, string)])
|
| 747 |
+
return callback()
|
| 748 |
+
|
| 749 |
+
|
| 750 |
+
_implemented = {
|
| 751 |
+
'builtins': {
|
| 752 |
+
'getattr': builtins_getattr,
|
| 753 |
+
'type': builtins_type,
|
| 754 |
+
'super': builtins_super,
|
| 755 |
+
'reversed': builtins_reversed,
|
| 756 |
+
'isinstance': builtins_isinstance,
|
| 757 |
+
'next': builtins_next,
|
| 758 |
+
'iter': builtins_iter,
|
| 759 |
+
'staticmethod': builtins_staticmethod,
|
| 760 |
+
'classmethod': builtins_classmethod,
|
| 761 |
+
'property': builtins_property,
|
| 762 |
+
},
|
| 763 |
+
'copy': {
|
| 764 |
+
'copy': _return_first_param,
|
| 765 |
+
'deepcopy': _return_first_param,
|
| 766 |
+
},
|
| 767 |
+
'json': {
|
| 768 |
+
'load': lambda value, arguments, callback: NO_VALUES,
|
| 769 |
+
'loads': lambda value, arguments, callback: NO_VALUES,
|
| 770 |
+
},
|
| 771 |
+
'collections': {
|
| 772 |
+
'namedtuple': collections_namedtuple,
|
| 773 |
+
},
|
| 774 |
+
'functools': {
|
| 775 |
+
'partial': functools_partial,
|
| 776 |
+
'partialmethod': functools_partialmethod,
|
| 777 |
+
'wraps': _functools_wraps,
|
| 778 |
+
},
|
| 779 |
+
'_weakref': {
|
| 780 |
+
'proxy': _return_first_param,
|
| 781 |
+
},
|
| 782 |
+
'random': {
|
| 783 |
+
'choice': _random_choice,
|
| 784 |
+
},
|
| 785 |
+
'operator': {
|
| 786 |
+
'itemgetter': _operator_itemgetter,
|
| 787 |
+
},
|
| 788 |
+
'abc': {
|
| 789 |
+
# Not sure if this is necessary, but it's used a lot in typeshed and
|
| 790 |
+
# it's for now easier to just pass the function.
|
| 791 |
+
'abstractmethod': _return_first_param,
|
| 792 |
+
},
|
| 793 |
+
'typing': {
|
| 794 |
+
# The _alias function just leads to some annoying type inference.
|
| 795 |
+
# Therefore, just make it return nothing, which leads to the stubs
|
| 796 |
+
# being used instead. This only matters for 3.7+.
|
| 797 |
+
'_alias': lambda value, arguments, callback: NO_VALUES,
|
| 798 |
+
# runtime_checkable doesn't really change anything and is just
|
| 799 |
+
# adding logs for infering stuff, so we can safely ignore it.
|
| 800 |
+
'runtime_checkable': lambda value, arguments, callback: NO_VALUES,
|
| 801 |
+
},
|
| 802 |
+
'dataclasses': {
|
| 803 |
+
# For now this works at least better than Jedi trying to understand it.
|
| 804 |
+
'dataclass': _dataclass
|
| 805 |
+
},
|
| 806 |
+
# attrs exposes declaration interface roughly compatible with dataclasses
|
| 807 |
+
# via attrs.define, attrs.frozen and attrs.mutable
|
| 808 |
+
# https://www.attrs.org/en/stable/names.html
|
| 809 |
+
'attr': {
|
| 810 |
+
'define': _dataclass,
|
| 811 |
+
'frozen': _dataclass,
|
| 812 |
+
},
|
| 813 |
+
'attrs': {
|
| 814 |
+
'define': _dataclass,
|
| 815 |
+
'frozen': _dataclass,
|
| 816 |
+
},
|
| 817 |
+
'os.path': {
|
| 818 |
+
'dirname': _create_string_input_function(os.path.dirname),
|
| 819 |
+
'abspath': _create_string_input_function(os.path.abspath),
|
| 820 |
+
'relpath': _create_string_input_function(os.path.relpath),
|
| 821 |
+
'join': _os_path_join,
|
| 822 |
+
}
|
| 823 |
+
}
|
| 824 |
+
|
| 825 |
+
|
| 826 |
+
def get_metaclass_filters(func):
|
| 827 |
+
def wrapper(cls, metaclasses, is_instance):
|
| 828 |
+
for metaclass in metaclasses:
|
| 829 |
+
if metaclass.py__name__() == 'EnumMeta' \
|
| 830 |
+
and metaclass.get_root_context().py__name__() == 'enum':
|
| 831 |
+
filter_ = ParserTreeFilter(parent_context=cls.as_context())
|
| 832 |
+
return [DictFilter({
|
| 833 |
+
name.string_name: EnumInstance(cls, name).name
|
| 834 |
+
for name in filter_.values()
|
| 835 |
+
})]
|
| 836 |
+
return func(cls, metaclasses, is_instance)
|
| 837 |
+
return wrapper
|
| 838 |
+
|
| 839 |
+
|
| 840 |
+
class EnumInstance(LazyValueWrapper):
|
| 841 |
+
def __init__(self, cls, name):
|
| 842 |
+
self.inference_state = cls.inference_state
|
| 843 |
+
self._cls = cls # Corresponds to super().__self__
|
| 844 |
+
self._name = name
|
| 845 |
+
self.tree_node = self._name.tree_name
|
| 846 |
+
|
| 847 |
+
@safe_property
|
| 848 |
+
def name(self):
|
| 849 |
+
return ValueName(self, self._name.tree_name)
|
| 850 |
+
|
| 851 |
+
def _get_wrapped_value(self):
|
| 852 |
+
n = self._name.string_name
|
| 853 |
+
if n.startswith('__') and n.endswith('__') or self._name.api_type == 'function':
|
| 854 |
+
inferred = self._name.infer()
|
| 855 |
+
if inferred:
|
| 856 |
+
return next(iter(inferred))
|
| 857 |
+
o, = self.inference_state.builtins_module.py__getattribute__('object')
|
| 858 |
+
return o
|
| 859 |
+
|
| 860 |
+
value, = self._cls.execute_with_values()
|
| 861 |
+
return value
|
| 862 |
+
|
| 863 |
+
def get_filters(self, origin_scope=None):
|
| 864 |
+
yield DictFilter(dict(
|
| 865 |
+
name=compiled.create_simple_object(self.inference_state, self._name.string_name).name,
|
| 866 |
+
value=self._name,
|
| 867 |
+
))
|
| 868 |
+
for f in self._get_wrapped_value().get_filters():
|
| 869 |
+
yield f
|
| 870 |
+
|
| 871 |
+
|
| 872 |
+
def tree_name_to_values(func):
|
| 873 |
+
def wrapper(inference_state, context, tree_name):
|
| 874 |
+
if tree_name.value == 'sep' and context.is_module() and context.py__name__() == 'os.path':
|
| 875 |
+
return ValueSet({
|
| 876 |
+
compiled.create_simple_object(inference_state, os.path.sep),
|
| 877 |
+
})
|
| 878 |
+
return func(inference_state, context, tree_name)
|
| 879 |
+
return wrapper
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/third_party/django-stubs/django-stubs/db/backends/base/base.pyi
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Any, Callable, Dict, Iterator, List, Optional
|
| 2 |
+
|
| 3 |
+
from django.db.backends.base.client import BaseDatabaseClient
|
| 4 |
+
from django.db.backends.base.creation import BaseDatabaseCreation
|
| 5 |
+
from django.db.backends.base.validation import BaseDatabaseValidation
|
| 6 |
+
from django.db.backends.utils import CursorDebugWrapper, CursorWrapper
|
| 7 |
+
|
| 8 |
+
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
|
| 9 |
+
|
| 10 |
+
from django.db.backends.base.features import BaseDatabaseFeatures
|
| 11 |
+
|
| 12 |
+
from django.db.backends.base.introspection import BaseDatabaseIntrospection
|
| 13 |
+
|
| 14 |
+
NO_DB_ALIAS: str
|
| 15 |
+
|
| 16 |
+
class BaseDatabaseWrapper:
|
| 17 |
+
data_types: Any = ...
|
| 18 |
+
data_types_suffix: Any = ...
|
| 19 |
+
data_type_check_constraints: Any = ...
|
| 20 |
+
ops: Any = ...
|
| 21 |
+
vendor: str = ...
|
| 22 |
+
display_name: str = ...
|
| 23 |
+
SchemaEditorClass: Optional[BaseDatabaseSchemaEditor] = ...
|
| 24 |
+
client_class: Any = ...
|
| 25 |
+
creation_class: Any = ...
|
| 26 |
+
features_class: Any = ...
|
| 27 |
+
introspection_class: Any = ...
|
| 28 |
+
ops_class: Any = ...
|
| 29 |
+
validation_class: Any = ...
|
| 30 |
+
queries_limit: int = ...
|
| 31 |
+
connection: Any = ...
|
| 32 |
+
settings_dict: Any = ...
|
| 33 |
+
alias: str = ...
|
| 34 |
+
queries_log: Any = ...
|
| 35 |
+
force_debug_cursor: bool = ...
|
| 36 |
+
autocommit: bool = ...
|
| 37 |
+
in_atomic_block: bool = ...
|
| 38 |
+
savepoint_state: int = ...
|
| 39 |
+
savepoint_ids: Any = ...
|
| 40 |
+
commit_on_exit: bool = ...
|
| 41 |
+
needs_rollback: bool = ...
|
| 42 |
+
close_at: Optional[Any] = ...
|
| 43 |
+
closed_in_transaction: bool = ...
|
| 44 |
+
errors_occurred: bool = ...
|
| 45 |
+
allow_thread_sharing: bool = ...
|
| 46 |
+
run_on_commit: List[Any] = ...
|
| 47 |
+
run_commit_hooks_on_set_autocommit_on: bool = ...
|
| 48 |
+
execute_wrappers: List[Any] = ...
|
| 49 |
+
client: BaseDatabaseClient = ...
|
| 50 |
+
creation: BaseDatabaseCreation = ...
|
| 51 |
+
features: BaseDatabaseFeatures = ...
|
| 52 |
+
introspection: BaseDatabaseIntrospection = ...
|
| 53 |
+
validation: BaseDatabaseValidation = ...
|
| 54 |
+
def __init__(
|
| 55 |
+
self, settings_dict: Dict[str, Dict[str, str]], alias: str = ..., allow_thread_sharing: bool = ...
|
| 56 |
+
) -> None: ...
|
| 57 |
+
def ensure_timezone(self) -> bool: ...
|
| 58 |
+
def timezone(self): ...
|
| 59 |
+
def timezone_name(self): ...
|
| 60 |
+
@property
|
| 61 |
+
def queries_logged(self) -> bool: ...
|
| 62 |
+
@property
|
| 63 |
+
def queries(self) -> List[Dict[str, str]]: ...
|
| 64 |
+
def get_connection_params(self) -> None: ...
|
| 65 |
+
def get_new_connection(self, conn_params: Any) -> None: ...
|
| 66 |
+
def init_connection_state(self) -> None: ...
|
| 67 |
+
def create_cursor(self, name: Optional[Any] = ...) -> None: ...
|
| 68 |
+
def connect(self) -> None: ...
|
| 69 |
+
def check_settings(self) -> None: ...
|
| 70 |
+
def ensure_connection(self) -> None: ...
|
| 71 |
+
def cursor(self) -> CursorWrapper: ...
|
| 72 |
+
def commit(self) -> None: ...
|
| 73 |
+
def rollback(self) -> None: ...
|
| 74 |
+
def close(self) -> None: ...
|
| 75 |
+
def savepoint(self) -> str: ...
|
| 76 |
+
def savepoint_rollback(self, sid: str) -> None: ...
|
| 77 |
+
def savepoint_commit(self, sid: str) -> None: ...
|
| 78 |
+
def clean_savepoints(self) -> None: ...
|
| 79 |
+
def get_autocommit(self) -> bool: ...
|
| 80 |
+
def set_autocommit(self, autocommit: bool, force_begin_transaction_with_broken_autocommit: bool = ...) -> None: ...
|
| 81 |
+
def get_rollback(self) -> bool: ...
|
| 82 |
+
def set_rollback(self, rollback: bool) -> None: ...
|
| 83 |
+
def validate_no_atomic_block(self) -> None: ...
|
| 84 |
+
def validate_no_broken_transaction(self) -> None: ...
|
| 85 |
+
def constraint_checks_disabled(self) -> Iterator[None]: ...
|
| 86 |
+
def disable_constraint_checking(self): ...
|
| 87 |
+
def enable_constraint_checking(self) -> None: ...
|
| 88 |
+
def check_constraints(self, table_names: Optional[Any] = ...) -> None: ...
|
| 89 |
+
def is_usable(self) -> None: ...
|
| 90 |
+
def close_if_unusable_or_obsolete(self) -> None: ...
|
| 91 |
+
def validate_thread_sharing(self) -> None: ...
|
| 92 |
+
def prepare_database(self) -> None: ...
|
| 93 |
+
def wrap_database_errors(self) -> Any: ...
|
| 94 |
+
def chunked_cursor(self) -> CursorWrapper: ...
|
| 95 |
+
def make_debug_cursor(self, cursor: CursorWrapper) -> CursorDebugWrapper: ...
|
| 96 |
+
def make_cursor(self, cursor: CursorWrapper) -> CursorWrapper: ...
|
| 97 |
+
def temporary_connection(self) -> None: ...
|
| 98 |
+
def schema_editor(self, *args: Any, **kwargs: Any) -> BaseDatabaseSchemaEditor: ...
|
| 99 |
+
def on_commit(self, func: Callable) -> None: ...
|
| 100 |
+
def run_and_clear_commit_hooks(self) -> None: ...
|
| 101 |
+
def execute_wrapper(self, wrapper: Callable) -> Iterator[None]: ...
|
| 102 |
+
def copy(self, alias: None = ..., allow_thread_sharing: None = ...) -> Any: ...
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/third_party/django-stubs/django-stubs/db/backends/base/client.pyi
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Any
|
| 2 |
+
|
| 3 |
+
from django.db.backends.base.base import BaseDatabaseWrapper
|
| 4 |
+
|
| 5 |
+
class BaseDatabaseClient:
|
| 6 |
+
executable_name: Any = ...
|
| 7 |
+
connection: Any = ...
|
| 8 |
+
def __init__(self, connection: BaseDatabaseWrapper) -> None: ...
|
| 9 |
+
def runshell(self) -> None: ...
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/third_party/django-stubs/django-stubs/db/backends/base/creation.pyi
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Any, Dict, Optional, Tuple, Union
|
| 2 |
+
|
| 3 |
+
from django.db.backends.base.base import BaseDatabaseWrapper
|
| 4 |
+
|
| 5 |
+
TEST_DATABASE_PREFIX: str
|
| 6 |
+
|
| 7 |
+
class BaseDatabaseCreation:
|
| 8 |
+
connection: Any = ...
|
| 9 |
+
def __init__(self, connection: BaseDatabaseWrapper) -> None: ...
|
| 10 |
+
def create_test_db(
|
| 11 |
+
self, verbosity: int = ..., autoclobber: bool = ..., serialize: bool = ..., keepdb: bool = ...
|
| 12 |
+
) -> str: ...
|
| 13 |
+
def set_as_test_mirror(
|
| 14 |
+
self, primary_settings_dict: Dict[str, Optional[Union[Dict[str, None], int, str]]]
|
| 15 |
+
) -> None: ...
|
| 16 |
+
def serialize_db_to_string(self) -> str: ...
|
| 17 |
+
def deserialize_db_from_string(self, data: str) -> None: ...
|
| 18 |
+
def clone_test_db(self, suffix: Any, verbosity: int = ..., autoclobber: bool = ..., keepdb: bool = ...) -> None: ...
|
| 19 |
+
def get_test_db_clone_settings(self, suffix: Any): ...
|
| 20 |
+
def destroy_test_db(
|
| 21 |
+
self, old_database_name: str = ..., verbosity: int = ..., keepdb: bool = ..., suffix: None = ...
|
| 22 |
+
) -> None: ...
|
| 23 |
+
def sql_table_creation_suffix(self): ...
|
| 24 |
+
def test_db_signature(self) -> Tuple[str, str, str, str]: ...
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/third_party/django-stubs/django-stubs/db/backends/base/introspection.pyi
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from collections import namedtuple
|
| 2 |
+
from typing import Any, Dict, List, Optional, Set, Type
|
| 3 |
+
|
| 4 |
+
from django.db.backends.base.base import BaseDatabaseWrapper
|
| 5 |
+
from django.db.backends.utils import CursorWrapper
|
| 6 |
+
from django.db.models.base import Model
|
| 7 |
+
|
| 8 |
+
TableInfo = namedtuple("TableInfo", ["name", "type"])
|
| 9 |
+
|
| 10 |
+
FieldInfo = namedtuple("FieldInfo", "name type_code display_size internal_size precision scale null_ok default")
|
| 11 |
+
|
| 12 |
+
class BaseDatabaseIntrospection:
|
| 13 |
+
data_types_reverse: Any = ...
|
| 14 |
+
connection: Any = ...
|
| 15 |
+
def __init__(self, connection: BaseDatabaseWrapper) -> None: ...
|
| 16 |
+
def get_field_type(self, data_type: str, description: FieldInfo) -> str: ...
|
| 17 |
+
def table_name_converter(self, name: str) -> str: ...
|
| 18 |
+
def column_name_converter(self, name: str) -> str: ...
|
| 19 |
+
def table_names(self, cursor: Optional[CursorWrapper] = ..., include_views: bool = ...) -> List[str]: ...
|
| 20 |
+
def get_table_list(self, cursor: Any) -> None: ...
|
| 21 |
+
def django_table_names(self, only_existing: bool = ..., include_views: bool = ...) -> List[str]: ...
|
| 22 |
+
def installed_models(self, tables: List[str]) -> Set[Type[Model]]: ...
|
| 23 |
+
def sequence_list(self) -> List[Dict[str, str]]: ...
|
| 24 |
+
def get_sequences(self, cursor: Any, table_name: Any, table_fields: Any = ...) -> None: ...
|
| 25 |
+
def get_key_columns(self, cursor: Any, table_name: Any) -> None: ...
|
| 26 |
+
def get_primary_key_column(self, cursor: Any, table_name: Any): ...
|
| 27 |
+
def get_constraints(self, cursor: Any, table_name: Any) -> None: ...
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/third_party/django-stubs/django-stubs/db/backends/base/operations.pyi
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from datetime import date, datetime, timedelta, time
|
| 2 |
+
from decimal import Decimal
|
| 3 |
+
from typing import Any, List, Optional, Sequence, Tuple, Type, Union
|
| 4 |
+
|
| 5 |
+
from django.core.management.color import Style
|
| 6 |
+
from django.db.backends.base.base import BaseDatabaseWrapper
|
| 7 |
+
from django.db.backends.utils import CursorWrapper
|
| 8 |
+
from django.db.models.base import Model
|
| 9 |
+
from django.db.models.expressions import Case, Expression
|
| 10 |
+
from django.db.models.sql.compiler import SQLCompiler
|
| 11 |
+
|
| 12 |
+
from django.db import DefaultConnectionProxy
|
| 13 |
+
from django.db.models.fields import Field
|
| 14 |
+
|
| 15 |
+
_Connection = Union[DefaultConnectionProxy, BaseDatabaseWrapper]
|
| 16 |
+
|
| 17 |
+
class BaseDatabaseOperations:
|
| 18 |
+
compiler_module: str = ...
|
| 19 |
+
integer_field_ranges: Any = ...
|
| 20 |
+
set_operators: Any = ...
|
| 21 |
+
cast_data_types: Any = ...
|
| 22 |
+
cast_char_field_without_max_length: Any = ...
|
| 23 |
+
PRECEDING: str = ...
|
| 24 |
+
FOLLOWING: str = ...
|
| 25 |
+
UNBOUNDED_PRECEDING: Any = ...
|
| 26 |
+
UNBOUNDED_FOLLOWING: Any = ...
|
| 27 |
+
CURRENT_ROW: str = ...
|
| 28 |
+
explain_prefix: Any = ...
|
| 29 |
+
connection: _Connection = ...
|
| 30 |
+
def __init__(self, connection: Optional[_Connection]) -> None: ...
|
| 31 |
+
def autoinc_sql(self, table: str, column: str) -> None: ...
|
| 32 |
+
def bulk_batch_size(self, fields: Any, objs: Any): ...
|
| 33 |
+
def cache_key_culling_sql(self) -> str: ...
|
| 34 |
+
def unification_cast_sql(self, output_field: Field) -> str: ...
|
| 35 |
+
def date_extract_sql(self, lookup_type: None, field_name: None) -> Any: ...
|
| 36 |
+
def date_interval_sql(self, timedelta: None) -> Any: ...
|
| 37 |
+
def date_trunc_sql(self, lookup_type: None, field_name: None) -> Any: ...
|
| 38 |
+
def datetime_cast_date_sql(self, field_name: None, tzname: None) -> Any: ...
|
| 39 |
+
def datetime_cast_time_sql(self, field_name: None, tzname: None) -> Any: ...
|
| 40 |
+
def datetime_extract_sql(self, lookup_type: None, field_name: None, tzname: None) -> Any: ...
|
| 41 |
+
def datetime_trunc_sql(self, lookup_type: None, field_name: None, tzname: None) -> Any: ...
|
| 42 |
+
def time_trunc_sql(self, lookup_type: None, field_name: None) -> Any: ...
|
| 43 |
+
def time_extract_sql(self, lookup_type: None, field_name: None) -> Any: ...
|
| 44 |
+
def deferrable_sql(self) -> str: ...
|
| 45 |
+
def distinct_sql(self, fields: List[str], params: Optional[List[Any]]) -> Tuple[List[str], List[Any]]: ...
|
| 46 |
+
def fetch_returned_insert_id(self, cursor: Any): ...
|
| 47 |
+
def field_cast_sql(self, db_type: Optional[str], internal_type: str) -> str: ...
|
| 48 |
+
def force_no_ordering(self) -> List[Any]: ...
|
| 49 |
+
def for_update_sql(self, nowait: bool = ..., skip_locked: bool = ..., of: Any = ...): ...
|
| 50 |
+
def limit_offset_sql(self, low_mark: int, high_mark: Optional[int]) -> str: ...
|
| 51 |
+
def last_executed_query(self, cursor: Any, sql: Any, params: Any): ...
|
| 52 |
+
def last_insert_id(self, cursor: CursorWrapper, table_name: str, pk_name: str) -> int: ...
|
| 53 |
+
def lookup_cast(self, lookup_type: str, internal_type: str = ...) -> str: ...
|
| 54 |
+
def max_in_list_size(self) -> None: ...
|
| 55 |
+
def max_name_length(self) -> None: ...
|
| 56 |
+
def no_limit_value(self) -> Any: ...
|
| 57 |
+
def pk_default_value(self) -> str: ...
|
| 58 |
+
def prepare_sql_script(self, sql: Any): ...
|
| 59 |
+
def process_clob(self, value: str) -> str: ...
|
| 60 |
+
def return_insert_id(self) -> None: ...
|
| 61 |
+
def compiler(self, compiler_name: str) -> Type[SQLCompiler]: ...
|
| 62 |
+
def quote_name(self, name: str) -> Any: ...
|
| 63 |
+
def random_function_sql(self): ...
|
| 64 |
+
def regex_lookup(self, lookup_type: str) -> Any: ...
|
| 65 |
+
def savepoint_create_sql(self, sid: str) -> str: ...
|
| 66 |
+
def savepoint_commit_sql(self, sid: str) -> str: ...
|
| 67 |
+
def savepoint_rollback_sql(self, sid: str) -> str: ...
|
| 68 |
+
def set_time_zone_sql(self) -> str: ...
|
| 69 |
+
def sql_flush(self, style: None, tables: None, sequences: None, allow_cascade: bool = ...) -> Any: ...
|
| 70 |
+
def execute_sql_flush(self, using: str, sql_list: List[str]) -> None: ...
|
| 71 |
+
def sequence_reset_by_name_sql(self, style: None, sequences: List[Any]) -> List[Any]: ...
|
| 72 |
+
def sequence_reset_sql(self, style: Style, model_list: Sequence[Type[Model]]) -> List[Any]: ...
|
| 73 |
+
def start_transaction_sql(self) -> str: ...
|
| 74 |
+
def end_transaction_sql(self, success: bool = ...) -> str: ...
|
| 75 |
+
def tablespace_sql(self, tablespace: Optional[str], inline: bool = ...) -> str: ...
|
| 76 |
+
def prep_for_like_query(self, x: str) -> str: ...
|
| 77 |
+
prep_for_iexact_query: Any = ...
|
| 78 |
+
def validate_autopk_value(self, value: int) -> int: ...
|
| 79 |
+
def adapt_unknown_value(self, value: Any) -> Any: ...
|
| 80 |
+
def adapt_datefield_value(self, value: Optional[date]) -> Optional[str]: ...
|
| 81 |
+
def adapt_datetimefield_value(self, value: Optional[datetime]) -> Optional[str]: ...
|
| 82 |
+
def adapt_timefield_value(self, value: Optional[Union[datetime, time]]) -> Optional[str]: ...
|
| 83 |
+
def adapt_decimalfield_value(
|
| 84 |
+
self, value: Optional[Decimal], max_digits: Optional[int] = ..., decimal_places: Optional[int] = ...
|
| 85 |
+
) -> Optional[str]: ...
|
| 86 |
+
def adapt_ipaddressfield_value(self, value: Optional[str]) -> Optional[str]: ...
|
| 87 |
+
def year_lookup_bounds_for_date_field(self, value: int) -> List[str]: ...
|
| 88 |
+
def year_lookup_bounds_for_datetime_field(self, value: int) -> List[str]: ...
|
| 89 |
+
def get_db_converters(self, expression: Expression) -> List[Any]: ...
|
| 90 |
+
def convert_durationfield_value(
|
| 91 |
+
self, value: Optional[float], expression: Expression, connection: _Connection
|
| 92 |
+
) -> Optional[timedelta]: ...
|
| 93 |
+
def check_expression_support(self, expression: Any) -> None: ...
|
| 94 |
+
def combine_expression(self, connector: str, sub_expressions: List[str]) -> str: ...
|
| 95 |
+
def combine_duration_expression(self, connector: Any, sub_expressions: Any): ...
|
| 96 |
+
def binary_placeholder_sql(self, value: Optional[Case]) -> str: ...
|
| 97 |
+
def modify_insert_params(self, placeholder: str, params: Any) -> Any: ...
|
| 98 |
+
def integer_field_range(self, internal_type: Any): ...
|
| 99 |
+
def subtract_temporals(self, internal_type: Any, lhs: Any, rhs: Any): ...
|
| 100 |
+
def window_frame_start(self, start: Any): ...
|
| 101 |
+
def window_frame_end(self, end: Any): ...
|
| 102 |
+
def window_frame_rows_start_end(self, start: Optional[int] = ..., end: Optional[int] = ...) -> Any: ...
|
| 103 |
+
def window_frame_range_start_end(self, start: Optional[int] = ..., end: Optional[int] = ...) -> Any: ...
|
| 104 |
+
def explain_query_prefix(self, format: Optional[str] = ..., **options: Any) -> str: ...
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/third_party/django-stubs/django-stubs/db/backends/dummy/__init__.pyi
ADDED
|
File without changes
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/third_party/django-stubs/django-stubs/db/backends/dummy/base.pyi
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Any
|
| 2 |
+
|
| 3 |
+
from django.db.backends.base.base import BaseDatabaseWrapper
|
| 4 |
+
from django.db.backends.base.client import BaseDatabaseClient
|
| 5 |
+
from django.db.backends.base.creation import BaseDatabaseCreation
|
| 6 |
+
from django.db.backends.base.introspection import BaseDatabaseIntrospection
|
| 7 |
+
from django.db.backends.base.operations import BaseDatabaseOperations
|
| 8 |
+
|
| 9 |
+
def complain(*args: Any, **kwargs: Any) -> Any: ...
|
| 10 |
+
def ignore(*args: Any, **kwargs: Any) -> None: ...
|
| 11 |
+
|
| 12 |
+
class DatabaseOperations(BaseDatabaseOperations):
|
| 13 |
+
quote_name: Any = ...
|
| 14 |
+
|
| 15 |
+
class DatabaseClient(BaseDatabaseClient):
|
| 16 |
+
runshell: Any = ...
|
| 17 |
+
|
| 18 |
+
class DatabaseCreation(BaseDatabaseCreation):
|
| 19 |
+
create_test_db: Any = ...
|
| 20 |
+
destroy_test_db: Any = ...
|
| 21 |
+
|
| 22 |
+
class DatabaseIntrospection(BaseDatabaseIntrospection):
|
| 23 |
+
get_table_list: Any = ...
|
| 24 |
+
get_table_description: Any = ...
|
| 25 |
+
get_relations: Any = ...
|
| 26 |
+
get_indexes: Any = ...
|
| 27 |
+
get_key_columns: Any = ...
|
| 28 |
+
|
| 29 |
+
class DatabaseWrapper(BaseDatabaseWrapper):
|
| 30 |
+
operators: Any = ...
|
| 31 |
+
ensure_connection: Any = ...
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/third_party/django-stubs/django-stubs/db/backends/sqlite3/features.pyi
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from django.db.backends.base.features import BaseDatabaseFeatures
|
| 2 |
+
|
| 3 |
+
class DatabaseFeatures(BaseDatabaseFeatures): ...
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/third_party/django-stubs/django-stubs/db/backends/sqlite3/operations.pyi
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from django.db.backends.base.operations import BaseDatabaseOperations
|
| 2 |
+
|
| 3 |
+
class DatabaseOperations(BaseDatabaseOperations): ...
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/third_party/typeshed/stdlib/3/asyncio/base_futures.pyi
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
from typing import Any, Callable, List, Sequence, Tuple
|
| 3 |
+
from typing_extensions import Literal
|
| 4 |
+
|
| 5 |
+
if sys.version_info >= (3, 7):
|
| 6 |
+
from contextvars import Context
|
| 7 |
+
|
| 8 |
+
from . import futures
|
| 9 |
+
|
| 10 |
+
_PENDING: Literal["PENDING"] # undocumented
|
| 11 |
+
_CANCELLED: Literal["CANCELLED"] # undocumented
|
| 12 |
+
_FINISHED: Literal["FINISHED"] # undocumented
|
| 13 |
+
|
| 14 |
+
def isfuture(obj: object) -> bool: ...
|
| 15 |
+
|
| 16 |
+
if sys.version_info >= (3, 7):
|
| 17 |
+
def _format_callbacks(cb: Sequence[Tuple[Callable[[futures.Future[Any]], None], Context]]) -> str: ... # undocumented
|
| 18 |
+
|
| 19 |
+
else:
|
| 20 |
+
def _format_callbacks(cb: Sequence[Callable[[futures.Future[Any]], None]]) -> str: ... # undocumented
|
| 21 |
+
|
| 22 |
+
def _future_repr_info(future: futures.Future[Any]) -> List[str]: ... # undocumented
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/third_party/typeshed/stdlib/3/asyncio/events.pyi
ADDED
|
@@ -0,0 +1,502 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import ssl
|
| 2 |
+
import sys
|
| 3 |
+
from _typeshed import FileDescriptorLike
|
| 4 |
+
from abc import ABCMeta, abstractmethod
|
| 5 |
+
from asyncio.futures import Future
|
| 6 |
+
from asyncio.protocols import BaseProtocol
|
| 7 |
+
from asyncio.tasks import Task
|
| 8 |
+
from asyncio.transports import BaseTransport
|
| 9 |
+
from asyncio.unix_events import AbstractChildWatcher
|
| 10 |
+
from socket import AddressFamily, SocketKind, _Address, _RetAddress, socket
|
| 11 |
+
from typing import IO, Any, Awaitable, Callable, Dict, Generator, List, Optional, Sequence, Tuple, TypeVar, Union, overload
|
| 12 |
+
|
| 13 |
+
if sys.version_info >= (3, 7):
|
| 14 |
+
from contextvars import Context
|
| 15 |
+
|
| 16 |
+
_T = TypeVar("_T")
|
| 17 |
+
_Context = Dict[str, Any]
|
| 18 |
+
_ExceptionHandler = Callable[[AbstractEventLoop, _Context], Any]
|
| 19 |
+
_ProtocolFactory = Callable[[], BaseProtocol]
|
| 20 |
+
_SSLContext = Union[bool, None, ssl.SSLContext]
|
| 21 |
+
_TransProtPair = Tuple[BaseTransport, BaseProtocol]
|
| 22 |
+
|
| 23 |
+
class Handle:
|
| 24 |
+
_cancelled = False
|
| 25 |
+
_args: Sequence[Any]
|
| 26 |
+
if sys.version_info >= (3, 7):
|
| 27 |
+
def __init__(
|
| 28 |
+
self, callback: Callable[..., Any], args: Sequence[Any], loop: AbstractEventLoop, context: Optional[Context] = ...
|
| 29 |
+
) -> None: ...
|
| 30 |
+
else:
|
| 31 |
+
def __init__(self, callback: Callable[..., Any], args: Sequence[Any], loop: AbstractEventLoop) -> None: ...
|
| 32 |
+
def __repr__(self) -> str: ...
|
| 33 |
+
def cancel(self) -> None: ...
|
| 34 |
+
def _run(self) -> None: ...
|
| 35 |
+
if sys.version_info >= (3, 7):
|
| 36 |
+
def cancelled(self) -> bool: ...
|
| 37 |
+
|
| 38 |
+
class TimerHandle(Handle):
|
| 39 |
+
if sys.version_info >= (3, 7):
|
| 40 |
+
def __init__(
|
| 41 |
+
self,
|
| 42 |
+
when: float,
|
| 43 |
+
callback: Callable[..., Any],
|
| 44 |
+
args: Sequence[Any],
|
| 45 |
+
loop: AbstractEventLoop,
|
| 46 |
+
context: Optional[Context] = ...,
|
| 47 |
+
) -> None: ...
|
| 48 |
+
else:
|
| 49 |
+
def __init__(self, when: float, callback: Callable[..., Any], args: Sequence[Any], loop: AbstractEventLoop) -> None: ...
|
| 50 |
+
def __hash__(self) -> int: ...
|
| 51 |
+
if sys.version_info >= (3, 7):
|
| 52 |
+
def when(self) -> float: ...
|
| 53 |
+
|
| 54 |
+
class AbstractServer:
|
| 55 |
+
sockets: Optional[List[socket]]
|
| 56 |
+
def close(self) -> None: ...
|
| 57 |
+
if sys.version_info >= (3, 7):
|
| 58 |
+
async def __aenter__(self: _T) -> _T: ...
|
| 59 |
+
async def __aexit__(self, *exc: Any) -> None: ...
|
| 60 |
+
def get_loop(self) -> AbstractEventLoop: ...
|
| 61 |
+
def is_serving(self) -> bool: ...
|
| 62 |
+
async def start_serving(self) -> None: ...
|
| 63 |
+
async def serve_forever(self) -> None: ...
|
| 64 |
+
async def wait_closed(self) -> None: ...
|
| 65 |
+
|
| 66 |
+
class AbstractEventLoop(metaclass=ABCMeta):
|
| 67 |
+
slow_callback_duration: float = ...
|
| 68 |
+
@abstractmethod
|
| 69 |
+
def run_forever(self) -> None: ...
|
| 70 |
+
# Can't use a union, see mypy issue # 1873.
|
| 71 |
+
@overload
|
| 72 |
+
@abstractmethod
|
| 73 |
+
def run_until_complete(self, future: Generator[Any, None, _T]) -> _T: ...
|
| 74 |
+
@overload
|
| 75 |
+
@abstractmethod
|
| 76 |
+
def run_until_complete(self, future: Awaitable[_T]) -> _T: ...
|
| 77 |
+
@abstractmethod
|
| 78 |
+
def stop(self) -> None: ...
|
| 79 |
+
@abstractmethod
|
| 80 |
+
def is_running(self) -> bool: ...
|
| 81 |
+
@abstractmethod
|
| 82 |
+
def is_closed(self) -> bool: ...
|
| 83 |
+
@abstractmethod
|
| 84 |
+
def close(self) -> None: ...
|
| 85 |
+
if sys.version_info >= (3, 6):
|
| 86 |
+
@abstractmethod
|
| 87 |
+
async def shutdown_asyncgens(self) -> None: ...
|
| 88 |
+
# Methods scheduling callbacks. All these return Handles.
|
| 89 |
+
@abstractmethod
|
| 90 |
+
def call_soon(self, callback: Callable[..., Any], *args: Any) -> Handle: ...
|
| 91 |
+
@abstractmethod
|
| 92 |
+
def call_later(self, delay: float, callback: Callable[..., Any], *args: Any) -> TimerHandle: ...
|
| 93 |
+
@abstractmethod
|
| 94 |
+
def call_at(self, when: float, callback: Callable[..., Any], *args: Any) -> TimerHandle: ...
|
| 95 |
+
@abstractmethod
|
| 96 |
+
def time(self) -> float: ...
|
| 97 |
+
# Future methods
|
| 98 |
+
@abstractmethod
|
| 99 |
+
def create_future(self) -> Future[Any]: ...
|
| 100 |
+
# Tasks methods
|
| 101 |
+
if sys.version_info >= (3, 8):
|
| 102 |
+
@abstractmethod
|
| 103 |
+
def create_task(self, coro: Union[Awaitable[_T], Generator[Any, None, _T]], *, name: Optional[str] = ...) -> Task[_T]: ...
|
| 104 |
+
else:
|
| 105 |
+
@abstractmethod
|
| 106 |
+
def create_task(self, coro: Union[Awaitable[_T], Generator[Any, None, _T]]) -> Task[_T]: ...
|
| 107 |
+
@abstractmethod
|
| 108 |
+
def set_task_factory(
|
| 109 |
+
self, factory: Optional[Callable[[AbstractEventLoop, Generator[Any, None, _T]], Future[_T]]]
|
| 110 |
+
) -> None: ...
|
| 111 |
+
@abstractmethod
|
| 112 |
+
def get_task_factory(self) -> Optional[Callable[[AbstractEventLoop, Generator[Any, None, _T]], Future[_T]]]: ...
|
| 113 |
+
# Methods for interacting with threads
|
| 114 |
+
@abstractmethod
|
| 115 |
+
def call_soon_threadsafe(self, callback: Callable[..., Any], *args: Any) -> Handle: ...
|
| 116 |
+
@abstractmethod
|
| 117 |
+
def run_in_executor(self, executor: Any, func: Callable[..., _T], *args: Any) -> Awaitable[_T]: ...
|
| 118 |
+
@abstractmethod
|
| 119 |
+
def set_default_executor(self, executor: Any) -> None: ...
|
| 120 |
+
# Network I/O methods returning Futures.
|
| 121 |
+
@abstractmethod
|
| 122 |
+
async def getaddrinfo(
|
| 123 |
+
self,
|
| 124 |
+
host: Optional[str],
|
| 125 |
+
port: Union[str, int, None],
|
| 126 |
+
*,
|
| 127 |
+
family: int = ...,
|
| 128 |
+
type: int = ...,
|
| 129 |
+
proto: int = ...,
|
| 130 |
+
flags: int = ...,
|
| 131 |
+
) -> List[Tuple[AddressFamily, SocketKind, int, str, Union[Tuple[str, int], Tuple[str, int, int, int]]]]: ...
|
| 132 |
+
@abstractmethod
|
| 133 |
+
async def getnameinfo(
|
| 134 |
+
self, sockaddr: Union[Tuple[str, int], Tuple[str, int, int, int]], flags: int = ...
|
| 135 |
+
) -> Tuple[str, str]: ...
|
| 136 |
+
if sys.version_info >= (3, 8):
|
| 137 |
+
@overload
|
| 138 |
+
@abstractmethod
|
| 139 |
+
async def create_connection(
|
| 140 |
+
self,
|
| 141 |
+
protocol_factory: _ProtocolFactory,
|
| 142 |
+
host: str = ...,
|
| 143 |
+
port: int = ...,
|
| 144 |
+
*,
|
| 145 |
+
ssl: _SSLContext = ...,
|
| 146 |
+
family: int = ...,
|
| 147 |
+
proto: int = ...,
|
| 148 |
+
flags: int = ...,
|
| 149 |
+
sock: None = ...,
|
| 150 |
+
local_addr: Optional[Tuple[str, int]] = ...,
|
| 151 |
+
server_hostname: Optional[str] = ...,
|
| 152 |
+
ssl_handshake_timeout: Optional[float] = ...,
|
| 153 |
+
happy_eyeballs_delay: Optional[float] = ...,
|
| 154 |
+
interleave: Optional[int] = ...,
|
| 155 |
+
) -> _TransProtPair: ...
|
| 156 |
+
@overload
|
| 157 |
+
@abstractmethod
|
| 158 |
+
async def create_connection(
|
| 159 |
+
self,
|
| 160 |
+
protocol_factory: _ProtocolFactory,
|
| 161 |
+
host: None = ...,
|
| 162 |
+
port: None = ...,
|
| 163 |
+
*,
|
| 164 |
+
ssl: _SSLContext = ...,
|
| 165 |
+
family: int = ...,
|
| 166 |
+
proto: int = ...,
|
| 167 |
+
flags: int = ...,
|
| 168 |
+
sock: socket,
|
| 169 |
+
local_addr: None = ...,
|
| 170 |
+
server_hostname: Optional[str] = ...,
|
| 171 |
+
ssl_handshake_timeout: Optional[float] = ...,
|
| 172 |
+
happy_eyeballs_delay: Optional[float] = ...,
|
| 173 |
+
interleave: Optional[int] = ...,
|
| 174 |
+
) -> _TransProtPair: ...
|
| 175 |
+
elif sys.version_info >= (3, 7):
|
| 176 |
+
@overload
|
| 177 |
+
@abstractmethod
|
| 178 |
+
async def create_connection(
|
| 179 |
+
self,
|
| 180 |
+
protocol_factory: _ProtocolFactory,
|
| 181 |
+
host: str = ...,
|
| 182 |
+
port: int = ...,
|
| 183 |
+
*,
|
| 184 |
+
ssl: _SSLContext = ...,
|
| 185 |
+
family: int = ...,
|
| 186 |
+
proto: int = ...,
|
| 187 |
+
flags: int = ...,
|
| 188 |
+
sock: None = ...,
|
| 189 |
+
local_addr: Optional[Tuple[str, int]] = ...,
|
| 190 |
+
server_hostname: Optional[str] = ...,
|
| 191 |
+
ssl_handshake_timeout: Optional[float] = ...,
|
| 192 |
+
) -> _TransProtPair: ...
|
| 193 |
+
@overload
|
| 194 |
+
@abstractmethod
|
| 195 |
+
async def create_connection(
|
| 196 |
+
self,
|
| 197 |
+
protocol_factory: _ProtocolFactory,
|
| 198 |
+
host: None = ...,
|
| 199 |
+
port: None = ...,
|
| 200 |
+
*,
|
| 201 |
+
ssl: _SSLContext = ...,
|
| 202 |
+
family: int = ...,
|
| 203 |
+
proto: int = ...,
|
| 204 |
+
flags: int = ...,
|
| 205 |
+
sock: socket,
|
| 206 |
+
local_addr: None = ...,
|
| 207 |
+
server_hostname: Optional[str] = ...,
|
| 208 |
+
ssl_handshake_timeout: Optional[float] = ...,
|
| 209 |
+
) -> _TransProtPair: ...
|
| 210 |
+
else:
|
| 211 |
+
@overload
|
| 212 |
+
@abstractmethod
|
| 213 |
+
async def create_connection(
|
| 214 |
+
self,
|
| 215 |
+
protocol_factory: _ProtocolFactory,
|
| 216 |
+
host: str = ...,
|
| 217 |
+
port: int = ...,
|
| 218 |
+
*,
|
| 219 |
+
ssl: _SSLContext = ...,
|
| 220 |
+
family: int = ...,
|
| 221 |
+
proto: int = ...,
|
| 222 |
+
flags: int = ...,
|
| 223 |
+
sock: None = ...,
|
| 224 |
+
local_addr: Optional[Tuple[str, int]] = ...,
|
| 225 |
+
server_hostname: Optional[str] = ...,
|
| 226 |
+
) -> _TransProtPair: ...
|
| 227 |
+
@overload
|
| 228 |
+
@abstractmethod
|
| 229 |
+
async def create_connection(
|
| 230 |
+
self,
|
| 231 |
+
protocol_factory: _ProtocolFactory,
|
| 232 |
+
host: None = ...,
|
| 233 |
+
port: None = ...,
|
| 234 |
+
*,
|
| 235 |
+
ssl: _SSLContext = ...,
|
| 236 |
+
family: int = ...,
|
| 237 |
+
proto: int = ...,
|
| 238 |
+
flags: int = ...,
|
| 239 |
+
sock: socket,
|
| 240 |
+
local_addr: None = ...,
|
| 241 |
+
server_hostname: Optional[str] = ...,
|
| 242 |
+
) -> _TransProtPair: ...
|
| 243 |
+
if sys.version_info >= (3, 7):
|
| 244 |
+
@abstractmethod
|
| 245 |
+
async def sock_sendfile(
|
| 246 |
+
self, sock: socket, file: IO[bytes], offset: int = ..., count: Optional[int] = ..., *, fallback: bool = ...
|
| 247 |
+
) -> int: ...
|
| 248 |
+
@overload
|
| 249 |
+
@abstractmethod
|
| 250 |
+
async def create_server(
|
| 251 |
+
self,
|
| 252 |
+
protocol_factory: _ProtocolFactory,
|
| 253 |
+
host: Optional[Union[str, Sequence[str]]] = ...,
|
| 254 |
+
port: int = ...,
|
| 255 |
+
*,
|
| 256 |
+
family: int = ...,
|
| 257 |
+
flags: int = ...,
|
| 258 |
+
sock: None = ...,
|
| 259 |
+
backlog: int = ...,
|
| 260 |
+
ssl: _SSLContext = ...,
|
| 261 |
+
reuse_address: Optional[bool] = ...,
|
| 262 |
+
reuse_port: Optional[bool] = ...,
|
| 263 |
+
ssl_handshake_timeout: Optional[float] = ...,
|
| 264 |
+
start_serving: bool = ...,
|
| 265 |
+
) -> AbstractServer: ...
|
| 266 |
+
@overload
|
| 267 |
+
@abstractmethod
|
| 268 |
+
async def create_server(
|
| 269 |
+
self,
|
| 270 |
+
protocol_factory: _ProtocolFactory,
|
| 271 |
+
host: None = ...,
|
| 272 |
+
port: None = ...,
|
| 273 |
+
*,
|
| 274 |
+
family: int = ...,
|
| 275 |
+
flags: int = ...,
|
| 276 |
+
sock: socket = ...,
|
| 277 |
+
backlog: int = ...,
|
| 278 |
+
ssl: _SSLContext = ...,
|
| 279 |
+
reuse_address: Optional[bool] = ...,
|
| 280 |
+
reuse_port: Optional[bool] = ...,
|
| 281 |
+
ssl_handshake_timeout: Optional[float] = ...,
|
| 282 |
+
start_serving: bool = ...,
|
| 283 |
+
) -> AbstractServer: ...
|
| 284 |
+
async def create_unix_connection(
|
| 285 |
+
self,
|
| 286 |
+
protocol_factory: _ProtocolFactory,
|
| 287 |
+
path: Optional[str] = ...,
|
| 288 |
+
*,
|
| 289 |
+
ssl: _SSLContext = ...,
|
| 290 |
+
sock: Optional[socket] = ...,
|
| 291 |
+
server_hostname: Optional[str] = ...,
|
| 292 |
+
ssl_handshake_timeout: Optional[float] = ...,
|
| 293 |
+
) -> _TransProtPair: ...
|
| 294 |
+
async def create_unix_server(
|
| 295 |
+
self,
|
| 296 |
+
protocol_factory: _ProtocolFactory,
|
| 297 |
+
path: Optional[str] = ...,
|
| 298 |
+
*,
|
| 299 |
+
sock: Optional[socket] = ...,
|
| 300 |
+
backlog: int = ...,
|
| 301 |
+
ssl: _SSLContext = ...,
|
| 302 |
+
ssl_handshake_timeout: Optional[float] = ...,
|
| 303 |
+
start_serving: bool = ...,
|
| 304 |
+
) -> AbstractServer: ...
|
| 305 |
+
@abstractmethod
|
| 306 |
+
async def sendfile(
|
| 307 |
+
self,
|
| 308 |
+
transport: BaseTransport,
|
| 309 |
+
file: IO[bytes],
|
| 310 |
+
offset: int = ...,
|
| 311 |
+
count: Optional[int] = ...,
|
| 312 |
+
*,
|
| 313 |
+
fallback: bool = ...,
|
| 314 |
+
) -> int: ...
|
| 315 |
+
@abstractmethod
|
| 316 |
+
async def start_tls(
|
| 317 |
+
self,
|
| 318 |
+
transport: BaseTransport,
|
| 319 |
+
protocol: BaseProtocol,
|
| 320 |
+
sslcontext: ssl.SSLContext,
|
| 321 |
+
*,
|
| 322 |
+
server_side: bool = ...,
|
| 323 |
+
server_hostname: Optional[str] = ...,
|
| 324 |
+
ssl_handshake_timeout: Optional[float] = ...,
|
| 325 |
+
) -> BaseTransport: ...
|
| 326 |
+
else:
|
| 327 |
+
@overload
|
| 328 |
+
@abstractmethod
|
| 329 |
+
async def create_server(
|
| 330 |
+
self,
|
| 331 |
+
protocol_factory: _ProtocolFactory,
|
| 332 |
+
host: Optional[Union[str, Sequence[str]]] = ...,
|
| 333 |
+
port: int = ...,
|
| 334 |
+
*,
|
| 335 |
+
family: int = ...,
|
| 336 |
+
flags: int = ...,
|
| 337 |
+
sock: None = ...,
|
| 338 |
+
backlog: int = ...,
|
| 339 |
+
ssl: _SSLContext = ...,
|
| 340 |
+
reuse_address: Optional[bool] = ...,
|
| 341 |
+
reuse_port: Optional[bool] = ...,
|
| 342 |
+
) -> AbstractServer: ...
|
| 343 |
+
@overload
|
| 344 |
+
@abstractmethod
|
| 345 |
+
async def create_server(
|
| 346 |
+
self,
|
| 347 |
+
protocol_factory: _ProtocolFactory,
|
| 348 |
+
host: None = ...,
|
| 349 |
+
port: None = ...,
|
| 350 |
+
*,
|
| 351 |
+
family: int = ...,
|
| 352 |
+
flags: int = ...,
|
| 353 |
+
sock: socket,
|
| 354 |
+
backlog: int = ...,
|
| 355 |
+
ssl: _SSLContext = ...,
|
| 356 |
+
reuse_address: Optional[bool] = ...,
|
| 357 |
+
reuse_port: Optional[bool] = ...,
|
| 358 |
+
) -> AbstractServer: ...
|
| 359 |
+
async def create_unix_connection(
|
| 360 |
+
self,
|
| 361 |
+
protocol_factory: _ProtocolFactory,
|
| 362 |
+
path: str,
|
| 363 |
+
*,
|
| 364 |
+
ssl: _SSLContext = ...,
|
| 365 |
+
sock: Optional[socket] = ...,
|
| 366 |
+
server_hostname: Optional[str] = ...,
|
| 367 |
+
) -> _TransProtPair: ...
|
| 368 |
+
async def create_unix_server(
|
| 369 |
+
self,
|
| 370 |
+
protocol_factory: _ProtocolFactory,
|
| 371 |
+
path: str,
|
| 372 |
+
*,
|
| 373 |
+
sock: Optional[socket] = ...,
|
| 374 |
+
backlog: int = ...,
|
| 375 |
+
ssl: _SSLContext = ...,
|
| 376 |
+
) -> AbstractServer: ...
|
| 377 |
+
@abstractmethod
|
| 378 |
+
async def create_datagram_endpoint(
|
| 379 |
+
self,
|
| 380 |
+
protocol_factory: _ProtocolFactory,
|
| 381 |
+
local_addr: Optional[Tuple[str, int]] = ...,
|
| 382 |
+
remote_addr: Optional[Tuple[str, int]] = ...,
|
| 383 |
+
*,
|
| 384 |
+
family: int = ...,
|
| 385 |
+
proto: int = ...,
|
| 386 |
+
flags: int = ...,
|
| 387 |
+
reuse_address: Optional[bool] = ...,
|
| 388 |
+
reuse_port: Optional[bool] = ...,
|
| 389 |
+
allow_broadcast: Optional[bool] = ...,
|
| 390 |
+
sock: Optional[socket] = ...,
|
| 391 |
+
) -> _TransProtPair: ...
|
| 392 |
+
# Pipes and subprocesses.
|
| 393 |
+
@abstractmethod
|
| 394 |
+
async def connect_read_pipe(self, protocol_factory: _ProtocolFactory, pipe: Any) -> _TransProtPair: ...
|
| 395 |
+
@abstractmethod
|
| 396 |
+
async def connect_write_pipe(self, protocol_factory: _ProtocolFactory, pipe: Any) -> _TransProtPair: ...
|
| 397 |
+
@abstractmethod
|
| 398 |
+
async def subprocess_shell(
|
| 399 |
+
self,
|
| 400 |
+
protocol_factory: _ProtocolFactory,
|
| 401 |
+
cmd: Union[bytes, str],
|
| 402 |
+
*,
|
| 403 |
+
stdin: Any = ...,
|
| 404 |
+
stdout: Any = ...,
|
| 405 |
+
stderr: Any = ...,
|
| 406 |
+
**kwargs: Any,
|
| 407 |
+
) -> _TransProtPair: ...
|
| 408 |
+
@abstractmethod
|
| 409 |
+
async def subprocess_exec(
|
| 410 |
+
self,
|
| 411 |
+
protocol_factory: _ProtocolFactory,
|
| 412 |
+
*args: Any,
|
| 413 |
+
stdin: Any = ...,
|
| 414 |
+
stdout: Any = ...,
|
| 415 |
+
stderr: Any = ...,
|
| 416 |
+
**kwargs: Any,
|
| 417 |
+
) -> _TransProtPair: ...
|
| 418 |
+
@abstractmethod
|
| 419 |
+
def add_reader(self, fd: FileDescriptorLike, callback: Callable[..., Any], *args: Any) -> None: ...
|
| 420 |
+
@abstractmethod
|
| 421 |
+
def remove_reader(self, fd: FileDescriptorLike) -> None: ...
|
| 422 |
+
@abstractmethod
|
| 423 |
+
def add_writer(self, fd: FileDescriptorLike, callback: Callable[..., Any], *args: Any) -> None: ...
|
| 424 |
+
@abstractmethod
|
| 425 |
+
def remove_writer(self, fd: FileDescriptorLike) -> None: ...
|
| 426 |
+
# Completion based I/O methods returning Futures prior to 3.7
|
| 427 |
+
if sys.version_info >= (3, 7):
|
| 428 |
+
@abstractmethod
|
| 429 |
+
async def sock_recv(self, sock: socket, nbytes: int) -> bytes: ...
|
| 430 |
+
@abstractmethod
|
| 431 |
+
async def sock_recv_into(self, sock: socket, buf: bytearray) -> int: ...
|
| 432 |
+
@abstractmethod
|
| 433 |
+
async def sock_sendall(self, sock: socket, data: bytes) -> None: ...
|
| 434 |
+
@abstractmethod
|
| 435 |
+
async def sock_connect(self, sock: socket, address: _Address) -> None: ...
|
| 436 |
+
@abstractmethod
|
| 437 |
+
async def sock_accept(self, sock: socket) -> Tuple[socket, _RetAddress]: ...
|
| 438 |
+
else:
|
| 439 |
+
@abstractmethod
|
| 440 |
+
def sock_recv(self, sock: socket, nbytes: int) -> Future[bytes]: ...
|
| 441 |
+
@abstractmethod
|
| 442 |
+
def sock_sendall(self, sock: socket, data: bytes) -> Future[None]: ...
|
| 443 |
+
@abstractmethod
|
| 444 |
+
def sock_connect(self, sock: socket, address: _Address) -> Future[None]: ...
|
| 445 |
+
@abstractmethod
|
| 446 |
+
def sock_accept(self, sock: socket) -> Future[Tuple[socket, _RetAddress]]: ...
|
| 447 |
+
# Signal handling.
|
| 448 |
+
@abstractmethod
|
| 449 |
+
def add_signal_handler(self, sig: int, callback: Callable[..., Any], *args: Any) -> None: ...
|
| 450 |
+
@abstractmethod
|
| 451 |
+
def remove_signal_handler(self, sig: int) -> None: ...
|
| 452 |
+
# Error handlers.
|
| 453 |
+
@abstractmethod
|
| 454 |
+
def set_exception_handler(self, handler: Optional[_ExceptionHandler]) -> None: ...
|
| 455 |
+
@abstractmethod
|
| 456 |
+
def get_exception_handler(self) -> Optional[_ExceptionHandler]: ...
|
| 457 |
+
@abstractmethod
|
| 458 |
+
def default_exception_handler(self, context: _Context) -> None: ...
|
| 459 |
+
@abstractmethod
|
| 460 |
+
def call_exception_handler(self, context: _Context) -> None: ...
|
| 461 |
+
# Debug flag management.
|
| 462 |
+
@abstractmethod
|
| 463 |
+
def get_debug(self) -> bool: ...
|
| 464 |
+
@abstractmethod
|
| 465 |
+
def set_debug(self, enabled: bool) -> None: ...
|
| 466 |
+
if sys.version_info >= (3, 9):
|
| 467 |
+
@abstractmethod
|
| 468 |
+
async def shutdown_default_executor(self) -> None: ...
|
| 469 |
+
|
| 470 |
+
class AbstractEventLoopPolicy(metaclass=ABCMeta):
|
| 471 |
+
@abstractmethod
|
| 472 |
+
def get_event_loop(self) -> AbstractEventLoop: ...
|
| 473 |
+
@abstractmethod
|
| 474 |
+
def set_event_loop(self, loop: Optional[AbstractEventLoop]) -> None: ...
|
| 475 |
+
@abstractmethod
|
| 476 |
+
def new_event_loop(self) -> AbstractEventLoop: ...
|
| 477 |
+
# Child processes handling (Unix only).
|
| 478 |
+
@abstractmethod
|
| 479 |
+
def get_child_watcher(self) -> AbstractChildWatcher: ...
|
| 480 |
+
@abstractmethod
|
| 481 |
+
def set_child_watcher(self, watcher: AbstractChildWatcher) -> None: ...
|
| 482 |
+
|
| 483 |
+
class BaseDefaultEventLoopPolicy(AbstractEventLoopPolicy, metaclass=ABCMeta):
|
| 484 |
+
def __init__(self) -> None: ...
|
| 485 |
+
def get_event_loop(self) -> AbstractEventLoop: ...
|
| 486 |
+
def set_event_loop(self, loop: Optional[AbstractEventLoop]) -> None: ...
|
| 487 |
+
def new_event_loop(self) -> AbstractEventLoop: ...
|
| 488 |
+
|
| 489 |
+
def get_event_loop_policy() -> AbstractEventLoopPolicy: ...
|
| 490 |
+
def set_event_loop_policy(policy: Optional[AbstractEventLoopPolicy]) -> None: ...
|
| 491 |
+
def get_event_loop() -> AbstractEventLoop: ...
|
| 492 |
+
def set_event_loop(loop: Optional[AbstractEventLoop]) -> None: ...
|
| 493 |
+
def new_event_loop() -> AbstractEventLoop: ...
|
| 494 |
+
def get_child_watcher() -> AbstractChildWatcher: ...
|
| 495 |
+
def set_child_watcher(watcher: AbstractChildWatcher) -> None: ...
|
| 496 |
+
def _set_running_loop(__loop: Optional[AbstractEventLoop]) -> None: ...
|
| 497 |
+
def _get_running_loop() -> AbstractEventLoop: ...
|
| 498 |
+
|
| 499 |
+
if sys.version_info >= (3, 7):
|
| 500 |
+
def get_running_loop() -> AbstractEventLoop: ...
|
| 501 |
+
if sys.version_info < (3, 8):
|
| 502 |
+
class SendfileNotAvailableError(RuntimeError): ...
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/third_party/typeshed/stdlib/3/asyncio/format_helpers.pyi
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import functools
|
| 2 |
+
import sys
|
| 3 |
+
import traceback
|
| 4 |
+
from types import FrameType, FunctionType
|
| 5 |
+
from typing import Any, Dict, Iterable, Optional, Tuple, Union, overload
|
| 6 |
+
|
| 7 |
+
class _HasWrapper:
|
| 8 |
+
__wrapper__: Union[_HasWrapper, FunctionType]
|
| 9 |
+
|
| 10 |
+
_FuncType = Union[FunctionType, _HasWrapper, functools.partial, functools.partialmethod]
|
| 11 |
+
|
| 12 |
+
if sys.version_info >= (3, 7):
|
| 13 |
+
@overload
|
| 14 |
+
def _get_function_source(func: _FuncType) -> Tuple[str, int]: ...
|
| 15 |
+
@overload
|
| 16 |
+
def _get_function_source(func: object) -> Optional[Tuple[str, int]]: ...
|
| 17 |
+
def _format_callback_source(func: object, args: Iterable[Any]) -> str: ...
|
| 18 |
+
def _format_args_and_kwargs(args: Iterable[Any], kwargs: Dict[str, Any]) -> str: ...
|
| 19 |
+
def _format_callback(func: object, args: Iterable[Any], kwargs: Dict[str, Any], suffix: str = ...) -> str: ...
|
| 20 |
+
def extract_stack(f: Optional[FrameType] = ..., limit: Optional[int] = ...) -> traceback.StackSummary: ...
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/third_party/typeshed/stdlib/3/asyncio/log.pyi
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import logging
|
| 2 |
+
|
| 3 |
+
logger: logging.Logger
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/third_party/typeshed/stdlib/3/asyncio/queues.pyi
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
from asyncio.events import AbstractEventLoop
|
| 3 |
+
from typing import Any, Generic, Optional, TypeVar
|
| 4 |
+
|
| 5 |
+
if sys.version_info >= (3, 9):
|
| 6 |
+
from types import GenericAlias
|
| 7 |
+
|
| 8 |
+
class QueueEmpty(Exception): ...
|
| 9 |
+
class QueueFull(Exception): ...
|
| 10 |
+
|
| 11 |
+
_T = TypeVar("_T")
|
| 12 |
+
|
| 13 |
+
class Queue(Generic[_T]):
|
| 14 |
+
def __init__(self, maxsize: int = ..., *, loop: Optional[AbstractEventLoop] = ...) -> None: ...
|
| 15 |
+
def _init(self, maxsize: int) -> None: ...
|
| 16 |
+
def _get(self) -> _T: ...
|
| 17 |
+
def _put(self, item: _T) -> None: ...
|
| 18 |
+
def __repr__(self) -> str: ...
|
| 19 |
+
def __str__(self) -> str: ...
|
| 20 |
+
def _format(self) -> str: ...
|
| 21 |
+
def qsize(self) -> int: ...
|
| 22 |
+
@property
|
| 23 |
+
def maxsize(self) -> int: ...
|
| 24 |
+
def empty(self) -> bool: ...
|
| 25 |
+
def full(self) -> bool: ...
|
| 26 |
+
async def put(self, item: _T) -> None: ...
|
| 27 |
+
def put_nowait(self, item: _T) -> None: ...
|
| 28 |
+
async def get(self) -> _T: ...
|
| 29 |
+
def get_nowait(self) -> _T: ...
|
| 30 |
+
async def join(self) -> None: ...
|
| 31 |
+
def task_done(self) -> None: ...
|
| 32 |
+
if sys.version_info >= (3, 9):
|
| 33 |
+
def __class_getitem__(cls, type: Any) -> GenericAlias: ...
|
| 34 |
+
|
| 35 |
+
class PriorityQueue(Queue[_T]): ...
|
| 36 |
+
class LifoQueue(Queue[_T]): ...
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jedi/third_party/typeshed/stdlib/3/html/parser.pyi
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from _markupbase import ParserBase
|
| 2 |
+
from typing import List, Optional, Tuple
|
| 3 |
+
|
| 4 |
+
class HTMLParser(ParserBase):
|
| 5 |
+
def __init__(self, *, convert_charrefs: bool = ...) -> None: ...
|
| 6 |
+
def feed(self, feed: str) -> None: ...
|
| 7 |
+
def close(self) -> None: ...
|
| 8 |
+
def reset(self) -> None: ...
|
| 9 |
+
def getpos(self) -> Tuple[int, int]: ...
|
| 10 |
+
def get_starttag_text(self) -> Optional[str]: ...
|
| 11 |
+
def handle_starttag(self, tag: str, attrs: List[Tuple[str, Optional[str]]]) -> None: ...
|
| 12 |
+
def handle_endtag(self, tag: str) -> None: ...
|
| 13 |
+
def handle_startendtag(self, tag: str, attrs: List[Tuple[str, Optional[str]]]) -> None: ...
|
| 14 |
+
def handle_data(self, data: str) -> None: ...
|
| 15 |
+
def handle_entityref(self, name: str) -> None: ...
|
| 16 |
+
def handle_charref(self, name: str) -> None: ...
|
| 17 |
+
def handle_comment(self, data: str) -> None: ...
|
| 18 |
+
def handle_decl(self, decl: str) -> None: ...
|
| 19 |
+
def handle_pi(self, data: str) -> None: ...
|
| 20 |
+
def unknown_decl(self, data: str) -> None: ...
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jupyter_events/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (440 Bytes). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jupyter_events/__pycache__/_version.cpython-310.pyc
ADDED
|
Binary file (889 Bytes). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jupyter_events/__pycache__/cli.cpython-310.pyc
ADDED
|
Binary file (3.12 kB). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jupyter_events/__pycache__/logger.cpython-310.pyc
ADDED
|
Binary file (12.1 kB). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jupyter_events/__pycache__/pytest_plugin.cpython-310.pyc
ADDED
|
Binary file (2.45 kB). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jupyter_events/__pycache__/schema.cpython-310.pyc
ADDED
|
Binary file (5.38 kB). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jupyter_events/__pycache__/schema_registry.cpython-310.pyc
ADDED
|
Binary file (3.69 kB). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jupyter_events/__pycache__/traits.cpython-310.pyc
ADDED
|
Binary file (1.85 kB). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jupyter_events/__pycache__/utils.cpython-310.pyc
ADDED
|
Binary file (591 Bytes). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jupyter_events/__pycache__/validators.cpython-310.pyc
ADDED
|
Binary file (2.51 kB). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jupyter_events/__pycache__/yaml.cpython-310.pyc
ADDED
|
Binary file (1.53 kB). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/jupyter_events/schemas/event-core-schema.yml
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
$schema: http://json-schema.org/draft-07/schema
|
| 2 |
+
$id: http://event.jupyter.org/event-schema
|
| 3 |
+
version: "1"
|
| 4 |
+
title: Event Schema
|
| 5 |
+
description: |
|
| 6 |
+
A schema for validating any Jupyter Event.
|
| 7 |
+
type: object
|
| 8 |
+
properties:
|
| 9 |
+
__metadata_version__:
|
| 10 |
+
title: Metadata Version
|
| 11 |
+
type: number
|
| 12 |
+
const: 1
|
| 13 |
+
__schema_version__:
|
| 14 |
+
title: Schema Version
|
| 15 |
+
type: string
|
| 16 |
+
__schema__:
|
| 17 |
+
title: Schema ID
|
| 18 |
+
type: string
|
| 19 |
+
__timestamp__:
|
| 20 |
+
title: Event Timestamp
|
| 21 |
+
type: string
|
| 22 |
+
format: datetime
|
| 23 |
+
required:
|
| 24 |
+
- __metadata_version__
|
| 25 |
+
- __schema__
|
| 26 |
+
- __schema_version__
|
| 27 |
+
- __timestamp__
|