__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
""" A universal module with functions / classes without dependencies. """
import functools
import re
import os
_sep = os.path.sep
if os.path.altsep is not None:
_sep += os.path.altsep
_path_re = re.compile(r'(?:\.[^{0}]+|[{0}]__init__\.py)$'.format(re.escape(_sep)))
del _sep
def to_list(func):
def wrapper(*args, **kwargs):
return list(func(*args, **kwargs))
return wrapper
def to_tuple(func):
def wrapper(*args, **kwargs):
return tuple(func(*args, **kwargs))
return wrapper
def unite(iterable):
"""Turns a two dimensional array into a one dimensional."""
return set(typ for types in iterable for typ in types)
class UncaughtAttributeError(Exception):
"""
Important, because `__getattr__` and `hasattr` catch AttributeErrors
implicitly. This is really evil (mainly because of `__getattr__`).
Therefore this class originally had to be derived from `BaseException`
instead of `Exception`. But because I removed relevant `hasattr` from
the code base, we can now switch back to `Exception`.
:param base: return values of sys.exc_info().
"""
def safe_property(func):
return property(reraise_uncaught(func))
def reraise_uncaught(func):
"""
Re-throw uncaught `AttributeError`.
Usage: Put ``@rethrow_uncaught`` in front of the function
which does **not** suppose to raise `AttributeError`.
AttributeError is easily get caught by `hasattr` and another
``except AttributeError`` clause. This becomes problem when you use
a lot of "dynamic" attributes (e.g., using ``@property``) because you
can't distinguish if the property does not exist for real or some code
inside of the "dynamic" attribute through that error. In a well
written code, such error should not exist but getting there is very
difficult. This decorator is to help us getting there by changing
`AttributeError` to `UncaughtAttributeError` to avoid unexpected catch.
This helps us noticing bugs earlier and facilitates debugging.
"""
@functools.wraps(func)
def wrapper(*args, **kwds):
try:
return func(*args, **kwds)
except AttributeError as e:
raise UncaughtAttributeError(e) from e
return wrapper
class PushBackIterator:
def __init__(self, iterator):
self.pushes = []
self.iterator = iterator
self.current = None
def push_back(self, value):
self.pushes.append(value)
def __iter__(self):
return self
def __next__(self):
if self.pushes:
self.current = self.pushes.pop()
else:
self.current = next(self.iterator)
return self.current
| 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 |
|