__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
from inspect import Parameter
from jedi.cache import memoize_method
from jedi import debug
from jedi import parser_utils
class _SignatureMixin:
def to_string(self):
def param_strings():
is_positional = False
is_kw_only = False
for n in self.get_param_names(resolve_stars=True):
kind = n.get_kind()
is_positional |= kind == Parameter.POSITIONAL_ONLY
if is_positional and kind != Parameter.POSITIONAL_ONLY:
yield '/'
is_positional = False
if kind == Parameter.VAR_POSITIONAL:
is_kw_only = True
elif kind == Parameter.KEYWORD_ONLY and not is_kw_only:
yield '*'
is_kw_only = True
yield n.to_string()
if is_positional:
yield '/'
s = self.name.string_name + '(' + ', '.join(param_strings()) + ')'
annotation = self.annotation_string
if annotation:
s += ' -> ' + annotation
return s
class AbstractSignature(_SignatureMixin):
def __init__(self, value, is_bound=False):
self.value = value
self.is_bound = is_bound
@property
def name(self):
return self.value.name
@property
def annotation_string(self):
return ''
def get_param_names(self, resolve_stars=False):
param_names = self._function_value.get_param_names()
if self.is_bound:
return param_names[1:]
return param_names
def bind(self, value):
raise NotImplementedError
def matches_signature(self, arguments):
return True
def __repr__(self):
if self.value is self._function_value:
return '<%s: %s>' % (self.__class__.__name__, self.value)
return '<%s: %s, %s>' % (self.__class__.__name__, self.value, self._function_value)
class TreeSignature(AbstractSignature):
def __init__(self, value, function_value=None, is_bound=False):
super().__init__(value, is_bound)
self._function_value = function_value or value
def bind(self, value):
return TreeSignature(value, self._function_value, is_bound=True)
@property
def _annotation(self):
# Classes don't need annotations, even if __init__ has one. They always
# return themselves.
if self.value.is_class():
return None
return self._function_value.tree_node.annotation
@property
def annotation_string(self):
a = self._annotation
if a is None:
return ''
return a.get_code(include_prefix=False)
@memoize_method
def get_param_names(self, resolve_stars=False):
params = self._function_value.get_param_names()
if resolve_stars:
from jedi.inference.star_args import process_params
params = process_params(params)
if self.is_bound:
return params[1:]
return params
def matches_signature(self, arguments):
from jedi.inference.param import get_executed_param_names_and_issues
executed_param_names, issues = \
get_executed_param_names_and_issues(self._function_value, arguments)
if issues:
return False
matches = all(executed_param_name.matches_signature()
for executed_param_name in executed_param_names)
if debug.enable_notice:
tree_node = self._function_value.tree_node
signature = parser_utils.get_signature(tree_node)
if matches:
debug.dbg("Overloading match: %s@%s (%s)",
signature, tree_node.start_pos[0], arguments, color='BLUE')
else:
debug.dbg("Overloading no match: %s@%s (%s)",
signature, tree_node.start_pos[0], arguments, color='BLUE')
return matches
class BuiltinSignature(AbstractSignature):
def __init__(self, value, return_string, function_value=None, is_bound=False):
super().__init__(value, is_bound)
self._return_string = return_string
self.__function_value = function_value
@property
def annotation_string(self):
return self._return_string
@property
def _function_value(self):
if self.__function_value is None:
return self.value
return self.__function_value
def bind(self, value):
return BuiltinSignature(
value, self._return_string,
function_value=self.value,
is_bound=True
)
class SignatureWrapper(_SignatureMixin):
def __init__(self, wrapped_signature):
self._wrapped_signature = wrapped_signature
def __getattr__(self, name):
return getattr(self._wrapped_signature, name)
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| __pycache__ | Folder | 0755 |
|
|
| compiled | Folder | 0755 |
|
|
| gradual | Folder | 0755 |
|
|
| value | Folder | 0755 |
|
|
| __init__.py | File | 8.31 KB | 0644 |
|
| analysis.py | File | 7.58 KB | 0644 |
|
| arguments.py | File | 11.93 KB | 0644 |
|
| base_value.py | File | 17.79 KB | 0644 |
|
| cache.py | File | 4.09 KB | 0644 |
|
| context.py | File | 16.76 KB | 0644 |
|
| docstring_utils.py | File | 759 B | 0644 |
|
| docstrings.py | File | 9.59 KB | 0644 |
|
| dynamic_params.py | File | 7.96 KB | 0644 |
|
| filters.py | File | 12.2 KB | 0644 |
|
| finder.py | File | 5.2 KB | 0644 |
|
| flow_analysis.py | File | 4.48 KB | 0644 |
|
| helpers.py | File | 5.8 KB | 0644 |
|
| imports.py | File | 22.54 KB | 0644 |
|
| lazy_value.py | File | 1.63 KB | 0644 |
|
| names.py | File | 22.67 KB | 0644 |
|
| param.py | File | 10.21 KB | 0644 |
|
| parser_cache.py | File | 191 B | 0644 |
|
| recursion.py | File | 4.82 KB | 0644 |
|
| references.py | File | 11.14 KB | 0644 |
|
| signature.py | File | 4.75 KB | 0644 |
|
| star_args.py | File | 7.71 KB | 0644 |
|
| syntax_tree.py | File | 34.92 KB | 0644 |
|
| sys_path.py | File | 9.98 KB | 0644 |
|
| utils.py | File | 2.64 KB | 0644 |
|