OXIESEC PANEL
- Current Dir:
/
/
snap
/
core24
/
888
/
usr
/
lib
/
python3
/
dist-packages
/
attr
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
03/18/2025 08:12:15 AM
rwxr-xr-x
📄
__init__.py
3.23 KB
02/29/2024 09:44:40 PM
rw-r--r--
📄
__init__.pyi
16.58 KB
02/29/2024 09:44:40 PM
rw-r--r--
📁
__pycache__
-
03/18/2025 08:12:15 AM
rwxr-xr-x
📄
_cmp.py
3.93 KB
02/29/2024 09:44:40 PM
rw-r--r--
📄
_cmp.pyi
399 bytes
02/29/2024 09:44:40 PM
rw-r--r--
📄
_compat.py
2.48 KB
02/29/2024 09:44:40 PM
rw-r--r--
📄
_config.py
843 bytes
02/29/2024 09:44:40 PM
rw-r--r--
📄
_funcs.py
16.77 KB
02/29/2024 09:44:40 PM
rw-r--r--
📄
_make.py
99.53 KB
02/29/2024 09:44:40 PM
rw-r--r--
📄
_next_gen.py
6.06 KB
02/29/2024 09:44:40 PM
rw-r--r--
📄
_typing_compat.pyi
469 bytes
02/29/2024 09:44:40 PM
rw-r--r--
📄
_version_info.py
2.07 KB
02/29/2024 09:44:40 PM
rw-r--r--
📄
_version_info.pyi
209 bytes
02/29/2024 09:44:40 PM
rw-r--r--
📄
converters.py
3.54 KB
02/29/2024 09:44:40 PM
rw-r--r--
📄
converters.pyi
406 bytes
02/29/2024 09:44:40 PM
rw-r--r--
📄
exceptions.py
1.93 KB
02/29/2024 09:44:40 PM
rw-r--r--
📄
exceptions.pyi
539 bytes
02/29/2024 09:44:40 PM
rw-r--r--
📄
filters.py
1.44 KB
02/29/2024 09:44:40 PM
rw-r--r--
📄
filters.pyi
225 bytes
02/29/2024 09:44:40 PM
rw-r--r--
📄
py.typed
0 bytes
02/29/2024 09:44:40 PM
rw-r--r--
📄
setters.py
1.37 KB
02/29/2024 09:44:40 PM
rw-r--r--
📄
setters.pyi
567 bytes
02/29/2024 09:44:40 PM
rw-r--r--
📄
validators.py
19.21 KB
02/29/2024 09:44:40 PM
rw-r--r--
📄
validators.pyi
2.52 KB
02/29/2024 09:44:40 PM
rw-r--r--
Editing: _compat.py
Close
# SPDX-License-Identifier: MIT import inspect import platform import sys import threading from collections.abc import Mapping, Sequence # noqa: F401 from typing import _GenericAlias PYPY = platform.python_implementation() == "PyPy" PY_3_8_PLUS = sys.version_info[:2] >= (3, 8) PY_3_9_PLUS = sys.version_info[:2] >= (3, 9) PY310 = sys.version_info[:2] >= (3, 10) PY_3_12_PLUS = sys.version_info[:2] >= (3, 12) if sys.version_info < (3, 8): try: from typing_extensions import Protocol except ImportError: # pragma: no cover Protocol = object else: from typing import Protocol # noqa: F401 class _AnnotationExtractor: """ Extract type annotations from a callable, returning None whenever there is none. """ __slots__ = ["sig"] def __init__(self, callable): try: self.sig = inspect.signature(callable) except (ValueError, TypeError): # inspect failed self.sig = None def get_first_param_type(self): """ Return the type annotation of the first argument if it's not empty. """ if not self.sig: return None params = list(self.sig.parameters.values()) if params and params[0].annotation is not inspect.Parameter.empty: return params[0].annotation return None def get_return_type(self): """ Return the return type if it's not empty. """ if ( self.sig and self.sig.return_annotation is not inspect.Signature.empty ): return self.sig.return_annotation return None # Thread-local global to track attrs instances which are already being repr'd. # This is needed because there is no other (thread-safe) way to pass info # about the instances that are already being repr'd through the call stack # in order to ensure we don't perform infinite recursion. # # For instance, if an instance contains a dict which contains that instance, # we need to know that we're already repr'ing the outside instance from within # the dict's repr() call. # # This lives here rather than in _make.py so that the functions in _make.py # don't have a direct reference to the thread-local in their globals dict. # If they have such a reference, it breaks cloudpickle. repr_context = threading.local() def get_generic_base(cl): """If this is a generic class (A[str]), return the generic base for it.""" if cl.__class__ is _GenericAlias: return cl.__origin__ return None