partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | floor | Floor function (round towards negative infinity) | mcerp/umath.py | def floor(x):
"""
Floor function (round towards negative infinity)
"""
if isinstance(x, UncertainFunction):
mcpts = np.floor(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.floor(x) | def floor(x):
"""
Floor function (round towards negative infinity)
"""
if isinstance(x, UncertainFunction):
mcpts = np.floor(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.floor(x) | [
"Floor",
"function",
"(",
"round",
"towards",
"negative",
"infinity",
")"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L172-L180 | [
"def",
"floor",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"floor",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | hypot | Calculate the hypotenuse given two "legs" of a right triangle | mcerp/umath.py | def hypot(x, y):
"""
Calculate the hypotenuse given two "legs" of a right triangle
"""
if isinstance(x, UncertainFunction) or isinstance(x, UncertainFunction):
ufx = to_uncertain_func(x)
ufy = to_uncertain_func(y)
mcpts = np.hypot(ufx._mcpts, ufy._mcpts)
return UncertainF... | def hypot(x, y):
"""
Calculate the hypotenuse given two "legs" of a right triangle
"""
if isinstance(x, UncertainFunction) or isinstance(x, UncertainFunction):
ufx = to_uncertain_func(x)
ufy = to_uncertain_func(y)
mcpts = np.hypot(ufx._mcpts, ufy._mcpts)
return UncertainF... | [
"Calculate",
"the",
"hypotenuse",
"given",
"two",
"legs",
"of",
"a",
"right",
"triangle"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L183-L193 | [
"def",
"hypot",
"(",
"x",
",",
"y",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
"or",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"ufx",
"=",
"to_uncertain_func",
"(",
"x",
")",
"ufy",
"=",
"to_uncertain_func",
... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | log | Natural logarithm | mcerp/umath.py | def log(x):
"""
Natural logarithm
"""
if isinstance(x, UncertainFunction):
mcpts = np.log(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.log(x) | def log(x):
"""
Natural logarithm
"""
if isinstance(x, UncertainFunction):
mcpts = np.log(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.log(x) | [
"Natural",
"logarithm"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L203-L211 | [
"def",
"log",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"log",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
"l... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | log10 | Base-10 logarithm | mcerp/umath.py | def log10(x):
"""
Base-10 logarithm
"""
if isinstance(x, UncertainFunction):
mcpts = np.log10(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.log10(x) | def log10(x):
"""
Base-10 logarithm
"""
if isinstance(x, UncertainFunction):
mcpts = np.log10(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.log10(x) | [
"Base",
"-",
"10",
"logarithm"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L214-L222 | [
"def",
"log10",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"log10",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | log1p | Natural logarithm of (1 + x) | mcerp/umath.py | def log1p(x):
"""
Natural logarithm of (1 + x)
"""
if isinstance(x, UncertainFunction):
mcpts = np.log1p(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.log1p(x) | def log1p(x):
"""
Natural logarithm of (1 + x)
"""
if isinstance(x, UncertainFunction):
mcpts = np.log1p(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.log1p(x) | [
"Natural",
"logarithm",
"of",
"(",
"1",
"+",
"x",
")"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L225-L233 | [
"def",
"log1p",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"log1p",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | radians | Convert degrees to radians | mcerp/umath.py | def radians(x):
"""
Convert degrees to radians
"""
if isinstance(x, UncertainFunction):
mcpts = np.radians(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.radians(x) | def radians(x):
"""
Convert degrees to radians
"""
if isinstance(x, UncertainFunction):
mcpts = np.radians(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.radians(x) | [
"Convert",
"degrees",
"to",
"radians"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L236-L244 | [
"def",
"radians",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"radians",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
"... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | sin | Sine | mcerp/umath.py | def sin(x):
"""
Sine
"""
if isinstance(x, UncertainFunction):
mcpts = np.sin(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.sin(x) | def sin(x):
"""
Sine
"""
if isinstance(x, UncertainFunction):
mcpts = np.sin(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.sin(x) | [
"Sine"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L247-L255 | [
"def",
"sin",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"sin",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
"s... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | sinh | Hyperbolic sine | mcerp/umath.py | def sinh(x):
"""
Hyperbolic sine
"""
if isinstance(x, UncertainFunction):
mcpts = np.sinh(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.sinh(x) | def sinh(x):
"""
Hyperbolic sine
"""
if isinstance(x, UncertainFunction):
mcpts = np.sinh(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.sinh(x) | [
"Hyperbolic",
"sine"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L258-L266 | [
"def",
"sinh",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"sinh",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | sqrt | Square-root function | mcerp/umath.py | def sqrt(x):
"""
Square-root function
"""
if isinstance(x, UncertainFunction):
mcpts = np.sqrt(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.sqrt(x) | def sqrt(x):
"""
Square-root function
"""
if isinstance(x, UncertainFunction):
mcpts = np.sqrt(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.sqrt(x) | [
"Square",
"-",
"root",
"function"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L269-L277 | [
"def",
"sqrt",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"sqrt",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | tan | Tangent | mcerp/umath.py | def tan(x):
"""
Tangent
"""
if isinstance(x, UncertainFunction):
mcpts = np.tan(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.tan(x) | def tan(x):
"""
Tangent
"""
if isinstance(x, UncertainFunction):
mcpts = np.tan(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.tan(x) | [
"Tangent"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L280-L288 | [
"def",
"tan",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"tan",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
"t... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | tanh | Hyperbolic tangent | mcerp/umath.py | def tanh(x):
"""
Hyperbolic tangent
"""
if isinstance(x, UncertainFunction):
mcpts = np.tanh(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.tanh(x) | def tanh(x):
"""
Hyperbolic tangent
"""
if isinstance(x, UncertainFunction):
mcpts = np.tanh(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.tanh(x) | [
"Hyperbolic",
"tangent"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L291-L299 | [
"def",
"tanh",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"tanh",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | trunc | Truncate the values to the integer value without rounding | mcerp/umath.py | def trunc(x):
"""
Truncate the values to the integer value without rounding
"""
if isinstance(x, UncertainFunction):
mcpts = np.trunc(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.trunc(x) | def trunc(x):
"""
Truncate the values to the integer value without rounding
"""
if isinstance(x, UncertainFunction):
mcpts = np.trunc(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.trunc(x) | [
"Truncate",
"the",
"values",
"to",
"the",
"integer",
"value",
"without",
"rounding"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L302-L310 | [
"def",
"trunc",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"trunc",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | lhd | Create a Latin-Hypercube sample design based on distributions defined in the
`scipy.stats` module
Parameters
----------
dist: array_like
frozen scipy.stats.rv_continuous or rv_discrete distribution objects
that are defined previous to calling LHD
size: int
integer valu... | mcerp/lhd.py | def lhd(
dist=None,
size=None,
dims=1,
form="randomized",
iterations=100,
showcorrelations=False,
):
"""
Create a Latin-Hypercube sample design based on distributions defined in the
`scipy.stats` module
Parameters
----------
dist: array_like
frozen scipy.stat... | def lhd(
dist=None,
size=None,
dims=1,
form="randomized",
iterations=100,
showcorrelations=False,
):
"""
Create a Latin-Hypercube sample design based on distributions defined in the
`scipy.stats` module
Parameters
----------
dist: array_like
frozen scipy.stat... | [
"Create",
"a",
"Latin",
"-",
"Hypercube",
"sample",
"design",
"based",
"on",
"distributions",
"defined",
"in",
"the",
"scipy",
".",
"stats",
"module",
"Parameters",
"----------",
"dist",
":",
"array_like",
"frozen",
"scipy",
".",
"stats",
".",
"rv_continuous",
... | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/lhd.py#L5-L286 | [
"def",
"lhd",
"(",
"dist",
"=",
"None",
",",
"size",
"=",
"None",
",",
"dims",
"=",
"1",
",",
"form",
"=",
"\"randomized\"",
",",
"iterations",
"=",
"100",
",",
"showcorrelations",
"=",
"False",
",",
")",
":",
"assert",
"dims",
">",
"0",
",",
"'kwa... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | to_uncertain_func | Transforms x into an UncertainFunction-compatible object,
unless it is already an UncertainFunction (in which case x is returned
unchanged).
Raises an exception unless 'x' belongs to some specific classes of
objects that are known not to depend on UncertainFunction objects
(which then cannot be co... | mcerp/__init__.py | def to_uncertain_func(x):
"""
Transforms x into an UncertainFunction-compatible object,
unless it is already an UncertainFunction (in which case x is returned
unchanged).
Raises an exception unless 'x' belongs to some specific classes of
objects that are known not to depend on UncertainFunctio... | def to_uncertain_func(x):
"""
Transforms x into an UncertainFunction-compatible object,
unless it is already an UncertainFunction (in which case x is returned
unchanged).
Raises an exception unless 'x' belongs to some specific classes of
objects that are known not to depend on UncertainFunctio... | [
"Transforms",
"x",
"into",
"an",
"UncertainFunction",
"-",
"compatible",
"object",
"unless",
"it",
"is",
"already",
"an",
"UncertainFunction",
"(",
"in",
"which",
"case",
"x",
"is",
"returned",
"unchanged",
")",
"."
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L31-L49 | [
"def",
"to_uncertain_func",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"return",
"x",
"# ! In Python 2.6+, numbers.Number could be used instead, here:",
"elif",
"isinstance",
"(",
"x",
",",
"CONSTANT_TYPES",
")",
":",
"# No... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | Beta | A Beta random variate
Parameters
----------
alpha : scalar
The first shape parameter
beta : scalar
The second shape parameter
Optional
--------
low : scalar
Lower bound of the distribution support (default=0)
high : scalar
Upper bound of the dist... | mcerp/__init__.py | def Beta(alpha, beta, low=0, high=1, tag=None):
"""
A Beta random variate
Parameters
----------
alpha : scalar
The first shape parameter
beta : scalar
The second shape parameter
Optional
--------
low : scalar
Lower bound of the distribution support (... | def Beta(alpha, beta, low=0, high=1, tag=None):
"""
A Beta random variate
Parameters
----------
alpha : scalar
The first shape parameter
beta : scalar
The second shape parameter
Optional
--------
low : scalar
Lower bound of the distribution support (... | [
"A",
"Beta",
"random",
"variate",
"Parameters",
"----------",
"alpha",
":",
"scalar",
"The",
"first",
"shape",
"parameter",
"beta",
":",
"scalar",
"The",
"second",
"shape",
"parameter",
"Optional",
"--------",
"low",
":",
"scalar",
"Lower",
"bound",
"of",
"the... | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L721-L743 | [
"def",
"Beta",
"(",
"alpha",
",",
"beta",
",",
"low",
"=",
"0",
",",
"high",
"=",
"1",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"(",
"alpha",
">",
"0",
"and",
"beta",
">",
"0",
")",
",",
"'Beta \"alpha\" and \"beta\" parameters must be greater than z... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | BetaPrime | A BetaPrime random variate
Parameters
----------
alpha : scalar
The first shape parameter
beta : scalar
The second shape parameter | mcerp/__init__.py | def BetaPrime(alpha, beta, tag=None):
"""
A BetaPrime random variate
Parameters
----------
alpha : scalar
The first shape parameter
beta : scalar
The second shape parameter
"""
assert (
alpha > 0 and beta > 0
), 'BetaPrime "alpha" and "beta" paramete... | def BetaPrime(alpha, beta, tag=None):
"""
A BetaPrime random variate
Parameters
----------
alpha : scalar
The first shape parameter
beta : scalar
The second shape parameter
"""
assert (
alpha > 0 and beta > 0
), 'BetaPrime "alpha" and "beta" paramete... | [
"A",
"BetaPrime",
"random",
"variate",
"Parameters",
"----------",
"alpha",
":",
"scalar",
"The",
"first",
"shape",
"parameter",
"beta",
":",
"scalar",
"The",
"second",
"shape",
"parameter"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L746-L762 | [
"def",
"BetaPrime",
"(",
"alpha",
",",
"beta",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"(",
"alpha",
">",
"0",
"and",
"beta",
">",
"0",
")",
",",
"'BetaPrime \"alpha\" and \"beta\" parameters must be greater than zero'",
"x",
"=",
"Beta",
"(",
"alpha",
... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | Bradford | A Bradford random variate
Parameters
----------
q : scalar
The shape parameter
low : scalar
The lower bound of the distribution (default=0)
high : scalar
The upper bound of the distribution (default=1) | mcerp/__init__.py | def Bradford(q, low=0, high=1, tag=None):
"""
A Bradford random variate
Parameters
----------
q : scalar
The shape parameter
low : scalar
The lower bound of the distribution (default=0)
high : scalar
The upper bound of the distribution (default=1)
"""
ass... | def Bradford(q, low=0, high=1, tag=None):
"""
A Bradford random variate
Parameters
----------
q : scalar
The shape parameter
low : scalar
The lower bound of the distribution (default=0)
high : scalar
The upper bound of the distribution (default=1)
"""
ass... | [
"A",
"Bradford",
"random",
"variate",
"Parameters",
"----------",
"q",
":",
"scalar",
"The",
"shape",
"parameter",
"low",
":",
"scalar",
"The",
"lower",
"bound",
"of",
"the",
"distribution",
"(",
"default",
"=",
"0",
")",
"high",
":",
"scalar",
"The",
"upp... | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L765-L780 | [
"def",
"Bradford",
"(",
"q",
",",
"low",
"=",
"0",
",",
"high",
"=",
"1",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"q",
">",
"0",
",",
"'Bradford \"q\" parameter must be greater than zero'",
"assert",
"low",
"<",
"high",
",",
"'Bradford \"low\" parameter... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | Burr | A Burr random variate
Parameters
----------
c : scalar
The first shape parameter
k : scalar
The second shape parameter | mcerp/__init__.py | def Burr(c, k, tag=None):
"""
A Burr random variate
Parameters
----------
c : scalar
The first shape parameter
k : scalar
The second shape parameter
"""
assert c > 0 and k > 0, 'Burr "c" and "k" parameters must be greater than zero'
return uv(ss.burr(c, k), ... | def Burr(c, k, tag=None):
"""
A Burr random variate
Parameters
----------
c : scalar
The first shape parameter
k : scalar
The second shape parameter
"""
assert c > 0 and k > 0, 'Burr "c" and "k" parameters must be greater than zero'
return uv(ss.burr(c, k), ... | [
"A",
"Burr",
"random",
"variate",
"Parameters",
"----------",
"c",
":",
"scalar",
"The",
"first",
"shape",
"parameter",
"k",
":",
"scalar",
"The",
"second",
"shape",
"parameter"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L783-L796 | [
"def",
"Burr",
"(",
"c",
",",
"k",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"c",
">",
"0",
"and",
"k",
">",
"0",
",",
"'Burr \"c\" and \"k\" parameters must be greater than zero'",
"return",
"uv",
"(",
"ss",
".",
"burr",
"(",
"c",
",",
"k",
")",
... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | ChiSquared | A Chi-Squared random variate
Parameters
----------
k : int
The degrees of freedom of the distribution (must be greater than one) | mcerp/__init__.py | def ChiSquared(k, tag=None):
"""
A Chi-Squared random variate
Parameters
----------
k : int
The degrees of freedom of the distribution (must be greater than one)
"""
assert int(k) == k and k >= 1, 'Chi-Squared "k" must be an integer greater than 0'
return uv(ss.chi2(k), tag=... | def ChiSquared(k, tag=None):
"""
A Chi-Squared random variate
Parameters
----------
k : int
The degrees of freedom of the distribution (must be greater than one)
"""
assert int(k) == k and k >= 1, 'Chi-Squared "k" must be an integer greater than 0'
return uv(ss.chi2(k), tag=... | [
"A",
"Chi",
"-",
"Squared",
"random",
"variate",
"Parameters",
"----------",
"k",
":",
"int",
"The",
"degrees",
"of",
"freedom",
"of",
"the",
"distribution",
"(",
"must",
"be",
"greater",
"than",
"one",
")"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L799-L809 | [
"def",
"ChiSquared",
"(",
"k",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"int",
"(",
"k",
")",
"==",
"k",
"and",
"k",
">=",
"1",
",",
"'Chi-Squared \"k\" must be an integer greater than 0'",
"return",
"uv",
"(",
"ss",
".",
"chi2",
"(",
"k",
")",
","... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | Erlang | An Erlang random variate.
This distribution is the same as a Gamma(k, theta) distribution, but
with the restriction that k must be a positive integer. This
is provided for greater compatibility with other simulation tools, but
provides no advantage over the Gamma distribution in its applications.
... | mcerp/__init__.py | def Erlang(k, lamda, tag=None):
"""
An Erlang random variate.
This distribution is the same as a Gamma(k, theta) distribution, but
with the restriction that k must be a positive integer. This
is provided for greater compatibility with other simulation tools, but
provides no advantage over ... | def Erlang(k, lamda, tag=None):
"""
An Erlang random variate.
This distribution is the same as a Gamma(k, theta) distribution, but
with the restriction that k must be a positive integer. This
is provided for greater compatibility with other simulation tools, but
provides no advantage over ... | [
"An",
"Erlang",
"random",
"variate",
".",
"This",
"distribution",
"is",
"the",
"same",
"as",
"a",
"Gamma",
"(",
"k",
"theta",
")",
"distribution",
"but",
"with",
"the",
"restriction",
"that",
"k",
"must",
"be",
"a",
"positive",
"integer",
".",
"This",
"i... | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L832-L850 | [
"def",
"Erlang",
"(",
"k",
",",
"lamda",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"int",
"(",
"k",
")",
"==",
"k",
"and",
"k",
">",
"0",
",",
"'Erlang \"k\" must be a positive integer'",
"assert",
"lamda",
">",
"0",
",",
"'Erlang \"lamda\" must be grea... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | Exponential | An Exponential random variate
Parameters
----------
lamda : scalar
The inverse scale (as shown on Wikipedia). (FYI: mu = 1/lamda.) | mcerp/__init__.py | def Exponential(lamda, tag=None):
"""
An Exponential random variate
Parameters
----------
lamda : scalar
The inverse scale (as shown on Wikipedia). (FYI: mu = 1/lamda.)
"""
assert lamda > 0, 'Exponential "lamda" must be greater than zero'
return uv(ss.expon(scale=1.0 / lamda... | def Exponential(lamda, tag=None):
"""
An Exponential random variate
Parameters
----------
lamda : scalar
The inverse scale (as shown on Wikipedia). (FYI: mu = 1/lamda.)
"""
assert lamda > 0, 'Exponential "lamda" must be greater than zero'
return uv(ss.expon(scale=1.0 / lamda... | [
"An",
"Exponential",
"random",
"variate",
"Parameters",
"----------",
"lamda",
":",
"scalar",
"The",
"inverse",
"scale",
"(",
"as",
"shown",
"on",
"Wikipedia",
")",
".",
"(",
"FYI",
":",
"mu",
"=",
"1",
"/",
"lamda",
".",
")"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L853-L863 | [
"def",
"Exponential",
"(",
"lamda",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"lamda",
">",
"0",
",",
"'Exponential \"lamda\" must be greater than zero'",
"return",
"uv",
"(",
"ss",
".",
"expon",
"(",
"scale",
"=",
"1.0",
"/",
"lamda",
")",
",",
"tag",
... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | ExtValueMax | An Extreme Value Maximum random variate.
Parameters
----------
mu : scalar
The location parameter
sigma : scalar
The scale parameter (must be greater than zero) | mcerp/__init__.py | def ExtValueMax(mu, sigma, tag=None):
"""
An Extreme Value Maximum random variate.
Parameters
----------
mu : scalar
The location parameter
sigma : scalar
The scale parameter (must be greater than zero)
"""
assert sigma > 0, 'ExtremeValueMax "sigma" must be greater t... | def ExtValueMax(mu, sigma, tag=None):
"""
An Extreme Value Maximum random variate.
Parameters
----------
mu : scalar
The location parameter
sigma : scalar
The scale parameter (must be greater than zero)
"""
assert sigma > 0, 'ExtremeValueMax "sigma" must be greater t... | [
"An",
"Extreme",
"Value",
"Maximum",
"random",
"variate",
".",
"Parameters",
"----------",
"mu",
":",
"scalar",
"The",
"location",
"parameter",
"sigma",
":",
"scalar",
"The",
"scale",
"parameter",
"(",
"must",
"be",
"greater",
"than",
"zero",
")"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L869-L882 | [
"def",
"ExtValueMax",
"(",
"mu",
",",
"sigma",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"sigma",
">",
"0",
",",
"'ExtremeValueMax \"sigma\" must be greater than zero'",
"p",
"=",
"U",
"(",
"0",
",",
"1",
")",
".",
"_mcpts",
"[",
":",
"]",
"return",
... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | Fisher | An F (fisher) random variate
Parameters
----------
d1 : int
Numerator degrees of freedom
d2 : int
Denominator degrees of freedom | mcerp/__init__.py | def Fisher(d1, d2, tag=None):
"""
An F (fisher) random variate
Parameters
----------
d1 : int
Numerator degrees of freedom
d2 : int
Denominator degrees of freedom
"""
assert (
int(d1) == d1 and d1 >= 1
), 'Fisher (F) "d1" must be an integer greater than 0... | def Fisher(d1, d2, tag=None):
"""
An F (fisher) random variate
Parameters
----------
d1 : int
Numerator degrees of freedom
d2 : int
Denominator degrees of freedom
"""
assert (
int(d1) == d1 and d1 >= 1
), 'Fisher (F) "d1" must be an integer greater than 0... | [
"An",
"F",
"(",
"fisher",
")",
"random",
"variate",
"Parameters",
"----------",
"d1",
":",
"int",
"Numerator",
"degrees",
"of",
"freedom",
"d2",
":",
"int",
"Denominator",
"degrees",
"of",
"freedom"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L907-L924 | [
"def",
"Fisher",
"(",
"d1",
",",
"d2",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"(",
"int",
"(",
"d1",
")",
"==",
"d1",
"and",
"d1",
">=",
"1",
")",
",",
"'Fisher (F) \"d1\" must be an integer greater than 0'",
"assert",
"(",
"int",
"(",
"d2",
")",... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | Gamma | A Gamma random variate
Parameters
----------
k : scalar
The shape parameter (must be positive and non-zero)
theta : scalar
The scale parameter (must be positive and non-zero) | mcerp/__init__.py | def Gamma(k, theta, tag=None):
"""
A Gamma random variate
Parameters
----------
k : scalar
The shape parameter (must be positive and non-zero)
theta : scalar
The scale parameter (must be positive and non-zero)
"""
assert (
k > 0 and theta > 0
), 'Gamma "k... | def Gamma(k, theta, tag=None):
"""
A Gamma random variate
Parameters
----------
k : scalar
The shape parameter (must be positive and non-zero)
theta : scalar
The scale parameter (must be positive and non-zero)
"""
assert (
k > 0 and theta > 0
), 'Gamma "k... | [
"A",
"Gamma",
"random",
"variate",
"Parameters",
"----------",
"k",
":",
"scalar",
"The",
"shape",
"parameter",
"(",
"must",
"be",
"positive",
"and",
"non",
"-",
"zero",
")",
"theta",
":",
"scalar",
"The",
"scale",
"parameter",
"(",
"must",
"be",
"positive... | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L930-L944 | [
"def",
"Gamma",
"(",
"k",
",",
"theta",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"(",
"k",
">",
"0",
"and",
"theta",
">",
"0",
")",
",",
"'Gamma \"k\" and \"theta\" parameters must be greater than zero'",
"return",
"uv",
"(",
"ss",
".",
"gamma",
"(",
... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | LogNormal | A Log-Normal random variate
Parameters
----------
mu : scalar
The location parameter
sigma : scalar
The scale parameter (must be positive and non-zero) | mcerp/__init__.py | def LogNormal(mu, sigma, tag=None):
"""
A Log-Normal random variate
Parameters
----------
mu : scalar
The location parameter
sigma : scalar
The scale parameter (must be positive and non-zero)
"""
assert sigma > 0, 'Log-Normal "sigma" must be positive'
return uv(s... | def LogNormal(mu, sigma, tag=None):
"""
A Log-Normal random variate
Parameters
----------
mu : scalar
The location parameter
sigma : scalar
The scale parameter (must be positive and non-zero)
"""
assert sigma > 0, 'Log-Normal "sigma" must be positive'
return uv(s... | [
"A",
"Log",
"-",
"Normal",
"random",
"variate",
"Parameters",
"----------",
"mu",
":",
"scalar",
"The",
"location",
"parameter",
"sigma",
":",
"scalar",
"The",
"scale",
"parameter",
"(",
"must",
"be",
"positive",
"and",
"non",
"-",
"zero",
")"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L947-L959 | [
"def",
"LogNormal",
"(",
"mu",
",",
"sigma",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"sigma",
">",
"0",
",",
"'Log-Normal \"sigma\" must be positive'",
"return",
"uv",
"(",
"ss",
".",
"lognorm",
"(",
"sigma",
",",
"loc",
"=",
"mu",
")",
",",
"tag"... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | Normal | A Normal (or Gaussian) random variate
Parameters
----------
mu : scalar
The mean value of the distribution
sigma : scalar
The standard deviation (must be positive and non-zero) | mcerp/__init__.py | def Normal(mu, sigma, tag=None):
"""
A Normal (or Gaussian) random variate
Parameters
----------
mu : scalar
The mean value of the distribution
sigma : scalar
The standard deviation (must be positive and non-zero)
"""
assert sigma > 0, 'Normal "sigma" must be greater... | def Normal(mu, sigma, tag=None):
"""
A Normal (or Gaussian) random variate
Parameters
----------
mu : scalar
The mean value of the distribution
sigma : scalar
The standard deviation (must be positive and non-zero)
"""
assert sigma > 0, 'Normal "sigma" must be greater... | [
"A",
"Normal",
"(",
"or",
"Gaussian",
")",
"random",
"variate",
"Parameters",
"----------",
"mu",
":",
"scalar",
"The",
"mean",
"value",
"of",
"the",
"distribution",
"sigma",
":",
"scalar",
"The",
"standard",
"deviation",
"(",
"must",
"be",
"positive",
"and"... | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L965-L977 | [
"def",
"Normal",
"(",
"mu",
",",
"sigma",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"sigma",
">",
"0",
",",
"'Normal \"sigma\" must be greater than zero'",
"return",
"uv",
"(",
"ss",
".",
"norm",
"(",
"loc",
"=",
"mu",
",",
"scale",
"=",
"sigma",
")... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | Pareto | A Pareto random variate (first kind)
Parameters
----------
q : scalar
The scale parameter
a : scalar
The shape parameter (the minimum possible value) | mcerp/__init__.py | def Pareto(q, a, tag=None):
"""
A Pareto random variate (first kind)
Parameters
----------
q : scalar
The scale parameter
a : scalar
The shape parameter (the minimum possible value)
"""
assert q > 0 and a > 0, 'Pareto "q" and "a" must be positive scalars'
p = Uni... | def Pareto(q, a, tag=None):
"""
A Pareto random variate (first kind)
Parameters
----------
q : scalar
The scale parameter
a : scalar
The shape parameter (the minimum possible value)
"""
assert q > 0 and a > 0, 'Pareto "q" and "a" must be positive scalars'
p = Uni... | [
"A",
"Pareto",
"random",
"variate",
"(",
"first",
"kind",
")",
"Parameters",
"----------",
"q",
":",
"scalar",
"The",
"scale",
"parameter",
"a",
":",
"scalar",
"The",
"shape",
"parameter",
"(",
"the",
"minimum",
"possible",
"value",
")"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L983-L996 | [
"def",
"Pareto",
"(",
"q",
",",
"a",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"q",
">",
"0",
"and",
"a",
">",
"0",
",",
"'Pareto \"q\" and \"a\" must be positive scalars'",
"p",
"=",
"Uniform",
"(",
"0",
",",
"1",
",",
"tag",
")",
"return",
"a",
... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | Pareto2 | A Pareto random variate (second kind). This form always starts at the
origin.
Parameters
----------
q : scalar
The scale parameter
b : scalar
The shape parameter | mcerp/__init__.py | def Pareto2(q, b, tag=None):
"""
A Pareto random variate (second kind). This form always starts at the
origin.
Parameters
----------
q : scalar
The scale parameter
b : scalar
The shape parameter
"""
assert q > 0 and b > 0, 'Pareto2 "q" and "b" must be positive sc... | def Pareto2(q, b, tag=None):
"""
A Pareto random variate (second kind). This form always starts at the
origin.
Parameters
----------
q : scalar
The scale parameter
b : scalar
The shape parameter
"""
assert q > 0 and b > 0, 'Pareto2 "q" and "b" must be positive sc... | [
"A",
"Pareto",
"random",
"variate",
"(",
"second",
"kind",
")",
".",
"This",
"form",
"always",
"starts",
"at",
"the",
"origin",
".",
"Parameters",
"----------",
"q",
":",
"scalar",
"The",
"scale",
"parameter",
"b",
":",
"scalar",
"The",
"shape",
"parameter... | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L999-L1012 | [
"def",
"Pareto2",
"(",
"q",
",",
"b",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"q",
">",
"0",
"and",
"b",
">",
"0",
",",
"'Pareto2 \"q\" and \"b\" must be positive scalars'",
"return",
"Pareto",
"(",
"q",
",",
"b",
",",
"tag",
")",
"-",
"b"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | PERT | A PERT random variate
Parameters
----------
low : scalar
Lower bound of the distribution support
peak : scalar
The location of the distribution's peak (low <= peak <= high)
high : scalar
Upper bound of the distribution support
Optional
--------
g : scala... | mcerp/__init__.py | def PERT(low, peak, high, g=4.0, tag=None):
"""
A PERT random variate
Parameters
----------
low : scalar
Lower bound of the distribution support
peak : scalar
The location of the distribution's peak (low <= peak <= high)
high : scalar
Upper bound of the distribut... | def PERT(low, peak, high, g=4.0, tag=None):
"""
A PERT random variate
Parameters
----------
low : scalar
Lower bound of the distribution support
peak : scalar
The location of the distribution's peak (low <= peak <= high)
high : scalar
Upper bound of the distribut... | [
"A",
"PERT",
"random",
"variate",
"Parameters",
"----------",
"low",
":",
"scalar",
"Lower",
"bound",
"of",
"the",
"distribution",
"support",
"peak",
":",
"scalar",
"The",
"location",
"of",
"the",
"distribution",
"s",
"peak",
"(",
"low",
"<",
"=",
"peak",
... | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L1015-L1046 | [
"def",
"PERT",
"(",
"low",
",",
"peak",
",",
"high",
",",
"g",
"=",
"4.0",
",",
"tag",
"=",
"None",
")",
":",
"a",
",",
"b",
",",
"c",
"=",
"[",
"float",
"(",
"x",
")",
"for",
"x",
"in",
"[",
"low",
",",
"peak",
",",
"high",
"]",
"]",
"... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | StudentT | A Student-T random variate
Parameters
----------
v : int
The degrees of freedom of the distribution (must be greater than one) | mcerp/__init__.py | def StudentT(v, tag=None):
"""
A Student-T random variate
Parameters
----------
v : int
The degrees of freedom of the distribution (must be greater than one)
"""
assert int(v) == v and v >= 1, 'Student-T "v" must be an integer greater than 0'
return uv(ss.t(v), tag=tag) | def StudentT(v, tag=None):
"""
A Student-T random variate
Parameters
----------
v : int
The degrees of freedom of the distribution (must be greater than one)
"""
assert int(v) == v and v >= 1, 'Student-T "v" must be an integer greater than 0'
return uv(ss.t(v), tag=tag) | [
"A",
"Student",
"-",
"T",
"random",
"variate",
"Parameters",
"----------",
"v",
":",
"int",
"The",
"degrees",
"of",
"freedom",
"of",
"the",
"distribution",
"(",
"must",
"be",
"greater",
"than",
"one",
")"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L1049-L1059 | [
"def",
"StudentT",
"(",
"v",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"int",
"(",
"v",
")",
"==",
"v",
"and",
"v",
">=",
"1",
",",
"'Student-T \"v\" must be an integer greater than 0'",
"return",
"uv",
"(",
"ss",
".",
"t",
"(",
"v",
")",
",",
"ta... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | Triangular | A triangular random variate
Parameters
----------
low : scalar
Lower bound of the distribution support
peak : scalar
The location of the triangle's peak (low <= peak <= high)
high : scalar
Upper bound of the distribution support | mcerp/__init__.py | def Triangular(low, peak, high, tag=None):
"""
A triangular random variate
Parameters
----------
low : scalar
Lower bound of the distribution support
peak : scalar
The location of the triangle's peak (low <= peak <= high)
high : scalar
Upper bound of the distribu... | def Triangular(low, peak, high, tag=None):
"""
A triangular random variate
Parameters
----------
low : scalar
Lower bound of the distribution support
peak : scalar
The location of the triangle's peak (low <= peak <= high)
high : scalar
Upper bound of the distribu... | [
"A",
"triangular",
"random",
"variate",
"Parameters",
"----------",
"low",
":",
"scalar",
"Lower",
"bound",
"of",
"the",
"distribution",
"support",
"peak",
":",
"scalar",
"The",
"location",
"of",
"the",
"triangle",
"s",
"peak",
"(",
"low",
"<",
"=",
"peak",
... | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L1065-L1083 | [
"def",
"Triangular",
"(",
"low",
",",
"peak",
",",
"high",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"low",
"<=",
"peak",
"<=",
"high",
",",
"'Triangular \"peak\" must lie between \"low\" and \"high\"'",
"low",
",",
"peak",
",",
"high",
"=",
"[",
"float",... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | Uniform | A Uniform random variate
Parameters
----------
low : scalar
Lower bound of the distribution support.
high : scalar
Upper bound of the distribution support. | mcerp/__init__.py | def Uniform(low, high, tag=None):
"""
A Uniform random variate
Parameters
----------
low : scalar
Lower bound of the distribution support.
high : scalar
Upper bound of the distribution support.
"""
assert low < high, 'Uniform "low" must be less than "high"'
retur... | def Uniform(low, high, tag=None):
"""
A Uniform random variate
Parameters
----------
low : scalar
Lower bound of the distribution support.
high : scalar
Upper bound of the distribution support.
"""
assert low < high, 'Uniform "low" must be less than "high"'
retur... | [
"A",
"Uniform",
"random",
"variate",
"Parameters",
"----------",
"low",
":",
"scalar",
"Lower",
"bound",
"of",
"the",
"distribution",
"support",
".",
"high",
":",
"scalar",
"Upper",
"bound",
"of",
"the",
"distribution",
"support",
"."
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L1089-L1101 | [
"def",
"Uniform",
"(",
"low",
",",
"high",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"low",
"<",
"high",
",",
"'Uniform \"low\" must be less than \"high\"'",
"return",
"uv",
"(",
"ss",
".",
"uniform",
"(",
"loc",
"=",
"low",
",",
"scale",
"=",
"high",... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | Weibull | A Weibull random variate
Parameters
----------
lamda : scalar
The scale parameter
k : scalar
The shape parameter | mcerp/__init__.py | def Weibull(lamda, k, tag=None):
"""
A Weibull random variate
Parameters
----------
lamda : scalar
The scale parameter
k : scalar
The shape parameter
"""
assert (
lamda > 0 and k > 0
), 'Weibull "lamda" and "k" parameters must be greater than zero'
re... | def Weibull(lamda, k, tag=None):
"""
A Weibull random variate
Parameters
----------
lamda : scalar
The scale parameter
k : scalar
The shape parameter
"""
assert (
lamda > 0 and k > 0
), 'Weibull "lamda" and "k" parameters must be greater than zero'
re... | [
"A",
"Weibull",
"random",
"variate",
"Parameters",
"----------",
"lamda",
":",
"scalar",
"The",
"scale",
"parameter",
"k",
":",
"scalar",
"The",
"shape",
"parameter"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L1107-L1121 | [
"def",
"Weibull",
"(",
"lamda",
",",
"k",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"(",
"lamda",
">",
"0",
"and",
"k",
">",
"0",
")",
",",
"'Weibull \"lamda\" and \"k\" parameters must be greater than zero'",
"return",
"uv",
"(",
"ss",
".",
"exponweib",
... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | Bernoulli | A Bernoulli random variate
Parameters
----------
p : scalar
The probability of success | mcerp/__init__.py | def Bernoulli(p, tag=None):
"""
A Bernoulli random variate
Parameters
----------
p : scalar
The probability of success
"""
assert (
0 < p < 1
), 'Bernoulli probability "p" must be between zero and one, non-inclusive'
return uv(ss.bernoulli(p), tag=tag) | def Bernoulli(p, tag=None):
"""
A Bernoulli random variate
Parameters
----------
p : scalar
The probability of success
"""
assert (
0 < p < 1
), 'Bernoulli probability "p" must be between zero and one, non-inclusive'
return uv(ss.bernoulli(p), tag=tag) | [
"A",
"Bernoulli",
"random",
"variate",
"Parameters",
"----------",
"p",
":",
"scalar",
"The",
"probability",
"of",
"success"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L1132-L1144 | [
"def",
"Bernoulli",
"(",
"p",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"(",
"0",
"<",
"p",
"<",
"1",
")",
",",
"'Bernoulli probability \"p\" must be between zero and one, non-inclusive'",
"return",
"uv",
"(",
"ss",
".",
"bernoulli",
"(",
"p",
")",
",",
... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | Binomial | A Binomial random variate
Parameters
----------
n : int
The number of trials
p : scalar
The probability of success | mcerp/__init__.py | def Binomial(n, p, tag=None):
"""
A Binomial random variate
Parameters
----------
n : int
The number of trials
p : scalar
The probability of success
"""
assert (
int(n) == n and n > 0
), 'Binomial number of trials "n" must be an integer greater than zero'... | def Binomial(n, p, tag=None):
"""
A Binomial random variate
Parameters
----------
n : int
The number of trials
p : scalar
The probability of success
"""
assert (
int(n) == n and n > 0
), 'Binomial number of trials "n" must be an integer greater than zero'... | [
"A",
"Binomial",
"random",
"variate",
"Parameters",
"----------",
"n",
":",
"int",
"The",
"number",
"of",
"trials",
"p",
":",
"scalar",
"The",
"probability",
"of",
"success"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L1150-L1167 | [
"def",
"Binomial",
"(",
"n",
",",
"p",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"(",
"int",
"(",
"n",
")",
"==",
"n",
"and",
"n",
">",
"0",
")",
",",
"'Binomial number of trials \"n\" must be an integer greater than zero'",
"assert",
"(",
"0",
"<",
"... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | Geometric | A Geometric random variate
Parameters
----------
p : scalar
The probability of success | mcerp/__init__.py | def Geometric(p, tag=None):
"""
A Geometric random variate
Parameters
----------
p : scalar
The probability of success
"""
assert (
0 < p < 1
), 'Geometric probability "p" must be between zero and one, non-inclusive'
return uv(ss.geom(p), tag=tag) | def Geometric(p, tag=None):
"""
A Geometric random variate
Parameters
----------
p : scalar
The probability of success
"""
assert (
0 < p < 1
), 'Geometric probability "p" must be between zero and one, non-inclusive'
return uv(ss.geom(p), tag=tag) | [
"A",
"Geometric",
"random",
"variate",
"Parameters",
"----------",
"p",
":",
"scalar",
"The",
"probability",
"of",
"success"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L1173-L1185 | [
"def",
"Geometric",
"(",
"p",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"(",
"0",
"<",
"p",
"<",
"1",
")",
",",
"'Geometric probability \"p\" must be between zero and one, non-inclusive'",
"return",
"uv",
"(",
"ss",
".",
"geom",
"(",
"p",
")",
",",
"tag... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | Hypergeometric | A Hypergeometric random variate
Parameters
----------
N : int
The total population size
n : int
The number of individuals of interest in the population
K : int
The number of individuals that will be chosen from the population
Example
-------
(Taken f... | mcerp/__init__.py | def Hypergeometric(N, n, K, tag=None):
"""
A Hypergeometric random variate
Parameters
----------
N : int
The total population size
n : int
The number of individuals of interest in the population
K : int
The number of individuals that will be chosen from the popul... | def Hypergeometric(N, n, K, tag=None):
"""
A Hypergeometric random variate
Parameters
----------
N : int
The total population size
n : int
The number of individuals of interest in the population
K : int
The number of individuals that will be chosen from the popul... | [
"A",
"Hypergeometric",
"random",
"variate",
"Parameters",
"----------",
"N",
":",
"int",
"The",
"total",
"population",
"size",
"n",
":",
"int",
"The",
"number",
"of",
"individuals",
"of",
"interest",
"in",
"the",
"population",
"K",
":",
"int",
"The",
"number... | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L1191-L1234 | [
"def",
"Hypergeometric",
"(",
"N",
",",
"n",
",",
"K",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"(",
"int",
"(",
"N",
")",
"==",
"N",
"and",
"N",
">",
"0",
")",
",",
"'Hypergeometric total population size \"N\" must be an integer greater than zero.'",
"a... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | Poisson | A Poisson random variate
Parameters
----------
lamda : scalar
The rate of an occurance within a specified interval of time or space. | mcerp/__init__.py | def Poisson(lamda, tag=None):
"""
A Poisson random variate
Parameters
----------
lamda : scalar
The rate of an occurance within a specified interval of time or space.
"""
assert lamda > 0, 'Poisson "lamda" must be greater than zero.'
return uv(ss.poisson(lamda), tag=tag) | def Poisson(lamda, tag=None):
"""
A Poisson random variate
Parameters
----------
lamda : scalar
The rate of an occurance within a specified interval of time or space.
"""
assert lamda > 0, 'Poisson "lamda" must be greater than zero.'
return uv(ss.poisson(lamda), tag=tag) | [
"A",
"Poisson",
"random",
"variate",
"Parameters",
"----------",
"lamda",
":",
"scalar",
"The",
"rate",
"of",
"an",
"occurance",
"within",
"a",
"specified",
"interval",
"of",
"time",
"or",
"space",
"."
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L1240-L1250 | [
"def",
"Poisson",
"(",
"lamda",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"lamda",
">",
"0",
",",
"'Poisson \"lamda\" must be greater than zero.'",
"return",
"uv",
"(",
"ss",
".",
"poisson",
"(",
"lamda",
")",
",",
"tag",
"=",
"tag",
")"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | covariance_matrix | Calculate the covariance matrix of uncertain variables, oriented by the
order of the inputs
Parameters
----------
nums_with_uncert : array-like
A list of variables that have an associated uncertainty
Returns
-------
cov_matrix : 2d-array-like
A nested list containin... | mcerp/__init__.py | def covariance_matrix(nums_with_uncert):
"""
Calculate the covariance matrix of uncertain variables, oriented by the
order of the inputs
Parameters
----------
nums_with_uncert : array-like
A list of variables that have an associated uncertainty
Returns
-------
cov_m... | def covariance_matrix(nums_with_uncert):
"""
Calculate the covariance matrix of uncertain variables, oriented by the
order of the inputs
Parameters
----------
nums_with_uncert : array-like
A list of variables that have an associated uncertainty
Returns
-------
cov_m... | [
"Calculate",
"the",
"covariance",
"matrix",
"of",
"uncertain",
"variables",
"oriented",
"by",
"the",
"order",
"of",
"the",
"inputs",
"Parameters",
"----------",
"nums_with_uncert",
":",
"array",
"-",
"like",
"A",
"list",
"of",
"variables",
"that",
"have",
"an",
... | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L1261-L1303 | [
"def",
"covariance_matrix",
"(",
"nums_with_uncert",
")",
":",
"ufuncs",
"=",
"list",
"(",
"map",
"(",
"to_uncertain_func",
",",
"nums_with_uncert",
")",
")",
"cov_matrix",
"=",
"[",
"]",
"for",
"(",
"i1",
",",
"expr1",
")",
"in",
"enumerate",
"(",
"ufuncs... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | correlation_matrix | Calculate the correlation matrix of uncertain variables, oriented by the
order of the inputs
Parameters
----------
nums_with_uncert : array-like
A list of variables that have an associated uncertainty
Returns
-------
corr_matrix : 2d-array-like
A nested list contain... | mcerp/__init__.py | def correlation_matrix(nums_with_uncert):
"""
Calculate the correlation matrix of uncertain variables, oriented by the
order of the inputs
Parameters
----------
nums_with_uncert : array-like
A list of variables that have an associated uncertainty
Returns
-------
cor... | def correlation_matrix(nums_with_uncert):
"""
Calculate the correlation matrix of uncertain variables, oriented by the
order of the inputs
Parameters
----------
nums_with_uncert : array-like
A list of variables that have an associated uncertainty
Returns
-------
cor... | [
"Calculate",
"the",
"correlation",
"matrix",
"of",
"uncertain",
"variables",
"oriented",
"by",
"the",
"order",
"of",
"the",
"inputs",
"Parameters",
"----------",
"nums_with_uncert",
":",
"array",
"-",
"like",
"A",
"list",
"of",
"variables",
"that",
"have",
"an",... | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L1306-L1335 | [
"def",
"correlation_matrix",
"(",
"nums_with_uncert",
")",
":",
"ufuncs",
"=",
"list",
"(",
"map",
"(",
"to_uncertain_func",
",",
"nums_with_uncert",
")",
")",
"data",
"=",
"np",
".",
"vstack",
"(",
"[",
"ufunc",
".",
"_mcpts",
"for",
"ufunc",
"in",
"ufunc... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | UncertainFunction.var | Variance value as a result of an uncertainty calculation | mcerp/__init__.py | def var(self):
"""
Variance value as a result of an uncertainty calculation
"""
mn = self.mean
vr = np.mean((self._mcpts - mn) ** 2)
return vr | def var(self):
"""
Variance value as a result of an uncertainty calculation
"""
mn = self.mean
vr = np.mean((self._mcpts - mn) ** 2)
return vr | [
"Variance",
"value",
"as",
"a",
"result",
"of",
"an",
"uncertainty",
"calculation"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L74-L80 | [
"def",
"var",
"(",
"self",
")",
":",
"mn",
"=",
"self",
".",
"mean",
"vr",
"=",
"np",
".",
"mean",
"(",
"(",
"self",
".",
"_mcpts",
"-",
"mn",
")",
"**",
"2",
")",
"return",
"vr"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | UncertainFunction.skew | r"""
Skewness coefficient value as a result of an uncertainty calculation,
defined as::
_____ m3
\/beta1 = ------
std**3
where m3 is the third central moment and std is the standard deviation | mcerp/__init__.py | def skew(self):
r"""
Skewness coefficient value as a result of an uncertainty calculation,
defined as::
_____ m3
\/beta1 = ------
std**3
where m3 is the third central moment and std is the standard deviation
... | def skew(self):
r"""
Skewness coefficient value as a result of an uncertainty calculation,
defined as::
_____ m3
\/beta1 = ------
std**3
where m3 is the third central moment and std is the standard deviation
... | [
"r",
"Skewness",
"coefficient",
"value",
"as",
"a",
"result",
"of",
"an",
"uncertainty",
"calculation",
"defined",
"as",
"::",
"_____",
"m3",
"\\",
"/",
"beta1",
"=",
"------",
"std",
"**",
"3",
"where",
"m3",
"is",
"the",
"third",
"central",
"moment",
"... | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L95-L109 | [
"def",
"skew",
"(",
"self",
")",
":",
"mn",
"=",
"self",
".",
"mean",
"sd",
"=",
"self",
".",
"std",
"sk",
"=",
"0.0",
"if",
"abs",
"(",
"sd",
")",
"<=",
"1e-8",
"else",
"np",
".",
"mean",
"(",
"(",
"self",
".",
"_mcpts",
"-",
"mn",
")",
"*... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | UncertainFunction.kurt | Kurtosis coefficient value as a result of an uncertainty calculation,
defined as::
m4
beta2 = ------
std**4
where m4 is the fourth central moment and std is the standard deviation | mcerp/__init__.py | def kurt(self):
"""
Kurtosis coefficient value as a result of an uncertainty calculation,
defined as::
m4
beta2 = ------
std**4
where m4 is the fourth central moment and std is the standard deviation
"""
... | def kurt(self):
"""
Kurtosis coefficient value as a result of an uncertainty calculation,
defined as::
m4
beta2 = ------
std**4
where m4 is the fourth central moment and std is the standard deviation
"""
... | [
"Kurtosis",
"coefficient",
"value",
"as",
"a",
"result",
"of",
"an",
"uncertainty",
"calculation",
"defined",
"as",
"::",
"m4",
"beta2",
"=",
"------",
"std",
"**",
"4"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L112-L126 | [
"def",
"kurt",
"(",
"self",
")",
":",
"mn",
"=",
"self",
".",
"mean",
"sd",
"=",
"self",
".",
"std",
"kt",
"=",
"0.0",
"if",
"abs",
"(",
"sd",
")",
"<=",
"1e-8",
"else",
"np",
".",
"mean",
"(",
"(",
"self",
".",
"_mcpts",
"-",
"mn",
")",
"*... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | UncertainFunction.stats | The first four standard moments of a distribution: mean, variance, and
standardized skewness and kurtosis coefficients. | mcerp/__init__.py | def stats(self):
"""
The first four standard moments of a distribution: mean, variance, and
standardized skewness and kurtosis coefficients.
"""
mn = self.mean
vr = self.var
sk = self.skew
kt = self.kurt
return [mn, vr, sk, kt] | def stats(self):
"""
The first four standard moments of a distribution: mean, variance, and
standardized skewness and kurtosis coefficients.
"""
mn = self.mean
vr = self.var
sk = self.skew
kt = self.kurt
return [mn, vr, sk, kt] | [
"The",
"first",
"four",
"standard",
"moments",
"of",
"a",
"distribution",
":",
"mean",
"variance",
"and",
"standardized",
"skewness",
"and",
"kurtosis",
"coefficients",
"."
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L129-L138 | [
"def",
"stats",
"(",
"self",
")",
":",
"mn",
"=",
"self",
".",
"mean",
"vr",
"=",
"self",
".",
"var",
"sk",
"=",
"self",
".",
"skew",
"kt",
"=",
"self",
".",
"kurt",
"return",
"[",
"mn",
",",
"vr",
",",
"sk",
",",
"kt",
"]"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | UncertainFunction.percentile | Get the distribution value at a given percentile or set of percentiles.
This follows the NIST method for calculating percentiles.
Parameters
----------
val : scalar or array
Either a single value or an array of values between 0 and 1.
Returns
... | mcerp/__init__.py | def percentile(self, val):
"""
Get the distribution value at a given percentile or set of percentiles.
This follows the NIST method for calculating percentiles.
Parameters
----------
val : scalar or array
Either a single value or an array of values be... | def percentile(self, val):
"""
Get the distribution value at a given percentile or set of percentiles.
This follows the NIST method for calculating percentiles.
Parameters
----------
val : scalar or array
Either a single value or an array of values be... | [
"Get",
"the",
"distribution",
"value",
"at",
"a",
"given",
"percentile",
"or",
"set",
"of",
"percentiles",
".",
"This",
"follows",
"the",
"NIST",
"method",
"for",
"calculating",
"percentiles",
".",
"Parameters",
"----------",
"val",
":",
"scalar",
"or",
"array... | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L140-L172 | [
"def",
"percentile",
"(",
"self",
",",
"val",
")",
":",
"try",
":",
"# test to see if an input is given as an array",
"out",
"=",
"[",
"self",
".",
"percentile",
"(",
"vi",
")",
"for",
"vi",
"in",
"val",
"]",
"except",
"(",
"ValueError",
",",
"TypeError",
... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | UncertainFunction.describe | Cleanly show what the four displayed distribution moments are:
- Mean
- Variance
- Standardized Skewness Coefficient
- Standardized Kurtosis Coefficient
For a standard Normal distribution, these are [0, 1, 0, 3].
If the object has an asso... | mcerp/__init__.py | def describe(self, name=None):
"""
Cleanly show what the four displayed distribution moments are:
- Mean
- Variance
- Standardized Skewness Coefficient
- Standardized Kurtosis Coefficient
For a standard Normal distribution, these are [0, 1... | def describe(self, name=None):
"""
Cleanly show what the four displayed distribution moments are:
- Mean
- Variance
- Standardized Skewness Coefficient
- Standardized Kurtosis Coefficient
For a standard Normal distribution, these are [0, 1... | [
"Cleanly",
"show",
"what",
"the",
"four",
"displayed",
"distribution",
"moments",
"are",
":",
"-",
"Mean",
"-",
"Variance",
"-",
"Standardized",
"Skewness",
"Coefficient",
"-",
"Standardized",
"Kurtosis",
"Coefficient",
"For",
"a",
"standard",
"Normal",
"distribut... | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L191-L239 | [
"def",
"describe",
"(",
"self",
",",
"name",
"=",
"None",
")",
":",
"mn",
",",
"vr",
",",
"sk",
",",
"kt",
"=",
"self",
".",
"stats",
"if",
"name",
"is",
"not",
"None",
":",
"s",
"=",
"\"MCERP Uncertain Value (\"",
"+",
"name",
"+",
"\"):\\n\"",
"e... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | UncertainFunction.plot | Plot the distribution of the UncertainFunction. By default, the
distribution is shown with a kernel density estimate (kde).
Optional
--------
hist : bool
If true, a density histogram is displayed (histtype='stepfilled')
show : bool
If ``True``, th... | mcerp/__init__.py | def plot(self, hist=False, show=False, **kwargs):
"""
Plot the distribution of the UncertainFunction. By default, the
distribution is shown with a kernel density estimate (kde).
Optional
--------
hist : bool
If true, a density histogram is displayed (... | def plot(self, hist=False, show=False, **kwargs):
"""
Plot the distribution of the UncertainFunction. By default, the
distribution is shown with a kernel density estimate (kde).
Optional
--------
hist : bool
If true, a density histogram is displayed (... | [
"Plot",
"the",
"distribution",
"of",
"the",
"UncertainFunction",
".",
"By",
"default",
"the",
"distribution",
"is",
"shown",
"with",
"a",
"kernel",
"density",
"estimate",
"(",
"kde",
")",
".",
"Optional",
"--------",
"hist",
":",
"bool",
"If",
"true",
"a",
... | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L241-L281 | [
"def",
"plot",
"(",
"self",
",",
"hist",
"=",
"False",
",",
"show",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"vals",
"=",
"self",
".",
"_mcpts",
"low",
"=",
"min",
"(",
"vals",
")",
"hig... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | UncertainVariable.plot | Plot the distribution of the UncertainVariable. Continuous
distributions are plotted with a line plot and discrete distributions
are plotted with discrete circles.
Optional
--------
hist : bool
If true, a histogram is displayed
show : bool
... | mcerp/__init__.py | def plot(self, hist=False, show=False, **kwargs):
"""
Plot the distribution of the UncertainVariable. Continuous
distributions are plotted with a line plot and discrete distributions
are plotted with discrete circles.
Optional
--------
hist : bool
... | def plot(self, hist=False, show=False, **kwargs):
"""
Plot the distribution of the UncertainVariable. Continuous
distributions are plotted with a line plot and discrete distributions
are plotted with discrete circles.
Optional
--------
hist : bool
... | [
"Plot",
"the",
"distribution",
"of",
"the",
"UncertainVariable",
".",
"Continuous",
"distributions",
"are",
"plotted",
"with",
"a",
"line",
"plot",
"and",
"discrete",
"distributions",
"are",
"plotted",
"with",
"discrete",
"circles",
".",
"Optional",
"--------",
"h... | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L652-L698 | [
"def",
"plot",
"(",
"self",
",",
"hist",
"=",
"False",
",",
"show",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"if",
"hist",
":",
"vals",
"=",
"self",
".",
"_mcpts",
"low",
"=",
"vals",
".... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | DrawHat.load_hat | Loads the hat from a picture at path.
Args:
path: The path to load from
Returns:
The hat data. | cvloop/functions.py | def load_hat(self, path): # pylint: disable=no-self-use
"""Loads the hat from a picture at path.
Args:
path: The path to load from
Returns:
The hat data.
"""
hat = cv2.imread(path, cv2.IMREAD_UNCHANGED)
if hat is None:
raise ValueErr... | def load_hat(self, path): # pylint: disable=no-self-use
"""Loads the hat from a picture at path.
Args:
path: The path to load from
Returns:
The hat data.
"""
hat = cv2.imread(path, cv2.IMREAD_UNCHANGED)
if hat is None:
raise ValueErr... | [
"Loads",
"the",
"hat",
"from",
"a",
"picture",
"at",
"path",
"."
] | shoeffner/cvloop | python | https://github.com/shoeffner/cvloop/blob/3ddd311e9b679d16c8fd36779931380374de343c/cvloop/functions.py#L173-L186 | [
"def",
"load_hat",
"(",
"self",
",",
"path",
")",
":",
"# pylint: disable=no-self-use",
"hat",
"=",
"cv2",
".",
"imread",
"(",
"path",
",",
"cv2",
".",
"IMREAD_UNCHANGED",
")",
"if",
"hat",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'No hat image found ... | 3ddd311e9b679d16c8fd36779931380374de343c |
train | DrawHat.find_faces | Uses a haarcascade to detect faces inside an image.
Args:
image: The image.
draw_box: If True, the image will be marked with a rectangle.
Return:
The faces as returned by OpenCV's detectMultiScale method for
cascades. | cvloop/functions.py | def find_faces(self, image, draw_box=False):
"""Uses a haarcascade to detect faces inside an image.
Args:
image: The image.
draw_box: If True, the image will be marked with a rectangle.
Return:
The faces as returned by OpenCV's detectMultiScale method for
... | def find_faces(self, image, draw_box=False):
"""Uses a haarcascade to detect faces inside an image.
Args:
image: The image.
draw_box: If True, the image will be marked with a rectangle.
Return:
The faces as returned by OpenCV's detectMultiScale method for
... | [
"Uses",
"a",
"haarcascade",
"to",
"detect",
"faces",
"inside",
"an",
"image",
"."
] | shoeffner/cvloop | python | https://github.com/shoeffner/cvloop/blob/3ddd311e9b679d16c8fd36779931380374de343c/cvloop/functions.py#L188-L211 | [
"def",
"find_faces",
"(",
"self",
",",
"image",
",",
"draw_box",
"=",
"False",
")",
":",
"frame_gray",
"=",
"cv2",
".",
"cvtColor",
"(",
"image",
",",
"cv2",
".",
"COLOR_RGB2GRAY",
")",
"faces",
"=",
"self",
".",
"cascade",
".",
"detectMultiScale",
"(",
... | 3ddd311e9b679d16c8fd36779931380374de343c |
train | HackerOneClient.find_resources | Find instances of `rsrc_type` that match the filter in `**kwargs` | h1/client.py | def find_resources(self, rsrc_type, sort=None, yield_pages=False, **kwargs):
"""Find instances of `rsrc_type` that match the filter in `**kwargs`"""
return rsrc_type.find(self, sort=sort, yield_pages=yield_pages, **kwargs) | def find_resources(self, rsrc_type, sort=None, yield_pages=False, **kwargs):
"""Find instances of `rsrc_type` that match the filter in `**kwargs`"""
return rsrc_type.find(self, sort=sort, yield_pages=yield_pages, **kwargs) | [
"Find",
"instances",
"of",
"rsrc_type",
"that",
"match",
"the",
"filter",
"in",
"**",
"kwargs"
] | uber-archive/h1-python | python | https://github.com/uber-archive/h1-python/blob/c91aec6a26887e453106af39e96ec6d5c7b00c9d/h1/client.py#L111-L113 | [
"def",
"find_resources",
"(",
"self",
",",
"rsrc_type",
",",
"sort",
"=",
"None",
",",
"yield_pages",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"rsrc_type",
".",
"find",
"(",
"self",
",",
"sort",
"=",
"sort",
",",
"yield_pages",
"=",
... | c91aec6a26887e453106af39e96ec6d5c7b00c9d |
train | TrackedObject.changed | Marks the object as changed.
If a `parent` attribute is set, the `changed()` method on the parent
will be called, propagating the change notification up the chain.
The message (if provided) will be debug logged. | sqlalchemy_json/track.py | def changed(self, message=None, *args):
"""Marks the object as changed.
If a `parent` attribute is set, the `changed()` method on the parent
will be called, propagating the change notification up the chain.
The message (if provided) will be debug logged.
"""
if message ... | def changed(self, message=None, *args):
"""Marks the object as changed.
If a `parent` attribute is set, the `changed()` method on the parent
will be called, propagating the change notification up the chain.
The message (if provided) will be debug logged.
"""
if message ... | [
"Marks",
"the",
"object",
"as",
"changed",
"."
] | edelooff/sqlalchemy-json | python | https://github.com/edelooff/sqlalchemy-json/blob/4e5df0d61dc09ed9a52e24ab291a1f1e14aa95cc/sqlalchemy_json/track.py#L25-L39 | [
"def",
"changed",
"(",
"self",
",",
"message",
"=",
"None",
",",
"*",
"args",
")",
":",
"if",
"message",
"is",
"not",
"None",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"'%s: %s'",
",",
"self",
".",
"_repr",
"(",
")",
",",
"message",
"%",
"ar... | 4e5df0d61dc09ed9a52e24ab291a1f1e14aa95cc |
train | TrackedObject.register | Decorator for mutation tracker registration.
The provided `origin_type` is mapped to the decorated class such that
future calls to `convert()` will convert the object of `origin_type`
to an instance of the decorated class. | sqlalchemy_json/track.py | def register(cls, origin_type):
"""Decorator for mutation tracker registration.
The provided `origin_type` is mapped to the decorated class such that
future calls to `convert()` will convert the object of `origin_type`
to an instance of the decorated class.
"""
def decor... | def register(cls, origin_type):
"""Decorator for mutation tracker registration.
The provided `origin_type` is mapped to the decorated class such that
future calls to `convert()` will convert the object of `origin_type`
to an instance of the decorated class.
"""
def decor... | [
"Decorator",
"for",
"mutation",
"tracker",
"registration",
"."
] | edelooff/sqlalchemy-json | python | https://github.com/edelooff/sqlalchemy-json/blob/4e5df0d61dc09ed9a52e24ab291a1f1e14aa95cc/sqlalchemy_json/track.py#L42-L53 | [
"def",
"register",
"(",
"cls",
",",
"origin_type",
")",
":",
"def",
"decorator",
"(",
"tracked_type",
")",
":",
"\"\"\"Adds the decorated class to the `_type_mapping` dictionary.\"\"\"",
"cls",
".",
"_type_mapping",
"[",
"origin_type",
"]",
"=",
"tracked_type",
"return"... | 4e5df0d61dc09ed9a52e24ab291a1f1e14aa95cc |
train | TrackedObject.convert | Converts objects to registered tracked types
This checks the type of the given object against the registered tracked
types. When a match is found, the given object will be converted to the
tracked type, its parent set to the provided parent, and returned.
If its type does not occur in ... | sqlalchemy_json/track.py | def convert(cls, obj, parent):
"""Converts objects to registered tracked types
This checks the type of the given object against the registered tracked
types. When a match is found, the given object will be converted to the
tracked type, its parent set to the provided parent, and returne... | def convert(cls, obj, parent):
"""Converts objects to registered tracked types
This checks the type of the given object against the registered tracked
types. When a match is found, the given object will be converted to the
tracked type, its parent set to the provided parent, and returne... | [
"Converts",
"objects",
"to",
"registered",
"tracked",
"types"
] | edelooff/sqlalchemy-json | python | https://github.com/edelooff/sqlalchemy-json/blob/4e5df0d61dc09ed9a52e24ab291a1f1e14aa95cc/sqlalchemy_json/track.py#L56-L71 | [
"def",
"convert",
"(",
"cls",
",",
"obj",
",",
"parent",
")",
":",
"replacement_type",
"=",
"cls",
".",
"_type_mapping",
".",
"get",
"(",
"type",
"(",
"obj",
")",
")",
"if",
"replacement_type",
"is",
"not",
"None",
":",
"new",
"=",
"replacement_type",
... | 4e5df0d61dc09ed9a52e24ab291a1f1e14aa95cc |
train | TrackedObject.convert_items | Generator like `convert_iterable`, but for 2-tuple iterators. | sqlalchemy_json/track.py | def convert_items(self, items):
"""Generator like `convert_iterable`, but for 2-tuple iterators."""
return ((key, self.convert(value, self)) for key, value in items) | def convert_items(self, items):
"""Generator like `convert_iterable`, but for 2-tuple iterators."""
return ((key, self.convert(value, self)) for key, value in items) | [
"Generator",
"like",
"convert_iterable",
"but",
"for",
"2",
"-",
"tuple",
"iterators",
"."
] | edelooff/sqlalchemy-json | python | https://github.com/edelooff/sqlalchemy-json/blob/4e5df0d61dc09ed9a52e24ab291a1f1e14aa95cc/sqlalchemy_json/track.py#L77-L79 | [
"def",
"convert_items",
"(",
"self",
",",
"items",
")",
":",
"return",
"(",
"(",
"key",
",",
"self",
".",
"convert",
"(",
"value",
",",
"self",
")",
")",
"for",
"key",
",",
"value",
"in",
"items",
")"
] | 4e5df0d61dc09ed9a52e24ab291a1f1e14aa95cc |
train | TrackedObject.convert_mapping | Convenience method to track either a dict or a 2-tuple iterator. | sqlalchemy_json/track.py | def convert_mapping(self, mapping):
"""Convenience method to track either a dict or a 2-tuple iterator."""
if isinstance(mapping, dict):
return self.convert_items(iteritems(mapping))
return self.convert_items(mapping) | def convert_mapping(self, mapping):
"""Convenience method to track either a dict or a 2-tuple iterator."""
if isinstance(mapping, dict):
return self.convert_items(iteritems(mapping))
return self.convert_items(mapping) | [
"Convenience",
"method",
"to",
"track",
"either",
"a",
"dict",
"or",
"a",
"2",
"-",
"tuple",
"iterator",
"."
] | edelooff/sqlalchemy-json | python | https://github.com/edelooff/sqlalchemy-json/blob/4e5df0d61dc09ed9a52e24ab291a1f1e14aa95cc/sqlalchemy_json/track.py#L81-L85 | [
"def",
"convert_mapping",
"(",
"self",
",",
"mapping",
")",
":",
"if",
"isinstance",
"(",
"mapping",
",",
"dict",
")",
":",
"return",
"self",
".",
"convert_items",
"(",
"iteritems",
"(",
"mapping",
")",
")",
"return",
"self",
".",
"convert_items",
"(",
"... | 4e5df0d61dc09ed9a52e24ab291a1f1e14aa95cc |
train | PreferencesAdmin.changelist_view | If we only have a single preference object redirect to it,
otherwise display listing. | preferences/admin.py | def changelist_view(self, request, extra_context=None):
"""
If we only have a single preference object redirect to it,
otherwise display listing.
"""
model = self.model
if model.objects.all().count() > 1:
return super(PreferencesAdmin, self).changelist_view(re... | def changelist_view(self, request, extra_context=None):
"""
If we only have a single preference object redirect to it,
otherwise display listing.
"""
model = self.model
if model.objects.all().count() > 1:
return super(PreferencesAdmin, self).changelist_view(re... | [
"If",
"we",
"only",
"have",
"a",
"single",
"preference",
"object",
"redirect",
"to",
"it",
"otherwise",
"display",
"listing",
"."
] | praekelt/django-preferences | python | https://github.com/praekelt/django-preferences/blob/724f23da45449e96feb5179cb34e3d380cf151a1/preferences/admin.py#L13-L30 | [
"def",
"changelist_view",
"(",
"self",
",",
"request",
",",
"extra_context",
"=",
"None",
")",
":",
"model",
"=",
"self",
".",
"model",
"if",
"model",
".",
"objects",
".",
"all",
"(",
")",
".",
"count",
"(",
")",
">",
"1",
":",
"return",
"super",
"... | 724f23da45449e96feb5179cb34e3d380cf151a1 |
train | md2rst | Only converts headers | setup.py | def md2rst(md_lines):
'Only converts headers'
lvl2header_char = {1: '=', 2: '-', 3: '~'}
for md_line in md_lines:
if md_line.startswith('#'):
header_indent, header_text = md_line.split(' ', 1)
yield header_text
header_char = lvl2header_char[len(header_indent)]
... | def md2rst(md_lines):
'Only converts headers'
lvl2header_char = {1: '=', 2: '-', 3: '~'}
for md_line in md_lines:
if md_line.startswith('#'):
header_indent, header_text = md_line.split(' ', 1)
yield header_text
header_char = lvl2header_char[len(header_indent)]
... | [
"Only",
"converts",
"headers"
] | voyages-sncf-technologies/nexus_uploader | python | https://github.com/voyages-sncf-technologies/nexus_uploader/blob/dca654f9080264b1dcaabfc2fd19f26b1c4f59fe/setup.py#L24-L34 | [
"def",
"md2rst",
"(",
"md_lines",
")",
":",
"lvl2header_char",
"=",
"{",
"1",
":",
"'='",
",",
"2",
":",
"'-'",
",",
"3",
":",
"'~'",
"}",
"for",
"md_line",
"in",
"md_lines",
":",
"if",
"md_line",
".",
"startswith",
"(",
"'#'",
")",
":",
"header_in... | dca654f9080264b1dcaabfc2fd19f26b1c4f59fe |
train | aslist | Function decorator to transform a generator into a list | nexus_uploader/utils.py | def aslist(generator):
'Function decorator to transform a generator into a list'
def wrapper(*args, **kwargs):
return list(generator(*args, **kwargs))
return wrapper | def aslist(generator):
'Function decorator to transform a generator into a list'
def wrapper(*args, **kwargs):
return list(generator(*args, **kwargs))
return wrapper | [
"Function",
"decorator",
"to",
"transform",
"a",
"generator",
"into",
"a",
"list"
] | voyages-sncf-technologies/nexus_uploader | python | https://github.com/voyages-sncf-technologies/nexus_uploader/blob/dca654f9080264b1dcaabfc2fd19f26b1c4f59fe/nexus_uploader/utils.py#L17-L21 | [
"def",
"aslist",
"(",
"generator",
")",
":",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"list",
"(",
"generator",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")",
"return",
"wrapper"
] | dca654f9080264b1dcaabfc2fd19f26b1c4f59fe |
train | get_package_release_from_pypi | No classifier-based selection of Python packages is currently implemented: for now we don't fetch any .whl or .egg
Eventually, we should select the best release available, based on the classifier & PEP 425: https://www.python.org/dev/peps/pep-0425/
E.g. a wheel when available but NOT for tornado 4.3 for example... | nexus_uploader/pypi.py | def get_package_release_from_pypi(pkg_name, version, pypi_json_api_url, allowed_classifiers):
"""
No classifier-based selection of Python packages is currently implemented: for now we don't fetch any .whl or .egg
Eventually, we should select the best release available, based on the classifier & PEP 425: htt... | def get_package_release_from_pypi(pkg_name, version, pypi_json_api_url, allowed_classifiers):
"""
No classifier-based selection of Python packages is currently implemented: for now we don't fetch any .whl or .egg
Eventually, we should select the best release available, based on the classifier & PEP 425: htt... | [
"No",
"classifier",
"-",
"based",
"selection",
"of",
"Python",
"packages",
"is",
"currently",
"implemented",
":",
"for",
"now",
"we",
"don",
"t",
"fetch",
"any",
".",
"whl",
"or",
".",
"egg",
"Eventually",
"we",
"should",
"select",
"the",
"best",
"release"... | voyages-sncf-technologies/nexus_uploader | python | https://github.com/voyages-sncf-technologies/nexus_uploader/blob/dca654f9080264b1dcaabfc2fd19f26b1c4f59fe/nexus_uploader/pypi.py#L27-L40 | [
"def",
"get_package_release_from_pypi",
"(",
"pkg_name",
",",
"version",
",",
"pypi_json_api_url",
",",
"allowed_classifiers",
")",
":",
"matching_releases",
"=",
"get_package_releases_matching_version",
"(",
"pkg_name",
",",
"version",
",",
"pypi_json_api_url",
")",
"src... | dca654f9080264b1dcaabfc2fd19f26b1c4f59fe |
train | extract_classifier_and_extension | Returns a PEP425-compliant classifier (or 'py2.py3-none-any' if it cannot be extracted),
and the file extension
TODO: return a classifier 3-members namedtuple instead of a single string | nexus_uploader/pypi.py | def extract_classifier_and_extension(pkg_name, filename):
"""
Returns a PEP425-compliant classifier (or 'py2.py3-none-any' if it cannot be extracted),
and the file extension
TODO: return a classifier 3-members namedtuple instead of a single string
"""
basename, _, extension = filename.rpartition... | def extract_classifier_and_extension(pkg_name, filename):
"""
Returns a PEP425-compliant classifier (or 'py2.py3-none-any' if it cannot be extracted),
and the file extension
TODO: return a classifier 3-members namedtuple instead of a single string
"""
basename, _, extension = filename.rpartition... | [
"Returns",
"a",
"PEP425",
"-",
"compliant",
"classifier",
"(",
"or",
"py2",
".",
"py3",
"-",
"none",
"-",
"any",
"if",
"it",
"cannot",
"be",
"extracted",
")",
"and",
"the",
"file",
"extension",
"TODO",
":",
"return",
"a",
"classifier",
"3",
"-",
"membe... | voyages-sncf-technologies/nexus_uploader | python | https://github.com/voyages-sncf-technologies/nexus_uploader/blob/dca654f9080264b1dcaabfc2fd19f26b1c4f59fe/nexus_uploader/pypi.py#L62-L80 | [
"def",
"extract_classifier_and_extension",
"(",
"pkg_name",
",",
"filename",
")",
":",
"basename",
",",
"_",
",",
"extension",
"=",
"filename",
".",
"rpartition",
"(",
"'.'",
")",
"if",
"extension",
"==",
"'gz'",
"and",
"filename",
".",
"endswith",
"(",
"'.t... | dca654f9080264b1dcaabfc2fd19f26b1c4f59fe |
train | NestedMutable.coerce | Convert plain dictionary to NestedMutable. | sqlalchemy_json/__init__.py | def coerce(cls, key, value):
"""Convert plain dictionary to NestedMutable."""
if value is None:
return value
if isinstance(value, cls):
return value
if isinstance(value, dict):
return NestedMutableDict.coerce(key, value)
if isinstance(value, li... | def coerce(cls, key, value):
"""Convert plain dictionary to NestedMutable."""
if value is None:
return value
if isinstance(value, cls):
return value
if isinstance(value, dict):
return NestedMutableDict.coerce(key, value)
if isinstance(value, li... | [
"Convert",
"plain",
"dictionary",
"to",
"NestedMutable",
"."
] | edelooff/sqlalchemy-json | python | https://github.com/edelooff/sqlalchemy-json/blob/4e5df0d61dc09ed9a52e24ab291a1f1e14aa95cc/sqlalchemy_json/__init__.py#L36-L46 | [
"def",
"coerce",
"(",
"cls",
",",
"key",
",",
"value",
")",
":",
"if",
"value",
"is",
"None",
":",
"return",
"value",
"if",
"isinstance",
"(",
"value",
",",
"cls",
")",
":",
"return",
"value",
"if",
"isinstance",
"(",
"value",
",",
"dict",
")",
":"... | 4e5df0d61dc09ed9a52e24ab291a1f1e14aa95cc |
train | is_mod_function | Checks if a function in a module was declared in that module.
http://stackoverflow.com/a/1107150/3004221
Args:
mod: the module
fun: the function | tools/create_functions_ipynb.py | def is_mod_function(mod, fun):
"""Checks if a function in a module was declared in that module.
http://stackoverflow.com/a/1107150/3004221
Args:
mod: the module
fun: the function
"""
return inspect.isfunction(fun) and inspect.getmodule(fun) == mod | def is_mod_function(mod, fun):
"""Checks if a function in a module was declared in that module.
http://stackoverflow.com/a/1107150/3004221
Args:
mod: the module
fun: the function
"""
return inspect.isfunction(fun) and inspect.getmodule(fun) == mod | [
"Checks",
"if",
"a",
"function",
"in",
"a",
"module",
"was",
"declared",
"in",
"that",
"module",
"."
] | shoeffner/cvloop | python | https://github.com/shoeffner/cvloop/blob/3ddd311e9b679d16c8fd36779931380374de343c/tools/create_functions_ipynb.py#L15-L24 | [
"def",
"is_mod_function",
"(",
"mod",
",",
"fun",
")",
":",
"return",
"inspect",
".",
"isfunction",
"(",
"fun",
")",
"and",
"inspect",
".",
"getmodule",
"(",
"fun",
")",
"==",
"mod"
] | 3ddd311e9b679d16c8fd36779931380374de343c |
train | is_mod_class | Checks if a class in a module was declared in that module.
Args:
mod: the module
cls: the class | tools/create_functions_ipynb.py | def is_mod_class(mod, cls):
"""Checks if a class in a module was declared in that module.
Args:
mod: the module
cls: the class
"""
return inspect.isclass(cls) and inspect.getmodule(cls) == mod | def is_mod_class(mod, cls):
"""Checks if a class in a module was declared in that module.
Args:
mod: the module
cls: the class
"""
return inspect.isclass(cls) and inspect.getmodule(cls) == mod | [
"Checks",
"if",
"a",
"class",
"in",
"a",
"module",
"was",
"declared",
"in",
"that",
"module",
"."
] | shoeffner/cvloop | python | https://github.com/shoeffner/cvloop/blob/3ddd311e9b679d16c8fd36779931380374de343c/tools/create_functions_ipynb.py#L27-L34 | [
"def",
"is_mod_class",
"(",
"mod",
",",
"cls",
")",
":",
"return",
"inspect",
".",
"isclass",
"(",
"cls",
")",
"and",
"inspect",
".",
"getmodule",
"(",
"cls",
")",
"==",
"mod"
] | 3ddd311e9b679d16c8fd36779931380374de343c |
train | list_functions | Lists all functions declared in a module.
http://stackoverflow.com/a/1107150/3004221
Args:
mod_name: the module name
Returns:
A list of functions declared in that module. | tools/create_functions_ipynb.py | def list_functions(mod_name):
"""Lists all functions declared in a module.
http://stackoverflow.com/a/1107150/3004221
Args:
mod_name: the module name
Returns:
A list of functions declared in that module.
"""
mod = sys.modules[mod_name]
return [func.__name__ for func in mod.... | def list_functions(mod_name):
"""Lists all functions declared in a module.
http://stackoverflow.com/a/1107150/3004221
Args:
mod_name: the module name
Returns:
A list of functions declared in that module.
"""
mod = sys.modules[mod_name]
return [func.__name__ for func in mod.... | [
"Lists",
"all",
"functions",
"declared",
"in",
"a",
"module",
"."
] | shoeffner/cvloop | python | https://github.com/shoeffner/cvloop/blob/3ddd311e9b679d16c8fd36779931380374de343c/tools/create_functions_ipynb.py#L37-L49 | [
"def",
"list_functions",
"(",
"mod_name",
")",
":",
"mod",
"=",
"sys",
".",
"modules",
"[",
"mod_name",
"]",
"return",
"[",
"func",
".",
"__name__",
"for",
"func",
"in",
"mod",
".",
"__dict__",
".",
"values",
"(",
")",
"if",
"is_mod_function",
"(",
"mo... | 3ddd311e9b679d16c8fd36779931380374de343c |
train | list_classes | Lists all classes declared in a module.
Args:
mod_name: the module name
Returns:
A list of functions declared in that module. | tools/create_functions_ipynb.py | def list_classes(mod_name):
"""Lists all classes declared in a module.
Args:
mod_name: the module name
Returns:
A list of functions declared in that module.
"""
mod = sys.modules[mod_name]
return [cls.__name__ for cls in mod.__dict__.values()
if is_mod_class(mod, cls... | def list_classes(mod_name):
"""Lists all classes declared in a module.
Args:
mod_name: the module name
Returns:
A list of functions declared in that module.
"""
mod = sys.modules[mod_name]
return [cls.__name__ for cls in mod.__dict__.values()
if is_mod_class(mod, cls... | [
"Lists",
"all",
"classes",
"declared",
"in",
"a",
"module",
"."
] | shoeffner/cvloop | python | https://github.com/shoeffner/cvloop/blob/3ddd311e9b679d16c8fd36779931380374de343c/tools/create_functions_ipynb.py#L52-L62 | [
"def",
"list_classes",
"(",
"mod_name",
")",
":",
"mod",
"=",
"sys",
".",
"modules",
"[",
"mod_name",
"]",
"return",
"[",
"cls",
".",
"__name__",
"for",
"cls",
"in",
"mod",
".",
"__dict__",
".",
"values",
"(",
")",
"if",
"is_mod_class",
"(",
"mod",
"... | 3ddd311e9b679d16c8fd36779931380374de343c |
train | get_linenumbers | Returns a dictionary which maps function names to line numbers.
Args:
functions: a list of function names
module: the module to look the functions up
searchstr: the string to search for
Returns:
A dictionary with functions as keys and their line numbers as values. | tools/create_functions_ipynb.py | def get_linenumbers(functions, module, searchstr='def {}(image):\n'):
"""Returns a dictionary which maps function names to line numbers.
Args:
functions: a list of function names
module: the module to look the functions up
searchstr: the string to search for
Returns:
A di... | def get_linenumbers(functions, module, searchstr='def {}(image):\n'):
"""Returns a dictionary which maps function names to line numbers.
Args:
functions: a list of function names
module: the module to look the functions up
searchstr: the string to search for
Returns:
A di... | [
"Returns",
"a",
"dictionary",
"which",
"maps",
"function",
"names",
"to",
"line",
"numbers",
"."
] | shoeffner/cvloop | python | https://github.com/shoeffner/cvloop/blob/3ddd311e9b679d16c8fd36779931380374de343c/tools/create_functions_ipynb.py#L65-L84 | [
"def",
"get_linenumbers",
"(",
"functions",
",",
"module",
",",
"searchstr",
"=",
"'def {}(image):\\n'",
")",
":",
"lines",
"=",
"inspect",
".",
"getsourcelines",
"(",
"module",
")",
"[",
"0",
"]",
"line_numbers",
"=",
"{",
"}",
"for",
"function",
"in",
"f... | 3ddd311e9b679d16c8fd36779931380374de343c |
train | format_doc | Formats the documentation in a nicer way and for notebook cells. | tools/create_functions_ipynb.py | def format_doc(fun):
"""Formats the documentation in a nicer way and for notebook cells."""
SEPARATOR = '============================='
func = cvloop.functions.__dict__[fun]
doc_lines = ['{}'.format(l).strip() for l in func.__doc__.split('\n')]
if hasattr(func, '__init__'):
doc_lines.append... | def format_doc(fun):
"""Formats the documentation in a nicer way and for notebook cells."""
SEPARATOR = '============================='
func = cvloop.functions.__dict__[fun]
doc_lines = ['{}'.format(l).strip() for l in func.__doc__.split('\n')]
if hasattr(func, '__init__'):
doc_lines.append... | [
"Formats",
"the",
"documentation",
"in",
"a",
"nicer",
"way",
"and",
"for",
"notebook",
"cells",
"."
] | shoeffner/cvloop | python | https://github.com/shoeffner/cvloop/blob/3ddd311e9b679d16c8fd36779931380374de343c/tools/create_functions_ipynb.py#L87-L121 | [
"def",
"format_doc",
"(",
"fun",
")",
":",
"SEPARATOR",
"=",
"'============================='",
"func",
"=",
"cvloop",
".",
"functions",
".",
"__dict__",
"[",
"fun",
"]",
"doc_lines",
"=",
"[",
"'{}'",
".",
"format",
"(",
"l",
")",
".",
"strip",
"(",
")"... | 3ddd311e9b679d16c8fd36779931380374de343c |
train | main | Main function creates the cvloop.functions example notebook. | tools/create_functions_ipynb.py | def main():
"""Main function creates the cvloop.functions example notebook."""
notebook = {
'cells': [
{
'cell_type': 'markdown',
'metadata': {},
'source': [
'# cvloop functions\n\n',
'This notebook shows... | def main():
"""Main function creates the cvloop.functions example notebook."""
notebook = {
'cells': [
{
'cell_type': 'markdown',
'metadata': {},
'source': [
'# cvloop functions\n\n',
'This notebook shows... | [
"Main",
"function",
"creates",
"the",
"cvloop",
".",
"functions",
"example",
"notebook",
"."
] | shoeffner/cvloop | python | https://github.com/shoeffner/cvloop/blob/3ddd311e9b679d16c8fd36779931380374de343c/tools/create_functions_ipynb.py#L161-L212 | [
"def",
"main",
"(",
")",
":",
"notebook",
"=",
"{",
"'cells'",
":",
"[",
"{",
"'cell_type'",
":",
"'markdown'",
",",
"'metadata'",
":",
"{",
"}",
",",
"'source'",
":",
"[",
"'# cvloop functions\\n\\n'",
",",
"'This notebook shows an overview over all cvloop '",
... | 3ddd311e9b679d16c8fd36779931380374de343c |
train | prepare_axes | Prepares an axes object for clean plotting.
Removes x and y axes labels and ticks, sets the aspect ratio to be
equal, uses the size to determine the drawing area and fills the image
with random colors as visual feedback.
Creates an AxesImage to be shown inside the axes object and sets the
needed p... | cvloop/cvloop.py | def prepare_axes(axes, title, size, cmap=None):
"""Prepares an axes object for clean plotting.
Removes x and y axes labels and ticks, sets the aspect ratio to be
equal, uses the size to determine the drawing area and fills the image
with random colors as visual feedback.
Creates an AxesImage to be... | def prepare_axes(axes, title, size, cmap=None):
"""Prepares an axes object for clean plotting.
Removes x and y axes labels and ticks, sets the aspect ratio to be
equal, uses the size to determine the drawing area and fills the image
with random colors as visual feedback.
Creates an AxesImage to be... | [
"Prepares",
"an",
"axes",
"object",
"for",
"clean",
"plotting",
"."
] | shoeffner/cvloop | python | https://github.com/shoeffner/cvloop/blob/3ddd311e9b679d16c8fd36779931380374de343c/cvloop/cvloop.py#L29-L67 | [
"def",
"prepare_axes",
"(",
"axes",
",",
"title",
",",
"size",
",",
"cmap",
"=",
"None",
")",
":",
"if",
"axes",
"is",
"None",
":",
"return",
"None",
"# prepare axis itself",
"axes",
".",
"set_xlim",
"(",
"[",
"0",
",",
"size",
"[",
"1",
"]",
"]",
... | 3ddd311e9b679d16c8fd36779931380374de343c |
train | cvloop.connect_event_handlers | Connects event handlers to the figure. | cvloop/cvloop.py | def connect_event_handlers(self):
"""Connects event handlers to the figure."""
self.figure.canvas.mpl_connect('close_event', self.evt_release)
self.figure.canvas.mpl_connect('pause_event', self.evt_toggle_pause) | def connect_event_handlers(self):
"""Connects event handlers to the figure."""
self.figure.canvas.mpl_connect('close_event', self.evt_release)
self.figure.canvas.mpl_connect('pause_event', self.evt_toggle_pause) | [
"Connects",
"event",
"handlers",
"to",
"the",
"figure",
"."
] | shoeffner/cvloop | python | https://github.com/shoeffner/cvloop/blob/3ddd311e9b679d16c8fd36779931380374de343c/cvloop/cvloop.py#L237-L240 | [
"def",
"connect_event_handlers",
"(",
"self",
")",
":",
"self",
".",
"figure",
".",
"canvas",
".",
"mpl_connect",
"(",
"'close_event'",
",",
"self",
".",
"evt_release",
")",
"self",
".",
"figure",
".",
"canvas",
".",
"mpl_connect",
"(",
"'pause_event'",
",",... | 3ddd311e9b679d16c8fd36779931380374de343c |
train | cvloop.evt_toggle_pause | Pauses and resumes the video source. | cvloop/cvloop.py | def evt_toggle_pause(self, *args): # pylint: disable=unused-argument
"""Pauses and resumes the video source."""
if self.event_source._timer is None: # noqa: e501 pylint: disable=protected-access
self.event_source.start()
else:
self.event_source.stop() | def evt_toggle_pause(self, *args): # pylint: disable=unused-argument
"""Pauses and resumes the video source."""
if self.event_source._timer is None: # noqa: e501 pylint: disable=protected-access
self.event_source.start()
else:
self.event_source.stop() | [
"Pauses",
"and",
"resumes",
"the",
"video",
"source",
"."
] | shoeffner/cvloop | python | https://github.com/shoeffner/cvloop/blob/3ddd311e9b679d16c8fd36779931380374de343c/cvloop/cvloop.py#L249-L254 | [
"def",
"evt_toggle_pause",
"(",
"self",
",",
"*",
"args",
")",
":",
"# pylint: disable=unused-argument",
"if",
"self",
".",
"event_source",
".",
"_timer",
"is",
"None",
":",
"# noqa: e501 pylint: disable=protected-access",
"self",
".",
"event_source",
".",
"start",
... | 3ddd311e9b679d16c8fd36779931380374de343c |
train | cvloop.print_info | Prints information about the unprocessed image.
Reads one frame from the source to determine image colors, dimensions
and data types.
Args:
capture: the source to read from. | cvloop/cvloop.py | def print_info(self, capture):
"""Prints information about the unprocessed image.
Reads one frame from the source to determine image colors, dimensions
and data types.
Args:
capture: the source to read from.
"""
self.frame_offset += 1
ret, frame = ca... | def print_info(self, capture):
"""Prints information about the unprocessed image.
Reads one frame from the source to determine image colors, dimensions
and data types.
Args:
capture: the source to read from.
"""
self.frame_offset += 1
ret, frame = ca... | [
"Prints",
"information",
"about",
"the",
"unprocessed",
"image",
"."
] | shoeffner/cvloop | python | https://github.com/shoeffner/cvloop/blob/3ddd311e9b679d16c8fd36779931380374de343c/cvloop/cvloop.py#L256-L276 | [
"def",
"print_info",
"(",
"self",
",",
"capture",
")",
":",
"self",
".",
"frame_offset",
"+=",
"1",
"ret",
",",
"frame",
"=",
"capture",
".",
"read",
"(",
")",
"if",
"ret",
":",
"print",
"(",
"'Capture Information'",
")",
"print",
"(",
"'\\tDimensions (H... | 3ddd311e9b679d16c8fd36779931380374de343c |
train | cvloop.determine_size | Determines the height and width of the image source.
If no dimensions are available, this method defaults to a resolution of
640x480, thus returns (480, 640).
If capture has a get method it is assumed to understand
`cv2.CAP_PROP_FRAME_WIDTH` and `cv2.CAP_PROP_FRAME_HEIGHT` to get the
... | cvloop/cvloop.py | def determine_size(self, capture):
"""Determines the height and width of the image source.
If no dimensions are available, this method defaults to a resolution of
640x480, thus returns (480, 640).
If capture has a get method it is assumed to understand
`cv2.CAP_PROP_FRAME_WIDTH`... | def determine_size(self, capture):
"""Determines the height and width of the image source.
If no dimensions are available, this method defaults to a resolution of
640x480, thus returns (480, 640).
If capture has a get method it is assumed to understand
`cv2.CAP_PROP_FRAME_WIDTH`... | [
"Determines",
"the",
"height",
"and",
"width",
"of",
"the",
"image",
"source",
"."
] | shoeffner/cvloop | python | https://github.com/shoeffner/cvloop/blob/3ddd311e9b679d16c8fd36779931380374de343c/cvloop/cvloop.py#L278-L305 | [
"def",
"determine_size",
"(",
"self",
",",
"capture",
")",
":",
"width",
"=",
"640",
"height",
"=",
"480",
"if",
"capture",
"and",
"hasattr",
"(",
"capture",
",",
"'get'",
")",
":",
"width",
"=",
"capture",
".",
"get",
"(",
"cv2",
".",
"CAP_PROP_FRAME_... | 3ddd311e9b679d16c8fd36779931380374de343c |
train | cvloop._init_draw | Initializes the drawing of the frames by setting the images to
random colors.
This function is called by TimedAnimation. | cvloop/cvloop.py | def _init_draw(self):
"""Initializes the drawing of the frames by setting the images to
random colors.
This function is called by TimedAnimation.
"""
if self.original is not None:
self.original.set_data(np.random.random((10, 10, 3)))
self.processed.set_data(n... | def _init_draw(self):
"""Initializes the drawing of the frames by setting the images to
random colors.
This function is called by TimedAnimation.
"""
if self.original is not None:
self.original.set_data(np.random.random((10, 10, 3)))
self.processed.set_data(n... | [
"Initializes",
"the",
"drawing",
"of",
"the",
"frames",
"by",
"setting",
"the",
"images",
"to",
"random",
"colors",
"."
] | shoeffner/cvloop | python | https://github.com/shoeffner/cvloop/blob/3ddd311e9b679d16c8fd36779931380374de343c/cvloop/cvloop.py#L320-L328 | [
"def",
"_init_draw",
"(",
"self",
")",
":",
"if",
"self",
".",
"original",
"is",
"not",
"None",
":",
"self",
".",
"original",
".",
"set_data",
"(",
"np",
".",
"random",
".",
"random",
"(",
"(",
"10",
",",
"10",
",",
"3",
")",
")",
")",
"self",
... | 3ddd311e9b679d16c8fd36779931380374de343c |
train | cvloop.read_frame | Reads a frame and converts the color if needed.
In case no frame is available, i.e. self.capture.read() returns False
as the first return value, the event_source of the TimedAnimation is
stopped, and if possible the capture source released.
Returns:
None if stopped, otherwi... | cvloop/cvloop.py | def read_frame(self):
"""Reads a frame and converts the color if needed.
In case no frame is available, i.e. self.capture.read() returns False
as the first return value, the event_source of the TimedAnimation is
stopped, and if possible the capture source released.
Returns:
... | def read_frame(self):
"""Reads a frame and converts the color if needed.
In case no frame is available, i.e. self.capture.read() returns False
as the first return value, the event_source of the TimedAnimation is
stopped, and if possible the capture source released.
Returns:
... | [
"Reads",
"a",
"frame",
"and",
"converts",
"the",
"color",
"if",
"needed",
"."
] | shoeffner/cvloop | python | https://github.com/shoeffner/cvloop/blob/3ddd311e9b679d16c8fd36779931380374de343c/cvloop/cvloop.py#L330-L351 | [
"def",
"read_frame",
"(",
"self",
")",
":",
"ret",
",",
"frame",
"=",
"self",
".",
"capture",
".",
"read",
"(",
")",
"if",
"not",
"ret",
":",
"self",
".",
"event_source",
".",
"stop",
"(",
")",
"try",
":",
"self",
".",
"capture",
".",
"release",
... | 3ddd311e9b679d16c8fd36779931380374de343c |
train | cvloop.annotate | Annotates the processed axis with given annotations for
the provided framedata.
Args:
framedata: The current frame number. | cvloop/cvloop.py | def annotate(self, framedata):
"""Annotates the processed axis with given annotations for
the provided framedata.
Args:
framedata: The current frame number.
"""
for artist in self.annotation_artists:
artist.remove()
self.annotation_artists = []
... | def annotate(self, framedata):
"""Annotates the processed axis with given annotations for
the provided framedata.
Args:
framedata: The current frame number.
"""
for artist in self.annotation_artists:
artist.remove()
self.annotation_artists = []
... | [
"Annotates",
"the",
"processed",
"axis",
"with",
"given",
"annotations",
"for",
"the",
"provided",
"framedata",
"."
] | shoeffner/cvloop | python | https://github.com/shoeffner/cvloop/blob/3ddd311e9b679d16c8fd36779931380374de343c/cvloop/cvloop.py#L364-L403 | [
"def",
"annotate",
"(",
"self",
",",
"framedata",
")",
":",
"for",
"artist",
"in",
"self",
".",
"annotation_artists",
":",
"artist",
".",
"remove",
"(",
")",
"self",
".",
"annotation_artists",
"=",
"[",
"]",
"for",
"annotation",
"in",
"self",
".",
"annot... | 3ddd311e9b679d16c8fd36779931380374de343c |
train | cvloop._draw_frame | Reads, processes and draws the frames.
If needed for color maps, conversions to gray scale are performed. In
case the images are no color images and no custom color maps are
defined, the colormap `gray` is applied.
This function is called by TimedAnimation.
Args:
f... | cvloop/cvloop.py | def _draw_frame(self, framedata):
"""Reads, processes and draws the frames.
If needed for color maps, conversions to gray scale are performed. In
case the images are no color images and no custom color maps are
defined, the colormap `gray` is applied.
This function is called by... | def _draw_frame(self, framedata):
"""Reads, processes and draws the frames.
If needed for color maps, conversions to gray scale are performed. In
case the images are no color images and no custom color maps are
defined, the colormap `gray` is applied.
This function is called by... | [
"Reads",
"processes",
"and",
"draws",
"the",
"frames",
"."
] | shoeffner/cvloop | python | https://github.com/shoeffner/cvloop/blob/3ddd311e9b679d16c8fd36779931380374de343c/cvloop/cvloop.py#L405-L444 | [
"def",
"_draw_frame",
"(",
"self",
",",
"framedata",
")",
":",
"original",
"=",
"self",
".",
"read_frame",
"(",
")",
"if",
"original",
"is",
"None",
":",
"self",
".",
"update_info",
"(",
"self",
".",
"info_string",
"(",
"message",
"=",
"'Finished.'",
","... | 3ddd311e9b679d16c8fd36779931380374de343c |
train | cvloop.update_info | Updates the figure's suptitle.
Calls self.info_string() unless custom is provided.
Args:
custom: Overwrite it with this string, unless None. | cvloop/cvloop.py | def update_info(self, custom=None):
"""Updates the figure's suptitle.
Calls self.info_string() unless custom is provided.
Args:
custom: Overwrite it with this string, unless None.
"""
self.figure.suptitle(self.info_string() if custom is None else custom) | def update_info(self, custom=None):
"""Updates the figure's suptitle.
Calls self.info_string() unless custom is provided.
Args:
custom: Overwrite it with this string, unless None.
"""
self.figure.suptitle(self.info_string() if custom is None else custom) | [
"Updates",
"the",
"figure",
"s",
"suptitle",
"."
] | shoeffner/cvloop | python | https://github.com/shoeffner/cvloop/blob/3ddd311e9b679d16c8fd36779931380374de343c/cvloop/cvloop.py#L446-L454 | [
"def",
"update_info",
"(",
"self",
",",
"custom",
"=",
"None",
")",
":",
"self",
".",
"figure",
".",
"suptitle",
"(",
"self",
".",
"info_string",
"(",
")",
"if",
"custom",
"is",
"None",
"else",
"custom",
")"
] | 3ddd311e9b679d16c8fd36779931380374de343c |
train | cvloop.info_string | Returns information about the stream.
Generates a string containing size, frame number, and info messages.
Omits unnecessary information (e.g. empty messages and frame -1).
This method is primarily used to update the suptitle of the plot
figure.
Returns:
An info st... | cvloop/cvloop.py | def info_string(self, size=None, message='', frame=-1):
"""Returns information about the stream.
Generates a string containing size, frame number, and info messages.
Omits unnecessary information (e.g. empty messages and frame -1).
This method is primarily used to update the suptitle o... | def info_string(self, size=None, message='', frame=-1):
"""Returns information about the stream.
Generates a string containing size, frame number, and info messages.
Omits unnecessary information (e.g. empty messages and frame -1).
This method is primarily used to update the suptitle o... | [
"Returns",
"information",
"about",
"the",
"stream",
"."
] | shoeffner/cvloop | python | https://github.com/shoeffner/cvloop/blob/3ddd311e9b679d16c8fd36779931380374de343c/cvloop/cvloop.py#L456-L477 | [
"def",
"info_string",
"(",
"self",
",",
"size",
"=",
"None",
",",
"message",
"=",
"''",
",",
"frame",
"=",
"-",
"1",
")",
":",
"info",
"=",
"[",
"]",
"if",
"size",
"is",
"not",
"None",
":",
"info",
".",
"append",
"(",
"'Size: {1}x{0}'",
".",
"for... | 3ddd311e9b679d16c8fd36779931380374de343c |
train | main | Sanitizes the loaded *.ipynb. | tools/sanitize_ipynb.py | def main():
"""Sanitizes the loaded *.ipynb."""
with open(sys.argv[1], 'r') as nbfile:
notebook = json.load(nbfile)
# remove kernelspec (venvs)
try:
del notebook['metadata']['kernelspec']
except KeyError:
pass
# remove outputs and metadata, set execution counts to None
... | def main():
"""Sanitizes the loaded *.ipynb."""
with open(sys.argv[1], 'r') as nbfile:
notebook = json.load(nbfile)
# remove kernelspec (venvs)
try:
del notebook['metadata']['kernelspec']
except KeyError:
pass
# remove outputs and metadata, set execution counts to None
... | [
"Sanitizes",
"the",
"loaded",
"*",
".",
"ipynb",
"."
] | shoeffner/cvloop | python | https://github.com/shoeffner/cvloop/blob/3ddd311e9b679d16c8fd36779931380374de343c/tools/sanitize_ipynb.py#L8-L30 | [
"def",
"main",
"(",
")",
":",
"with",
"open",
"(",
"sys",
".",
"argv",
"[",
"1",
"]",
",",
"'r'",
")",
"as",
"nbfile",
":",
"notebook",
"=",
"json",
".",
"load",
"(",
"nbfile",
")",
"# remove kernelspec (venvs)",
"try",
":",
"del",
"notebook",
"[",
... | 3ddd311e9b679d16c8fd36779931380374de343c |
train | CommentAPI.create | create comment
:param comment:
:param mentions: list of pair of code and type("USER", "GROUP", and so on)
:return: | pykintone/comment_api.py | def create(self, comment, mentions=()):
"""
create comment
:param comment:
:param mentions: list of pair of code and type("USER", "GROUP", and so on)
:return:
"""
data = {
"app": self.app_id,
"record": self.record_id,
"comment"... | def create(self, comment, mentions=()):
"""
create comment
:param comment:
:param mentions: list of pair of code and type("USER", "GROUP", and so on)
:return:
"""
data = {
"app": self.app_id,
"record": self.record_id,
"comment"... | [
"create",
"comment",
":",
"param",
"comment",
":",
":",
"param",
"mentions",
":",
"list",
"of",
"pair",
"of",
"code",
"and",
"type",
"(",
"USER",
"GROUP",
"and",
"so",
"on",
")",
":",
"return",
":"
] | icoxfog417/pykintone | python | https://github.com/icoxfog417/pykintone/blob/756609fc956fc784325d58cc01473a67a640654c/pykintone/comment_api.py#L42-L76 | [
"def",
"create",
"(",
"self",
",",
"comment",
",",
"mentions",
"=",
"(",
")",
")",
":",
"data",
"=",
"{",
"\"app\"",
":",
"self",
".",
"app_id",
",",
"\"record\"",
":",
"self",
".",
"record_id",
",",
"\"comment\"",
":",
"{",
"\"text\"",
":",
"comment... | 756609fc956fc784325d58cc01473a67a640654c |
train | _consume | Advance the iterator n-steps ahead. If n is none, consume entirely. | h1/lazy_listing.py | def _consume(iterator, n=None):
"""Advance the iterator n-steps ahead. If n is none, consume entirely."""
# Use functions that consume iterators at C speed.
if n is None:
# feed the entire iterator into a zero-length deque
collections.deque(iterator, maxlen=0)
else:
# advance to ... | def _consume(iterator, n=None):
"""Advance the iterator n-steps ahead. If n is none, consume entirely."""
# Use functions that consume iterators at C speed.
if n is None:
# feed the entire iterator into a zero-length deque
collections.deque(iterator, maxlen=0)
else:
# advance to ... | [
"Advance",
"the",
"iterator",
"n",
"-",
"steps",
"ahead",
".",
"If",
"n",
"is",
"none",
"consume",
"entirely",
"."
] | uber-archive/h1-python | python | https://github.com/uber-archive/h1-python/blob/c91aec6a26887e453106af39e96ec6d5c7b00c9d/h1/lazy_listing.py#L31-L39 | [
"def",
"_consume",
"(",
"iterator",
",",
"n",
"=",
"None",
")",
":",
"# Use functions that consume iterators at C speed.",
"if",
"n",
"is",
"None",
":",
"# feed the entire iterator into a zero-length deque",
"collections",
".",
"deque",
"(",
"iterator",
",",
"maxlen",
... | c91aec6a26887e453106af39e96ec6d5c7b00c9d |
train | _slice_required_len | Calculate how many items must be in the collection to satisfy this slice
returns `None` for slices may vary based on the length of the underlying collection
such as `lst[-1]` or `lst[::]` | h1/lazy_listing.py | def _slice_required_len(slice_obj):
"""
Calculate how many items must be in the collection to satisfy this slice
returns `None` for slices may vary based on the length of the underlying collection
such as `lst[-1]` or `lst[::]`
"""
if slice_obj.step and slice_obj.step != 1:
return None
... | def _slice_required_len(slice_obj):
"""
Calculate how many items must be in the collection to satisfy this slice
returns `None` for slices may vary based on the length of the underlying collection
such as `lst[-1]` or `lst[::]`
"""
if slice_obj.step and slice_obj.step != 1:
return None
... | [
"Calculate",
"how",
"many",
"items",
"must",
"be",
"in",
"the",
"collection",
"to",
"satisfy",
"this",
"slice"
] | uber-archive/h1-python | python | https://github.com/uber-archive/h1-python/blob/c91aec6a26887e453106af39e96ec6d5c7b00c9d/h1/lazy_listing.py#L42-L65 | [
"def",
"_slice_required_len",
"(",
"slice_obj",
")",
":",
"if",
"slice_obj",
".",
"step",
"and",
"slice_obj",
".",
"step",
"!=",
"1",
":",
"return",
"None",
"# (None, None, *) requires the entire list",
"if",
"slice_obj",
".",
"start",
"is",
"None",
"and",
"slic... | c91aec6a26887e453106af39e96ec6d5c7b00c9d |
train | stylize | conveniently styles your text as and resets ANSI codes at its end. | colored/colored.py | def stylize(text, styles, reset=True):
"""conveniently styles your text as and resets ANSI codes at its end."""
terminator = attr("reset") if reset else ""
return "{}{}{}".format("".join(styles), text, terminator) | def stylize(text, styles, reset=True):
"""conveniently styles your text as and resets ANSI codes at its end."""
terminator = attr("reset") if reset else ""
return "{}{}{}".format("".join(styles), text, terminator) | [
"conveniently",
"styles",
"your",
"text",
"as",
"and",
"resets",
"ANSI",
"codes",
"at",
"its",
"end",
"."
] | dslackw/colored | python | https://github.com/dslackw/colored/blob/064172b36bd5e456c60581c7fbf77060ca7829ba/colored/colored.py#L389-L392 | [
"def",
"stylize",
"(",
"text",
",",
"styles",
",",
"reset",
"=",
"True",
")",
":",
"terminator",
"=",
"attr",
"(",
"\"reset\"",
")",
"if",
"reset",
"else",
"\"\"",
"return",
"\"{}{}{}\"",
".",
"format",
"(",
"\"\"",
".",
"join",
"(",
"styles",
")",
"... | 064172b36bd5e456c60581c7fbf77060ca7829ba |
train | stylize_interactive | stylize() variant that adds C0 control codes (SOH/STX) for readline
safety. | colored/colored.py | def stylize_interactive(text, styles, reset=True):
"""stylize() variant that adds C0 control codes (SOH/STX) for readline
safety."""
# problem: readline includes bare ANSI codes in width calculations.
# solution: wrap nonprinting codes in SOH/STX when necessary.
# see: https://github.com/dslackw/col... | def stylize_interactive(text, styles, reset=True):
"""stylize() variant that adds C0 control codes (SOH/STX) for readline
safety."""
# problem: readline includes bare ANSI codes in width calculations.
# solution: wrap nonprinting codes in SOH/STX when necessary.
# see: https://github.com/dslackw/col... | [
"stylize",
"()",
"variant",
"that",
"adds",
"C0",
"control",
"codes",
"(",
"SOH",
"/",
"STX",
")",
"for",
"readline",
"safety",
"."
] | dslackw/colored | python | https://github.com/dslackw/colored/blob/064172b36bd5e456c60581c7fbf77060ca7829ba/colored/colored.py#L402-L409 | [
"def",
"stylize_interactive",
"(",
"text",
",",
"styles",
",",
"reset",
"=",
"True",
")",
":",
"# problem: readline includes bare ANSI codes in width calculations.",
"# solution: wrap nonprinting codes in SOH/STX when necessary.",
"# see: https://github.com/dslackw/colored/issues/5",
"... | 064172b36bd5e456c60581c7fbf77060ca7829ba |
train | colored.attribute | Set or reset attributes | colored/colored.py | def attribute(self):
"""Set or reset attributes"""
paint = {
"bold": self.ESC + "1" + self.END,
1: self.ESC + "1" + self.END,
"dim": self.ESC + "2" + self.END,
2: self.ESC + "2" + self.END,
"underlined": self.ESC + "4" + self.END,
... | def attribute(self):
"""Set or reset attributes"""
paint = {
"bold": self.ESC + "1" + self.END,
1: self.ESC + "1" + self.END,
"dim": self.ESC + "2" + self.END,
2: self.ESC + "2" + self.END,
"underlined": self.ESC + "4" + self.END,
... | [
"Set",
"or",
"reset",
"attributes"
] | dslackw/colored | python | https://github.com/dslackw/colored/blob/064172b36bd5e456c60581c7fbf77060ca7829ba/colored/colored.py#L312-L343 | [
"def",
"attribute",
"(",
"self",
")",
":",
"paint",
"=",
"{",
"\"bold\"",
":",
"self",
".",
"ESC",
"+",
"\"1\"",
"+",
"self",
".",
"END",
",",
"1",
":",
"self",
".",
"ESC",
"+",
"\"1\"",
"+",
"self",
".",
"END",
",",
"\"dim\"",
":",
"self",
"."... | 064172b36bd5e456c60581c7fbf77060ca7829ba |
train | colored.foreground | Print 256 foreground colors | colored/colored.py | def foreground(self):
"""Print 256 foreground colors"""
code = self.ESC + "38;5;"
if str(self.color).isdigit():
self.reverse_dict()
color = self.reserve_paint[str(self.color)]
return code + self.paint[color] + self.END
elif self.color.startswith("#"):
... | def foreground(self):
"""Print 256 foreground colors"""
code = self.ESC + "38;5;"
if str(self.color).isdigit():
self.reverse_dict()
color = self.reserve_paint[str(self.color)]
return code + self.paint[color] + self.END
elif self.color.startswith("#"):
... | [
"Print",
"256",
"foreground",
"colors"
] | dslackw/colored | python | https://github.com/dslackw/colored/blob/064172b36bd5e456c60581c7fbf77060ca7829ba/colored/colored.py#L345-L355 | [
"def",
"foreground",
"(",
"self",
")",
":",
"code",
"=",
"self",
".",
"ESC",
"+",
"\"38;5;\"",
"if",
"str",
"(",
"self",
".",
"color",
")",
".",
"isdigit",
"(",
")",
":",
"self",
".",
"reverse_dict",
"(",
")",
"color",
"=",
"self",
".",
"reserve_pa... | 064172b36bd5e456c60581c7fbf77060ca7829ba |
train | colored.reverse_dict | reverse dictionary | colored/colored.py | def reverse_dict(self):
"""reverse dictionary"""
self.reserve_paint = dict(zip(self.paint.values(), self.paint.keys())) | def reverse_dict(self):
"""reverse dictionary"""
self.reserve_paint = dict(zip(self.paint.values(), self.paint.keys())) | [
"reverse",
"dictionary"
] | dslackw/colored | python | https://github.com/dslackw/colored/blob/064172b36bd5e456c60581c7fbf77060ca7829ba/colored/colored.py#L369-L371 | [
"def",
"reverse_dict",
"(",
"self",
")",
":",
"self",
".",
"reserve_paint",
"=",
"dict",
"(",
"zip",
"(",
"self",
".",
"paint",
".",
"values",
"(",
")",
",",
"self",
".",
"paint",
".",
"keys",
"(",
")",
")",
")"
] | 064172b36bd5e456c60581c7fbf77060ca7829ba |
train | OneWireBus.reset | Perform a reset and check for presence pulse.
:param bool required: require presence pulse | adafruit_onewire/bus.py | def reset(self, required=False):
"""
Perform a reset and check for presence pulse.
:param bool required: require presence pulse
"""
reset = self._ow.reset()
if required and reset:
raise OneWireError("No presence pulse found. Check devices and wiring.")
... | def reset(self, required=False):
"""
Perform a reset and check for presence pulse.
:param bool required: require presence pulse
"""
reset = self._ow.reset()
if required and reset:
raise OneWireError("No presence pulse found. Check devices and wiring.")
... | [
"Perform",
"a",
"reset",
"and",
"check",
"for",
"presence",
"pulse",
"."
] | adafruit/Adafruit_CircuitPython_OneWire | python | https://github.com/adafruit/Adafruit_CircuitPython_OneWire/blob/113ca99b9087f7031f0b46a963472ad106520f9b/adafruit_onewire/bus.py#L97-L106 | [
"def",
"reset",
"(",
"self",
",",
"required",
"=",
"False",
")",
":",
"reset",
"=",
"self",
".",
"_ow",
".",
"reset",
"(",
")",
"if",
"required",
"and",
"reset",
":",
"raise",
"OneWireError",
"(",
"\"No presence pulse found. Check devices and wiring.\"",
")",
... | 113ca99b9087f7031f0b46a963472ad106520f9b |
train | OneWireBus.readinto | Read into ``buf`` from the device. The number of bytes read will be the
length of ``buf``.
If ``start`` or ``end`` is provided, then the buffer will be sliced
as if ``buf[start:end]``. This will not cause an allocation like
``buf[start:end]`` will so it saves memory.
:param byt... | adafruit_onewire/bus.py | def readinto(self, buf, *, start=0, end=None):
"""
Read into ``buf`` from the device. The number of bytes read will be the
length of ``buf``.
If ``start`` or ``end`` is provided, then the buffer will be sliced
as if ``buf[start:end]``. This will not cause an allocation like
... | def readinto(self, buf, *, start=0, end=None):
"""
Read into ``buf`` from the device. The number of bytes read will be the
length of ``buf``.
If ``start`` or ``end`` is provided, then the buffer will be sliced
as if ``buf[start:end]``. This will not cause an allocation like
... | [
"Read",
"into",
"buf",
"from",
"the",
"device",
".",
"The",
"number",
"of",
"bytes",
"read",
"will",
"be",
"the",
"length",
"of",
"buf",
"."
] | adafruit/Adafruit_CircuitPython_OneWire | python | https://github.com/adafruit/Adafruit_CircuitPython_OneWire/blob/113ca99b9087f7031f0b46a963472ad106520f9b/adafruit_onewire/bus.py#L108-L124 | [
"def",
"readinto",
"(",
"self",
",",
"buf",
",",
"*",
",",
"start",
"=",
"0",
",",
"end",
"=",
"None",
")",
":",
"if",
"end",
"is",
"None",
":",
"end",
"=",
"len",
"(",
"buf",
")",
"for",
"i",
"in",
"range",
"(",
"start",
",",
"end",
")",
"... | 113ca99b9087f7031f0b46a963472ad106520f9b |
train | OneWireBus.write | Write the bytes from ``buf`` to the device.
If ``start`` or ``end`` is provided, then the buffer will be sliced
as if ``buffer[start:end]``. This will not cause an allocation like
``buffer[start:end]`` will so it saves memory.
:param bytearray buf: buffer containing the bytes to write
... | adafruit_onewire/bus.py | def write(self, buf, *, start=0, end=None):
"""
Write the bytes from ``buf`` to the device.
If ``start`` or ``end`` is provided, then the buffer will be sliced
as if ``buffer[start:end]``. This will not cause an allocation like
``buffer[start:end]`` will so it saves memory.
... | def write(self, buf, *, start=0, end=None):
"""
Write the bytes from ``buf`` to the device.
If ``start`` or ``end`` is provided, then the buffer will be sliced
as if ``buffer[start:end]``. This will not cause an allocation like
``buffer[start:end]`` will so it saves memory.
... | [
"Write",
"the",
"bytes",
"from",
"buf",
"to",
"the",
"device",
"."
] | adafruit/Adafruit_CircuitPython_OneWire | python | https://github.com/adafruit/Adafruit_CircuitPython_OneWire/blob/113ca99b9087f7031f0b46a963472ad106520f9b/adafruit_onewire/bus.py#L126-L141 | [
"def",
"write",
"(",
"self",
",",
"buf",
",",
"*",
",",
"start",
"=",
"0",
",",
"end",
"=",
"None",
")",
":",
"if",
"end",
"is",
"None",
":",
"end",
"=",
"len",
"(",
"buf",
")",
"for",
"i",
"in",
"range",
"(",
"start",
",",
"end",
")",
":",... | 113ca99b9087f7031f0b46a963472ad106520f9b |
train | OneWireBus.scan | Scan for devices on the bus and return a list of addresses. | adafruit_onewire/bus.py | def scan(self):
"""Scan for devices on the bus and return a list of addresses."""
devices = []
diff = 65
rom = False
count = 0
for _ in range(0xff):
rom, diff = self._search_rom(rom, diff)
if rom:
count += 1
if count... | def scan(self):
"""Scan for devices on the bus and return a list of addresses."""
devices = []
diff = 65
rom = False
count = 0
for _ in range(0xff):
rom, diff = self._search_rom(rom, diff)
if rom:
count += 1
if count... | [
"Scan",
"for",
"devices",
"on",
"the",
"bus",
"and",
"return",
"a",
"list",
"of",
"addresses",
"."
] | adafruit/Adafruit_CircuitPython_OneWire | python | https://github.com/adafruit/Adafruit_CircuitPython_OneWire/blob/113ca99b9087f7031f0b46a963472ad106520f9b/adafruit_onewire/bus.py#L143-L160 | [
"def",
"scan",
"(",
"self",
")",
":",
"devices",
"=",
"[",
"]",
"diff",
"=",
"65",
"rom",
"=",
"False",
"count",
"=",
"0",
"for",
"_",
"in",
"range",
"(",
"0xff",
")",
":",
"rom",
",",
"diff",
"=",
"self",
".",
"_search_rom",
"(",
"rom",
",",
... | 113ca99b9087f7031f0b46a963472ad106520f9b |
train | OneWireBus.crc8 | Perform the 1-Wire CRC check on the provided data.
:param bytearray data: 8 byte array representing 64 bit ROM code | adafruit_onewire/bus.py | def crc8(data):
"""
Perform the 1-Wire CRC check on the provided data.
:param bytearray data: 8 byte array representing 64 bit ROM code
"""
crc = 0
for byte in data:
crc ^= byte
for _ in range(8):
if crc & 0x01:
... | def crc8(data):
"""
Perform the 1-Wire CRC check on the provided data.
:param bytearray data: 8 byte array representing 64 bit ROM code
"""
crc = 0
for byte in data:
crc ^= byte
for _ in range(8):
if crc & 0x01:
... | [
"Perform",
"the",
"1",
"-",
"Wire",
"CRC",
"check",
"on",
"the",
"provided",
"data",
"."
] | adafruit/Adafruit_CircuitPython_OneWire | python | https://github.com/adafruit/Adafruit_CircuitPython_OneWire/blob/113ca99b9087f7031f0b46a963472ad106520f9b/adafruit_onewire/bus.py#L202-L218 | [
"def",
"crc8",
"(",
"data",
")",
":",
"crc",
"=",
"0",
"for",
"byte",
"in",
"data",
":",
"crc",
"^=",
"byte",
"for",
"_",
"in",
"range",
"(",
"8",
")",
":",
"if",
"crc",
"&",
"0x01",
":",
"crc",
"=",
"(",
"crc",
">>",
"1",
")",
"^",
"0x8C",... | 113ca99b9087f7031f0b46a963472ad106520f9b |
train | kintoneStructure._deserialize | deserialize json to model
:param json_body: json data
:param get_value_and_type: function(f: json_field) -> value, field_type_string(see FieldType)
:return: | pykintone/structure.py | def _deserialize(cls, json_body, get_value_and_type):
"""
deserialize json to model
:param json_body: json data
:param get_value_and_type: function(f: json_field) -> value, field_type_string(see FieldType)
:return:
"""
instance = cls()
is_set = False
... | def _deserialize(cls, json_body, get_value_and_type):
"""
deserialize json to model
:param json_body: json data
:param get_value_and_type: function(f: json_field) -> value, field_type_string(see FieldType)
:return:
"""
instance = cls()
is_set = False
... | [
"deserialize",
"json",
"to",
"model",
":",
"param",
"json_body",
":",
"json",
"data",
":",
"param",
"get_value_and_type",
":",
"function",
"(",
"f",
":",
"json_field",
")",
"-",
">",
"value",
"field_type_string",
"(",
"see",
"FieldType",
")",
":",
"return",
... | icoxfog417/pykintone | python | https://github.com/icoxfog417/pykintone/blob/756609fc956fc784325d58cc01473a67a640654c/pykintone/structure.py#L35-L62 | [
"def",
"_deserialize",
"(",
"cls",
",",
"json_body",
",",
"get_value_and_type",
")",
":",
"instance",
"=",
"cls",
"(",
")",
"is_set",
"=",
"False",
"properties",
"=",
"cls",
".",
"_get_property_names",
"(",
"instance",
")",
"def",
"get_property_detail",
"(",
... | 756609fc956fc784325d58cc01473a67a640654c |
train | kintoneStructure._serialize | serialize model object to dictionary
:param convert_to_key_and_value: function(field_name, value, property_detail) -> key, value
:return: | pykintone/structure.py | def _serialize(self, convert_to_key_and_value, ignore_missing=False):
"""
serialize model object to dictionary
:param convert_to_key_and_value: function(field_name, value, property_detail) -> key, value
:return:
"""
serialized = {}
properties = self._get_property... | def _serialize(self, convert_to_key_and_value, ignore_missing=False):
"""
serialize model object to dictionary
:param convert_to_key_and_value: function(field_name, value, property_detail) -> key, value
:return:
"""
serialized = {}
properties = self._get_property... | [
"serialize",
"model",
"object",
"to",
"dictionary",
":",
"param",
"convert_to_key_and_value",
":",
"function",
"(",
"field_name",
"value",
"property_detail",
")",
"-",
">",
"key",
"value",
":",
"return",
":"
] | icoxfog417/pykintone | python | https://github.com/icoxfog417/pykintone/blob/756609fc956fc784325d58cc01473a67a640654c/pykintone/structure.py#L126-L152 | [
"def",
"_serialize",
"(",
"self",
",",
"convert_to_key_and_value",
",",
"ignore_missing",
"=",
"False",
")",
":",
"serialized",
"=",
"{",
"}",
"properties",
"=",
"self",
".",
"_get_property_names",
"(",
"self",
")",
"def",
"get_property_detail",
"(",
"name",
"... | 756609fc956fc784325d58cc01473a67a640654c |
train | OneWireDevice.readinto | Read into ``buf`` from the device. The number of bytes read will be the
length of ``buf``.
If ``start`` or ``end`` is provided, then the buffer will be sliced
as if ``buf[start:end]``. This will not cause an allocation like
``buf[start:end]`` will so it saves memory.
:param byt... | adafruit_onewire/device.py | def readinto(self, buf, *, start=0, end=None):
"""
Read into ``buf`` from the device. The number of bytes read will be the
length of ``buf``.
If ``start`` or ``end`` is provided, then the buffer will be sliced
as if ``buf[start:end]``. This will not cause an allocation like
... | def readinto(self, buf, *, start=0, end=None):
"""
Read into ``buf`` from the device. The number of bytes read will be the
length of ``buf``.
If ``start`` or ``end`` is provided, then the buffer will be sliced
as if ``buf[start:end]``. This will not cause an allocation like
... | [
"Read",
"into",
"buf",
"from",
"the",
"device",
".",
"The",
"number",
"of",
"bytes",
"read",
"will",
"be",
"the",
"length",
"of",
"buf",
"."
] | adafruit/Adafruit_CircuitPython_OneWire | python | https://github.com/adafruit/Adafruit_CircuitPython_OneWire/blob/113ca99b9087f7031f0b46a963472ad106520f9b/adafruit_onewire/device.py#L50-L66 | [
"def",
"readinto",
"(",
"self",
",",
"buf",
",",
"*",
",",
"start",
"=",
"0",
",",
"end",
"=",
"None",
")",
":",
"self",
".",
"_bus",
".",
"readinto",
"(",
"buf",
",",
"start",
"=",
"start",
",",
"end",
"=",
"end",
")",
"if",
"start",
"==",
"... | 113ca99b9087f7031f0b46a963472ad106520f9b |
train | OneWireDevice.write | Write the bytes from ``buf`` to the device.
If ``start`` or ``end`` is provided, then the buffer will be sliced
as if ``buffer[start:end]``. This will not cause an allocation like
``buffer[start:end]`` will so it saves memory.
:param bytearray buf: buffer containing the bytes to write
... | adafruit_onewire/device.py | def write(self, buf, *, start=0, end=None):
"""
Write the bytes from ``buf`` to the device.
If ``start`` or ``end`` is provided, then the buffer will be sliced
as if ``buffer[start:end]``. This will not cause an allocation like
``buffer[start:end]`` will so it saves memory.
... | def write(self, buf, *, start=0, end=None):
"""
Write the bytes from ``buf`` to the device.
If ``start`` or ``end`` is provided, then the buffer will be sliced
as if ``buffer[start:end]``. This will not cause an allocation like
``buffer[start:end]`` will so it saves memory.
... | [
"Write",
"the",
"bytes",
"from",
"buf",
"to",
"the",
"device",
"."
] | adafruit/Adafruit_CircuitPython_OneWire | python | https://github.com/adafruit/Adafruit_CircuitPython_OneWire/blob/113ca99b9087f7031f0b46a963472ad106520f9b/adafruit_onewire/device.py#L68-L80 | [
"def",
"write",
"(",
"self",
",",
"buf",
",",
"*",
",",
"start",
"=",
"0",
",",
"end",
"=",
"None",
")",
":",
"return",
"self",
".",
"_bus",
".",
"write",
"(",
"buf",
",",
"start",
"=",
"start",
",",
"end",
"=",
"end",
")"
] | 113ca99b9087f7031f0b46a963472ad106520f9b |
train | preferences_class_prepared | Adds various preferences members to preferences.preferences,
thus enabling easy access from code. | preferences/models.py | def preferences_class_prepared(sender, *args, **kwargs):
"""
Adds various preferences members to preferences.preferences,
thus enabling easy access from code.
"""
cls = sender
if issubclass(cls, Preferences):
# Add singleton manager to subclasses.
cls.add_to_class('singleton', Si... | def preferences_class_prepared(sender, *args, **kwargs):
"""
Adds various preferences members to preferences.preferences,
thus enabling easy access from code.
"""
cls = sender
if issubclass(cls, Preferences):
# Add singleton manager to subclasses.
cls.add_to_class('singleton', Si... | [
"Adds",
"various",
"preferences",
"members",
"to",
"preferences",
".",
"preferences",
"thus",
"enabling",
"easy",
"access",
"from",
"code",
"."
] | praekelt/django-preferences | python | https://github.com/praekelt/django-preferences/blob/724f23da45449e96feb5179cb34e3d380cf151a1/preferences/models.py#L30-L40 | [
"def",
"preferences_class_prepared",
"(",
"sender",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"cls",
"=",
"sender",
"if",
"issubclass",
"(",
"cls",
",",
"Preferences",
")",
":",
"# Add singleton manager to subclasses.",
"cls",
".",
"add_to_class",
"... | 724f23da45449e96feb5179cb34e3d380cf151a1 |
train | site_cleanup | Make sure there is only a single preferences object per site.
So remove sites from pre-existing preferences objects. | preferences/models.py | def site_cleanup(sender, action, instance, **kwargs):
"""
Make sure there is only a single preferences object per site.
So remove sites from pre-existing preferences objects.
"""
if action == 'post_add':
if isinstance(instance, Preferences) \
and hasattr(instance.__class__, 'obje... | def site_cleanup(sender, action, instance, **kwargs):
"""
Make sure there is only a single preferences object per site.
So remove sites from pre-existing preferences objects.
"""
if action == 'post_add':
if isinstance(instance, Preferences) \
and hasattr(instance.__class__, 'obje... | [
"Make",
"sure",
"there",
"is",
"only",
"a",
"single",
"preferences",
"object",
"per",
"site",
".",
"So",
"remove",
"sites",
"from",
"pre",
"-",
"existing",
"preferences",
"objects",
"."
] | praekelt/django-preferences | python | https://github.com/praekelt/django-preferences/blob/724f23da45449e96feb5179cb34e3d380cf151a1/preferences/models.py#L44-L59 | [
"def",
"site_cleanup",
"(",
"sender",
",",
"action",
",",
"instance",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"action",
"==",
"'post_add'",
":",
"if",
"isinstance",
"(",
"instance",
",",
"Preferences",
")",
"and",
"hasattr",
"(",
"instance",
".",
"__cla... | 724f23da45449e96feb5179cb34e3d380cf151a1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.