code
stringlengths
66
870k
docstring
stringlengths
19
26.7k
func_name
stringlengths
1
138
language
stringclasses
1 value
repo
stringlengths
7
68
path
stringlengths
5
324
url
stringlengths
46
389
license
stringclasses
7 values
def deepcopy(x, memo=None, _nil=[]): """Deep copy operation on arbitrary Python objects. See the module's __doc__ string for more info. """ if memo is None: memo = {} d = id(x) y = memo.get(d, _nil) if y is not _nil: return y cls = type(x) copier = _deepcopy_disp...
Deep copy operation on arbitrary Python objects. See the module's __doc__ string for more info.
deepcopy
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/copy.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/copy.py
MIT
def _keep_alive(x, memo): """Keeps a reference to the object x in the memo. Because we remember objects by their id, we have to assure that possibly temporary objects are kept alive by referencing them. We store a reference at the id of the memo, which should normally not be used unless someone...
Keeps a reference to the object x in the memo. Because we remember objects by their id, we have to assure that possibly temporary objects are kept alive by referencing them. We store a reference at the id of the memo, which should normally not be used unless someone tries to deepcopy the memo i...
_keep_alive
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/copy.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/copy.py
MIT
def _slotnames(cls): """Return a list of slot names for a given class. This needs to find slots defined by the class and its bases, so we can't simply return the __slots__ attribute. We must walk down the Method Resolution Order and concatenate the __slots__ of each class found there. (This assum...
Return a list of slot names for a given class. This needs to find slots defined by the class and its bases, so we can't simply return the __slots__ attribute. We must walk down the Method Resolution Order and concatenate the __slots__ of each class found there. (This assumes classes don't modify thei...
_slotnames
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/copy_reg.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/copy_reg.py
MIT
def remove_extension(module, name, code): """Unregister an extension code. For testing only.""" key = (module, name) if (_extension_registry.get(key) != code or _inverted_registry.get(code) != key): raise ValueError("key %s is not registered with code %s" % (key, co...
Unregister an extension code. For testing only.
remove_extension
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/copy_reg.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/copy_reg.py
MIT
def run(statement, filename=None, sort=-1): """Run statement under profiler optionally saving results in filename This function takes a single argument that can be passed to the "exec" statement, and an optional file name. In all cases this routine attempts to "exec" its first argument and gather prof...
Run statement under profiler optionally saving results in filename This function takes a single argument that can be passed to the "exec" statement, and an optional file name. In all cases this routine attempts to "exec" its first argument and gather profiling statistics from the execution. If no file...
run
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/cProfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/cProfile.py
MIT
def runctx(statement, globals, locals, filename=None, sort=-1): """Run statement under profiler, supplying your own globals and locals, optionally saving results in filename. statement and filename have the same semantics as profile.run """ prof = Profile() result = None try: try: ...
Run statement under profiler, supplying your own globals and locals, optionally saving results in filename. statement and filename have the same semantics as profile.run
runctx
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/cProfile.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/cProfile.py
MIT
def sniff(self, sample, delimiters=None): """ Returns a dialect (or None) corresponding to the sample """ quotechar, doublequote, delimiter, skipinitialspace = \ self._guess_quote_and_delimiter(sample, delimiters) if not delimiter: delimiter, skipi...
Returns a dialect (or None) corresponding to the sample
sniff
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/csv.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/csv.py
MIT
def setcontext(context): """Set this thread's context to context.""" if context in (DefaultContext, BasicContext, ExtendedContext): context = context.copy() context.clear_flags() threading.currentThread().__decimal_context__ = context
Set this thread's context to context.
setcontext
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def getcontext(): """Returns this thread's context. If this thread does not yet have a context, returns a new context and sets this thread's context. New contexts are copies of DefaultContext. """ try: return threading.currentThread().__decimal_context__ ...
Returns this thread's context. If this thread does not yet have a context, returns a new context and sets this thread's context. New contexts are copies of DefaultContext.
getcontext
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def getcontext(_local=local): """Returns this thread's context. If this thread does not yet have a context, returns a new context and sets this thread's context. New contexts are copies of DefaultContext. """ try: return _local.__decimal_context__ exc...
Returns this thread's context. If this thread does not yet have a context, returns a new context and sets this thread's context. New contexts are copies of DefaultContext.
getcontext
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def setcontext(context, _local=local): """Set this thread's context to context.""" if context in (DefaultContext, BasicContext, ExtendedContext): context = context.copy() context.clear_flags() _local.__decimal_context__ = context
Set this thread's context to context.
setcontext
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def __new__(cls, value="0", context=None): """Create a decimal point instance. >>> Decimal('3.14') # string input Decimal('3.14') >>> Decimal((0, (3, 1, 4), -2)) # tuple (sign, digit_tuple, exponent) Decimal('3.14') >>> Decimal(314) # int or...
Create a decimal point instance. >>> Decimal('3.14') # string input Decimal('3.14') >>> Decimal((0, (3, 1, 4), -2)) # tuple (sign, digit_tuple, exponent) Decimal('3.14') >>> Decimal(314) # int or long Decimal('314') >>> Decimal(Decim...
__new__
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def from_float(cls, f): """Converts a float to a decimal number, exactly. Note that Decimal.from_float(0.1) is not the same as Decimal('0.1'). Since 0.1 is not exactly representable in binary floating point, the value is stored as the nearest representable value which is 0x1.999...
Converts a float to a decimal number, exactly. Note that Decimal.from_float(0.1) is not the same as Decimal('0.1'). Since 0.1 is not exactly representable in binary floating point, the value is stored as the nearest representable value which is 0x1.999999999999ap-4. The exact equivalen...
from_float
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def _isnan(self): """Returns whether the number is not actually one. 0 if a number 1 if NaN 2 if sNaN """ if self._is_special: exp = self._exp if exp == 'n': return 1 elif exp == 'N': return 2 re...
Returns whether the number is not actually one. 0 if a number 1 if NaN 2 if sNaN
_isnan
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def _isinfinity(self): """Returns whether the number is infinite 0 if finite or not a number 1 if +INF -1 if -INF """ if self._exp == 'F': if self._sign: return -1 return 1 return 0
Returns whether the number is infinite 0 if finite or not a number 1 if +INF -1 if -INF
_isinfinity
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def _check_nans(self, other=None, context=None): """Returns whether the number is not actually one. if self, other are sNaN, signal if self, other are NaN return nan return 0 Done before operations. """ self_is_nan = self._isnan() if other is None: ...
Returns whether the number is not actually one. if self, other are sNaN, signal if self, other are NaN return nan return 0 Done before operations.
_check_nans
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def _compare_check_nans(self, other, context): """Version of _check_nans used for the signaling comparisons compare_signal, __le__, __lt__, __ge__, __gt__. Signal InvalidOperation if either self or other is a (quiet or signaling) NaN. Signaling NaNs take precedence over quiet N...
Version of _check_nans used for the signaling comparisons compare_signal, __le__, __lt__, __ge__, __gt__. Signal InvalidOperation if either self or other is a (quiet or signaling) NaN. Signaling NaNs take precedence over quiet NaNs. Return 0 if neither operand is a NaN. ...
_compare_check_nans
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def _cmp(self, other): """Compare the two non-NaN decimal instances self and other. Returns -1 if self < other, 0 if self == other and 1 if self > other. This routine is for internal use only.""" if self._is_special or other._is_special: self_inf = self._isinfinity() ...
Compare the two non-NaN decimal instances self and other. Returns -1 if self < other, 0 if self == other and 1 if self > other. This routine is for internal use only.
_cmp
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def compare(self, other, context=None): """Compares one to another. -1 => a < b 0 => a = b 1 => a > b NaN => one is NaN Like __cmp__, but returns Decimal instances. """ other = _convert_other(other, raiseit=True) # Compare(NaN, NaN) = NaN ...
Compares one to another. -1 => a < b 0 => a = b 1 => a > b NaN => one is NaN Like __cmp__, but returns Decimal instances.
compare
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def __repr__(self): """Represents the number as an instance of Decimal.""" # Invariant: eval(repr(d)) == d return "Decimal('%s')" % str(self)
Represents the number as an instance of Decimal.
__repr__
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def __str__(self, eng=False, context=None): """Return string representation of the number in scientific notation. Captures all of the information in the underlying representation. """ sign = ['', '-'][self._sign] if self._is_special: if self._exp == 'F': ...
Return string representation of the number in scientific notation. Captures all of the information in the underlying representation.
__str__
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def __neg__(self, context=None): """Returns a copy with the sign switched. Rounds, if it has reason. """ if self._is_special: ans = self._check_nans(context=context) if ans: return ans if context is None: context = getcontext(...
Returns a copy with the sign switched. Rounds, if it has reason.
__neg__
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def __pos__(self, context=None): """Returns a copy, unless it is a sNaN. Rounds the number (if more than precision digits) """ if self._is_special: ans = self._check_nans(context=context) if ans: return ans if context is None: ...
Returns a copy, unless it is a sNaN. Rounds the number (if more than precision digits)
__pos__
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def __abs__(self, round=True, context=None): """Returns the absolute value of self. If the keyword argument 'round' is false, do not round. The expression self.__abs__(round=False) is equivalent to self.copy_abs(). """ if not round: return self.copy_abs() ...
Returns the absolute value of self. If the keyword argument 'round' is false, do not round. The expression self.__abs__(round=False) is equivalent to self.copy_abs().
__abs__
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def __add__(self, other, context=None): """Returns self + other. -INF + INF (or the reverse) cause InvalidOperation errors. """ other = _convert_other(other) if other is NotImplemented: return other if context is None: context = getcontext() ...
Returns self + other. -INF + INF (or the reverse) cause InvalidOperation errors.
__add__
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def __mul__(self, other, context=None): """Return self * other. (+-) INF * 0 (or its reverse) raise InvalidOperation. """ other = _convert_other(other) if other is NotImplemented: return other if context is None: context = getcontext() r...
Return self * other. (+-) INF * 0 (or its reverse) raise InvalidOperation.
__mul__
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def _divide(self, other, context): """Return (self // other, self % other), to context.prec precision. Assumes that neither self nor other is a NaN, that self is not infinite and that other is nonzero. """ sign = self._sign ^ other._sign if other._isinfinity(): ...
Return (self // other, self % other), to context.prec precision. Assumes that neither self nor other is a NaN, that self is not infinite and that other is nonzero.
_divide
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def remainder_near(self, other, context=None): """ Remainder nearest to 0- abs(remainder-near) <= other/2 """ if context is None: context = getcontext() other = _convert_other(other, raiseit=True) ans = self._check_nans(other, context) if ans: ...
Remainder nearest to 0- abs(remainder-near) <= other/2
remainder_near
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def __int__(self): """Converts self to an int, truncating if necessary.""" if self._is_special: if self._isnan(): raise ValueError("Cannot convert NaN to integer") elif self._isinfinity(): raise OverflowError("Cannot convert infinity to integer") ...
Converts self to an int, truncating if necessary.
__int__
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def _fix_nan(self, context): """Decapitate the payload of a NaN to fit the context""" payload = self._int # maximum length of payload is precision if _clamp=0, # precision-1 if _clamp=1. max_payload_len = context.prec - context._clamp if len(payload) > max_payload_len: ...
Decapitate the payload of a NaN to fit the context
_fix_nan
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def _fix(self, context): """Round if it is necessary to keep self within prec precision. Rounds and fixes the exponent. Does not raise on a sNaN. Arguments: self - Decimal instance context - context used. """ if self._is_special: if self._isnan(): ...
Round if it is necessary to keep self within prec precision. Rounds and fixes the exponent. Does not raise on a sNaN. Arguments: self - Decimal instance context - context used.
_fix
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def _round_down(self, prec): """Also known as round-towards-0, truncate.""" if _all_zeros(self._int, prec): return 0 else: return -1
Also known as round-towards-0, truncate.
_round_down
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def _round_half_even(self, prec): """Round 5 to even, rest to nearest.""" if _exact_half(self._int, prec) and \ (prec == 0 or self._int[prec-1] in '02468'): return -1 else: return self._round_half_up(prec)
Round 5 to even, rest to nearest.
_round_half_even
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def _round_ceiling(self, prec): """Rounds up (not away from 0 if negative.)""" if self._sign: return self._round_down(prec) else: return -self._round_down(prec)
Rounds up (not away from 0 if negative.)
_round_ceiling
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def _round_floor(self, prec): """Rounds down (not towards 0 if negative)""" if not self._sign: return self._round_down(prec) else: return -self._round_down(prec)
Rounds down (not towards 0 if negative)
_round_floor
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def _round_05up(self, prec): """Round down unless digit prec-1 is 0 or 5.""" if prec and self._int[prec-1] not in '05': return self._round_down(prec) else: return -self._round_down(prec)
Round down unless digit prec-1 is 0 or 5.
_round_05up
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def fma(self, other, third, context=None): """Fused multiply-add. Returns self*other+third with no rounding of the intermediate product self*other. self and other are multiplied together, with no rounding of the result. The third operand is then added to the result, an...
Fused multiply-add. Returns self*other+third with no rounding of the intermediate product self*other. self and other are multiplied together, with no rounding of the result. The third operand is then added to the result, and a single final rounding is performed.
fma
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def _power_exact(self, other, p): """Attempt to compute self**other exactly. Given Decimals self and other and an integer p, attempt to compute an exact result for the power self**other, with p digits of precision. Return None if self**other is not exactly representable in p di...
Attempt to compute self**other exactly. Given Decimals self and other and an integer p, attempt to compute an exact result for the power self**other, with p digits of precision. Return None if self**other is not exactly representable in p digits. Assumes that elimination of sp...
_power_exact
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def __pow__(self, other, modulo=None, context=None): """Return self ** other [ % modulo]. With two arguments, compute self**other. With three arguments, compute (self**other) % modulo. For the three argument form, the following restrictions on the arguments hold: - a...
Return self ** other [ % modulo]. With two arguments, compute self**other. With three arguments, compute (self**other) % modulo. For the three argument form, the following restrictions on the arguments hold: - all three arguments must be integral - other must be non...
__pow__
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def normalize(self, context=None): """Normalize- strip trailing 0s, change anything equal to 0 to 0e0""" if context is None: context = getcontext() if self._is_special: ans = self._check_nans(context=context) if ans: return ans dup =...
Normalize- strip trailing 0s, change anything equal to 0 to 0e0
normalize
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def quantize(self, exp, rounding=None, context=None, watchexp=True): """Quantize self so its exponent is the same as that of exp. Similar to self._rescale(exp._exp) but with error checking. """ exp = _convert_other(exp, raiseit=True) if context is None: context = ge...
Quantize self so its exponent is the same as that of exp. Similar to self._rescale(exp._exp) but with error checking.
quantize
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def same_quantum(self, other): """Return True if self and other have the same exponent; otherwise return False. If either operand is a special value, the following rules are used: * return True if both operands are infinities * return True if both operands are NaNs ...
Return True if self and other have the same exponent; otherwise return False. If either operand is a special value, the following rules are used: * return True if both operands are infinities * return True if both operands are NaNs * otherwise, return False.
same_quantum
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def _rescale(self, exp, rounding): """Rescale self so that the exponent is exp, either by padding with zeros or by truncating digits, using the given rounding mode. Specials are returned without change. This operation is quiet: it raises no flags, and uses no information from the ...
Rescale self so that the exponent is exp, either by padding with zeros or by truncating digits, using the given rounding mode. Specials are returned without change. This operation is quiet: it raises no flags, and uses no information from the context. exp = exp to scale to (an...
_rescale
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def _round(self, places, rounding): """Round a nonzero, nonspecial Decimal to a fixed number of significant figures, using the given rounding mode. Infinities, NaNs and zeros are returned unaltered. This operation is quiet: it raises no flags, and uses no information from the c...
Round a nonzero, nonspecial Decimal to a fixed number of significant figures, using the given rounding mode. Infinities, NaNs and zeros are returned unaltered. This operation is quiet: it raises no flags, and uses no information from the context.
_round
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def to_integral_exact(self, rounding=None, context=None): """Rounds to a nearby integer. If no rounding mode is specified, take the rounding mode from the context. This method raises the Rounded and Inexact flags when appropriate. See also: to_integral_value, which does exactl...
Rounds to a nearby integer. If no rounding mode is specified, take the rounding mode from the context. This method raises the Rounded and Inexact flags when appropriate. See also: to_integral_value, which does exactly the same as this method except that it doesn't raise Inexac...
to_integral_exact
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def to_integral_value(self, rounding=None, context=None): """Rounds to the nearest integer, without raising inexact, rounded.""" if context is None: context = getcontext() if rounding is None: rounding = context.rounding if self._is_special: ans = self...
Rounds to the nearest integer, without raising inexact, rounded.
to_integral_value
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def sqrt(self, context=None): """Return the square root of self.""" if context is None: context = getcontext() if self._is_special: ans = self._check_nans(context=context) if ans: return ans if self._isinfinity() and self._sign ==...
Return the square root of self.
sqrt
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def max(self, other, context=None): """Returns the larger value. Like max(self, other) except if one is not a number, returns NaN (and signals if one is sNaN). Also rounds. """ other = _convert_other(other, raiseit=True) if context is None: context = getcon...
Returns the larger value. Like max(self, other) except if one is not a number, returns NaN (and signals if one is sNaN). Also rounds.
max
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def min(self, other, context=None): """Returns the smaller value. Like min(self, other) except if one is not a number, returns NaN (and signals if one is sNaN). Also rounds. """ other = _convert_other(other, raiseit=True) if context is None: context = getco...
Returns the smaller value. Like min(self, other) except if one is not a number, returns NaN (and signals if one is sNaN). Also rounds.
min
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def _isinteger(self): """Returns whether self is an integer""" if self._is_special: return False if self._exp >= 0: return True rest = self._int[self._exp:] return rest == '0'*len(rest)
Returns whether self is an integer
_isinteger
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def _iseven(self): """Returns True if self is even. Assumes self is an integer.""" if not self or self._exp > 0: return True return self._int[-1+self._exp] in '02468'
Returns True if self is even. Assumes self is an integer.
_iseven
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def adjusted(self): """Return the adjusted exponent of self""" try: return self._exp + len(self._int) - 1 # If NaN or Infinity, self._exp is string except TypeError: return 0
Return the adjusted exponent of self
adjusted
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def compare_signal(self, other, context=None): """Compares self to the other operand numerically. It's pretty much like compare(), but all NaNs signal, with signaling NaNs taking precedence over quiet NaNs. """ other = _convert_other(other, raiseit = True) ans = self._co...
Compares self to the other operand numerically. It's pretty much like compare(), but all NaNs signal, with signaling NaNs taking precedence over quiet NaNs.
compare_signal
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def compare_total(self, other): """Compares self to other using the abstract representations. This is not like the standard compare, which use their numerical value. Note that a total ordering is defined for all possible abstract representations. """ other = _convert_oth...
Compares self to other using the abstract representations. This is not like the standard compare, which use their numerical value. Note that a total ordering is defined for all possible abstract representations.
compare_total
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def compare_total_mag(self, other): """Compares self to other using abstract repr., ignoring sign. Like compare_total, but with operand's sign ignored and assumed to be 0. """ other = _convert_other(other, raiseit=True) s = self.copy_abs() o = other.copy_abs() r...
Compares self to other using abstract repr., ignoring sign. Like compare_total, but with operand's sign ignored and assumed to be 0.
compare_total_mag
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def copy_negate(self): """Returns a copy with the sign inverted.""" if self._sign: return _dec_from_triple(0, self._int, self._exp, self._is_special) else: return _dec_from_triple(1, self._int, self._exp, self._is_special)
Returns a copy with the sign inverted.
copy_negate
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def copy_sign(self, other): """Returns self with the sign of other.""" other = _convert_other(other, raiseit=True) return _dec_from_triple(other._sign, self._int, self._exp, self._is_special)
Returns self with the sign of other.
copy_sign
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def is_normal(self, context=None): """Return True if self is a normal number; otherwise return False.""" if self._is_special or not self: return False if context is None: context = getcontext() return context.Emin <= self.adjusted()
Return True if self is a normal number; otherwise return False.
is_normal
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def is_subnormal(self, context=None): """Return True if self is subnormal; otherwise return False.""" if self._is_special or not self: return False if context is None: context = getcontext() return self.adjusted() < context.Emin
Return True if self is subnormal; otherwise return False.
is_subnormal
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def _ln_exp_bound(self): """Compute a lower bound for the adjusted exponent of self.ln(). In other words, compute r such that self.ln() >= 10**r. Assumes that self is finite and positive and that self != 1. """ # for 0.1 <= x <= 10 we use the inequalities 1-1/x <= ln(x) <= x-1 ...
Compute a lower bound for the adjusted exponent of self.ln(). In other words, compute r such that self.ln() >= 10**r. Assumes that self is finite and positive and that self != 1.
_ln_exp_bound
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def ln(self, context=None): """Returns the natural (base e) logarithm of self.""" if context is None: context = getcontext() # ln(NaN) = NaN ans = self._check_nans(context=context) if ans: return ans # ln(0.0) == -Infinity if not self: ...
Returns the natural (base e) logarithm of self.
ln
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def _log10_exp_bound(self): """Compute a lower bound for the adjusted exponent of self.log10(). In other words, find r such that self.log10() >= 10**r. Assumes that self is finite and positive and that self != 1. """ # For x >= 10 or x < 0.1 we only need a bound on the integer ...
Compute a lower bound for the adjusted exponent of self.log10(). In other words, find r such that self.log10() >= 10**r. Assumes that self is finite and positive and that self != 1.
_log10_exp_bound
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def log10(self, context=None): """Returns the base 10 logarithm of self.""" if context is None: context = getcontext() # log10(NaN) = NaN ans = self._check_nans(context=context) if ans: return ans # log10(0.0) == -Infinity if not self: ...
Returns the base 10 logarithm of self.
log10
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def _islogical(self): """Return True if self is a logical operand. For being logical, it must be a finite number with a sign of 0, an exponent of 0, and a coefficient whose digits must all be either 0 or 1. """ if self._sign != 0 or self._exp != 0: return Fal...
Return True if self is a logical operand. For being logical, it must be a finite number with a sign of 0, an exponent of 0, and a coefficient whose digits must all be either 0 or 1.
_islogical
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def logical_and(self, other, context=None): """Applies an 'and' operation between self and other's digits.""" if context is None: context = getcontext() other = _convert_other(other, raiseit=True) if not self._islogical() or not other._islogical(): return contex...
Applies an 'and' operation between self and other's digits.
logical_and
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def logical_or(self, other, context=None): """Applies an 'or' operation between self and other's digits.""" if context is None: context = getcontext() other = _convert_other(other, raiseit=True) if not self._islogical() or not other._islogical(): return context....
Applies an 'or' operation between self and other's digits.
logical_or
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def logical_xor(self, other, context=None): """Applies an 'xor' operation between self and other's digits.""" if context is None: context = getcontext() other = _convert_other(other, raiseit=True) if not self._islogical() or not other._islogical(): return contex...
Applies an 'xor' operation between self and other's digits.
logical_xor
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def max_mag(self, other, context=None): """Compares the values numerically with their sign ignored.""" other = _convert_other(other, raiseit=True) if context is None: context = getcontext() if self._is_special or other._is_special: # If one operand is a quiet Na...
Compares the values numerically with their sign ignored.
max_mag
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def min_mag(self, other, context=None): """Compares the values numerically with their sign ignored.""" other = _convert_other(other, raiseit=True) if context is None: context = getcontext() if self._is_special or other._is_special: # If one operand is a quiet Na...
Compares the values numerically with their sign ignored.
min_mag
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def next_minus(self, context=None): """Returns the largest representable number smaller than itself.""" if context is None: context = getcontext() ans = self._check_nans(context=context) if ans: return ans if self._isinfinity() == -1: return ...
Returns the largest representable number smaller than itself.
next_minus
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def next_plus(self, context=None): """Returns the smallest representable number larger than itself.""" if context is None: context = getcontext() ans = self._check_nans(context=context) if ans: return ans if self._isinfinity() == 1: return _I...
Returns the smallest representable number larger than itself.
next_plus
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def next_toward(self, other, context=None): """Returns the number closest to self, in the direction towards other. The result is the closest representable number to self (excluding self) that is in the direction towards other, unless both have the same value. If the two operands are ...
Returns the number closest to self, in the direction towards other. The result is the closest representable number to self (excluding self) that is in the direction towards other, unless both have the same value. If the two operands are numerically equal, then the result is a copy of s...
next_toward
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def number_class(self, context=None): """Returns an indication of the class of self. The class is one of the following strings: sNaN NaN -Infinity -Normal -Subnormal -Zero +Zero +Subnormal +Normal +Infin...
Returns an indication of the class of self. The class is one of the following strings: sNaN NaN -Infinity -Normal -Subnormal -Zero +Zero +Subnormal +Normal +Infinity
number_class
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def rotate(self, other, context=None): """Returns a rotated copy of self, value-of-other times.""" if context is None: context = getcontext() other = _convert_other(other, raiseit=True) ans = self._check_nans(other, context) if ans: return ans i...
Returns a rotated copy of self, value-of-other times.
rotate
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def scaleb(self, other, context=None): """Returns self operand after adding the second value to its exp.""" if context is None: context = getcontext() other = _convert_other(other, raiseit=True) ans = self._check_nans(other, context) if ans: return ans ...
Returns self operand after adding the second value to its exp.
scaleb
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def shift(self, other, context=None): """Returns a shifted copy of self, value-of-other times.""" if context is None: context = getcontext() other = _convert_other(other, raiseit=True) ans = self._check_nans(other, context) if ans: return ans if...
Returns a shifted copy of self, value-of-other times.
shift
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def _dec_from_triple(sign, coefficient, exponent, special=False): """Create a decimal instance directly, without any validation, normalization (e.g. removal of leading zeros) or argument conversion. This function is for *internal use only*. """ self = object.__new__(Decimal) self._sign = s...
Create a decimal instance directly, without any validation, normalization (e.g. removal of leading zeros) or argument conversion. This function is for *internal use only*.
_dec_from_triple
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def _raise_error(self, condition, explanation = None, *args): """Handles an error If the flag is in _ignored_flags, returns the default response. Otherwise, it sets the flag, then, if the corresponding trap_enabler is set, it reraises the exception. Otherwise, it returns the de...
Handles an error If the flag is in _ignored_flags, returns the default response. Otherwise, it sets the flag, then, if the corresponding trap_enabler is set, it reraises the exception. Otherwise, it returns the default value after setting the flag.
_raise_error
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def _ignore_flags(self, *flags): """Ignore the flags, if they are raised""" # Do not mutate-- This way, copies of a context leave the original # alone. self._ignored_flags = (self._ignored_flags + list(flags)) return list(flags)
Ignore the flags, if they are raised
_ignore_flags
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def _regard_flags(self, *flags): """Stop ignoring the flags, if they are raised""" if flags and isinstance(flags[0], (tuple,list)): flags = flags[0] for flag in flags: self._ignored_flags.remove(flag)
Stop ignoring the flags, if they are raised
_regard_flags
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def _set_rounding(self, type): """Sets the rounding type. Sets the rounding type, and returns the current (previous) rounding type. Often used like: context = context.copy() # so you don't change the calling context # if an error occurs in the middle. rounding ...
Sets the rounding type. Sets the rounding type, and returns the current (previous) rounding type. Often used like: context = context.copy() # so you don't change the calling context # if an error occurs in the middle. rounding = context._set_rounding(ROUND_UP) ...
_set_rounding
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def create_decimal(self, num='0'): """Creates a new Decimal instance but using self as context. This method implements the to-number operation of the IBM Decimal specification.""" if isinstance(num, basestring) and num != num.strip(): return self._raise_error(ConversionSynt...
Creates a new Decimal instance but using self as context. This method implements the to-number operation of the IBM Decimal specification.
create_decimal
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def create_decimal_from_float(self, f): """Creates a new Decimal instance from a float but rounding using self as the context. >>> context = Context(prec=5, rounding=ROUND_DOWN) >>> context.create_decimal_from_float(3.1415926535897932) Decimal('3.1415') >>> context = Con...
Creates a new Decimal instance from a float but rounding using self as the context. >>> context = Context(prec=5, rounding=ROUND_DOWN) >>> context.create_decimal_from_float(3.1415926535897932) Decimal('3.1415') >>> context = Context(prec=5, traps=[Inexact]) >>> context.c...
create_decimal_from_float
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def add(self, a, b): """Return the sum of the two operands. >>> ExtendedContext.add(Decimal('12'), Decimal('7.00')) Decimal('19.00') >>> ExtendedContext.add(Decimal('1E+2'), Decimal('1.01E+4')) Decimal('1.02E+4') >>> ExtendedContext.add(1, Decimal(2)) Decimal('3'...
Return the sum of the two operands. >>> ExtendedContext.add(Decimal('12'), Decimal('7.00')) Decimal('19.00') >>> ExtendedContext.add(Decimal('1E+2'), Decimal('1.01E+4')) Decimal('1.02E+4') >>> ExtendedContext.add(1, Decimal(2)) Decimal('3') >>> ExtendedContext.ad...
add
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def compare(self, a, b): """Compares values numerically. If the signs of the operands differ, a value representing each operand ('-1' if the operand is less than zero, '0' if the operand is zero or negative zero, or '1' if the operand is greater than zero) is used in place of th...
Compares values numerically. If the signs of the operands differ, a value representing each operand ('-1' if the operand is less than zero, '0' if the operand is zero or negative zero, or '1' if the operand is greater than zero) is used in place of that operand for the comparison instea...
compare
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def compare_signal(self, a, b): """Compares the values of the two operands numerically. It's pretty much like compare(), but all NaNs signal, with signaling NaNs taking precedence over quiet NaNs. >>> c = ExtendedContext >>> c.compare_signal(Decimal('2.1'), Decimal('3')) ...
Compares the values of the two operands numerically. It's pretty much like compare(), but all NaNs signal, with signaling NaNs taking precedence over quiet NaNs. >>> c = ExtendedContext >>> c.compare_signal(Decimal('2.1'), Decimal('3')) Decimal('-1') >>> c.compare_signa...
compare_signal
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def divide(self, a, b): """Decimal division in a specified context. >>> ExtendedContext.divide(Decimal('1'), Decimal('3')) Decimal('0.333333333') >>> ExtendedContext.divide(Decimal('2'), Decimal('3')) Decimal('0.666666667') >>> ExtendedContext.divide(Decimal('5'), Decima...
Decimal division in a specified context. >>> ExtendedContext.divide(Decimal('1'), Decimal('3')) Decimal('0.333333333') >>> ExtendedContext.divide(Decimal('2'), Decimal('3')) Decimal('0.666666667') >>> ExtendedContext.divide(Decimal('5'), Decimal('2')) Decimal('2.5') ...
divide
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def divide_int(self, a, b): """Divides two numbers and returns the integer part of the result. >>> ExtendedContext.divide_int(Decimal('2'), Decimal('3')) Decimal('0') >>> ExtendedContext.divide_int(Decimal('10'), Decimal('3')) Decimal('3') >>> ExtendedContext.divide_int(...
Divides two numbers and returns the integer part of the result. >>> ExtendedContext.divide_int(Decimal('2'), Decimal('3')) Decimal('0') >>> ExtendedContext.divide_int(Decimal('10'), Decimal('3')) Decimal('3') >>> ExtendedContext.divide_int(Decimal('1'), Decimal('0.3')) D...
divide_int
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def divmod(self, a, b): """Return (a // b, a % b). >>> ExtendedContext.divmod(Decimal(8), Decimal(3)) (Decimal('2'), Decimal('2')) >>> ExtendedContext.divmod(Decimal(8), Decimal(4)) (Decimal('2'), Decimal('0')) >>> ExtendedContext.divmod(8, 4) (Decimal('2'), Deci...
Return (a // b, a % b). >>> ExtendedContext.divmod(Decimal(8), Decimal(3)) (Decimal('2'), Decimal('2')) >>> ExtendedContext.divmod(Decimal(8), Decimal(4)) (Decimal('2'), Decimal('0')) >>> ExtendedContext.divmod(8, 4) (Decimal('2'), Decimal('0')) >>> ExtendedConte...
divmod
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def fma(self, a, b, c): """Returns a multiplied by b, plus c. The first two operands are multiplied together, using multiply, the third operand is then added to the result of that multiplication, using add, all with only one final rounding. >>> ExtendedContext.fma(Decimal('3'),...
Returns a multiplied by b, plus c. The first two operands are multiplied together, using multiply, the third operand is then added to the result of that multiplication, using add, all with only one final rounding. >>> ExtendedContext.fma(Decimal('3'), Decimal('5'), Decimal('7')) ...
fma
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def logical_and(self, a, b): """Applies the logical operation 'and' between each operand's digits. The operands must be both logical numbers. >>> ExtendedContext.logical_and(Decimal('0'), Decimal('0')) Decimal('0') >>> ExtendedContext.logical_and(Decimal('0'), Decimal('1')) ...
Applies the logical operation 'and' between each operand's digits. The operands must be both logical numbers. >>> ExtendedContext.logical_and(Decimal('0'), Decimal('0')) Decimal('0') >>> ExtendedContext.logical_and(Decimal('0'), Decimal('1')) Decimal('0') >>> ExtendedCo...
logical_and
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def logical_or(self, a, b): """Applies the logical operation 'or' between each operand's digits. The operands must be both logical numbers. >>> ExtendedContext.logical_or(Decimal('0'), Decimal('0')) Decimal('0') >>> ExtendedContext.logical_or(Decimal('0'), Decimal('1')) ...
Applies the logical operation 'or' between each operand's digits. The operands must be both logical numbers. >>> ExtendedContext.logical_or(Decimal('0'), Decimal('0')) Decimal('0') >>> ExtendedContext.logical_or(Decimal('0'), Decimal('1')) Decimal('1') >>> ExtendedConte...
logical_or
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def logical_xor(self, a, b): """Applies the logical operation 'xor' between each operand's digits. The operands must be both logical numbers. >>> ExtendedContext.logical_xor(Decimal('0'), Decimal('0')) Decimal('0') >>> ExtendedContext.logical_xor(Decimal('0'), Decimal('1')) ...
Applies the logical operation 'xor' between each operand's digits. The operands must be both logical numbers. >>> ExtendedContext.logical_xor(Decimal('0'), Decimal('0')) Decimal('0') >>> ExtendedContext.logical_xor(Decimal('0'), Decimal('1')) Decimal('1') >>> ExtendedCo...
logical_xor
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def max(self, a, b): """max compares two values numerically and returns the maximum. If either operand is a NaN then the general rules apply. Otherwise, the operands are compared as though by the compare operation. If they are numerically equal then the left-hand operand is cho...
max compares two values numerically and returns the maximum. If either operand is a NaN then the general rules apply. Otherwise, the operands are compared as though by the compare operation. If they are numerically equal then the left-hand operand is chosen as the result. Otherwise th...
max
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def max_mag(self, a, b): """Compares the values numerically with their sign ignored. >>> ExtendedContext.max_mag(Decimal('7'), Decimal('NaN')) Decimal('7') >>> ExtendedContext.max_mag(Decimal('7'), Decimal('-10')) Decimal('-10') >>> ExtendedContext.max_mag(1, -2) ...
Compares the values numerically with their sign ignored. >>> ExtendedContext.max_mag(Decimal('7'), Decimal('NaN')) Decimal('7') >>> ExtendedContext.max_mag(Decimal('7'), Decimal('-10')) Decimal('-10') >>> ExtendedContext.max_mag(1, -2) Decimal('-2') >>> ExtendedC...
max_mag
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def min(self, a, b): """min compares two values numerically and returns the minimum. If either operand is a NaN then the general rules apply. Otherwise, the operands are compared as though by the compare operation. If they are numerically equal then the left-hand operand is cho...
min compares two values numerically and returns the minimum. If either operand is a NaN then the general rules apply. Otherwise, the operands are compared as though by the compare operation. If they are numerically equal then the left-hand operand is chosen as the result. Otherwise th...
min
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def min_mag(self, a, b): """Compares the values numerically with their sign ignored. >>> ExtendedContext.min_mag(Decimal('3'), Decimal('-2')) Decimal('-2') >>> ExtendedContext.min_mag(Decimal('-3'), Decimal('NaN')) Decimal('-3') >>> ExtendedContext.min_mag(1, -2) ...
Compares the values numerically with their sign ignored. >>> ExtendedContext.min_mag(Decimal('3'), Decimal('-2')) Decimal('-2') >>> ExtendedContext.min_mag(Decimal('-3'), Decimal('NaN')) Decimal('-3') >>> ExtendedContext.min_mag(1, -2) Decimal('1') >>> ExtendedCo...
min_mag
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def multiply(self, a, b): """multiply multiplies two operands. If either operand is a special value then the general rules apply. Otherwise, the operands are multiplied together ('long multiplication'), resulting in a number which may be as long as the sum of the lengths of the ...
multiply multiplies two operands. If either operand is a special value then the general rules apply. Otherwise, the operands are multiplied together ('long multiplication'), resulting in a number which may be as long as the sum of the lengths of the two operands. >>> ExtendedCo...
multiply
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def next_toward(self, a, b): """Returns the number closest to a, in direction towards b. The result is the closest representable number from the first operand (but not the first operand) that is in the direction towards the second operand, unless the operands have the same value...
Returns the number closest to a, in direction towards b. The result is the closest representable number from the first operand (but not the first operand) that is in the direction towards the second operand, unless the operands have the same value. >>> c = ExtendedContext.copy(...
next_toward
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT
def power(self, a, b, modulo=None): """Raises a to the power of b, to modulo if given. With two arguments, compute a**b. If a is negative then b must be integral. The result will be inexact unless b is integral and the result is finite and can be expressed exactly in 'precisio...
Raises a to the power of b, to modulo if given. With two arguments, compute a**b. If a is negative then b must be integral. The result will be inexact unless b is integral and the result is finite and can be expressed exactly in 'precision' digits. With three arguments, compu...
power
python
mchristopher/PokemonGo-DesktopMap
app/pywin/Lib/decimal.py
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/decimal.py
MIT