golden hour
/opt/saltstack/salt/lib/python3.10
⬆️ Go Up
Upload
File/Folder
Size
Actions
__future__.py
5.03 KB
Del
OK
__phello__.foo.py
64 B
Del
OK
__pycache__
-
Del
OK
_aix_support.py
3.19 KB
Del
OK
_bootsubprocess.py
2.61 KB
Del
OK
_collections_abc.py
31.53 KB
Del
OK
_compat_pickle.py
8.54 KB
Del
OK
_compression.py
5.55 KB
Del
OK
_markupbase.py
14.31 KB
Del
OK
_osx_support.py
21.28 KB
Del
OK
_py_abc.py
6.04 KB
Del
OK
_pydecimal.py
223.32 KB
Del
OK
_pyio.py
92.25 KB
Del
OK
_sitebuiltins.py
3.05 KB
Del
OK
_strptime.py
24.68 KB
Del
OK
_sysconfigdata__linux_x86_64-linux-gnu.py
31.51 KB
Del
OK
_threading_local.py
7.05 KB
Del
OK
_weakrefset.py
5.78 KB
Del
OK
abc.py
6.37 KB
Del
OK
aifc.py
31.84 KB
Del
OK
antigravity.py
500 B
Del
OK
argparse.py
96.23 KB
Del
OK
ast.py
58.5 KB
Del
OK
asynchat.py
11.25 KB
Del
OK
asyncio
-
Del
OK
asyncore.py
19.79 KB
Del
OK
base64.py
20.36 KB
Del
OK
bdb.py
31.64 KB
Del
OK
binhex.py
14.44 KB
Del
OK
bisect.py
3.06 KB
Del
OK
bz2.py
11.57 KB
Del
OK
cProfile.py
6.2 KB
Del
OK
calendar.py
24 KB
Del
OK
cgi.py
33.37 KB
Del
OK
cgitb.py
11.81 KB
Del
OK
chunk.py
5.31 KB
Del
OK
cmd.py
14.51 KB
Del
OK
code.py
10.37 KB
Del
OK
codecs.py
35.85 KB
Del
OK
codeop.py
5.48 KB
Del
OK
collections
-
Del
OK
colorsys.py
3.92 KB
Del
OK
compileall.py
19.78 KB
Del
OK
concurrent
-
Del
OK
config-3.10-x86_64-linux-gnu
-
Del
OK
configparser.py
53.33 KB
Del
OK
contextlib.py
25.28 KB
Del
OK
contextvars.py
129 B
Del
OK
copy.py
8.48 KB
Del
OK
copyreg.py
7.25 KB
Del
OK
crypt.py
3.76 KB
Del
OK
csv.py
15.65 KB
Del
OK
ctypes
-
Del
OK
curses
-
Del
OK
dataclasses.py
55.07 KB
Del
OK
datetime.py
86.02 KB
Del
OK
dbm
-
Del
OK
decimal.py
320 B
Del
OK
difflib.py
81.36 KB
Del
OK
dis.py
19.55 KB
Del
OK
distutils
-
Del
OK
doctest.py
102.68 KB
Del
OK
email
-
Del
OK
encodings
-
Del
OK
ensurepip
-
Del
OK
enum.py
38.9 KB
Del
OK
filecmp.py
9.94 KB
Del
OK
fileinput.py
16.06 KB
Del
OK
fnmatch.py
6.56 KB
Del
OK
fractions.py
27.58 KB
Del
OK
ftplib.py
34.66 KB
Del
OK
functools.py
37.18 KB
Del
OK
genericpath.py
4.86 KB
Del
OK
getopt.py
7.31 KB
Del
OK
getpass.py
5.85 KB
Del
OK
gettext.py
26.63 KB
Del
OK
glob.py
7.7 KB
Del
OK
graphlib.py
9.35 KB
Del
OK
gzip.py
21.34 KB
Del
OK
hashlib.py
9.99 KB
Del
OK
heapq.py
22.34 KB
Del
OK
hmac.py
7.54 KB
Del
OK
html
-
Del
OK
http
-
Del
OK
imaplib.py
53.58 KB
Del
OK
imghdr.py
3.72 KB
Del
OK
imp.py
10.34 KB
Del
OK
importlib
-
Del
OK
inspect.py
121.46 KB
Del
OK
io.py
4.1 KB
Del
OK
ipaddress.py
72.97 KB
Del
OK
json
-
Del
OK
keyword.py
1.04 KB
Del
OK
lib-dynload
-
Del
OK
lib2to3
-
Del
OK
linecache.py
5.56 KB
Del
OK
locale.py
76.29 KB
Del
OK
logging
-
Del
OK
lzma.py
12.97 KB
Del
OK
mailbox.py
76.95 KB
Del
OK
mailcap.py
8.9 KB
Del
OK
mimetypes.py
22.01 KB
Del
OK
modulefinder.py
23.83 KB
Del
OK
multiprocessing
-
Del
OK
netrc.py
5.61 KB
Del
OK
nntplib.py
40.06 KB
Del
OK
ntpath.py
28.79 KB
Del
OK
nturl2path.py
2.82 KB
Del
OK
numbers.py
10.11 KB
Del
OK
opcode.py
5.76 KB
Del
OK
operator.py
10.5 KB
Del
OK
optparse.py
58.95 KB
Del
OK
os.py
38.63 KB
Del
OK
pathlib.py
48.41 KB
Del
OK
pdb.py
61.74 KB
Del
OK
pickle.py
63.43 KB
Del
OK
pickletools.py
91.29 KB
Del
OK
pipes.py
8.71 KB
Del
OK
pkgutil.py
24 KB
Del
OK
platform.py
41.04 KB
Del
OK
plistlib.py
27.69 KB
Del
OK
poplib.py
14.84 KB
Del
OK
posixpath.py
15.87 KB
Del
OK
pprint.py
23.87 KB
Del
OK
profile.py
22.35 KB
Del
OK
pstats.py
28.64 KB
Del
OK
pty.py
5.09 KB
Del
OK
py_compile.py
7.65 KB
Del
OK
pyclbr.py
11.13 KB
Del
OK
pydoc.py
107.02 KB
Del
OK
pydoc_data
-
Del
OK
queue.py
11.23 KB
Del
OK
quopri.py
7.1 KB
Del
OK
random.py
32.44 KB
Del
OK
re.py
15.49 KB
Del
OK
reprlib.py
5.14 KB
Del
OK
rlcompleter.py
7.63 KB
Del
OK
runpy.py
12.8 KB
Del
OK
sched.py
6.2 KB
Del
OK
secrets.py
1.99 KB
Del
OK
selectors.py
19.08 KB
Del
OK
shelve.py
8.36 KB
Del
OK
shlex.py
13.18 KB
Del
OK
shutil.py
53.29 KB
Del
OK
signal.py
2.38 KB
Del
OK
site-packages
-
Del
OK
site.py
22.06 KB
Del
OK
smtpd.py
34.34 KB
Del
OK
smtplib.py
44.35 KB
Del
OK
sndhdr.py
6.93 KB
Del
OK
socket.py
35.92 KB
Del
OK
socketserver.py
26.66 KB
Del
OK
sqlite3
-
Del
OK
sre_compile.py
27.32 KB
Del
OK
sre_constants.py
7.01 KB
Del
OK
sre_parse.py
39.82 KB
Del
OK
ssl.py
52.63 KB
Del
OK
stat.py
5.36 KB
Del
OK
statistics.py
42.19 KB
Del
OK
string.py
10.32 KB
Del
OK
stringprep.py
12.61 KB
Del
OK
struct.py
257 B
Del
OK
subprocess.py
82.93 KB
Del
OK
sunau.py
17.73 KB
Del
OK
symtable.py
9.98 KB
Del
OK
sysconfig.py
26.96 KB
Del
OK
tabnanny.py
11.03 KB
Del
OK
tarfile.py
103.63 KB
Del
OK
telnetlib.py
22.71 KB
Del
OK
tempfile.py
28.5 KB
Del
OK
textwrap.py
19.31 KB
Del
OK
this.py
1003 B
Del
OK
threading.py
55.86 KB
Del
OK
timeit.py
13.18 KB
Del
OK
token.py
2.33 KB
Del
OK
tokenize.py
25.31 KB
Del
OK
trace.py
28.53 KB
Del
OK
traceback.py
25.61 KB
Del
OK
tracemalloc.py
17.62 KB
Del
OK
tty.py
879 B
Del
OK
turtle.py
140.39 KB
Del
OK
types.py
9.88 KB
Del
OK
typing.py
90.39 KB
Del
OK
unittest
-
Del
OK
urllib
-
Del
OK
uu.py
7.13 KB
Del
OK
uuid.py
26.86 KB
Del
OK
venv
-
Del
OK
warnings.py
19.23 KB
Del
OK
wave.py
17.58 KB
Del
OK
weakref.py
21.05 KB
Del
OK
webbrowser.py
23.68 KB
Del
OK
wsgiref
-
Del
OK
xdrlib.py
5.77 KB
Del
OK
xml
-
Del
OK
xmlrpc
-
Del
OK
zipapp.py
7.36 KB
Del
OK
zipfile.py
87.34 KB
Del
OK
zipimport.py
30.17 KB
Del
OK
zoneinfo
-
Del
OK
Edit: numbers.py
# Copyright 2007 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """Abstract Base Classes (ABCs) for numbers, according to PEP 3141. TODO: Fill out more detailed documentation on the operators.""" from abc import ABCMeta, abstractmethod __all__ = ["Number", "Complex", "Real", "Rational", "Integral"] class Number(metaclass=ABCMeta): """All numbers inherit from this class. If you just want to check if an argument x is a number, without caring what kind, use isinstance(x, Number). """ __slots__ = () # Concrete numeric types must provide their own hash implementation __hash__ = None ## Notes on Decimal ## ---------------- ## Decimal has all of the methods specified by the Real abc, but it should ## not be registered as a Real because decimals do not interoperate with ## binary floats (i.e. Decimal('3.14') + 2.71828 is undefined). But, ## abstract reals are expected to interoperate (i.e. R1 + R2 should be ## expected to work if R1 and R2 are both Reals). class Complex(Number): """Complex defines the operations that work on the builtin complex type. In short, those are: a conversion to complex, .real, .imag, +, -, *, /, **, abs(), .conjugate, ==, and !=. If it is given heterogeneous arguments, and doesn't have special knowledge about them, it should fall back to the builtin complex type as described below. """ __slots__ = () @abstractmethod def __complex__(self): """Return a builtin complex instance. Called for complex(self).""" def __bool__(self): """True if self != 0. Called for bool(self).""" return self != 0 @property @abstractmethod def real(self): """Retrieve the real component of this number. This should subclass Real. """ raise NotImplementedError @property @abstractmethod def imag(self): """Retrieve the imaginary component of this number. This should subclass Real. """ raise NotImplementedError @abstractmethod def __add__(self, other): """self + other""" raise NotImplementedError @abstractmethod def __radd__(self, other): """other + self""" raise NotImplementedError @abstractmethod def __neg__(self): """-self""" raise NotImplementedError @abstractmethod def __pos__(self): """+self""" raise NotImplementedError def __sub__(self, other): """self - other""" return self + -other def __rsub__(self, other): """other - self""" return -self + other @abstractmethod def __mul__(self, other): """self * other""" raise NotImplementedError @abstractmethod def __rmul__(self, other): """other * self""" raise NotImplementedError @abstractmethod def __truediv__(self, other): """self / other: Should promote to float when necessary.""" raise NotImplementedError @abstractmethod def __rtruediv__(self, other): """other / self""" raise NotImplementedError @abstractmethod def __pow__(self, exponent): """self**exponent; should promote to float or complex when necessary.""" raise NotImplementedError @abstractmethod def __rpow__(self, base): """base ** self""" raise NotImplementedError @abstractmethod def __abs__(self): """Returns the Real distance from 0. Called for abs(self).""" raise NotImplementedError @abstractmethod def conjugate(self): """(x+y*i).conjugate() returns (x-y*i).""" raise NotImplementedError @abstractmethod def __eq__(self, other): """self == other""" raise NotImplementedError Complex.register(complex) class Real(Complex): """To Complex, Real adds the operations that work on real numbers. In short, those are: a conversion to float, trunc(), divmod, %, <, <=, >, and >=. Real also provides defaults for the derived operations. """ __slots__ = () @abstractmethod def __float__(self): """Any Real can be converted to a native float object. Called for float(self).""" raise NotImplementedError @abstractmethod def __trunc__(self): """trunc(self): Truncates self to an Integral. Returns an Integral i such that: * i>0 iff self>0; * abs(i) <= abs(self); * for any Integral j satisfying the first two conditions, abs(i) >= abs(j) [i.e. i has "maximal" abs among those]. i.e. "truncate towards 0". """ raise NotImplementedError @abstractmethod def __floor__(self): """Finds the greatest Integral <= self.""" raise NotImplementedError @abstractmethod def __ceil__(self): """Finds the least Integral >= self.""" raise NotImplementedError @abstractmethod def __round__(self, ndigits=None): """Rounds self to ndigits decimal places, defaulting to 0. If ndigits is omitted or None, returns an Integral, otherwise returns a Real. Rounds half toward even. """ raise NotImplementedError def __divmod__(self, other): """divmod(self, other): The pair (self // other, self % other). Sometimes this can be computed faster than the pair of operations. """ return (self // other, self % other) def __rdivmod__(self, other): """divmod(other, self): The pair (self // other, self % other). Sometimes this can be computed faster than the pair of operations. """ return (other // self, other % self) @abstractmethod def __floordiv__(self, other): """self // other: The floor() of self/other.""" raise NotImplementedError @abstractmethod def __rfloordiv__(self, other): """other // self: The floor() of other/self.""" raise NotImplementedError @abstractmethod def __mod__(self, other): """self % other""" raise NotImplementedError @abstractmethod def __rmod__(self, other): """other % self""" raise NotImplementedError @abstractmethod def __lt__(self, other): """self < other < on Reals defines a total ordering, except perhaps for NaN.""" raise NotImplementedError @abstractmethod def __le__(self, other): """self <= other""" raise NotImplementedError # Concrete implementations of Complex abstract methods. def __complex__(self): """complex(self) == complex(float(self), 0)""" return complex(float(self)) @property def real(self): """Real numbers are their real component.""" return +self @property def imag(self): """Real numbers have no imaginary component.""" return 0 def conjugate(self): """Conjugate is a no-op for Reals.""" return +self Real.register(float) class Rational(Real): """.numerator and .denominator should be in lowest terms.""" __slots__ = () @property @abstractmethod def numerator(self): raise NotImplementedError @property @abstractmethod def denominator(self): raise NotImplementedError # Concrete implementation of Real's conversion to float. def __float__(self): """float(self) = self.numerator / self.denominator It's important that this conversion use the integer's "true" division rather than casting one side to float before dividing so that ratios of huge integers convert without overflowing. """ return int(self.numerator) / int(self.denominator) class Integral(Rational): """Integral adds methods that work on integral numbers. In short, these are conversion to int, pow with modulus, and the bit-string operations. """ __slots__ = () @abstractmethod def __int__(self): """int(self)""" raise NotImplementedError def __index__(self): """Called whenever an index is needed, such as in slicing""" return int(self) @abstractmethod def __pow__(self, exponent, modulus=None): """self ** exponent % modulus, but maybe faster. Accept the modulus argument if you want to support the 3-argument version of pow(). Raise a TypeError if exponent < 0 or any argument isn't Integral. Otherwise, just implement the 2-argument version described in Complex. """ raise NotImplementedError @abstractmethod def __lshift__(self, other): """self << other""" raise NotImplementedError @abstractmethod def __rlshift__(self, other): """other << self""" raise NotImplementedError @abstractmethod def __rshift__(self, other): """self >> other""" raise NotImplementedError @abstractmethod def __rrshift__(self, other): """other >> self""" raise NotImplementedError @abstractmethod def __and__(self, other): """self & other""" raise NotImplementedError @abstractmethod def __rand__(self, other): """other & self""" raise NotImplementedError @abstractmethod def __xor__(self, other): """self ^ other""" raise NotImplementedError @abstractmethod def __rxor__(self, other): """other ^ self""" raise NotImplementedError @abstractmethod def __or__(self, other): """self | other""" raise NotImplementedError @abstractmethod def __ror__(self, other): """other | self""" raise NotImplementedError @abstractmethod def __invert__(self): """~self""" raise NotImplementedError # Concrete implementations of Rational and Real abstract methods. def __float__(self): """float(self) == float(int(self))""" return float(int(self)) @property def numerator(self): """Integers are their own numerators.""" return +self @property def denominator(self): """Integers have a denominator of 1.""" return 1 Integral.register(int)
Save