repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
listlengths
20
707
docstring
stringlengths
3
17.3k
docstring_tokens
listlengths
3
222
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
idx
int64
0
252k
mdickinson/bigfloat
bigfloat/core.py
greater
def greater(x, y): """ Return True if x > y and False otherwise. This function returns False whenever x and/or y is a NaN. """ x = BigFloat._implicit_convert(x) y = BigFloat._implicit_convert(y) return mpfr.mpfr_greater_p(x, y)
python
def greater(x, y): """ Return True if x > y and False otherwise. This function returns False whenever x and/or y is a NaN. """ x = BigFloat._implicit_convert(x) y = BigFloat._implicit_convert(y) return mpfr.mpfr_greater_p(x, y)
[ "def", "greater", "(", "x", ",", "y", ")", ":", "x", "=", "BigFloat", ".", "_implicit_convert", "(", "x", ")", "y", "=", "BigFloat", ".", "_implicit_convert", "(", "y", ")", "return", "mpfr", ".", "mpfr_greater_p", "(", "x", ",", "y", ")" ]
Return True if x > y and False otherwise. This function returns False whenever x and/or y is a NaN.
[ "Return", "True", "if", "x", ">", "y", "and", "False", "otherwise", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1436-L1445
train
63,800
mdickinson/bigfloat
bigfloat/core.py
greaterequal
def greaterequal(x, y): """ Return True if x >= y and False otherwise. This function returns False whenever x and/or y is a NaN. """ x = BigFloat._implicit_convert(x) y = BigFloat._implicit_convert(y) return mpfr.mpfr_greaterequal_p(x, y)
python
def greaterequal(x, y): """ Return True if x >= y and False otherwise. This function returns False whenever x and/or y is a NaN. """ x = BigFloat._implicit_convert(x) y = BigFloat._implicit_convert(y) return mpfr.mpfr_greaterequal_p(x, y)
[ "def", "greaterequal", "(", "x", ",", "y", ")", ":", "x", "=", "BigFloat", ".", "_implicit_convert", "(", "x", ")", "y", "=", "BigFloat", ".", "_implicit_convert", "(", "y", ")", "return", "mpfr", ".", "mpfr_greaterequal_p", "(", "x", ",", "y", ")" ]
Return True if x >= y and False otherwise. This function returns False whenever x and/or y is a NaN.
[ "Return", "True", "if", "x", ">", "=", "y", "and", "False", "otherwise", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1448-L1457
train
63,801
mdickinson/bigfloat
bigfloat/core.py
less
def less(x, y): """ Return True if x < y and False otherwise. This function returns False whenever x and/or y is a NaN. """ x = BigFloat._implicit_convert(x) y = BigFloat._implicit_convert(y) return mpfr.mpfr_less_p(x, y)
python
def less(x, y): """ Return True if x < y and False otherwise. This function returns False whenever x and/or y is a NaN. """ x = BigFloat._implicit_convert(x) y = BigFloat._implicit_convert(y) return mpfr.mpfr_less_p(x, y)
[ "def", "less", "(", "x", ",", "y", ")", ":", "x", "=", "BigFloat", ".", "_implicit_convert", "(", "x", ")", "y", "=", "BigFloat", ".", "_implicit_convert", "(", "y", ")", "return", "mpfr", ".", "mpfr_less_p", "(", "x", ",", "y", ")" ]
Return True if x < y and False otherwise. This function returns False whenever x and/or y is a NaN.
[ "Return", "True", "if", "x", "<", "y", "and", "False", "otherwise", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1460-L1469
train
63,802
mdickinson/bigfloat
bigfloat/core.py
lessequal
def lessequal(x, y): """ Return True if x <= y and False otherwise. This function returns False whenever x and/or y is a NaN. """ x = BigFloat._implicit_convert(x) y = BigFloat._implicit_convert(y) return mpfr.mpfr_lessequal_p(x, y)
python
def lessequal(x, y): """ Return True if x <= y and False otherwise. This function returns False whenever x and/or y is a NaN. """ x = BigFloat._implicit_convert(x) y = BigFloat._implicit_convert(y) return mpfr.mpfr_lessequal_p(x, y)
[ "def", "lessequal", "(", "x", ",", "y", ")", ":", "x", "=", "BigFloat", ".", "_implicit_convert", "(", "x", ")", "y", "=", "BigFloat", ".", "_implicit_convert", "(", "y", ")", "return", "mpfr", ".", "mpfr_lessequal_p", "(", "x", ",", "y", ")" ]
Return True if x <= y and False otherwise. This function returns False whenever x and/or y is a NaN.
[ "Return", "True", "if", "x", "<", "=", "y", "and", "False", "otherwise", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1472-L1481
train
63,803
mdickinson/bigfloat
bigfloat/core.py
equal
def equal(x, y): """ Return True if x == y and False otherwise. This function returns False whenever x and/or y is a NaN. """ x = BigFloat._implicit_convert(x) y = BigFloat._implicit_convert(y) return mpfr.mpfr_equal_p(x, y)
python
def equal(x, y): """ Return True if x == y and False otherwise. This function returns False whenever x and/or y is a NaN. """ x = BigFloat._implicit_convert(x) y = BigFloat._implicit_convert(y) return mpfr.mpfr_equal_p(x, y)
[ "def", "equal", "(", "x", ",", "y", ")", ":", "x", "=", "BigFloat", ".", "_implicit_convert", "(", "x", ")", "y", "=", "BigFloat", ".", "_implicit_convert", "(", "y", ")", "return", "mpfr", ".", "mpfr_equal_p", "(", "x", ",", "y", ")" ]
Return True if x == y and False otherwise. This function returns False whenever x and/or y is a NaN.
[ "Return", "True", "if", "x", "==", "y", "and", "False", "otherwise", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1484-L1493
train
63,804
mdickinson/bigfloat
bigfloat/core.py
notequal
def notequal(x, y): """ Return True if x != y and False otherwise. This function returns True whenever x and/or y is a NaN. """ x = BigFloat._implicit_convert(x) y = BigFloat._implicit_convert(y) return not mpfr.mpfr_equal_p(x, y)
python
def notequal(x, y): """ Return True if x != y and False otherwise. This function returns True whenever x and/or y is a NaN. """ x = BigFloat._implicit_convert(x) y = BigFloat._implicit_convert(y) return not mpfr.mpfr_equal_p(x, y)
[ "def", "notequal", "(", "x", ",", "y", ")", ":", "x", "=", "BigFloat", ".", "_implicit_convert", "(", "x", ")", "y", "=", "BigFloat", ".", "_implicit_convert", "(", "y", ")", "return", "not", "mpfr", ".", "mpfr_equal_p", "(", "x", ",", "y", ")" ]
Return True if x != y and False otherwise. This function returns True whenever x and/or y is a NaN.
[ "Return", "True", "if", "x", "!", "=", "y", "and", "False", "otherwise", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1496-L1505
train
63,805
mdickinson/bigfloat
bigfloat/core.py
unordered
def unordered(x, y): """ Return True if x or y is a NaN and False otherwise. """ x = BigFloat._implicit_convert(x) y = BigFloat._implicit_convert(y) return mpfr.mpfr_unordered_p(x, y)
python
def unordered(x, y): """ Return True if x or y is a NaN and False otherwise. """ x = BigFloat._implicit_convert(x) y = BigFloat._implicit_convert(y) return mpfr.mpfr_unordered_p(x, y)
[ "def", "unordered", "(", "x", ",", "y", ")", ":", "x", "=", "BigFloat", ".", "_implicit_convert", "(", "x", ")", "y", "=", "BigFloat", ".", "_implicit_convert", "(", "y", ")", "return", "mpfr", ".", "mpfr_unordered_p", "(", "x", ",", "y", ")" ]
Return True if x or y is a NaN and False otherwise.
[ "Return", "True", "if", "x", "or", "y", "is", "a", "NaN", "and", "False", "otherwise", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1520-L1527
train
63,806
mdickinson/bigfloat
bigfloat/core.py
log
def log(x, context=None): """ Return the natural logarithm of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_log, (BigFloat._implicit_convert(x),), context, )
python
def log(x, context=None): """ Return the natural logarithm of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_log, (BigFloat._implicit_convert(x),), context, )
[ "def", "log", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_log", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",", ")...
Return the natural logarithm of x.
[ "Return", "the", "natural", "logarithm", "of", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1534-L1544
train
63,807
mdickinson/bigfloat
bigfloat/core.py
log2
def log2(x, context=None): """ Return the base-two logarithm of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_log2, (BigFloat._implicit_convert(x),), context, )
python
def log2(x, context=None): """ Return the base-two logarithm of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_log2, (BigFloat._implicit_convert(x),), context, )
[ "def", "log2", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_log2", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",", ...
Return the base-two logarithm of x.
[ "Return", "the", "base", "-", "two", "logarithm", "of", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1547-L1557
train
63,808
mdickinson/bigfloat
bigfloat/core.py
log10
def log10(x, context=None): """ Return the base-ten logarithm of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_log10, (BigFloat._implicit_convert(x),), context, )
python
def log10(x, context=None): """ Return the base-ten logarithm of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_log10, (BigFloat._implicit_convert(x),), context, )
[ "def", "log10", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_log10", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",", ...
Return the base-ten logarithm of x.
[ "Return", "the", "base", "-", "ten", "logarithm", "of", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1560-L1570
train
63,809
mdickinson/bigfloat
bigfloat/core.py
exp
def exp(x, context=None): """ Return the exponential of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_exp, (BigFloat._implicit_convert(x),), context, )
python
def exp(x, context=None): """ Return the exponential of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_exp, (BigFloat._implicit_convert(x),), context, )
[ "def", "exp", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_exp", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",", ")...
Return the exponential of x.
[ "Return", "the", "exponential", "of", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1573-L1583
train
63,810
mdickinson/bigfloat
bigfloat/core.py
exp2
def exp2(x, context=None): """ Return two raised to the power x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_exp2, (BigFloat._implicit_convert(x),), context, )
python
def exp2(x, context=None): """ Return two raised to the power x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_exp2, (BigFloat._implicit_convert(x),), context, )
[ "def", "exp2", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_exp2", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",", ...
Return two raised to the power x.
[ "Return", "two", "raised", "to", "the", "power", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1586-L1596
train
63,811
mdickinson/bigfloat
bigfloat/core.py
exp10
def exp10(x, context=None): """ Return ten raised to the power x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_exp10, (BigFloat._implicit_convert(x),), context, )
python
def exp10(x, context=None): """ Return ten raised to the power x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_exp10, (BigFloat._implicit_convert(x),), context, )
[ "def", "exp10", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_exp10", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",", ...
Return ten raised to the power x.
[ "Return", "ten", "raised", "to", "the", "power", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1599-L1609
train
63,812
mdickinson/bigfloat
bigfloat/core.py
cos
def cos(x, context=None): """ Return the cosine of ``x``. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_cos, (BigFloat._implicit_convert(x),), context, )
python
def cos(x, context=None): """ Return the cosine of ``x``. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_cos, (BigFloat._implicit_convert(x),), context, )
[ "def", "cos", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_cos", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",", ")...
Return the cosine of ``x``.
[ "Return", "the", "cosine", "of", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1612-L1622
train
63,813
mdickinson/bigfloat
bigfloat/core.py
sin
def sin(x, context=None): """ Return the sine of ``x``. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_sin, (BigFloat._implicit_convert(x),), context, )
python
def sin(x, context=None): """ Return the sine of ``x``. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_sin, (BigFloat._implicit_convert(x),), context, )
[ "def", "sin", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_sin", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",", ")...
Return the sine of ``x``.
[ "Return", "the", "sine", "of", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1625-L1635
train
63,814
mdickinson/bigfloat
bigfloat/core.py
tan
def tan(x, context=None): """ Return the tangent of ``x``. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_tan, (BigFloat._implicit_convert(x),), context, )
python
def tan(x, context=None): """ Return the tangent of ``x``. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_tan, (BigFloat._implicit_convert(x),), context, )
[ "def", "tan", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_tan", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",", ")...
Return the tangent of ``x``.
[ "Return", "the", "tangent", "of", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1638-L1648
train
63,815
mdickinson/bigfloat
bigfloat/core.py
sec
def sec(x, context=None): """ Return the secant of ``x``. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_sec, (BigFloat._implicit_convert(x),), context, )
python
def sec(x, context=None): """ Return the secant of ``x``. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_sec, (BigFloat._implicit_convert(x),), context, )
[ "def", "sec", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_sec", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",", ")...
Return the secant of ``x``.
[ "Return", "the", "secant", "of", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1651-L1661
train
63,816
mdickinson/bigfloat
bigfloat/core.py
csc
def csc(x, context=None): """ Return the cosecant of ``x``. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_csc, (BigFloat._implicit_convert(x),), context, )
python
def csc(x, context=None): """ Return the cosecant of ``x``. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_csc, (BigFloat._implicit_convert(x),), context, )
[ "def", "csc", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_csc", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",", ")...
Return the cosecant of ``x``.
[ "Return", "the", "cosecant", "of", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1664-L1674
train
63,817
mdickinson/bigfloat
bigfloat/core.py
cot
def cot(x, context=None): """ Return the cotangent of ``x``. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_cot, (BigFloat._implicit_convert(x),), context, )
python
def cot(x, context=None): """ Return the cotangent of ``x``. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_cot, (BigFloat._implicit_convert(x),), context, )
[ "def", "cot", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_cot", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",", ")...
Return the cotangent of ``x``.
[ "Return", "the", "cotangent", "of", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1677-L1687
train
63,818
mdickinson/bigfloat
bigfloat/core.py
acos
def acos(x, context=None): """ Return the inverse cosine of ``x``. The mathematically exact result lies in the range [0, π]. However, note that as a result of rounding to the current context, it's possible for the actual value returned to be fractionally larger than π:: >>> from bigfloat ...
python
def acos(x, context=None): """ Return the inverse cosine of ``x``. The mathematically exact result lies in the range [0, π]. However, note that as a result of rounding to the current context, it's possible for the actual value returned to be fractionally larger than π:: >>> from bigfloat ...
[ "def", "acos", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_acos", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",", ...
Return the inverse cosine of ``x``. The mathematically exact result lies in the range [0, π]. However, note that as a result of rounding to the current context, it's possible for the actual value returned to be fractionally larger than π:: >>> from bigfloat import precision >>> with preci...
[ "Return", "the", "inverse", "cosine", "of", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1690-L1713
train
63,819
mdickinson/bigfloat
bigfloat/core.py
asin
def asin(x, context=None): """ Return the inverse sine of ``x``. The mathematically exact result lies in the range [-π/2, π/2]. However, note that as a result of rounding to the current context, it's possible for the actual value to lie just outside this range. """ return _apply_function_...
python
def asin(x, context=None): """ Return the inverse sine of ``x``. The mathematically exact result lies in the range [-π/2, π/2]. However, note that as a result of rounding to the current context, it's possible for the actual value to lie just outside this range. """ return _apply_function_...
[ "def", "asin", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_asin", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",", ...
Return the inverse sine of ``x``. The mathematically exact result lies in the range [-π/2, π/2]. However, note that as a result of rounding to the current context, it's possible for the actual value to lie just outside this range.
[ "Return", "the", "inverse", "sine", "of", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1716-L1730
train
63,820
mdickinson/bigfloat
bigfloat/core.py
atan
def atan(x, context=None): """ Return the inverse tangent of ``x``. The mathematically exact result lies in the range [-π/2, π/2]. However, note that as a result of rounding to the current context, it's possible for the actual value to lie just outside this range. """ return _apply_functi...
python
def atan(x, context=None): """ Return the inverse tangent of ``x``. The mathematically exact result lies in the range [-π/2, π/2]. However, note that as a result of rounding to the current context, it's possible for the actual value to lie just outside this range. """ return _apply_functi...
[ "def", "atan", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_atan", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",", ...
Return the inverse tangent of ``x``. The mathematically exact result lies in the range [-π/2, π/2]. However, note that as a result of rounding to the current context, it's possible for the actual value to lie just outside this range.
[ "Return", "the", "inverse", "tangent", "of", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1733-L1747
train
63,821
mdickinson/bigfloat
bigfloat/core.py
cosh
def cosh(x, context=None): """ Return the hyperbolic cosine of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_cosh, (BigFloat._implicit_convert(x),), context, )
python
def cosh(x, context=None): """ Return the hyperbolic cosine of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_cosh, (BigFloat._implicit_convert(x),), context, )
[ "def", "cosh", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_cosh", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",", ...
Return the hyperbolic cosine of x.
[ "Return", "the", "hyperbolic", "cosine", "of", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1805-L1815
train
63,822
mdickinson/bigfloat
bigfloat/core.py
sinh
def sinh(x, context=None): """ Return the hyperbolic sine of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_sinh, (BigFloat._implicit_convert(x),), context, )
python
def sinh(x, context=None): """ Return the hyperbolic sine of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_sinh, (BigFloat._implicit_convert(x),), context, )
[ "def", "sinh", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_sinh", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",", ...
Return the hyperbolic sine of x.
[ "Return", "the", "hyperbolic", "sine", "of", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1818-L1828
train
63,823
mdickinson/bigfloat
bigfloat/core.py
tanh
def tanh(x, context=None): """ Return the hyperbolic tangent of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_tanh, (BigFloat._implicit_convert(x),), context, )
python
def tanh(x, context=None): """ Return the hyperbolic tangent of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_tanh, (BigFloat._implicit_convert(x),), context, )
[ "def", "tanh", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_tanh", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",", ...
Return the hyperbolic tangent of x.
[ "Return", "the", "hyperbolic", "tangent", "of", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1831-L1841
train
63,824
mdickinson/bigfloat
bigfloat/core.py
sech
def sech(x, context=None): """ Return the hyperbolic secant of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_sech, (BigFloat._implicit_convert(x),), context, )
python
def sech(x, context=None): """ Return the hyperbolic secant of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_sech, (BigFloat._implicit_convert(x),), context, )
[ "def", "sech", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_sech", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",", ...
Return the hyperbolic secant of x.
[ "Return", "the", "hyperbolic", "secant", "of", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1844-L1854
train
63,825
mdickinson/bigfloat
bigfloat/core.py
csch
def csch(x, context=None): """ Return the hyperbolic cosecant of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_csch, (BigFloat._implicit_convert(x),), context, )
python
def csch(x, context=None): """ Return the hyperbolic cosecant of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_csch, (BigFloat._implicit_convert(x),), context, )
[ "def", "csch", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_csch", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",", ...
Return the hyperbolic cosecant of x.
[ "Return", "the", "hyperbolic", "cosecant", "of", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1857-L1867
train
63,826
mdickinson/bigfloat
bigfloat/core.py
coth
def coth(x, context=None): """ Return the hyperbolic cotangent of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_coth, (BigFloat._implicit_convert(x),), context, )
python
def coth(x, context=None): """ Return the hyperbolic cotangent of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_coth, (BigFloat._implicit_convert(x),), context, )
[ "def", "coth", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_coth", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",", ...
Return the hyperbolic cotangent of x.
[ "Return", "the", "hyperbolic", "cotangent", "of", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1870-L1880
train
63,827
mdickinson/bigfloat
bigfloat/core.py
acosh
def acosh(x, context=None): """ Return the inverse hyperbolic cosine of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_acosh, (BigFloat._implicit_convert(x),), context, )
python
def acosh(x, context=None): """ Return the inverse hyperbolic cosine of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_acosh, (BigFloat._implicit_convert(x),), context, )
[ "def", "acosh", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_acosh", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",", ...
Return the inverse hyperbolic cosine of x.
[ "Return", "the", "inverse", "hyperbolic", "cosine", "of", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1883-L1893
train
63,828
mdickinson/bigfloat
bigfloat/core.py
asinh
def asinh(x, context=None): """ Return the inverse hyperbolic sine of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_asinh, (BigFloat._implicit_convert(x),), context, )
python
def asinh(x, context=None): """ Return the inverse hyperbolic sine of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_asinh, (BigFloat._implicit_convert(x),), context, )
[ "def", "asinh", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_asinh", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",", ...
Return the inverse hyperbolic sine of x.
[ "Return", "the", "inverse", "hyperbolic", "sine", "of", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1896-L1906
train
63,829
mdickinson/bigfloat
bigfloat/core.py
atanh
def atanh(x, context=None): """ Return the inverse hyperbolic tangent of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_atanh, (BigFloat._implicit_convert(x),), context, )
python
def atanh(x, context=None): """ Return the inverse hyperbolic tangent of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_atanh, (BigFloat._implicit_convert(x),), context, )
[ "def", "atanh", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_atanh", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",", ...
Return the inverse hyperbolic tangent of x.
[ "Return", "the", "inverse", "hyperbolic", "tangent", "of", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1909-L1919
train
63,830
mdickinson/bigfloat
bigfloat/core.py
log1p
def log1p(x, context=None): """ Return the logarithm of one plus x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_log1p, (BigFloat._implicit_convert(x),), context, )
python
def log1p(x, context=None): """ Return the logarithm of one plus x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_log1p, (BigFloat._implicit_convert(x),), context, )
[ "def", "log1p", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_log1p", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",", ...
Return the logarithm of one plus x.
[ "Return", "the", "logarithm", "of", "one", "plus", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1935-L1945
train
63,831
mdickinson/bigfloat
bigfloat/core.py
expm1
def expm1(x, context=None): """ Return one less than the exponential of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_expm1, (BigFloat._implicit_convert(x),), context, )
python
def expm1(x, context=None): """ Return one less than the exponential of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_expm1, (BigFloat._implicit_convert(x),), context, )
[ "def", "expm1", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_expm1", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",", ...
Return one less than the exponential of x.
[ "Return", "one", "less", "than", "the", "exponential", "of", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1948-L1958
train
63,832
mdickinson/bigfloat
bigfloat/core.py
eint
def eint(x, context=None): """ Return the exponential integral of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_eint, (BigFloat._implicit_convert(x),), context, )
python
def eint(x, context=None): """ Return the exponential integral of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_eint, (BigFloat._implicit_convert(x),), context, )
[ "def", "eint", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_eint", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",", ...
Return the exponential integral of x.
[ "Return", "the", "exponential", "integral", "of", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1961-L1971
train
63,833
mdickinson/bigfloat
bigfloat/core.py
li2
def li2(x, context=None): """ Return the real part of the dilogarithm of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_li2, (BigFloat._implicit_convert(x),), context, )
python
def li2(x, context=None): """ Return the real part of the dilogarithm of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_li2, (BigFloat._implicit_convert(x),), context, )
[ "def", "li2", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_li2", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",", ")...
Return the real part of the dilogarithm of x.
[ "Return", "the", "real", "part", "of", "the", "dilogarithm", "of", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1974-L1984
train
63,834
mdickinson/bigfloat
bigfloat/core.py
gamma
def gamma(x, context=None): """ Return the value of the Gamma function of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_gamma, (BigFloat._implicit_convert(x),), context, )
python
def gamma(x, context=None): """ Return the value of the Gamma function of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_gamma, (BigFloat._implicit_convert(x),), context, )
[ "def", "gamma", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_gamma", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",", ...
Return the value of the Gamma function of x.
[ "Return", "the", "value", "of", "the", "Gamma", "function", "of", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1987-L1997
train
63,835
mdickinson/bigfloat
bigfloat/core.py
lngamma
def lngamma(x, context=None): """ Return the value of the logarithm of the Gamma function of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_lngamma, (BigFloat._implicit_convert(x),), context, )
python
def lngamma(x, context=None): """ Return the value of the logarithm of the Gamma function of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_lngamma, (BigFloat._implicit_convert(x),), context, )
[ "def", "lngamma", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_lngamma", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", "...
Return the value of the logarithm of the Gamma function of x.
[ "Return", "the", "value", "of", "the", "logarithm", "of", "the", "Gamma", "function", "of", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L2000-L2010
train
63,836
mdickinson/bigfloat
bigfloat/core.py
lgamma
def lgamma(x, context=None): """ Return the logarithm of the absolute value of the Gamma function at x. """ return _apply_function_in_current_context( BigFloat, lambda rop, op, rnd: mpfr.mpfr_lgamma(rop, op, rnd)[0], (BigFloat._implicit_convert(x),), context, )
python
def lgamma(x, context=None): """ Return the logarithm of the absolute value of the Gamma function at x. """ return _apply_function_in_current_context( BigFloat, lambda rop, op, rnd: mpfr.mpfr_lgamma(rop, op, rnd)[0], (BigFloat._implicit_convert(x),), context, )
[ "def", "lgamma", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "lambda", "rop", ",", "op", ",", "rnd", ":", "mpfr", ".", "mpfr_lgamma", "(", "rop", ",", "op", ",", "rnd", ")", "["...
Return the logarithm of the absolute value of the Gamma function at x.
[ "Return", "the", "logarithm", "of", "the", "absolute", "value", "of", "the", "Gamma", "function", "at", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L2013-L2023
train
63,837
mdickinson/bigfloat
bigfloat/core.py
zeta
def zeta(x, context=None): """ Return the value of the Riemann zeta function on x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_zeta, (BigFloat._implicit_convert(x),), context, )
python
def zeta(x, context=None): """ Return the value of the Riemann zeta function on x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_zeta, (BigFloat._implicit_convert(x),), context, )
[ "def", "zeta", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_zeta", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",", ...
Return the value of the Riemann zeta function on x.
[ "Return", "the", "value", "of", "the", "Riemann", "zeta", "function", "on", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L2039-L2049
train
63,838
mdickinson/bigfloat
bigfloat/core.py
erf
def erf(x, context=None): """ Return the value of the error function at x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_erf, (BigFloat._implicit_convert(x),), context, )
python
def erf(x, context=None): """ Return the value of the error function at x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_erf, (BigFloat._implicit_convert(x),), context, )
[ "def", "erf", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_erf", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",", ")...
Return the value of the error function at x.
[ "Return", "the", "value", "of", "the", "error", "function", "at", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L2065-L2075
train
63,839
mdickinson/bigfloat
bigfloat/core.py
erfc
def erfc(x, context=None): """ Return the value of the complementary error function at x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_erfc, (BigFloat._implicit_convert(x),), context, )
python
def erfc(x, context=None): """ Return the value of the complementary error function at x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_erfc, (BigFloat._implicit_convert(x),), context, )
[ "def", "erfc", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_erfc", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",", ...
Return the value of the complementary error function at x.
[ "Return", "the", "value", "of", "the", "complementary", "error", "function", "at", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L2078-L2088
train
63,840
mdickinson/bigfloat
bigfloat/core.py
j0
def j0(x, context=None): """ Return the value of the first kind Bessel function of order 0 at x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_j0, (BigFloat._implicit_convert(x),), context, )
python
def j0(x, context=None): """ Return the value of the first kind Bessel function of order 0 at x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_j0, (BigFloat._implicit_convert(x),), context, )
[ "def", "j0", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_j0", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",", ")" ...
Return the value of the first kind Bessel function of order 0 at x.
[ "Return", "the", "value", "of", "the", "first", "kind", "Bessel", "function", "of", "order", "0", "at", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L2091-L2101
train
63,841
mdickinson/bigfloat
bigfloat/core.py
j1
def j1(x, context=None): """ Return the value of the first kind Bessel function of order 1 at x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_j1, (BigFloat._implicit_convert(x),), context, )
python
def j1(x, context=None): """ Return the value of the first kind Bessel function of order 1 at x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_j1, (BigFloat._implicit_convert(x),), context, )
[ "def", "j1", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_j1", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",", ")" ...
Return the value of the first kind Bessel function of order 1 at x.
[ "Return", "the", "value", "of", "the", "first", "kind", "Bessel", "function", "of", "order", "1", "at", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L2104-L2114
train
63,842
mdickinson/bigfloat
bigfloat/core.py
jn
def jn(n, x, context=None): """ Return the value of the first kind Bessel function of order ``n`` at ``x``. ``n`` should be a Python integer. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_jn, (n, BigFloat._implicit_convert(x)), context, )
python
def jn(n, x, context=None): """ Return the value of the first kind Bessel function of order ``n`` at ``x``. ``n`` should be a Python integer. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_jn, (n, BigFloat._implicit_convert(x)), context, )
[ "def", "jn", "(", "n", ",", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_jn", ",", "(", "n", ",", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ")", ",", "co...
Return the value of the first kind Bessel function of order ``n`` at ``x``. ``n`` should be a Python integer.
[ "Return", "the", "value", "of", "the", "first", "kind", "Bessel", "function", "of", "order", "n", "at", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L2117-L2129
train
63,843
mdickinson/bigfloat
bigfloat/core.py
y0
def y0(x, context=None): """ Return the value of the second kind Bessel function of order 0 at x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_y0, (BigFloat._implicit_convert(x),), context, )
python
def y0(x, context=None): """ Return the value of the second kind Bessel function of order 0 at x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_y0, (BigFloat._implicit_convert(x),), context, )
[ "def", "y0", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_y0", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",", ")" ...
Return the value of the second kind Bessel function of order 0 at x.
[ "Return", "the", "value", "of", "the", "second", "kind", "Bessel", "function", "of", "order", "0", "at", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L2132-L2142
train
63,844
mdickinson/bigfloat
bigfloat/core.py
y1
def y1(x, context=None): """ Return the value of the second kind Bessel function of order 1 at x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_y1, (BigFloat._implicit_convert(x),), context, )
python
def y1(x, context=None): """ Return the value of the second kind Bessel function of order 1 at x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_y1, (BigFloat._implicit_convert(x),), context, )
[ "def", "y1", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_y1", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",", ")" ...
Return the value of the second kind Bessel function of order 1 at x.
[ "Return", "the", "value", "of", "the", "second", "kind", "Bessel", "function", "of", "order", "1", "at", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L2145-L2155
train
63,845
mdickinson/bigfloat
bigfloat/core.py
yn
def yn(n, x, context=None): """ Return the value of the second kind Bessel function of order ``n`` at ``x``. ``n`` should be a Python integer. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_yn, (n, BigFloat._implicit_convert(x)), context, ...
python
def yn(n, x, context=None): """ Return the value of the second kind Bessel function of order ``n`` at ``x``. ``n`` should be a Python integer. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_yn, (n, BigFloat._implicit_convert(x)), context, ...
[ "def", "yn", "(", "n", ",", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_yn", ",", "(", "n", ",", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ")", ",", "co...
Return the value of the second kind Bessel function of order ``n`` at ``x``. ``n`` should be a Python integer.
[ "Return", "the", "value", "of", "the", "second", "kind", "Bessel", "function", "of", "order", "n", "at", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L2158-L2171
train
63,846
mdickinson/bigfloat
bigfloat/core.py
agm
def agm(x, y, context=None): """ Return the arithmetic geometric mean of x and y. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_agm, ( BigFloat._implicit_convert(x), BigFloat._implicit_convert(y), ), context, )
python
def agm(x, y, context=None): """ Return the arithmetic geometric mean of x and y. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_agm, ( BigFloat._implicit_convert(x), BigFloat._implicit_convert(y), ), context, )
[ "def", "agm", "(", "x", ",", "y", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_agm", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", "BigFloat", ".", "...
Return the arithmetic geometric mean of x and y.
[ "Return", "the", "arithmetic", "geometric", "mean", "of", "x", "and", "y", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L2210-L2223
train
63,847
mdickinson/bigfloat
bigfloat/core.py
hypot
def hypot(x, y, context=None): """ Return the Euclidean norm of x and y, i.e., the square root of the sum of the squares of x and y. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_hypot, ( BigFloat._implicit_convert(x), BigFloat._i...
python
def hypot(x, y, context=None): """ Return the Euclidean norm of x and y, i.e., the square root of the sum of the squares of x and y. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_hypot, ( BigFloat._implicit_convert(x), BigFloat._i...
[ "def", "hypot", "(", "x", ",", "y", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_hypot", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", "BigFloat", ".",...
Return the Euclidean norm of x and y, i.e., the square root of the sum of the squares of x and y.
[ "Return", "the", "Euclidean", "norm", "of", "x", "and", "y", "i", ".", "e", ".", "the", "square", "root", "of", "the", "sum", "of", "the", "squares", "of", "x", "and", "y", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L2226-L2240
train
63,848
mdickinson/bigfloat
bigfloat/core.py
ai
def ai(x, context=None): """ Return the Airy function of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_ai, (BigFloat._implicit_convert(x),), context, )
python
def ai(x, context=None): """ Return the Airy function of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_ai, (BigFloat._implicit_convert(x),), context, )
[ "def", "ai", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_ai", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",", ")" ...
Return the Airy function of x.
[ "Return", "the", "Airy", "function", "of", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L2243-L2253
train
63,849
mdickinson/bigfloat
bigfloat/core.py
ceil
def ceil(x, context=None): """ Return the next higher or equal integer to x. If the result is not exactly representable, it will be rounded according to the current context. Note that the rounding step means that it's possible for the result to be smaller than ``x``. For example:: >>> x ...
python
def ceil(x, context=None): """ Return the next higher or equal integer to x. If the result is not exactly representable, it will be rounded according to the current context. Note that the rounding step means that it's possible for the result to be smaller than ``x``. For example:: >>> x ...
[ "def", "ceil", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_rint_ceil", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",...
Return the next higher or equal integer to x. If the result is not exactly representable, it will be rounded according to the current context. Note that the rounding step means that it's possible for the result to be smaller than ``x``. For example:: >>> x = 2**100 + 1 >>> ceil(2**100 + ...
[ "Return", "the", "next", "higher", "or", "equal", "integer", "to", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L2328-L2363
train
63,850
mdickinson/bigfloat
bigfloat/core.py
floor
def floor(x, context=None): """ Return the next lower or equal integer to x. If the result is not exactly representable, it will be rounded according to the current context. Note that it's possible for the result to be larger than ``x``. See the documentation of the :func:`ceil` function for ...
python
def floor(x, context=None): """ Return the next lower or equal integer to x. If the result is not exactly representable, it will be rounded according to the current context. Note that it's possible for the result to be larger than ``x``. See the documentation of the :func:`ceil` function for ...
[ "def", "floor", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_rint_floor", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ...
Return the next lower or equal integer to x. If the result is not exactly representable, it will be rounded according to the current context. Note that it's possible for the result to be larger than ``x``. See the documentation of the :func:`ceil` function for more information. .. note:: ...
[ "Return", "the", "next", "lower", "or", "equal", "integer", "to", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L2366-L2387
train
63,851
mdickinson/bigfloat
bigfloat/core.py
trunc
def trunc(x, context=None): """ Return the next integer towards zero. If the result is not exactly representable, it will be rounded according to the current context. .. note:: This function corresponds to the MPFR function ``mpfr_rint_trunc``, not to ``mpfr_trunc``. """ re...
python
def trunc(x, context=None): """ Return the next integer towards zero. If the result is not exactly representable, it will be rounded according to the current context. .. note:: This function corresponds to the MPFR function ``mpfr_rint_trunc``, not to ``mpfr_trunc``. """ re...
[ "def", "trunc", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_rint_trunc", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ...
Return the next integer towards zero. If the result is not exactly representable, it will be rounded according to the current context. .. note:: This function corresponds to the MPFR function ``mpfr_rint_trunc``, not to ``mpfr_trunc``.
[ "Return", "the", "next", "integer", "towards", "zero", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L2411-L2429
train
63,852
mdickinson/bigfloat
bigfloat/core.py
frac
def frac(x, context=None): """ Return the fractional part of ``x``. The result has the same sign as ``x``. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_frac, (BigFloat._implicit_convert(x),), context, )
python
def frac(x, context=None): """ Return the fractional part of ``x``. The result has the same sign as ``x``. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_frac, (BigFloat._implicit_convert(x),), context, )
[ "def", "frac", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_frac", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",", ...
Return the fractional part of ``x``. The result has the same sign as ``x``.
[ "Return", "the", "fractional", "part", "of", "x", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L2432-L2444
train
63,853
mdickinson/bigfloat
bigfloat/core.py
min
def min(x, y, context=None): """ Return the minimum of x and y. If x and y are both NaN, return NaN. If exactly one of x and y is NaN, return the non-NaN value. If x and y are zeros of different signs, return −0. """ return _apply_function_in_current_context( BigFloat, mpfr...
python
def min(x, y, context=None): """ Return the minimum of x and y. If x and y are both NaN, return NaN. If exactly one of x and y is NaN, return the non-NaN value. If x and y are zeros of different signs, return −0. """ return _apply_function_in_current_context( BigFloat, mpfr...
[ "def", "min", "(", "x", ",", "y", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_min", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", "BigFloat", ".", "...
Return the minimum of x and y. If x and y are both NaN, return NaN. If exactly one of x and y is NaN, return the non-NaN value. If x and y are zeros of different signs, return −0.
[ "Return", "the", "minimum", "of", "x", "and", "y", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L2506-L2523
train
63,854
mdickinson/bigfloat
bigfloat/core.py
max
def max(x, y, context=None): """ Return the maximum of x and y. If x and y are both NaN, return NaN. If exactly one of x and y is NaN, return the non-NaN value. If x and y are zeros of different signs, return +0. """ return _apply_function_in_current_context( BigFloat, mpfr...
python
def max(x, y, context=None): """ Return the maximum of x and y. If x and y are both NaN, return NaN. If exactly one of x and y is NaN, return the non-NaN value. If x and y are zeros of different signs, return +0. """ return _apply_function_in_current_context( BigFloat, mpfr...
[ "def", "max", "(", "x", ",", "y", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_max", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", "BigFloat", ".", "...
Return the maximum of x and y. If x and y are both NaN, return NaN. If exactly one of x and y is NaN, return the non-NaN value. If x and y are zeros of different signs, return +0.
[ "Return", "the", "maximum", "of", "x", "and", "y", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L2526-L2543
train
63,855
mdickinson/bigfloat
bigfloat/core.py
copysign
def copysign(x, y, context=None): """ Return a new BigFloat object with the magnitude of x but the sign of y. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_copysign, ( BigFloat._implicit_convert(x), BigFloat._implicit_convert(y), ...
python
def copysign(x, y, context=None): """ Return a new BigFloat object with the magnitude of x but the sign of y. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_copysign, ( BigFloat._implicit_convert(x), BigFloat._implicit_convert(y), ...
[ "def", "copysign", "(", "x", ",", "y", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_copysign", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", "BigFloat", ...
Return a new BigFloat object with the magnitude of x but the sign of y.
[ "Return", "a", "new", "BigFloat", "object", "with", "the", "magnitude", "of", "x", "but", "the", "sign", "of", "y", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L2556-L2569
train
63,856
mdickinson/bigfloat
bigfloat/core.py
BigFloat.exact
def exact(cls, value, precision=None): """Convert an integer, float or BigFloat with no loss of precision. Also convert a string with given precision. This constructor makes no use of the current context. """ # figure out precision to use if isinstance(value, six.string_...
python
def exact(cls, value, precision=None): """Convert an integer, float or BigFloat with no loss of precision. Also convert a string with given precision. This constructor makes no use of the current context. """ # figure out precision to use if isinstance(value, six.string_...
[ "def", "exact", "(", "cls", ",", "value", ",", "precision", "=", "None", ")", ":", "# figure out precision to use", "if", "isinstance", "(", "value", ",", "six", ".", "string_types", ")", ":", "if", "precision", "is", "None", ":", "raise", "TypeError", "("...
Convert an integer, float or BigFloat with no loss of precision. Also convert a string with given precision. This constructor makes no use of the current context.
[ "Convert", "an", "integer", "float", "or", "BigFloat", "with", "no", "loss", "of", "precision", ".", "Also", "convert", "a", "string", "with", "given", "precision", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L310-L357
train
63,857
mdickinson/bigfloat
bigfloat/core.py
BigFloat._significand
def _significand(self): """Return the significand of self, as a BigFloat. If self is a nonzero finite number, return a BigFloat m with the same precision as self, such that 0.5 <= m < 1. and self = +/-m * 2**e for some exponent e. If self is zero, infinity...
python
def _significand(self): """Return the significand of self, as a BigFloat. If self is a nonzero finite number, return a BigFloat m with the same precision as self, such that 0.5 <= m < 1. and self = +/-m * 2**e for some exponent e. If self is zero, infinity...
[ "def", "_significand", "(", "self", ")", ":", "m", "=", "self", ".", "copy", "(", ")", "if", "self", "and", "is_finite", "(", "self", ")", ":", "mpfr", ".", "mpfr_set_exp", "(", "m", ",", "0", ")", "mpfr", ".", "mpfr_setsign", "(", "m", ",", "m",...
Return the significand of self, as a BigFloat. If self is a nonzero finite number, return a BigFloat m with the same precision as self, such that 0.5 <= m < 1. and self = +/-m * 2**e for some exponent e. If self is zero, infinity or nan, return a copy of self with...
[ "Return", "the", "significand", "of", "self", "as", "a", "BigFloat", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L457-L476
train
63,858
mdickinson/bigfloat
bigfloat/core.py
BigFloat._exponent
def _exponent(self): """Return the exponent of self, as an integer. The exponent is defined as the unique integer k such that 2**(k-1) <= abs(self) < 2**k. If self is not finite and nonzero, return a string: one of '0', 'inf' or 'nan'. """ if self and is_finit...
python
def _exponent(self): """Return the exponent of self, as an integer. The exponent is defined as the unique integer k such that 2**(k-1) <= abs(self) < 2**k. If self is not finite and nonzero, return a string: one of '0', 'inf' or 'nan'. """ if self and is_finit...
[ "def", "_exponent", "(", "self", ")", ":", "if", "self", "and", "is_finite", "(", "self", ")", ":", "return", "mpfr", ".", "mpfr_get_exp", "(", "self", ")", "if", "not", "self", ":", "return", "'0'", "elif", "is_inf", "(", "self", ")", ":", "return",...
Return the exponent of self, as an integer. The exponent is defined as the unique integer k such that 2**(k-1) <= abs(self) < 2**k. If self is not finite and nonzero, return a string: one of '0', 'inf' or 'nan'.
[ "Return", "the", "exponent", "of", "self", "as", "an", "integer", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L478-L498
train
63,859
mdickinson/bigfloat
bigfloat/core.py
BigFloat.copy_neg
def copy_neg(self): """ Return a copy of self with the opposite sign bit. Unlike -self, this does not make use of the context: the result has the same precision as the original. """ result = mpfr.Mpfr_t.__new__(BigFloat) mpfr.mpfr_init2(result, self.precision) ...
python
def copy_neg(self): """ Return a copy of self with the opposite sign bit. Unlike -self, this does not make use of the context: the result has the same precision as the original. """ result = mpfr.Mpfr_t.__new__(BigFloat) mpfr.mpfr_init2(result, self.precision) ...
[ "def", "copy_neg", "(", "self", ")", ":", "result", "=", "mpfr", ".", "Mpfr_t", ".", "__new__", "(", "BigFloat", ")", "mpfr", ".", "mpfr_init2", "(", "result", ",", "self", ".", "precision", ")", "new_sign", "=", "not", "self", ".", "_sign", "(", ")"...
Return a copy of self with the opposite sign bit. Unlike -self, this does not make use of the context: the result has the same precision as the original.
[ "Return", "a", "copy", "of", "self", "with", "the", "opposite", "sign", "bit", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L512-L523
train
63,860
mdickinson/bigfloat
bigfloat/core.py
BigFloat.copy_abs
def copy_abs(self): """ Return a copy of self with the sign bit unset. Unlike abs(self), this does not make use of the context: the result has the same precision as the original. """ result = mpfr.Mpfr_t.__new__(BigFloat) mpfr.mpfr_init2(result, self.precision) ...
python
def copy_abs(self): """ Return a copy of self with the sign bit unset. Unlike abs(self), this does not make use of the context: the result has the same precision as the original. """ result = mpfr.Mpfr_t.__new__(BigFloat) mpfr.mpfr_init2(result, self.precision) ...
[ "def", "copy_abs", "(", "self", ")", ":", "result", "=", "mpfr", ".", "Mpfr_t", ".", "__new__", "(", "BigFloat", ")", "mpfr", ".", "mpfr_init2", "(", "result", ",", "self", ".", "precision", ")", "mpfr", ".", "mpfr_setsign", "(", "result", ",", "self",...
Return a copy of self with the sign bit unset. Unlike abs(self), this does not make use of the context: the result has the same precision as the original.
[ "Return", "a", "copy", "of", "self", "with", "the", "sign", "bit", "unset", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L525-L535
train
63,861
mdickinson/bigfloat
bigfloat/core.py
BigFloat.hex
def hex(self): """Return a hexadecimal representation of a BigFloat.""" sign = '-' if self._sign() else '' e = self._exponent() if isinstance(e, six.string_types): return sign + e m = self._significand() _, digits, _ = _mpfr_get_str2( 16, ...
python
def hex(self): """Return a hexadecimal representation of a BigFloat.""" sign = '-' if self._sign() else '' e = self._exponent() if isinstance(e, six.string_types): return sign + e m = self._significand() _, digits, _ = _mpfr_get_str2( 16, ...
[ "def", "hex", "(", "self", ")", ":", "sign", "=", "'-'", "if", "self", ".", "_sign", "(", ")", "else", "''", "e", "=", "self", ".", "_exponent", "(", ")", "if", "isinstance", "(", "e", ",", "six", ".", "string_types", ")", ":", "return", "sign", ...
Return a hexadecimal representation of a BigFloat.
[ "Return", "a", "hexadecimal", "representation", "of", "a", "BigFloat", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L537-L556
train
63,862
mdickinson/bigfloat
bigfloat/core.py
BigFloat._format_to_floating_precision
def _format_to_floating_precision(self, precision): """ Format a nonzero finite BigFloat instance to a given number of significant digits. Returns a triple (negative, digits, exp) where: - negative is a boolean, True for a negative number, else False - digits is a string gi...
python
def _format_to_floating_precision(self, precision): """ Format a nonzero finite BigFloat instance to a given number of significant digits. Returns a triple (negative, digits, exp) where: - negative is a boolean, True for a negative number, else False - digits is a string gi...
[ "def", "_format_to_floating_precision", "(", "self", ",", "precision", ")", ":", "if", "precision", "<=", "0", ":", "raise", "ValueError", "(", "\"precision argument should be at least 1\"", ")", "sign", ",", "digits", ",", "exp", "=", "_mpfr_get_str2", "(", "10",...
Format a nonzero finite BigFloat instance to a given number of significant digits. Returns a triple (negative, digits, exp) where: - negative is a boolean, True for a negative number, else False - digits is a string giving the digits of the output - exp represents the exp...
[ "Format", "a", "nonzero", "finite", "BigFloat", "instance", "to", "a", "given", "number", "of", "significant", "digits", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L616-L641
train
63,863
mdickinson/bigfloat
bigfloat/core.py
BigFloat._format_to_fixed_precision
def _format_to_fixed_precision(self, precision): """ Format 'self' to a given number of digits after the decimal point. Returns a triple (negative, digits, exp) where: - negative is a boolean, True for a negative number, else False - digits is a string giving the digits of the outp...
python
def _format_to_fixed_precision(self, precision): """ Format 'self' to a given number of digits after the decimal point. Returns a triple (negative, digits, exp) where: - negative is a boolean, True for a negative number, else False - digits is a string giving the digits of the outp...
[ "def", "_format_to_fixed_precision", "(", "self", ",", "precision", ")", ":", "# MPFR only provides functions to format to a given number of", "# significant digits. So we must:", "#", "# (1) Identify an e such that 10**(e-1) <= abs(x) < 10**e.", "#", "# (2) Determine the number of si...
Format 'self' to a given number of digits after the decimal point. Returns a triple (negative, digits, exp) where: - negative is a boolean, True for a negative number, else False - digits is a string giving the digits of the output - exp represents the exponent of the output ...
[ "Format", "self", "to", "a", "given", "number", "of", "digits", "after", "the", "decimal", "point", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L643-L724
train
63,864
mdickinson/bigfloat
bigfloat/core.py
BigFloat._implicit_convert
def _implicit_convert(cls, arg): """Implicit conversion used for binary operations, comparisons, functions, etc. Return value should be an instance of BigFloat.""" # ints, long and floats mix freely with BigFloats, and are # converted exactly. if isinstance(arg, six.int...
python
def _implicit_convert(cls, arg): """Implicit conversion used for binary operations, comparisons, functions, etc. Return value should be an instance of BigFloat.""" # ints, long and floats mix freely with BigFloats, and are # converted exactly. if isinstance(arg, six.int...
[ "def", "_implicit_convert", "(", "cls", ",", "arg", ")", ":", "# ints, long and floats mix freely with BigFloats, and are", "# converted exactly.", "if", "isinstance", "(", "arg", ",", "six", ".", "integer_types", ")", "or", "isinstance", "(", "arg", ",", "float", "...
Implicit conversion used for binary operations, comparisons, functions, etc. Return value should be an instance of BigFloat.
[ "Implicit", "conversion", "used", "for", "binary", "operations", "comparisons", "functions", "etc", ".", "Return", "value", "should", "be", "an", "instance", "of", "BigFloat", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L858-L871
train
63,865
blockstack/virtualchain
virtualchain/lib/merkle.py
calculate_merkle_pairs
def calculate_merkle_pairs(bin_hashes, hash_function=bin_double_sha256): """ Calculate the parents of a row of a merkle tree. Takes in a list of binary hashes, returns a binary hash. The returned parents list is such that parents[i] == hash(bin_hashes[2*i] + bin_hashes[2*i+1]). """ hashes = lis...
python
def calculate_merkle_pairs(bin_hashes, hash_function=bin_double_sha256): """ Calculate the parents of a row of a merkle tree. Takes in a list of binary hashes, returns a binary hash. The returned parents list is such that parents[i] == hash(bin_hashes[2*i] + bin_hashes[2*i+1]). """ hashes = lis...
[ "def", "calculate_merkle_pairs", "(", "bin_hashes", ",", "hash_function", "=", "bin_double_sha256", ")", ":", "hashes", "=", "list", "(", "bin_hashes", ")", "# if there are an odd number of hashes, double up the last one", "if", "len", "(", "hashes", ")", "%", "2", "=...
Calculate the parents of a row of a merkle tree. Takes in a list of binary hashes, returns a binary hash. The returned parents list is such that parents[i] == hash(bin_hashes[2*i] + bin_hashes[2*i+1]).
[ "Calculate", "the", "parents", "of", "a", "row", "of", "a", "merkle", "tree", ".", "Takes", "in", "a", "list", "of", "binary", "hashes", "returns", "a", "binary", "hash", "." ]
fcfc970064ca7dfcab26ebd3ab955870a763ea39
https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/merkle.py#L26-L43
train
63,866
blockstack/virtualchain
virtualchain/lib/merkle.py
verify_merkle_path
def verify_merkle_path(merkle_root_hex, serialized_path, leaf_hash_hex, hash_function=bin_double_sha256): """ Verify a merkle path. The given path is the path from two leaf nodes to the root itself. merkle_root_hex is a little-endian, hex-encoded hash. serialized_path is the serialized merkle path ...
python
def verify_merkle_path(merkle_root_hex, serialized_path, leaf_hash_hex, hash_function=bin_double_sha256): """ Verify a merkle path. The given path is the path from two leaf nodes to the root itself. merkle_root_hex is a little-endian, hex-encoded hash. serialized_path is the serialized merkle path ...
[ "def", "verify_merkle_path", "(", "merkle_root_hex", ",", "serialized_path", ",", "leaf_hash_hex", ",", "hash_function", "=", "bin_double_sha256", ")", ":", "merkle_root", "=", "hex_to_bin_reversed", "(", "merkle_root_hex", ")", "leaf_hash", "=", "hex_to_bin_reversed", ...
Verify a merkle path. The given path is the path from two leaf nodes to the root itself. merkle_root_hex is a little-endian, hex-encoded hash. serialized_path is the serialized merkle path path_hex is a list of little-endian, hex-encoded hashes. Return True if the path is consistent with the merkle r...
[ "Verify", "a", "merkle", "path", ".", "The", "given", "path", "is", "the", "path", "from", "two", "leaf", "nodes", "to", "the", "root", "itself", "." ]
fcfc970064ca7dfcab26ebd3ab955870a763ea39
https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/merkle.py#L46-L80
train
63,867
gregreen/dustmaps
dustmaps/unstructured_map.py
UnstructuredDustMap._coords2idx
def _coords2idx(self, coords): """ Converts from sky coordinates to pixel indices. Args: coords (:obj:`astropy.coordinates.SkyCoord`): Sky coordinates. Returns: Pixel indices of the coordinates, with the same shape as the input coordinates. Pixels wh...
python
def _coords2idx(self, coords): """ Converts from sky coordinates to pixel indices. Args: coords (:obj:`astropy.coordinates.SkyCoord`): Sky coordinates. Returns: Pixel indices of the coordinates, with the same shape as the input coordinates. Pixels wh...
[ "def", "_coords2idx", "(", "self", ",", "coords", ")", ":", "x", "=", "self", ".", "_coords2vec", "(", "coords", ")", "idx", "=", "self", ".", "_kd", ".", "query", "(", "x", ",", "p", "=", "self", ".", "_metric_p", ",", "distance_upper_bound", "=", ...
Converts from sky coordinates to pixel indices. Args: coords (:obj:`astropy.coordinates.SkyCoord`): Sky coordinates. Returns: Pixel indices of the coordinates, with the same shape as the input coordinates. Pixels which are outside the map are given an index ...
[ "Converts", "from", "sky", "coordinates", "to", "pixel", "indices", "." ]
c8f571a71da0d951bf8ea865621bee14492bdfd9
https://github.com/gregreen/dustmaps/blob/c8f571a71da0d951bf8ea865621bee14492bdfd9/dustmaps/unstructured_map.py#L105-L121
train
63,868
gregreen/dustmaps
dustmaps/marshall.py
MarshallQuery._gal2idx
def _gal2idx(self, gal): """ Converts from Galactic coordinates to pixel indices. Args: gal (:obj:`astropy.coordinates.SkyCoord`): Galactic coordinates. Must store an array of coordinates (i.e., not be scalar). Returns: ``j, k, mask`` - Pixel ind...
python
def _gal2idx(self, gal): """ Converts from Galactic coordinates to pixel indices. Args: gal (:obj:`astropy.coordinates.SkyCoord`): Galactic coordinates. Must store an array of coordinates (i.e., not be scalar). Returns: ``j, k, mask`` - Pixel ind...
[ "def", "_gal2idx", "(", "self", ",", "gal", ")", ":", "# Make sure that l is in domain [-180 deg, 180 deg)", "l", "=", "coordinates", ".", "Longitude", "(", "gal", ".", "l", ",", "wrap_angle", "=", "180.", "*", "units", ".", "deg", ")", "j", "=", "(", "sel...
Converts from Galactic coordinates to pixel indices. Args: gal (:obj:`astropy.coordinates.SkyCoord`): Galactic coordinates. Must store an array of coordinates (i.e., not be scalar). Returns: ``j, k, mask`` - Pixel indices of the coordinates, as well as a mask ...
[ "Converts", "from", "Galactic", "coordinates", "to", "pixel", "indices", "." ]
c8f571a71da0d951bf8ea865621bee14492bdfd9
https://github.com/gregreen/dustmaps/blob/c8f571a71da0d951bf8ea865621bee14492bdfd9/dustmaps/marshall.py#L79-L105
train
63,869
blockstack/virtualchain
virtualchain/lib/blockchain/bitcoin_blockchain/spv.py
GetHeaders.add_block_hash
def add_block_hash( self, block_hash ): """ Append up to 2000 block hashes for which to get headers. """ if len(self.block_hashes) > 2000: raise Exception("A getheaders request cannot have over 2000 block hashes") hash_num = int("0x" + block_hash, 16) ...
python
def add_block_hash( self, block_hash ): """ Append up to 2000 block hashes for which to get headers. """ if len(self.block_hashes) > 2000: raise Exception("A getheaders request cannot have over 2000 block hashes") hash_num = int("0x" + block_hash, 16) ...
[ "def", "add_block_hash", "(", "self", ",", "block_hash", ")", ":", "if", "len", "(", "self", ".", "block_hashes", ")", ">", "2000", ":", "raise", "Exception", "(", "\"A getheaders request cannot have over 2000 block hashes\"", ")", "hash_num", "=", "int", "(", "...
Append up to 2000 block hashes for which to get headers.
[ "Append", "up", "to", "2000", "block", "hashes", "for", "which", "to", "get", "headers", "." ]
fcfc970064ca7dfcab26ebd3ab955870a763ea39
https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/blockchain/bitcoin_blockchain/spv.py#L144-L157
train
63,870
blockstack/virtualchain
virtualchain/lib/blockchain/bitcoin_blockchain/spv.py
BlockHeaderClient.run
def run( self ): """ Interact with the blockchain peer, until we get a socket error or we exit the loop explicitly. Return True on success Raise on error """ self.handshake() try: self.loop() except socket.error, se: ...
python
def run( self ): """ Interact with the blockchain peer, until we get a socket error or we exit the loop explicitly. Return True on success Raise on error """ self.handshake() try: self.loop() except socket.error, se: ...
[ "def", "run", "(", "self", ")", ":", "self", ".", "handshake", "(", ")", "try", ":", "self", ".", "loop", "(", ")", "except", "socket", ".", "error", ",", "se", ":", "if", "self", ".", "finished", ":", "return", "True", "else", ":", "raise" ]
Interact with the blockchain peer, until we get a socket error or we exit the loop explicitly. Return True on success Raise on error
[ "Interact", "with", "the", "blockchain", "peer", "until", "we", "get", "a", "socket", "error", "or", "we", "exit", "the", "loop", "explicitly", ".", "Return", "True", "on", "success", "Raise", "on", "error" ]
fcfc970064ca7dfcab26ebd3ab955870a763ea39
https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/blockchain/bitcoin_blockchain/spv.py#L221-L238
train
63,871
blockstack/virtualchain
virtualchain/lib/blockchain/bitcoin_blockchain/spv.py
BlockHeaderClient.handle_ping
def handle_ping(self, message_header, message): """ This method will handle the Ping message and then will answer every Ping message with a Pong message using the nonce received. :param message_header: The header of the Ping message :param message: The Ping message ...
python
def handle_ping(self, message_header, message): """ This method will handle the Ping message and then will answer every Ping message with a Pong message using the nonce received. :param message_header: The header of the Ping message :param message: The Ping message ...
[ "def", "handle_ping", "(", "self", ",", "message_header", ",", "message", ")", ":", "log", ".", "debug", "(", "\"handle ping\"", ")", "pong", "=", "Pong", "(", ")", "pong", ".", "nonce", "=", "message", ".", "nonce", "log", ".", "debug", "(", "\"send p...
This method will handle the Ping message and then will answer every Ping message with a Pong message using the nonce received. :param message_header: The header of the Ping message :param message: The Ping message
[ "This", "method", "will", "handle", "the", "Ping", "message", "and", "then", "will", "answer", "every", "Ping", "message", "with", "a", "Pong", "message", "using", "the", "nonce", "received", "." ]
fcfc970064ca7dfcab26ebd3ab955870a763ea39
https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/blockchain/bitcoin_blockchain/spv.py#L395-L408
train
63,872
blockstack/virtualchain
virtualchain/lib/blockchain/bitcoin_blockchain/spv.py
SPVClient.init
def init(cls, path): """ Set up an SPV client. If the locally-stored headers do not exist, then create a stub headers file with the genesis block information. """ if not os.path.exists( path ): block_header_serializer = BlockHeaderSerializer() ge...
python
def init(cls, path): """ Set up an SPV client. If the locally-stored headers do not exist, then create a stub headers file with the genesis block information. """ if not os.path.exists( path ): block_header_serializer = BlockHeaderSerializer() ge...
[ "def", "init", "(", "cls", ",", "path", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "path", ")", ":", "block_header_serializer", "=", "BlockHeaderSerializer", "(", ")", "genesis_block_header", "=", "BlockHeader", "(", ")", "if", "USE_MAIN...
Set up an SPV client. If the locally-stored headers do not exist, then create a stub headers file with the genesis block information.
[ "Set", "up", "an", "SPV", "client", ".", "If", "the", "locally", "-", "stored", "headers", "do", "not", "exist", "then", "create", "a", "stub", "headers", "file", "with", "the", "genesis", "block", "information", "." ]
fcfc970064ca7dfcab26ebd3ab955870a763ea39
https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/blockchain/bitcoin_blockchain/spv.py#L423-L447
train
63,873
blockstack/virtualchain
virtualchain/lib/blockchain/bitcoin_blockchain/spv.py
SPVClient.height
def height(cls, path): """ Get the locally-stored block height """ if os.path.exists( path ): sb = os.stat( path ) h = (sb.st_size / BLOCK_HEADER_SIZE) - 1 return h else: return None
python
def height(cls, path): """ Get the locally-stored block height """ if os.path.exists( path ): sb = os.stat( path ) h = (sb.st_size / BLOCK_HEADER_SIZE) - 1 return h else: return None
[ "def", "height", "(", "cls", ",", "path", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "path", ")", ":", "sb", "=", "os", ".", "stat", "(", "path", ")", "h", "=", "(", "sb", ".", "st_size", "/", "BLOCK_HEADER_SIZE", ")", "-", "1", "...
Get the locally-stored block height
[ "Get", "the", "locally", "-", "stored", "block", "height" ]
fcfc970064ca7dfcab26ebd3ab955870a763ea39
https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/blockchain/bitcoin_blockchain/spv.py#L451-L460
train
63,874
blockstack/virtualchain
virtualchain/lib/blockchain/bitcoin_blockchain/spv.py
SPVClient.read_header
def read_header(cls, headers_path, block_height, allow_none=False): """ Get a block header at a particular height from disk. Return the header if found Return None if not. """ if os.path.exists(headers_path): header_parser = BlockHeaderSerializer() ...
python
def read_header(cls, headers_path, block_height, allow_none=False): """ Get a block header at a particular height from disk. Return the header if found Return None if not. """ if os.path.exists(headers_path): header_parser = BlockHeaderSerializer() ...
[ "def", "read_header", "(", "cls", ",", "headers_path", ",", "block_height", ",", "allow_none", "=", "False", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "headers_path", ")", ":", "header_parser", "=", "BlockHeaderSerializer", "(", ")", "sb", "="...
Get a block header at a particular height from disk. Return the header if found Return None if not.
[ "Get", "a", "block", "header", "at", "a", "particular", "height", "from", "disk", ".", "Return", "the", "header", "if", "found", "Return", "None", "if", "not", "." ]
fcfc970064ca7dfcab26ebd3ab955870a763ea39
https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/blockchain/bitcoin_blockchain/spv.py#L512-L538
train
63,875
blockstack/virtualchain
virtualchain/lib/blockchain/bitcoin_blockchain/spv.py
SPVClient.block_header_verify
def block_header_verify( cls, headers_path, block_id, block_hash, block_header ): """ Given the block's numeric ID, its hash, and the bitcoind-returned block_data, use the SPV header chain to verify the block's integrity. block_header must be a dict with the following structure: ...
python
def block_header_verify( cls, headers_path, block_id, block_hash, block_header ): """ Given the block's numeric ID, its hash, and the bitcoind-returned block_data, use the SPV header chain to verify the block's integrity. block_header must be a dict with the following structure: ...
[ "def", "block_header_verify", "(", "cls", ",", "headers_path", ",", "block_id", ",", "block_hash", ",", "block_header", ")", ":", "prev_header", "=", "cls", ".", "read_header", "(", "headers_path", ",", "block_id", "-", "1", ")", "prev_hash", "=", "prev_header...
Given the block's numeric ID, its hash, and the bitcoind-returned block_data, use the SPV header chain to verify the block's integrity. block_header must be a dict with the following structure: * version: protocol version (int) * prevhash: previous block hash (hex str) * merkler...
[ "Given", "the", "block", "s", "numeric", "ID", "its", "hash", "and", "the", "bitcoind", "-", "returned", "block_data", "use", "the", "SPV", "header", "chain", "to", "verify", "the", "block", "s", "integrity", "." ]
fcfc970064ca7dfcab26ebd3ab955870a763ea39
https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/blockchain/bitcoin_blockchain/spv.py#L594-L614
train
63,876
blockstack/virtualchain
virtualchain/lib/blockchain/bitcoin_blockchain/spv.py
SPVClient.tx_hash
def tx_hash( cls, tx ): """ Calculate the hash of a transction structure given by bitcoind """ tx_hex = bits.btc_bitcoind_tx_serialize( tx ) tx_hash = hashing.bin_double_sha256(tx_hex.decode('hex'))[::-1].encode('hex') return tx_hash
python
def tx_hash( cls, tx ): """ Calculate the hash of a transction structure given by bitcoind """ tx_hex = bits.btc_bitcoind_tx_serialize( tx ) tx_hash = hashing.bin_double_sha256(tx_hex.decode('hex'))[::-1].encode('hex') return tx_hash
[ "def", "tx_hash", "(", "cls", ",", "tx", ")", ":", "tx_hex", "=", "bits", ".", "btc_bitcoind_tx_serialize", "(", "tx", ")", "tx_hash", "=", "hashing", ".", "bin_double_sha256", "(", "tx_hex", ".", "decode", "(", "'hex'", ")", ")", "[", ":", ":", "-", ...
Calculate the hash of a transction structure given by bitcoind
[ "Calculate", "the", "hash", "of", "a", "transction", "structure", "given", "by", "bitcoind" ]
fcfc970064ca7dfcab26ebd3ab955870a763ea39
https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/blockchain/bitcoin_blockchain/spv.py#L636-L642
train
63,877
blockstack/virtualchain
virtualchain/lib/blockchain/bitcoin_blockchain/spv.py
SPVClient.tx_verify
def tx_verify( cls, verified_block_txids, tx ): """ Given the block's verified block txids, verify that a transaction is legit. @tx must be a dict with the following fields: * locktime: int * version: int * vin: list of dicts with: * vout: int, * has...
python
def tx_verify( cls, verified_block_txids, tx ): """ Given the block's verified block txids, verify that a transaction is legit. @tx must be a dict with the following fields: * locktime: int * version: int * vin: list of dicts with: * vout: int, * has...
[ "def", "tx_verify", "(", "cls", ",", "verified_block_txids", ",", "tx", ")", ":", "tx_hash", "=", "cls", ".", "tx_hash", "(", "tx", ")", "return", "tx_hash", "in", "verified_block_txids" ]
Given the block's verified block txids, verify that a transaction is legit. @tx must be a dict with the following fields: * locktime: int * version: int * vin: list of dicts with: * vout: int, * hash: hex str * sequence: int (optional) * script...
[ "Given", "the", "block", "s", "verified", "block", "txids", "verify", "that", "a", "transaction", "is", "legit", "." ]
fcfc970064ca7dfcab26ebd3ab955870a763ea39
https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/blockchain/bitcoin_blockchain/spv.py#L646-L664
train
63,878
blockstack/virtualchain
virtualchain/lib/blockchain/bitcoin_blockchain/spv.py
SPVClient.verify_header_chain
def verify_header_chain(cls, path, chain=None): """ Verify that a given chain of block headers has sufficient proof of work. """ if chain is None: chain = SPVClient.load_header_chain( path ) prev_header = chain[0] for i in xrange(1, len(chain...
python
def verify_header_chain(cls, path, chain=None): """ Verify that a given chain of block headers has sufficient proof of work. """ if chain is None: chain = SPVClient.load_header_chain( path ) prev_header = chain[0] for i in xrange(1, len(chain...
[ "def", "verify_header_chain", "(", "cls", ",", "path", ",", "chain", "=", "None", ")", ":", "if", "chain", "is", "None", ":", "chain", "=", "SPVClient", ".", "load_header_chain", "(", "path", ")", "prev_header", "=", "chain", "[", "0", "]", "for", "i",...
Verify that a given chain of block headers has sufficient proof of work.
[ "Verify", "that", "a", "given", "chain", "of", "block", "headers", "has", "sufficient", "proof", "of", "work", "." ]
fcfc970064ca7dfcab26ebd3ab955870a763ea39
https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/blockchain/bitcoin_blockchain/spv.py#L699-L729
train
63,879
blockstack/virtualchain
virtualchain/lib/blockchain/bitcoin_blockchain/spv.py
SPVClient.sync_header_chain
def sync_header_chain(cls, path, bitcoind_server, last_block_id ): """ Synchronize our local block headers up to the last block ID given. @last_block_id is *inclusive* @bitcoind_server is host:port or just host """ current_block_id = SPVClient.height( path ) if cu...
python
def sync_header_chain(cls, path, bitcoind_server, last_block_id ): """ Synchronize our local block headers up to the last block ID given. @last_block_id is *inclusive* @bitcoind_server is host:port or just host """ current_block_id = SPVClient.height( path ) if cu...
[ "def", "sync_header_chain", "(", "cls", ",", "path", ",", "bitcoind_server", ",", "last_block_id", ")", ":", "current_block_id", "=", "SPVClient", ".", "height", "(", "path", ")", "if", "current_block_id", "is", "None", ":", "assert", "USE_TESTNET", "current_blo...
Synchronize our local block headers up to the last block ID given. @last_block_id is *inclusive* @bitcoind_server is host:port or just host
[ "Synchronize", "our", "local", "block", "headers", "up", "to", "the", "last", "block", "ID", "given", "." ]
fcfc970064ca7dfcab26ebd3ab955870a763ea39
https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/blockchain/bitcoin_blockchain/spv.py#L733-L793
train
63,880
mdickinson/bigfloat
bigfloat/ieee.py
IEEEContext
def IEEEContext(bitwidth): """ Return IEEE 754-2008 context for a given bit width. The IEEE 754 standard specifies binary interchange formats with bitwidths 16, 32, 64, 128, and all multiples of 32 greater than 128. This function returns the context corresponding to the interchange format for the ...
python
def IEEEContext(bitwidth): """ Return IEEE 754-2008 context for a given bit width. The IEEE 754 standard specifies binary interchange formats with bitwidths 16, 32, 64, 128, and all multiples of 32 greater than 128. This function returns the context corresponding to the interchange format for the ...
[ "def", "IEEEContext", "(", "bitwidth", ")", ":", "try", ":", "precision", "=", "{", "16", ":", "11", ",", "32", ":", "24", ",", "64", ":", "53", ",", "128", ":", "113", "}", "[", "bitwidth", "]", "except", "KeyError", ":", "if", "not", "(", "bi...
Return IEEE 754-2008 context for a given bit width. The IEEE 754 standard specifies binary interchange formats with bitwidths 16, 32, 64, 128, and all multiples of 32 greater than 128. This function returns the context corresponding to the interchange format for the given bitwidth. See section 3....
[ "Return", "IEEE", "754", "-", "2008", "context", "for", "a", "given", "bit", "width", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/ieee.py#L22-L58
train
63,881
mcocdawc/chemcoord
src/chemcoord/cartesian_coordinates/xyz_functions.py
view
def view(molecule, viewer=settings['defaults']['viewer'], use_curr_dir=False): """View your molecule or list of molecules. .. note:: This function writes a temporary file and opens it with an external viewer. If you modify your molecule afterwards you have to recall view in order to see...
python
def view(molecule, viewer=settings['defaults']['viewer'], use_curr_dir=False): """View your molecule or list of molecules. .. note:: This function writes a temporary file and opens it with an external viewer. If you modify your molecule afterwards you have to recall view in order to see...
[ "def", "view", "(", "molecule", ",", "viewer", "=", "settings", "[", "'defaults'", "]", "[", "'viewer'", "]", ",", "use_curr_dir", "=", "False", ")", ":", "try", ":", "molecule", ".", "view", "(", "viewer", "=", "viewer", ",", "use_curr_dir", "=", "use...
View your molecule or list of molecules. .. note:: This function writes a temporary file and opens it with an external viewer. If you modify your molecule afterwards you have to recall view in order to see the changes. Args: molecule: Can be a cartesian, or a list of cartesians...
[ "View", "your", "molecule", "or", "list", "of", "molecules", "." ]
95561ce387c142227c38fb14a1d182179aef8f5f
https://github.com/mcocdawc/chemcoord/blob/95561ce387c142227c38fb14a1d182179aef8f5f/src/chemcoord/cartesian_coordinates/xyz_functions.py#L21-L73
train
63,882
mcocdawc/chemcoord
src/chemcoord/cartesian_coordinates/xyz_functions.py
to_molden
def to_molden(cartesian_list, buf=None, sort_index=True, overwrite=True, float_format='{:.6f}'.format): """Write a list of Cartesians into a molden file. .. note:: Since it permamently writes a file, this function is strictly speaking **not sideeffect free**. The list to be writte...
python
def to_molden(cartesian_list, buf=None, sort_index=True, overwrite=True, float_format='{:.6f}'.format): """Write a list of Cartesians into a molden file. .. note:: Since it permamently writes a file, this function is strictly speaking **not sideeffect free**. The list to be writte...
[ "def", "to_molden", "(", "cartesian_list", ",", "buf", "=", "None", ",", "sort_index", "=", "True", ",", "overwrite", "=", "True", ",", "float_format", "=", "'{:.6f}'", ".", "format", ")", ":", "if", "sort_index", ":", "cartesian_list", "=", "[", "molecule...
Write a list of Cartesians into a molden file. .. note:: Since it permamently writes a file, this function is strictly speaking **not sideeffect free**. The list to be written is of course not changed. Args: cartesian_list (list): buf (str): StringIO-like, optional buffer to wr...
[ "Write", "a", "list", "of", "Cartesians", "into", "a", "molden", "file", "." ]
95561ce387c142227c38fb14a1d182179aef8f5f
https://github.com/mcocdawc/chemcoord/blob/95561ce387c142227c38fb14a1d182179aef8f5f/src/chemcoord/cartesian_coordinates/xyz_functions.py#L76-L127
train
63,883
mcocdawc/chemcoord
src/chemcoord/cartesian_coordinates/xyz_functions.py
read_molden
def read_molden(inputfile, start_index=0, get_bonds=True): """Read a molden file. Args: inputfile (str): start_index (int): Returns: list: A list containing :class:`~chemcoord.Cartesian` is returned. """ from chemcoord.cartesian_coordinates.cartesian_class_main import Carte...
python
def read_molden(inputfile, start_index=0, get_bonds=True): """Read a molden file. Args: inputfile (str): start_index (int): Returns: list: A list containing :class:`~chemcoord.Cartesian` is returned. """ from chemcoord.cartesian_coordinates.cartesian_class_main import Carte...
[ "def", "read_molden", "(", "inputfile", ",", "start_index", "=", "0", ",", "get_bonds", "=", "True", ")", ":", "from", "chemcoord", ".", "cartesian_coordinates", ".", "cartesian_class_main", "import", "Cartesian", "with", "open", "(", "inputfile", ",", "'r'", ...
Read a molden file. Args: inputfile (str): start_index (int): Returns: list: A list containing :class:`~chemcoord.Cartesian` is returned.
[ "Read", "a", "molden", "file", "." ]
95561ce387c142227c38fb14a1d182179aef8f5f
https://github.com/mcocdawc/chemcoord/blob/95561ce387c142227c38fb14a1d182179aef8f5f/src/chemcoord/cartesian_coordinates/xyz_functions.py#L140-L184
train
63,884
mcocdawc/chemcoord
src/chemcoord/cartesian_coordinates/xyz_functions.py
concat
def concat(cartesians, ignore_index=False, keys=None): """Join list of cartesians into one molecule. Wrapper around the :func:`pandas.concat` function. Default values are the same as in the pandas function except for ``verify_integrity`` which is set to true in case of this library. Args: ...
python
def concat(cartesians, ignore_index=False, keys=None): """Join list of cartesians into one molecule. Wrapper around the :func:`pandas.concat` function. Default values are the same as in the pandas function except for ``verify_integrity`` which is set to true in case of this library. Args: ...
[ "def", "concat", "(", "cartesians", ",", "ignore_index", "=", "False", ",", "keys", "=", "None", ")", ":", "frames", "=", "[", "molecule", ".", "_frame", "for", "molecule", "in", "cartesians", "]", "new", "=", "pd", ".", "concat", "(", "frames", ",", ...
Join list of cartesians into one molecule. Wrapper around the :func:`pandas.concat` function. Default values are the same as in the pandas function except for ``verify_integrity`` which is set to true in case of this library. Args: ignore_index (sequence, bool, int): If it is a boolean, it ...
[ "Join", "list", "of", "cartesians", "into", "one", "molecule", "." ]
95561ce387c142227c38fb14a1d182179aef8f5f
https://github.com/mcocdawc/chemcoord/blob/95561ce387c142227c38fb14a1d182179aef8f5f/src/chemcoord/cartesian_coordinates/xyz_functions.py#L240-L277
train
63,885
mcocdawc/chemcoord
src/chemcoord/cartesian_coordinates/xyz_functions.py
dot
def dot(A, B): """Matrix multiplication between A and B This function is equivalent to ``A @ B``, which is unfortunately not possible under python 2.x. Args: A (sequence): B (sequence): Returns: sequence: """ try: result = A.__matmul__(B) if result ...
python
def dot(A, B): """Matrix multiplication between A and B This function is equivalent to ``A @ B``, which is unfortunately not possible under python 2.x. Args: A (sequence): B (sequence): Returns: sequence: """ try: result = A.__matmul__(B) if result ...
[ "def", "dot", "(", "A", ",", "B", ")", ":", "try", ":", "result", "=", "A", ".", "__matmul__", "(", "B", ")", "if", "result", "is", "NotImplemented", ":", "result", "=", "B", ".", "__rmatmul__", "(", "A", ")", "except", "AttributeError", ":", "resu...
Matrix multiplication between A and B This function is equivalent to ``A @ B``, which is unfortunately not possible under python 2.x. Args: A (sequence): B (sequence): Returns: sequence:
[ "Matrix", "multiplication", "between", "A", "and", "B" ]
95561ce387c142227c38fb14a1d182179aef8f5f
https://github.com/mcocdawc/chemcoord/blob/95561ce387c142227c38fb14a1d182179aef8f5f/src/chemcoord/cartesian_coordinates/xyz_functions.py#L280-L299
train
63,886
mcocdawc/chemcoord
src/chemcoord/cartesian_coordinates/xyz_functions.py
orthonormalize_righthanded
def orthonormalize_righthanded(basis): """Orthonormalizes righthandedly a given 3D basis. This functions returns a right handed orthonormalize_righthandedd basis. Since only the first two vectors in the basis are used, it does not matter if you give two or three vectors. Right handed means, that: ...
python
def orthonormalize_righthanded(basis): """Orthonormalizes righthandedly a given 3D basis. This functions returns a right handed orthonormalize_righthandedd basis. Since only the first two vectors in the basis are used, it does not matter if you give two or three vectors. Right handed means, that: ...
[ "def", "orthonormalize_righthanded", "(", "basis", ")", ":", "v1", ",", "v2", "=", "basis", "[", ":", ",", "0", "]", ",", "basis", "[", ":", ",", "1", "]", "e1", "=", "normalize", "(", "v1", ")", "e3", "=", "normalize", "(", "np", ".", "cross", ...
Orthonormalizes righthandedly a given 3D basis. This functions returns a right handed orthonormalize_righthandedd basis. Since only the first two vectors in the basis are used, it does not matter if you give two or three vectors. Right handed means, that: .. math:: \\vec{e_1} \\times \\v...
[ "Orthonormalizes", "righthandedly", "a", "given", "3D", "basis", "." ]
95561ce387c142227c38fb14a1d182179aef8f5f
https://github.com/mcocdawc/chemcoord/blob/95561ce387c142227c38fb14a1d182179aef8f5f/src/chemcoord/cartesian_coordinates/xyz_functions.py#L393-L418
train
63,887
mcocdawc/chemcoord
src/chemcoord/cartesian_coordinates/xyz_functions.py
get_kabsch_rotation
def get_kabsch_rotation(Q, P): """Calculate the optimal rotation from ``P`` unto ``Q``. Using the Kabsch algorithm the optimal rotation matrix for the rotation of ``other`` unto ``self`` is calculated. The algorithm is described very well in `wikipedia <http://en.wikipedia.org/wiki/Kabsch_algorithm...
python
def get_kabsch_rotation(Q, P): """Calculate the optimal rotation from ``P`` unto ``Q``. Using the Kabsch algorithm the optimal rotation matrix for the rotation of ``other`` unto ``self`` is calculated. The algorithm is described very well in `wikipedia <http://en.wikipedia.org/wiki/Kabsch_algorithm...
[ "def", "get_kabsch_rotation", "(", "Q", ",", "P", ")", ":", "# Naming of variables follows the wikipedia article:", "# http://en.wikipedia.org/wiki/Kabsch_algorithm", "A", "=", "np", ".", "dot", "(", "np", ".", "transpose", "(", "P", ")", ",", "Q", ")", "# One can't...
Calculate the optimal rotation from ``P`` unto ``Q``. Using the Kabsch algorithm the optimal rotation matrix for the rotation of ``other`` unto ``self`` is calculated. The algorithm is described very well in `wikipedia <http://en.wikipedia.org/wiki/Kabsch_algorithm>`_. Args: other (Cartesi...
[ "Calculate", "the", "optimal", "rotation", "from", "P", "unto", "Q", "." ]
95561ce387c142227c38fb14a1d182179aef8f5f
https://github.com/mcocdawc/chemcoord/blob/95561ce387c142227c38fb14a1d182179aef8f5f/src/chemcoord/cartesian_coordinates/xyz_functions.py#L421-L442
train
63,888
mcocdawc/chemcoord
src/chemcoord/cartesian_coordinates/xyz_functions.py
apply_grad_zmat_tensor
def apply_grad_zmat_tensor(grad_C, construction_table, cart_dist): """Apply the gradient for transformation to Zmatrix space onto cart_dist. Args: grad_C (:class:`numpy.ndarray`): A ``(3, n, n, 3)`` array. The mathematical details of the index layout is explained in :meth:`~chem...
python
def apply_grad_zmat_tensor(grad_C, construction_table, cart_dist): """Apply the gradient for transformation to Zmatrix space onto cart_dist. Args: grad_C (:class:`numpy.ndarray`): A ``(3, n, n, 3)`` array. The mathematical details of the index layout is explained in :meth:`~chem...
[ "def", "apply_grad_zmat_tensor", "(", "grad_C", ",", "construction_table", ",", "cart_dist", ")", ":", "if", "(", "construction_table", ".", "index", "!=", "cart_dist", ".", "index", ")", ".", "any", "(", ")", ":", "message", "=", "\"construction_table and cart_...
Apply the gradient for transformation to Zmatrix space onto cart_dist. Args: grad_C (:class:`numpy.ndarray`): A ``(3, n, n, 3)`` array. The mathematical details of the index layout is explained in :meth:`~chemcoord.Cartesian.get_grad_zmat()`. construction_table (pandas.DataF...
[ "Apply", "the", "gradient", "for", "transformation", "to", "Zmatrix", "space", "onto", "cart_dist", "." ]
95561ce387c142227c38fb14a1d182179aef8f5f
https://github.com/mcocdawc/chemcoord/blob/95561ce387c142227c38fb14a1d182179aef8f5f/src/chemcoord/cartesian_coordinates/xyz_functions.py#L445-L481
train
63,889
emory-libraries/eulxml
eulxml/xmlmap/fields.py
_remove_child_node
def _remove_child_node(node, context, xast, if_empty=False): '''Remove a child node based on the specified xpath. :param node: lxml element relative to which the xpath will be interpreted :param context: any context required for the xpath (e.g., namespace definitions) :param xast: parsed xpat...
python
def _remove_child_node(node, context, xast, if_empty=False): '''Remove a child node based on the specified xpath. :param node: lxml element relative to which the xpath will be interpreted :param context: any context required for the xpath (e.g., namespace definitions) :param xast: parsed xpat...
[ "def", "_remove_child_node", "(", "node", ",", "context", ",", "xast", ",", "if_empty", "=", "False", ")", ":", "xpath", "=", "serialize", "(", "xast", ")", "child", "=", "_find_xml_node", "(", "xpath", ",", "node", ",", "context", ")", "if", "child", ...
Remove a child node based on the specified xpath. :param node: lxml element relative to which the xpath will be interpreted :param context: any context required for the xpath (e.g., namespace definitions) :param xast: parsed xpath (xpath abstract syntax tree) from :mod:`eulxml.xpath` :param ...
[ "Remove", "a", "child", "node", "based", "on", "the", "specified", "xpath", "." ]
17d71c7d98c0cebda9932b7f13e72093805e1fe2
https://github.com/emory-libraries/eulxml/blob/17d71c7d98c0cebda9932b7f13e72093805e1fe2/eulxml/xmlmap/fields.py#L483-L506
train
63,890
emory-libraries/eulxml
eulxml/xmlmap/fields.py
_remove_predicates
def _remove_predicates(xast, node, context): '''Remove any constructible predicates specified in the xpath relative to the specified node. :param xast: parsed xpath (xpath abstract syntax tree) from :mod:`eulxml.xpath` :param node: lxml element which predicates will be removed from :param context:...
python
def _remove_predicates(xast, node, context): '''Remove any constructible predicates specified in the xpath relative to the specified node. :param xast: parsed xpath (xpath abstract syntax tree) from :mod:`eulxml.xpath` :param node: lxml element which predicates will be removed from :param context:...
[ "def", "_remove_predicates", "(", "xast", ",", "node", ",", "context", ")", ":", "# work from a copy since it may be modified", "xast_c", "=", "deepcopy", "(", "xast", ")", "# check if predicates are constructable", "for", "pred", "in", "list", "(", "xast_c", ".", "...
Remove any constructible predicates specified in the xpath relative to the specified node. :param xast: parsed xpath (xpath abstract syntax tree) from :mod:`eulxml.xpath` :param node: lxml element which predicates will be removed from :param context: any context required for the xpath (e.g., name...
[ "Remove", "any", "constructible", "predicates", "specified", "in", "the", "xpath", "relative", "to", "the", "specified", "node", "." ]
17d71c7d98c0cebda9932b7f13e72093805e1fe2
https://github.com/emory-libraries/eulxml/blob/17d71c7d98c0cebda9932b7f13e72093805e1fe2/eulxml/xmlmap/fields.py#L513-L559
train
63,891
emory-libraries/eulxml
eulxml/xmlmap/fields.py
NodeList.pop
def pop(self, i=None): """Remove the item at the given position in the list, and return it. If no index is specified, removes and returns the last item in the list.""" if i is None: i = len(self) - 1 val = self[i] del(self[i]) return val
python
def pop(self, i=None): """Remove the item at the given position in the list, and return it. If no index is specified, removes and returns the last item in the list.""" if i is None: i = len(self) - 1 val = self[i] del(self[i]) return val
[ "def", "pop", "(", "self", ",", "i", "=", "None", ")", ":", "if", "i", "is", "None", ":", "i", "=", "len", "(", "self", ")", "-", "1", "val", "=", "self", "[", "i", "]", "del", "(", "self", "[", "i", "]", ")", "return", "val" ]
Remove the item at the given position in the list, and return it. If no index is specified, removes and returns the last item in the list.
[ "Remove", "the", "item", "at", "the", "given", "position", "in", "the", "list", "and", "return", "it", ".", "If", "no", "index", "is", "specified", "removes", "and", "returns", "the", "last", "item", "in", "the", "list", "." ]
17d71c7d98c0cebda9932b7f13e72093805e1fe2
https://github.com/emory-libraries/eulxml/blob/17d71c7d98c0cebda9932b7f13e72093805e1fe2/eulxml/xmlmap/fields.py#L800-L807
train
63,892
probcomp/crosscat
src/utils/general_utils.py
get_scc_from_tuples
def get_scc_from_tuples(constraints): """Given set of equivalences, return map of transitive equivalence classes. >> constraints = [(1,2), (2,3)] >> get_scc_from_tuples(constraints) { 1: (1, 2, 3), 2: (1, 2, 3), 3: (1, 2, 3), } """ classes = unionfind.classes(constra...
python
def get_scc_from_tuples(constraints): """Given set of equivalences, return map of transitive equivalence classes. >> constraints = [(1,2), (2,3)] >> get_scc_from_tuples(constraints) { 1: (1, 2, 3), 2: (1, 2, 3), 3: (1, 2, 3), } """ classes = unionfind.classes(constra...
[ "def", "get_scc_from_tuples", "(", "constraints", ")", ":", "classes", "=", "unionfind", ".", "classes", "(", "constraints", ")", "return", "dict", "(", "(", "x", ",", "tuple", "(", "c", ")", ")", "for", "x", ",", "c", "in", "classes", ".", "iteritems"...
Given set of equivalences, return map of transitive equivalence classes. >> constraints = [(1,2), (2,3)] >> get_scc_from_tuples(constraints) { 1: (1, 2, 3), 2: (1, 2, 3), 3: (1, 2, 3), }
[ "Given", "set", "of", "equivalences", "return", "map", "of", "transitive", "equivalence", "classes", "." ]
4a05bddb06a45f3b7b3e05e095720f16257d1535
https://github.com/probcomp/crosscat/blob/4a05bddb06a45f3b7b3e05e095720f16257d1535/src/utils/general_utils.py#L206-L218
train
63,893
emory-libraries/eulxml
eulxml/forms/xmlobject.py
_parse_field_list
def _parse_field_list(fieldnames, include_parents=False): """ Parse a list of field names, possibly including dot-separated subform fields, into an internal ParsedFieldList object representing the base fields and subform listed. :param fieldnames: a list of field names as strings. dot-separated nam...
python
def _parse_field_list(fieldnames, include_parents=False): """ Parse a list of field names, possibly including dot-separated subform fields, into an internal ParsedFieldList object representing the base fields and subform listed. :param fieldnames: a list of field names as strings. dot-separated nam...
[ "def", "_parse_field_list", "(", "fieldnames", ",", "include_parents", "=", "False", ")", ":", "field_parts", "=", "(", "name", ".", "split", "(", "'.'", ")", "for", "name", "in", "fieldnames", ")", "return", "_collect_fields", "(", "field_parts", ",", "incl...
Parse a list of field names, possibly including dot-separated subform fields, into an internal ParsedFieldList object representing the base fields and subform listed. :param fieldnames: a list of field names as strings. dot-separated names are interpreted as subform fields. :param include_paren...
[ "Parse", "a", "list", "of", "field", "names", "possibly", "including", "dot", "-", "separated", "subform", "fields", "into", "an", "internal", "ParsedFieldList", "object", "representing", "the", "base", "fields", "and", "subform", "listed", "." ]
17d71c7d98c0cebda9932b7f13e72093805e1fe2
https://github.com/emory-libraries/eulxml/blob/17d71c7d98c0cebda9932b7f13e72093805e1fe2/eulxml/forms/xmlobject.py#L44-L57
train
63,894
emory-libraries/eulxml
eulxml/forms/xmlobject.py
xmlobject_to_dict
def xmlobject_to_dict(instance, fields=None, exclude=None, prefix=''): """ Generate a dictionary based on the data in an XmlObject instance to pass as a Form's ``initial`` keyword argument. :param instance: instance of :class:`~eulxml.xmlmap.XmlObject` :param fields: optional list of fields - if sp...
python
def xmlobject_to_dict(instance, fields=None, exclude=None, prefix=''): """ Generate a dictionary based on the data in an XmlObject instance to pass as a Form's ``initial`` keyword argument. :param instance: instance of :class:`~eulxml.xmlmap.XmlObject` :param fields: optional list of fields - if sp...
[ "def", "xmlobject_to_dict", "(", "instance", ",", "fields", "=", "None", ",", "exclude", "=", "None", ",", "prefix", "=", "''", ")", ":", "data", "=", "{", "}", "# convert prefix to combining form for convenience", "if", "prefix", ":", "prefix", "=", "'%s-'", ...
Generate a dictionary based on the data in an XmlObject instance to pass as a Form's ``initial`` keyword argument. :param instance: instance of :class:`~eulxml.xmlmap.XmlObject` :param fields: optional list of fields - if specified, only the named fields will be included in the data returned ...
[ "Generate", "a", "dictionary", "based", "on", "the", "data", "in", "an", "XmlObject", "instance", "to", "pass", "as", "a", "Form", "s", "initial", "keyword", "argument", "." ]
17d71c7d98c0cebda9932b7f13e72093805e1fe2
https://github.com/emory-libraries/eulxml/blob/17d71c7d98c0cebda9932b7f13e72093805e1fe2/eulxml/forms/xmlobject.py#L317-L354
train
63,895
emory-libraries/eulxml
eulxml/forms/xmlobject.py
XmlObjectForm.update_instance
def update_instance(self): """Save bound form data into the XmlObject model instance and return the updated instance.""" # NOTE: django model form has a save method - not applicable here, # since an XmlObject by itself is not expected to have a save method # (only likely to be s...
python
def update_instance(self): """Save bound form data into the XmlObject model instance and return the updated instance.""" # NOTE: django model form has a save method - not applicable here, # since an XmlObject by itself is not expected to have a save method # (only likely to be s...
[ "def", "update_instance", "(", "self", ")", ":", "# NOTE: django model form has a save method - not applicable here,", "# since an XmlObject by itself is not expected to have a save method", "# (only likely to be saved in context of a fedora or exist object)", "if", "hasattr", "(", "self", ...
Save bound form data into the XmlObject model instance and return the updated instance.
[ "Save", "bound", "form", "data", "into", "the", "XmlObject", "model", "instance", "and", "return", "the", "updated", "instance", "." ]
17d71c7d98c0cebda9932b7f13e72093805e1fe2
https://github.com/emory-libraries/eulxml/blob/17d71c7d98c0cebda9932b7f13e72093805e1fe2/eulxml/forms/xmlobject.py#L546-L593
train
63,896
emory-libraries/eulxml
eulxml/forms/xmlobject.py
XmlObjectForm._update_subinstance
def _update_subinstance(self, name, subform): """Save bound data for a single subform into the XmlObject model instance.""" old_subinstance = getattr(self.instance, name) new_subinstance = subform.update_instance() # if our instance previously had no node for the subform AND the...
python
def _update_subinstance(self, name, subform): """Save bound data for a single subform into the XmlObject model instance.""" old_subinstance = getattr(self.instance, name) new_subinstance = subform.update_instance() # if our instance previously had no node for the subform AND the...
[ "def", "_update_subinstance", "(", "self", ",", "name", ",", "subform", ")", ":", "old_subinstance", "=", "getattr", "(", "self", ".", "instance", ",", "name", ")", "new_subinstance", "=", "subform", ".", "update_instance", "(", ")", "# if our instance previousl...
Save bound data for a single subform into the XmlObject model instance.
[ "Save", "bound", "data", "for", "a", "single", "subform", "into", "the", "XmlObject", "model", "instance", "." ]
17d71c7d98c0cebda9932b7f13e72093805e1fe2
https://github.com/emory-libraries/eulxml/blob/17d71c7d98c0cebda9932b7f13e72093805e1fe2/eulxml/forms/xmlobject.py#L595-L609
train
63,897
blockstack/virtualchain
virtualchain/lib/blockchain/session.py
create_bitcoind_connection
def create_bitcoind_connection( rpc_username, rpc_password, server, port, use_https, timeout ): """ Creates an RPC client to a bitcoind instance. It will have ".opts" defined as a member, which will be a dict that stores the above connection options. """ from .bitcoin_blockchain import AuthServ...
python
def create_bitcoind_connection( rpc_username, rpc_password, server, port, use_https, timeout ): """ Creates an RPC client to a bitcoind instance. It will have ".opts" defined as a member, which will be a dict that stores the above connection options. """ from .bitcoin_blockchain import AuthServ...
[ "def", "create_bitcoind_connection", "(", "rpc_username", ",", "rpc_password", ",", "server", ",", "port", ",", "use_https", ",", "timeout", ")", ":", "from", ".", "bitcoin_blockchain", "import", "AuthServiceProxy", "global", "do_wrap_socket", ",", "create_ssl_authpro...
Creates an RPC client to a bitcoind instance. It will have ".opts" defined as a member, which will be a dict that stores the above connection options.
[ "Creates", "an", "RPC", "client", "to", "a", "bitcoind", "instance", ".", "It", "will", "have", ".", "opts", "defined", "as", "a", "member", "which", "will", "be", "a", "dict", "that", "stores", "the", "above", "connection", "options", "." ]
fcfc970064ca7dfcab26ebd3ab955870a763ea39
https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/blockchain/session.py#L94-L148
train
63,898
blockstack/virtualchain
virtualchain/lib/blockchain/session.py
connect_bitcoind_impl
def connect_bitcoind_impl( bitcoind_opts ): """ Create a connection to bitcoind, using a dict of config options. """ if 'bitcoind_port' not in bitcoind_opts.keys() or bitcoind_opts['bitcoind_port'] is None: log.error("No port given") raise ValueError("No RPC port given (bitcoind_port)")...
python
def connect_bitcoind_impl( bitcoind_opts ): """ Create a connection to bitcoind, using a dict of config options. """ if 'bitcoind_port' not in bitcoind_opts.keys() or bitcoind_opts['bitcoind_port'] is None: log.error("No port given") raise ValueError("No RPC port given (bitcoind_port)")...
[ "def", "connect_bitcoind_impl", "(", "bitcoind_opts", ")", ":", "if", "'bitcoind_port'", "not", "in", "bitcoind_opts", ".", "keys", "(", ")", "or", "bitcoind_opts", "[", "'bitcoind_port'", "]", "is", "None", ":", "log", ".", "error", "(", "\"No port given\"", ...
Create a connection to bitcoind, using a dict of config options.
[ "Create", "a", "connection", "to", "bitcoind", "using", "a", "dict", "of", "config", "options", "." ]
fcfc970064ca7dfcab26ebd3ab955870a763ea39
https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/blockchain/session.py#L151-L178
train
63,899