nwo stringlengths 5 86 | sha stringlengths 40 40 | path stringlengths 4 189 | language stringclasses 1
value | identifier stringlengths 1 94 | parameters stringlengths 2 4.03k | argument_list stringclasses 1
value | return_statement stringlengths 0 11.5k | docstring stringlengths 1 33.2k | docstring_summary stringlengths 0 5.15k | docstring_tokens list | function stringlengths 34 151k | function_tokens list | url stringlengths 90 278 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
intel/llvm | e6d0547e9d99b5a56430c4749f6c7e328bf221ab | lldb/third_party/Python/module/pexpect-4.6/pexpect/spawnbase.py | python | SpawnBase.readlines | (self, sizehint=-1) | return lines | This reads until EOF using readline() and returns a list containing
the lines thus read. The optional 'sizehint' argument is ignored.
Remember, because this reads until EOF that means the child
process should have closed its stdout. If you run this method on
a child that is still running... | This reads until EOF using readline() and returns a list containing
the lines thus read. The optional 'sizehint' argument is ignored.
Remember, because this reads until EOF that means the child
process should have closed its stdout. If you run this method on
a child that is still running... | [
"This",
"reads",
"until",
"EOF",
"using",
"readline",
"()",
"and",
"returns",
"a",
"list",
"containing",
"the",
"lines",
"thus",
"read",
".",
"The",
"optional",
"sizehint",
"argument",
"is",
"ignored",
".",
"Remember",
"because",
"this",
"reads",
"until",
"E... | def readlines(self, sizehint=-1):
'''This reads until EOF using readline() and returns a list containing
the lines thus read. The optional 'sizehint' argument is ignored.
Remember, because this reads until EOF that means the child
process should have closed its stdout. If you run this me... | [
"def",
"readlines",
"(",
"self",
",",
"sizehint",
"=",
"-",
"1",
")",
":",
"lines",
"=",
"[",
"]",
"while",
"True",
":",
"line",
"=",
"self",
".",
"readline",
"(",
")",
"if",
"not",
"line",
":",
"break",
"lines",
".",
"append",
"(",
"line",
")",
... | https://github.com/intel/llvm/blob/e6d0547e9d99b5a56430c4749f6c7e328bf221ab/lldb/third_party/Python/module/pexpect-4.6/pexpect/spawnbase.py#L485-L499 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib-tk/Tkinter.py | python | Menu.add_separator | (self, cnf={}, **kw) | Add separator. | Add separator. | [
"Add",
"separator",
"."
] | def add_separator(self, cnf={}, **kw):
"""Add separator."""
self.add('separator', cnf or kw) | [
"def",
"add_separator",
"(",
"self",
",",
"cnf",
"=",
"{",
"}",
",",
"*",
"*",
"kw",
")",
":",
"self",
".",
"add",
"(",
"'separator'",
",",
"cnf",
"or",
"kw",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib-tk/Tkinter.py#L2687-L2689 | ||
openmm/openmm | cb293447c4fc8b03976dfe11399f107bab70f3d9 | wrappers/python/openmm/unit/quantity.py | python | Quantity.__rtruediv__ | (self, other) | Divide a scalar by a quantity.
Returns a new Quantity. The resulting units are the inverse of the self argument units. | Divide a scalar by a quantity. | [
"Divide",
"a",
"scalar",
"by",
"a",
"quantity",
"."
] | def __rtruediv__(self, other):
"""Divide a scalar by a quantity.
Returns a new Quantity. The resulting units are the inverse of the self argument units.
"""
if is_unit(other):
# print "R unit / quantity"
raise NotImplementedError('programmer is surprised __rtrue... | [
"def",
"__rtruediv__",
"(",
"self",
",",
"other",
")",
":",
"if",
"is_unit",
"(",
"other",
")",
":",
"# print \"R unit / quantity\"",
"raise",
"NotImplementedError",
"(",
"'programmer is surprised __rtruediv__ was called instead of __truediv__'",
")",
"elif",
"is_quantity",... | https://github.com/openmm/openmm/blob/cb293447c4fc8b03976dfe11399f107bab70f3d9/wrappers/python/openmm/unit/quantity.py#L416-L428 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/json_schema_compiler/feature_compiler.py | python | FeatureCompiler._Load | (self) | Loads and parses the source from each input file and puts the result in
self._json. | Loads and parses the source from each input file and puts the result in
self._json. | [
"Loads",
"and",
"parses",
"the",
"source",
"from",
"each",
"input",
"file",
"and",
"puts",
"the",
"result",
"in",
"self",
".",
"_json",
"."
] | def _Load(self):
"""Loads and parses the source from each input file and puts the result in
self._json."""
for f in self._source_files:
abs_source_file = os.path.join(self._chrome_root, f)
try:
with open(abs_source_file, 'r') as f:
f_json = json_parse.Parse(f.read())
exce... | [
"def",
"_Load",
"(",
"self",
")",
":",
"for",
"f",
"in",
"self",
".",
"_source_files",
":",
"abs_source_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"_chrome_root",
",",
"f",
")",
"try",
":",
"with",
"open",
"(",
"abs_source_file",
"... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/json_schema_compiler/feature_compiler.py#L432-L446 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/auto_bisect/bisect_perf_regression.py | python | _TryParseResultValuesFromOutput | (metric, text) | return values_list | Attempts to parse a metric in the format RESULT <graph>: <trace>= ...
Args:
metric: The metric as a list of [<trace>, <value>] string pairs.
text: The text to parse the metric values from.
Returns:
A list of floating point numbers found. | Attempts to parse a metric in the format RESULT <graph>: <trace>= ... | [
"Attempts",
"to",
"parse",
"a",
"metric",
"in",
"the",
"format",
"RESULT",
"<graph",
">",
":",
"<trace",
">",
"=",
"..."
] | def _TryParseResultValuesFromOutput(metric, text):
"""Attempts to parse a metric in the format RESULT <graph>: <trace>= ...
Args:
metric: The metric as a list of [<trace>, <value>] string pairs.
text: The text to parse the metric values from.
Returns:
A list of floating point numbers found.
"""
... | [
"def",
"_TryParseResultValuesFromOutput",
"(",
"metric",
",",
"text",
")",
":",
"# Format is: RESULT <graph>: <trace>= <value> <units>",
"metric_re",
"=",
"re",
".",
"escape",
"(",
"'RESULT %s: %s='",
"%",
"(",
"metric",
"[",
"0",
"]",
",",
"metric",
"[",
"1",
"]"... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/auto_bisect/bisect_perf_regression.py#L364-L415 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | python/mxnet/operator.py | python | CustomOpProp.declare_backward_dependency | (self, out_grad, in_data, out_data) | return deps | Declare dependencies of this operator for backward pass.
Parameters
----------
out_grad : list of int
ids of out_grad blobs.
in_data : list of int
ids of in_data blobs.
out_data: list of int
ids of out_data blobs.
Returns
----... | Declare dependencies of this operator for backward pass. | [
"Declare",
"dependencies",
"of",
"this",
"operator",
"for",
"backward",
"pass",
"."
] | def declare_backward_dependency(self, out_grad, in_data, out_data):
"""Declare dependencies of this operator for backward pass.
Parameters
----------
out_grad : list of int
ids of out_grad blobs.
in_data : list of int
ids of in_data blobs.
out_dat... | [
"def",
"declare_backward_dependency",
"(",
"self",
",",
"out_grad",
",",
"in_data",
",",
"out_data",
")",
":",
"deps",
"=",
"[",
"]",
"if",
"self",
".",
"need_top_grad_",
":",
"deps",
".",
"extend",
"(",
"out_grad",
")",
"deps",
".",
"extend",
"(",
"in_d... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/operator.py#L644-L666 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py3/sklearn/model_selection/_split.py | python | PredefinedSplit.get_n_splits | (self, X=None, y=None, groups=None) | return len(self.unique_folds) | Returns the number of splitting iterations in the cross-validator
Parameters
----------
X : object
Always ignored, exists for compatibility.
y : object
Always ignored, exists for compatibility.
groups : object
Always ignored, exists for comp... | Returns the number of splitting iterations in the cross-validator | [
"Returns",
"the",
"number",
"of",
"splitting",
"iterations",
"in",
"the",
"cross",
"-",
"validator"
] | def get_n_splits(self, X=None, y=None, groups=None):
"""Returns the number of splitting iterations in the cross-validator
Parameters
----------
X : object
Always ignored, exists for compatibility.
y : object
Always ignored, exists for compatibility.
... | [
"def",
"get_n_splits",
"(",
"self",
",",
"X",
"=",
"None",
",",
"y",
"=",
"None",
",",
"groups",
"=",
"None",
")",
":",
"return",
"len",
"(",
"self",
".",
"unique_folds",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/model_selection/_split.py#L1891-L1910 | |
facebook/ThreatExchange | 31914a51820c73c8a0daffe62ccca29a6e3d359e | hasher-matcher-actioner/hmalib/writebacker/writebacker_base.py | python | Writebacker.writeback_type | (self) | The writeback label for when this action should be performed (eg WritebackType.SawThisToo) | The writeback label for when this action should be performed (eg WritebackType.SawThisToo) | [
"The",
"writeback",
"label",
"for",
"when",
"this",
"action",
"should",
"be",
"performed",
"(",
"eg",
"WritebackType",
".",
"SawThisToo",
")"
] | def writeback_type(self) -> WritebackTypes.WritebackType:
"""
The writeback label for when this action should be performed (eg WritebackType.SawThisToo)
"""
raise NotImplementedError | [
"def",
"writeback_type",
"(",
"self",
")",
"->",
"WritebackTypes",
".",
"WritebackType",
":",
"raise",
"NotImplementedError"
] | https://github.com/facebook/ThreatExchange/blob/31914a51820c73c8a0daffe62ccca29a6e3d359e/hasher-matcher-actioner/hmalib/writebacker/writebacker_base.py#L78-L82 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/idlelib/WidgetRedirector.py | python | WidgetRedirector.dispatch | (self, operation, *args) | Callback from Tcl which runs when the widget is referenced.
If an operation has been registered in self._operations, apply the
associated function to the args passed into Tcl. Otherwise, pass the
operation through to Tk via the original Tcl function.
Note that if a registered function ... | Callback from Tcl which runs when the widget is referenced. | [
"Callback",
"from",
"Tcl",
"which",
"runs",
"when",
"the",
"widget",
"is",
"referenced",
"."
] | def dispatch(self, operation, *args):
'''Callback from Tcl which runs when the widget is referenced.
If an operation has been registered in self._operations, apply the
associated function to the args passed into Tcl. Otherwise, pass the
operation through to Tk via the original Tcl funct... | [
"def",
"dispatch",
"(",
"self",
",",
"operation",
",",
"*",
"args",
")",
":",
"m",
"=",
"self",
".",
"_operations",
".",
"get",
"(",
"operation",
")",
"try",
":",
"if",
"m",
":",
"return",
"m",
"(",
"*",
"args",
")",
"else",
":",
"return",
"self"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/idlelib/WidgetRedirector.py#L98-L117 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/wizard.py | python | Wizard.GetPageAreaSizer | (*args, **kwargs) | return _wizard.Wizard_GetPageAreaSizer(*args, **kwargs) | GetPageAreaSizer(self) -> Sizer | GetPageAreaSizer(self) -> Sizer | [
"GetPageAreaSizer",
"(",
"self",
")",
"-",
">",
"Sizer"
] | def GetPageAreaSizer(*args, **kwargs):
"""GetPageAreaSizer(self) -> Sizer"""
return _wizard.Wizard_GetPageAreaSizer(*args, **kwargs) | [
"def",
"GetPageAreaSizer",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_wizard",
".",
"Wizard_GetPageAreaSizer",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/wizard.py#L394-L396 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | example/ctc/captcha_generator.py | python | CaptchaGen.image | (self, captcha_str) | return img | Generate a greyscale captcha image representing number string
Parameters
----------
captcha_str: str
string a characters for captcha image
Returns
-------
numpy.ndarray
Generated greyscale image in np.ndarray float type with values normalized to ... | Generate a greyscale captcha image representing number string | [
"Generate",
"a",
"greyscale",
"captcha",
"image",
"representing",
"number",
"string"
] | def image(self, captcha_str):
"""Generate a greyscale captcha image representing number string
Parameters
----------
captcha_str: str
string a characters for captcha image
Returns
-------
numpy.ndarray
Generated greyscale image in np.ndar... | [
"def",
"image",
"(",
"self",
",",
"captcha_str",
")",
":",
"img",
"=",
"self",
".",
"captcha",
".",
"generate",
"(",
"captcha_str",
")",
"img",
"=",
"np",
".",
"fromstring",
"(",
"img",
".",
"getvalue",
"(",
")",
",",
"dtype",
"=",
"'uint8'",
")",
... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/example/ctc/captcha_generator.py#L48-L67 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/src/motionplanning.py | python | PlannerInterface.getSolutionPath | (self) | return _motionplanning.PlannerInterface_getSolutionPath(self) | getSolutionPath(PlannerInterface self) -> PyObject * | getSolutionPath(PlannerInterface self) -> PyObject * | [
"getSolutionPath",
"(",
"PlannerInterface",
"self",
")",
"-",
">",
"PyObject",
"*"
] | def getSolutionPath(self):
"""
getSolutionPath(PlannerInterface self) -> PyObject *
"""
return _motionplanning.PlannerInterface_getSolutionPath(self) | [
"def",
"getSolutionPath",
"(",
"self",
")",
":",
"return",
"_motionplanning",
".",
"PlannerInterface_getSolutionPath",
"(",
"self",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/src/motionplanning.py#L894-L901 | |
metashell/metashell | f4177e4854ea00c8dbc722cadab26ef413d798ea | 3rd/templight/llvm/utils/lit/lit/util.py | python | to_string | (b) | Return the parameter as type 'str', possibly encoding it.
In Python2, the 'str' type is the same as 'bytes'. In Python3, the
'str' type is (essentially) Python2's 'unicode' type, and 'bytes' is
distinct. | Return the parameter as type 'str', possibly encoding it. | [
"Return",
"the",
"parameter",
"as",
"type",
"str",
"possibly",
"encoding",
"it",
"."
] | def to_string(b):
"""Return the parameter as type 'str', possibly encoding it.
In Python2, the 'str' type is the same as 'bytes'. In Python3, the
'str' type is (essentially) Python2's 'unicode' type, and 'bytes' is
distinct.
"""
if isinstance(b, str):
# In Python2, this branch is taken... | [
"def",
"to_string",
"(",
"b",
")",
":",
"if",
"isinstance",
"(",
"b",
",",
"str",
")",
":",
"# In Python2, this branch is taken for types 'str' and 'bytes'.",
"# In Python3, this branch is taken only for 'str'.",
"return",
"b",
"if",
"isinstance",
"(",
"b",
",",
"bytes"... | https://github.com/metashell/metashell/blob/f4177e4854ea00c8dbc722cadab26ef413d798ea/3rd/templight/llvm/utils/lit/lit/util.py#L59-L95 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | third_party/closure_linter/closure_linter/javascriptstatetracker.py | python | JavaScriptStateTracker.GetBlockType | (self, token) | Determine the block type given a START_BLOCK token.
Code blocks come after parameters, keywords like else, and closing parens.
Args:
token: The current token. Can be assumed to be type START_BLOCK
Returns:
Code block type for current token. | Determine the block type given a START_BLOCK token. | [
"Determine",
"the",
"block",
"type",
"given",
"a",
"START_BLOCK",
"token",
"."
] | def GetBlockType(self, token):
"""Determine the block type given a START_BLOCK token.
Code blocks come after parameters, keywords like else, and closing parens.
Args:
token: The current token. Can be assumed to be type START_BLOCK
Returns:
Code block type for current token.
"""
la... | [
"def",
"GetBlockType",
"(",
"self",
",",
"token",
")",
":",
"last_code",
"=",
"tokenutil",
".",
"SearchExcept",
"(",
"token",
",",
"Type",
".",
"NON_CODE_TYPES",
",",
"None",
",",
"True",
")",
"if",
"last_code",
".",
"type",
"in",
"(",
"Type",
".",
"EN... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/third_party/closure_linter/closure_linter/javascriptstatetracker.py#L90-L106 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/scipy/special/basic.py | python | factorial | (n, exact=False) | The factorial of a number or array of numbers.
The factorial of non-negative integer `n` is the product of all
positive integers less than or equal to `n`::
n! = n * (n - 1) * (n - 2) * ... * 1
Parameters
----------
n : int or array_like of ints
Input values. If ``n < 0``, the re... | The factorial of a number or array of numbers. | [
"The",
"factorial",
"of",
"a",
"number",
"or",
"array",
"of",
"numbers",
"."
] | def factorial(n, exact=False):
"""
The factorial of a number or array of numbers.
The factorial of non-negative integer `n` is the product of all
positive integers less than or equal to `n`::
n! = n * (n - 1) * (n - 2) * ... * 1
Parameters
----------
n : int or array_like of ints
... | [
"def",
"factorial",
"(",
"n",
",",
"exact",
"=",
"False",
")",
":",
"if",
"exact",
":",
"if",
"np",
".",
"ndim",
"(",
"n",
")",
"==",
"0",
":",
"return",
"0",
"if",
"n",
"<",
"0",
"else",
"math",
".",
"factorial",
"(",
"n",
")",
"else",
":",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/special/basic.py#L2256-L2338 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/_pyio.py | python | IOBase.seekable | (self) | return False | Return whether object supports random access.
If False, seek(), tell() and truncate() will raise IOError.
This method may need to do a test seek(). | Return whether object supports random access. | [
"Return",
"whether",
"object",
"supports",
"random",
"access",
"."
] | def seekable(self):
"""Return whether object supports random access.
If False, seek(), tell() and truncate() will raise IOError.
This method may need to do a test seek().
"""
return False | [
"def",
"seekable",
"(",
"self",
")",
":",
"return",
"False"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/_pyio.py#L371-L377 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/propgrid.py | python | PyChoiceEditor._SetSelf | (*args, **kwargs) | return _propgrid.PyChoiceEditor__SetSelf(*args, **kwargs) | _SetSelf(self, PyObject self) | _SetSelf(self, PyObject self) | [
"_SetSelf",
"(",
"self",
"PyObject",
"self",
")"
] | def _SetSelf(*args, **kwargs):
"""_SetSelf(self, PyObject self)"""
return _propgrid.PyChoiceEditor__SetSelf(*args, **kwargs) | [
"def",
"_SetSelf",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PyChoiceEditor__SetSelf",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/propgrid.py#L4470-L4472 | |
neoml-lib/neoml | a0d370fba05269a1b2258cef126f77bbd2054a3e | NeoML/Python/neoml/AutoDiff.py | python | div | (a, b) | return a / b | Elementwise divides two blobs or a blob and a scalar value. | Elementwise divides two blobs or a blob and a scalar value. | [
"Elementwise",
"divides",
"two",
"blobs",
"or",
"a",
"blob",
"and",
"a",
"scalar",
"value",
"."
] | def div(a, b):
"""Elementwise divides two blobs or a blob and a scalar value.
"""
if not type(a) is Blob and not type(b) is Blob:
raise ValueError('At least one of `a` and `b` should be neoml.Blob.')
return a / b | [
"def",
"div",
"(",
"a",
",",
"b",
")",
":",
"if",
"not",
"type",
"(",
"a",
")",
"is",
"Blob",
"and",
"not",
"type",
"(",
"b",
")",
"is",
"Blob",
":",
"raise",
"ValueError",
"(",
"'At least one of `a` and `b` should be neoml.Blob.'",
")",
"return",
"a",
... | https://github.com/neoml-lib/neoml/blob/a0d370fba05269a1b2258cef126f77bbd2054a3e/NeoML/Python/neoml/AutoDiff.py#L70-L76 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/_grad/grad_math_ops.py | python | get_bprop_floormod | (self) | return bprop | Grad definition for `FloorMod` operation. | Grad definition for `FloorMod` operation. | [
"Grad",
"definition",
"for",
"FloorMod",
"operation",
"."
] | def get_bprop_floormod(self):
"""Grad definition for `FloorMod` operation."""
def bprop(x, y, out, dout):
bc_x = dout
bc_y = -dout * (x // y)
return binop_grad_common(x, y, bc_x, bc_y)
return bprop | [
"def",
"get_bprop_floormod",
"(",
"self",
")",
":",
"def",
"bprop",
"(",
"x",
",",
"y",
",",
"out",
",",
"dout",
")",
":",
"bc_x",
"=",
"dout",
"bc_y",
"=",
"-",
"dout",
"*",
"(",
"x",
"//",
"y",
")",
"return",
"binop_grad_common",
"(",
"x",
",",... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/_grad/grad_math_ops.py#L388-L396 | |
wallix/redemption | fb4ceefb39e11e1ae250bce17e878e1dc7d195d2 | tools/sesman/sesmanworker/engine.py | python | Engine._get_target_right_htable | (self, target_account, target_device,
t_htable) | return results | Get target right list from t_htable
filtered by target_account and target_device
target_account = <login>@<domain> or <login>
'@' might be present in login but not in domain
t_htable = {(account, device)}{domain}[(service, group, right)]
device can be an alias | Get target right list from t_htable
filtered by target_account and target_device | [
"Get",
"target",
"right",
"list",
"from",
"t_htable",
"filtered",
"by",
"target_account",
"and",
"target_device"
] | def _get_target_right_htable(self, target_account, target_device,
t_htable):
"""
Get target right list from t_htable
filtered by target_account and target_device
target_account = <login>@<domain> or <login>
'@' might be present in login but not i... | [
"def",
"_get_target_right_htable",
"(",
"self",
",",
"target_account",
",",
"target_device",
",",
"t_htable",
")",
":",
"try",
":",
"acc_dom",
"=",
"target_account",
".",
"rsplit",
"(",
"'@'",
",",
"1",
")",
"account",
"=",
"acc_dom",
"[",
"0",
"]",
"domai... | https://github.com/wallix/redemption/blob/fb4ceefb39e11e1ae250bce17e878e1dc7d195d2/tools/sesman/sesmanworker/engine.py#L888-L919 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/math_grad.py | python | _BesselI0eGrad | (op, grad) | Compute gradient of bessel_i0e(x) with respect to its argument. | Compute gradient of bessel_i0e(x) with respect to its argument. | [
"Compute",
"gradient",
"of",
"bessel_i0e",
"(",
"x",
")",
"with",
"respect",
"to",
"its",
"argument",
"."
] | def _BesselI0eGrad(op, grad):
"""Compute gradient of bessel_i0e(x) with respect to its argument."""
x = op.inputs[0]
y = op.outputs[0]
with ops.control_dependencies([grad]):
partial_x = (special_math_ops.bessel_i1e(x) - math_ops.sign(x) * y)
return grad * partial_x | [
"def",
"_BesselI0eGrad",
"(",
"op",
",",
"grad",
")",
":",
"x",
"=",
"op",
".",
"inputs",
"[",
"0",
"]",
"y",
"=",
"op",
".",
"outputs",
"[",
"0",
"]",
"with",
"ops",
".",
"control_dependencies",
"(",
"[",
"grad",
"]",
")",
":",
"partial_x",
"=",... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/math_grad.py#L937-L943 | ||
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/design-search-autocomplete-system.py | python | AutocompleteSystem.input | (self, c) | return result | :type c: str
:rtype: List[str] | :type c: str
:rtype: List[str] | [
":",
"type",
"c",
":",
"str",
":",
"rtype",
":",
"List",
"[",
"str",
"]"
] | def input(self, c):
"""
:type c: str
:rtype: List[str]
"""
result = []
if c == '#':
self.__sentence_to_count["".join(self.__search)] += 1
self.__trie.insert("".join(self.__search), self.__sentence_to_count["".join(self.__search)])
self.... | [
"def",
"input",
"(",
"self",
",",
"c",
")",
":",
"result",
"=",
"[",
"]",
"if",
"c",
"==",
"'#'",
":",
"self",
".",
"__sentence_to_count",
"[",
"\"\"",
".",
"join",
"(",
"self",
".",
"__search",
")",
"]",
"+=",
"1",
"self",
".",
"__trie",
".",
... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/design-search-autocomplete-system.py#L54-L73 | |
yushroom/FishEngine | a4b9fb9b0a6dc202f7990e75f4b7d8d5163209d9 | Script/reflect/clang/cindex.py | python | TranslationUnit.get_location | (self, filename, position) | return SourceLocation.from_position(self, f, position[0], position[1]) | Obtain a SourceLocation for a file in this translation unit.
The position can be specified by passing:
- Integer file offset. Initial file offset is 0.
- 2-tuple of (line number, column number). Initial file position is
(0, 0) | Obtain a SourceLocation for a file in this translation unit. | [
"Obtain",
"a",
"SourceLocation",
"for",
"a",
"file",
"in",
"this",
"translation",
"unit",
"."
] | def get_location(self, filename, position):
"""Obtain a SourceLocation for a file in this translation unit.
The position can be specified by passing:
- Integer file offset. Initial file offset is 0.
- 2-tuple of (line number, column number). Initial file position is
(0,... | [
"def",
"get_location",
"(",
"self",
",",
"filename",
",",
"position",
")",
":",
"f",
"=",
"self",
".",
"get_file",
"(",
"filename",
")",
"if",
"isinstance",
"(",
"position",
",",
"int",
")",
":",
"return",
"SourceLocation",
".",
"from_offset",
"(",
"self... | https://github.com/yushroom/FishEngine/blob/a4b9fb9b0a6dc202f7990e75f4b7d8d5163209d9/Script/reflect/clang/cindex.py#L2636-L2650 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/protobuf/python/google/protobuf/internal/python_message.py | python | _AddSerializeToStringMethod | (message_descriptor, cls) | Helper for _AddMessageMethods(). | Helper for _AddMessageMethods(). | [
"Helper",
"for",
"_AddMessageMethods",
"()",
"."
] | def _AddSerializeToStringMethod(message_descriptor, cls):
"""Helper for _AddMessageMethods()."""
def SerializeToString(self):
# Check if the message has all of its required fields set.
errors = []
if not self.IsInitialized():
raise message_mod.EncodeError(
'Message %s is missing require... | [
"def",
"_AddSerializeToStringMethod",
"(",
"message_descriptor",
",",
"cls",
")",
":",
"def",
"SerializeToString",
"(",
"self",
")",
":",
"# Check if the message has all of its required fields set.",
"errors",
"=",
"[",
"]",
"if",
"not",
"self",
".",
"IsInitialized",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/protobuf/python/google/protobuf/internal/python_message.py#L1043-L1054 | ||
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/python/framework/ops.py | python | Tensor.__iter__ | (self) | Dummy method to prevent iteration. Do not call.
NOTE(mrry): If we register __getitem__ as an overloaded operator,
Python will valiantly attempt to iterate over the Tensor from 0 to
infinity. Declaring this method prevents this unintended
behavior.
Raises:
TypeError: when invoked. | Dummy method to prevent iteration. Do not call. | [
"Dummy",
"method",
"to",
"prevent",
"iteration",
".",
"Do",
"not",
"call",
"."
] | def __iter__(self):
"""Dummy method to prevent iteration. Do not call.
NOTE(mrry): If we register __getitem__ as an overloaded operator,
Python will valiantly attempt to iterate over the Tensor from 0 to
infinity. Declaring this method prevents this unintended
behavior.
Raises:
TypeErro... | [
"def",
"__iter__",
"(",
"self",
")",
":",
"raise",
"TypeError",
"(",
"\"'Tensor' object is not iterable.\"",
")"
] | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/framework/ops.py#L488-L499 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/uuid.py | python | uuid5 | (namespace, name) | return UUID(bytes=hash[:16], version=5) | Generate a UUID from the SHA-1 hash of a namespace UUID and a name. | Generate a UUID from the SHA-1 hash of a namespace UUID and a name. | [
"Generate",
"a",
"UUID",
"from",
"the",
"SHA",
"-",
"1",
"hash",
"of",
"a",
"namespace",
"UUID",
"and",
"a",
"name",
"."
] | def uuid5(namespace, name):
"""Generate a UUID from the SHA-1 hash of a namespace UUID and a name."""
from hashlib import sha1
hash = sha1(namespace.bytes + name).digest()
return UUID(bytes=hash[:16], version=5) | [
"def",
"uuid5",
"(",
"namespace",
",",
"name",
")",
":",
"from",
"hashlib",
"import",
"sha1",
"hash",
"=",
"sha1",
"(",
"namespace",
".",
"bytes",
"+",
"name",
")",
".",
"digest",
"(",
")",
"return",
"UUID",
"(",
"bytes",
"=",
"hash",
"[",
":",
"16... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/uuid.py#L549-L553 | |
MirrorYuChen/ncnn_example | a42608e6e0e51ed68d3bd8ada853595980935220 | ncnn-20210525-full-source/glslang/update_glslang_sources.py | python | command_retval | (cmd, directory) | return p.returncode | Runs a command in a directory and returns its return value.
Captures the standard error stream. | Runs a command in a directory and returns its return value. | [
"Runs",
"a",
"command",
"in",
"a",
"directory",
"and",
"returns",
"its",
"return",
"value",
"."
] | def command_retval(cmd, directory):
"""Runs a command in a directory and returns its return value.
Captures the standard error stream.
"""
p = subprocess.Popen(cmd,
cwd=directory,
stdout=subprocess.PIPE)
p.communicate()
return p.returncode | [
"def",
"command_retval",
"(",
"cmd",
",",
"directory",
")",
":",
"p",
"=",
"subprocess",
".",
"Popen",
"(",
"cmd",
",",
"cwd",
"=",
"directory",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
")",
"p",
".",
"communicate",
"(",
")",
"return",
"p",
"."... | https://github.com/MirrorYuChen/ncnn_example/blob/a42608e6e0e51ed68d3bd8ada853595980935220/ncnn-20210525-full-source/glslang/update_glslang_sources.py#L61-L70 | |
apache/qpid-proton | 6bcdfebb55ea3554bc29b1901422532db331a591 | python/proton/_endpoints.py | python | Connection.properties | (self) | return self.properties_dict | Connection properties as a dictionary of key/values. The AMQP 1.0
specification restricts this dictionary to have keys that are only
:class:`symbol` types. It is possible to use the special ``dict``
subclass :class:`PropertyDict` which will by default enforce this
restrictions on constru... | Connection properties as a dictionary of key/values. The AMQP 1.0
specification restricts this dictionary to have keys that are only
:class:`symbol` types. It is possible to use the special ``dict``
subclass :class:`PropertyDict` which will by default enforce this
restrictions on constru... | [
"Connection",
"properties",
"as",
"a",
"dictionary",
"of",
"key",
"/",
"values",
".",
"The",
"AMQP",
"1",
".",
"0",
"specification",
"restricts",
"this",
"dictionary",
"to",
"have",
"keys",
"that",
"are",
"only",
":",
"class",
":",
"symbol",
"types",
".",
... | def properties(self) -> Optional[PropertyDict]:
"""Connection properties as a dictionary of key/values. The AMQP 1.0
specification restricts this dictionary to have keys that are only
:class:`symbol` types. It is possible to use the special ``dict``
subclass :class:`PropertyDict` which w... | [
"def",
"properties",
"(",
"self",
")",
"->",
"Optional",
"[",
"PropertyDict",
"]",
":",
"return",
"self",
".",
"properties_dict"
] | https://github.com/apache/qpid-proton/blob/6bcdfebb55ea3554bc29b1901422532db331a591/python/proton/_endpoints.py#L555-L563 | |
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/ordered_dict.py | python | OrderedDict.setdefault | (self, key, default=None) | return default | od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od | od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od | [
"od",
".",
"setdefault",
"(",
"k",
"[",
"d",
"]",
")",
"-",
">",
"od",
".",
"get",
"(",
"k",
"d",
")",
"also",
"set",
"od",
"[",
"k",
"]",
"=",
"d",
"if",
"k",
"not",
"in",
"od"
] | def setdefault(self, key, default=None):
'od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od'
if key in self:
return self[key]
self[key] = default
return default | [
"def",
"setdefault",
"(",
"self",
",",
"key",
",",
"default",
"=",
"None",
")",
":",
"if",
"key",
"in",
"self",
":",
"return",
"self",
"[",
"key",
"]",
"self",
"[",
"key",
"]",
"=",
"default",
"return",
"default"
] | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/ordered_dict.py#L219-L224 | |
devsisters/libquic | 8954789a056d8e7d5fcb6452fd1572ca57eb5c4e | src/third_party/protobuf/python/google/protobuf/json_format.py | python | _ConvertListValueMessage | (value, message) | Convert a JSON representation into ListValue message. | Convert a JSON representation into ListValue message. | [
"Convert",
"a",
"JSON",
"representation",
"into",
"ListValue",
"message",
"."
] | def _ConvertListValueMessage(value, message):
"""Convert a JSON representation into ListValue message."""
if not isinstance(value, list):
raise ParseError(
'ListValue must be in [] which is {0}.'.format(value))
message.ClearField('values')
for item in value:
_ConvertValueMessage(item, message.va... | [
"def",
"_ConvertListValueMessage",
"(",
"value",
",",
"message",
")",
":",
"if",
"not",
"isinstance",
"(",
"value",
",",
"list",
")",
":",
"raise",
"ParseError",
"(",
"'ListValue must be in [] which is {0}.'",
".",
"format",
"(",
"value",
")",
")",
"message",
... | https://github.com/devsisters/libquic/blob/8954789a056d8e7d5fcb6452fd1572ca57eb5c4e/src/third_party/protobuf/python/google/protobuf/json_format.py#L477-L484 | ||
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py | python | parserCtxt.parseMisc | (self) | parse an XML Misc* optional field. [27] Misc ::= Comment |
PI | S | parse an XML Misc* optional field. [27] Misc ::= Comment |
PI | S | [
"parse",
"an",
"XML",
"Misc",
"*",
"optional",
"field",
".",
"[",
"27",
"]",
"Misc",
"::",
"=",
"Comment",
"|",
"PI",
"|",
"S"
] | def parseMisc(self):
"""parse an XML Misc* optional field. [27] Misc ::= Comment |
PI | S """
libxml2mod.xmlParseMisc(self._o) | [
"def",
"parseMisc",
"(",
"self",
")",
":",
"libxml2mod",
".",
"xmlParseMisc",
"(",
"self",
".",
"_o",
")"
] | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py#L5340-L5343 | ||
psi4/psi4 | be533f7f426b6ccc263904e55122899b16663395 | psi4/driver/procrouting/dft/dft_builder.py | python | build_superfunctional_from_dictionary | (func_dictionary, npoints, deriv, restricted) | return (sup, dispersion) | This returns a (core.SuperFunctional, dispersion) tuple based on the requested name.
The npoints, deriv and restricted parameters are also respected. | This returns a (core.SuperFunctional, dispersion) tuple based on the requested name.
The npoints, deriv and restricted parameters are also respected. | [
"This",
"returns",
"a",
"(",
"core",
".",
"SuperFunctional",
"dispersion",
")",
"tuple",
"based",
"on",
"the",
"requested",
"name",
".",
"The",
"npoints",
"deriv",
"and",
"restricted",
"parameters",
"are",
"also",
"respected",
"."
] | def build_superfunctional_from_dictionary(func_dictionary, npoints, deriv, restricted):
"""
This returns a (core.SuperFunctional, dispersion) tuple based on the requested name.
The npoints, deriv and restricted parameters are also respected.
"""
# Sanity check first, raises ValidationError if somet... | [
"def",
"build_superfunctional_from_dictionary",
"(",
"func_dictionary",
",",
"npoints",
",",
"deriv",
",",
"restricted",
")",
":",
"# Sanity check first, raises ValidationError if something is wrong",
"check_consistency",
"(",
"func_dictionary",
")",
"# Either process the \"xc_func... | https://github.com/psi4/psi4/blob/be533f7f426b6ccc263904e55122899b16663395/psi4/driver/procrouting/dft/dft_builder.py#L253-L412 | |
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | scripts/Python/static-binding/lldb.py | python | SBTypeEnumMemberList.Append | (self, entry) | return _lldb.SBTypeEnumMemberList_Append(self, entry) | Append(SBTypeEnumMemberList self, SBTypeEnumMember entry) | Append(SBTypeEnumMemberList self, SBTypeEnumMember entry) | [
"Append",
"(",
"SBTypeEnumMemberList",
"self",
"SBTypeEnumMember",
"entry",
")"
] | def Append(self, entry):
"""Append(SBTypeEnumMemberList self, SBTypeEnumMember entry)"""
return _lldb.SBTypeEnumMemberList_Append(self, entry) | [
"def",
"Append",
"(",
"self",
",",
"entry",
")",
":",
"return",
"_lldb",
".",
"SBTypeEnumMemberList_Append",
"(",
"self",
",",
"entry",
")"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L13407-L13409 | |
nvdla/sw | 79538ba1b52b040a4a4645f630e457fa01839e90 | regression/scripts/run_regression.py | python | run_tests | (options, testplan) | Run all given tests, and list result stats | Run all given tests, and list result stats | [
"Run",
"all",
"given",
"tests",
"and",
"list",
"result",
"stats"
] | def run_tests(options, testplan):
"""Run all given tests, and list result stats"""
deploy_tests(options)
target = options.target
for level in options.levels.split(','):
print("Running testplan[%s] level[%s] [%s] tests"
% (testplan.name, level, target))
testlist = testplan... | [
"def",
"run_tests",
"(",
"options",
",",
"testplan",
")",
":",
"deploy_tests",
"(",
"options",
")",
"target",
"=",
"options",
".",
"target",
"for",
"level",
"in",
"options",
".",
"levels",
".",
"split",
"(",
"','",
")",
":",
"print",
"(",
"\"Running test... | https://github.com/nvdla/sw/blob/79538ba1b52b040a4a4645f630e457fa01839e90/regression/scripts/run_regression.py#L168-L190 | ||
google/earthenterprise | 0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9 | earth_enterprise/src/google/protobuf-py/mox.py | python | MockObject.__getattr__ | (self, name) | Intercept attribute request on this object.
If the attribute is a public class variable, it will be returned and not
recorded as a call.
If the attribute is not a variable, it is handled like a method
call. The method name is checked against the set of mockable
methods, and a new MockMethod is ret... | Intercept attribute request on this object. | [
"Intercept",
"attribute",
"request",
"on",
"this",
"object",
"."
] | def __getattr__(self, name):
"""Intercept attribute request on this object.
If the attribute is a public class variable, it will be returned and not
recorded as a call.
If the attribute is not a variable, it is handled like a method
call. The method name is checked against the set of mockable
... | [
"def",
"__getattr__",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
"in",
"self",
".",
"_known_vars",
":",
"return",
"getattr",
"(",
"self",
".",
"_class_to_mock",
",",
"name",
")",
"if",
"name",
"in",
"self",
".",
"_known_methods",
":",
"return",
... | https://github.com/google/earthenterprise/blob/0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9/earth_enterprise/src/google/protobuf-py/mox.py#L386-L417 | ||
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py | python | SBLineEntry.__ne__ | (self, *args) | return _lldb.SBLineEntry___ne__(self, *args) | __ne__(self, SBLineEntry rhs) -> bool | __ne__(self, SBLineEntry rhs) -> bool | [
"__ne__",
"(",
"self",
"SBLineEntry",
"rhs",
")",
"-",
">",
"bool"
] | def __ne__(self, *args):
"""__ne__(self, SBLineEntry rhs) -> bool"""
return _lldb.SBLineEntry___ne__(self, *args) | [
"def",
"__ne__",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_lldb",
".",
"SBLineEntry___ne__",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py#L5667-L5669 | |
mapnik/mapnik | f3da900c355e1d15059c4a91b00203dcc9d9f0ef | scons/scons-local-4.1.0/SCons/PathList.py | python | PathListCache.PathList | (self, pathlist) | return result | Returns the cached _PathList object for the specified pathlist,
creating and caching a new object as necessary. | Returns the cached _PathList object for the specified pathlist,
creating and caching a new object as necessary. | [
"Returns",
"the",
"cached",
"_PathList",
"object",
"for",
"the",
"specified",
"pathlist",
"creating",
"and",
"caching",
"a",
"new",
"object",
"as",
"necessary",
"."
] | def PathList(self, pathlist):
"""
Returns the cached _PathList object for the specified pathlist,
creating and caching a new object as necessary.
"""
pathlist = self._PathList_key(pathlist)
try:
memo_dict = self._memo['PathList']
except KeyError:
... | [
"def",
"PathList",
"(",
"self",
",",
"pathlist",
")",
":",
"pathlist",
"=",
"self",
".",
"_PathList_key",
"(",
"pathlist",
")",
"try",
":",
"memo_dict",
"=",
"self",
".",
"_memo",
"[",
"'PathList'",
"]",
"except",
"KeyError",
":",
"memo_dict",
"=",
"{",
... | https://github.com/mapnik/mapnik/blob/f3da900c355e1d15059c4a91b00203dcc9d9f0ef/scons/scons-local-4.1.0/SCons/PathList.py#L192-L213 | |
NREL/EnergyPlus | fadc5973b85c70e8cc923efb69c144e808a26078 | src/EnergyPlus/api/datatransfer.py | python | DataExchange.get_trend_min | (self, state: c_void_p, trend_handle: int, count: int) | return self.api.getPluginTrendVariableMin(state, trend_handle, count) | Get the minimum of a plugin trend variable over a specific history set. The count argument specifies how
many time steps to go back in the trend history. A value of 1 indicates sweeping just the most recent value.
The value of time_index must be less than or equal to the number of history terms specif... | Get the minimum of a plugin trend variable over a specific history set. The count argument specifies how
many time steps to go back in the trend history. A value of 1 indicates sweeping just the most recent value.
The value of time_index must be less than or equal to the number of history terms specif... | [
"Get",
"the",
"minimum",
"of",
"a",
"plugin",
"trend",
"variable",
"over",
"a",
"specific",
"history",
"set",
".",
"The",
"count",
"argument",
"specifies",
"how",
"many",
"time",
"steps",
"to",
"go",
"back",
"in",
"the",
"trend",
"history",
".",
"A",
"va... | def get_trend_min(self, state: c_void_p, trend_handle: int, count: int) -> float:
"""
Get the minimum of a plugin trend variable over a specific history set. The count argument specifies how
many time steps to go back in the trend history. A value of 1 indicates sweeping just the most recent v... | [
"def",
"get_trend_min",
"(",
"self",
",",
"state",
":",
"c_void_p",
",",
"trend_handle",
":",
"int",
",",
"count",
":",
"int",
")",
"->",
"float",
":",
"if",
"not",
"self",
".",
"running_as_python_plugin",
":",
"raise",
"EnergyPlusException",
"(",
"\"get_tre... | https://github.com/NREL/EnergyPlus/blob/fadc5973b85c70e8cc923efb69c144e808a26078/src/EnergyPlus/api/datatransfer.py#L798-L826 | |
microsoft/ELL | a1d6bacc37a14879cc025d9be2ba40b1a0632315 | docs/tutorials/Boosting-classifier-accuracy-by-grouping-categories/pets.py | python | get_image_from_camera | (camera) | return None | Function to return an image from our camera using OpenCV | Function to return an image from our camera using OpenCV | [
"Function",
"to",
"return",
"an",
"image",
"from",
"our",
"camera",
"using",
"OpenCV"
] | def get_image_from_camera(camera):
"""Function to return an image from our camera using OpenCV"""
if camera:
# if predictor is too slow frames get buffered, this is designed to
# flush that buffer
ret, frame = camera.read()
if not ret:
raise Exception("your capture de... | [
"def",
"get_image_from_camera",
"(",
"camera",
")",
":",
"if",
"camera",
":",
"# if predictor is too slow frames get buffered, this is designed to",
"# flush that buffer",
"ret",
",",
"frame",
"=",
"camera",
".",
"read",
"(",
")",
"if",
"not",
"ret",
":",
"raise",
"... | https://github.com/microsoft/ELL/blob/a1d6bacc37a14879cc025d9be2ba40b1a0632315/docs/tutorials/Boosting-classifier-accuracy-by-grouping-categories/pets.py#L20-L29 | |
bristolcrypto/SPDZ-2 | 721abfae849625a02ea49aabc534f9cf41ca643f | Compiler/allocator.py | python | Merger.merge_nodes | (self, i, j) | Merge node j into i, removing node j | Merge node j into i, removing node j | [
"Merge",
"node",
"j",
"into",
"i",
"removing",
"node",
"j"
] | def merge_nodes(self, i, j):
""" Merge node j into i, removing node j """
G = self.G
if j in G[i]:
G.remove_edge(i, j)
if i in G[j]:
G.remove_edge(j, i)
G.add_edges_from(zip(itertools.cycle([i]), G[j], [G.weights[(j,k)] for k in G[j]]))
G.add_edges... | [
"def",
"merge_nodes",
"(",
"self",
",",
"i",
",",
"j",
")",
":",
"G",
"=",
"self",
".",
"G",
"if",
"j",
"in",
"G",
"[",
"i",
"]",
":",
"G",
".",
"remove_edge",
"(",
"i",
",",
"j",
")",
"if",
"i",
"in",
"G",
"[",
"j",
"]",
":",
"G",
".",... | https://github.com/bristolcrypto/SPDZ-2/blob/721abfae849625a02ea49aabc534f9cf41ca643f/Compiler/allocator.py#L614-L624 | ||
nasa/astrobee | 9241e67e6692810d6e275abb3165b6d02f4ca5ef | scripts/git/cpplint.py | python | CheckTrailingSemicolon | (filename, clean_lines, linenum, error) | Looks for redundant trailing semicolon.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found. | Looks for redundant trailing semicolon. | [
"Looks",
"for",
"redundant",
"trailing",
"semicolon",
"."
] | def CheckTrailingSemicolon(filename, clean_lines, linenum, error):
"""Looks for redundant trailing semicolon.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call wi... | [
"def",
"CheckTrailingSemicolon",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"# Block bodies should not be followed by a semicolon. Due to C++11",
"# brace initialization, ther... | https://github.com/nasa/astrobee/blob/9241e67e6692810d6e275abb3165b6d02f4ca5ef/scripts/git/cpplint.py#L4342-L4494 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/saved_model/model_utils/export_output.py | python | _SupervisedOutput._prefix_output_keys | (self, output_dict, output_name) | return new_outputs | Prepend output_name to the output_dict keys if it doesn't exist.
This produces predictable prefixes for the pre-determined outputs
of SupervisedOutput.
Args:
output_dict: dict of string to Tensor, assumed valid.
output_name: prefix string to prepend to existing keys.
Returns:
dict w... | Prepend output_name to the output_dict keys if it doesn't exist. | [
"Prepend",
"output_name",
"to",
"the",
"output_dict",
"keys",
"if",
"it",
"doesn",
"t",
"exist",
"."
] | def _prefix_output_keys(self, output_dict, output_name):
"""Prepend output_name to the output_dict keys if it doesn't exist.
This produces predictable prefixes for the pre-determined outputs
of SupervisedOutput.
Args:
output_dict: dict of string to Tensor, assumed valid.
output_name: prefi... | [
"def",
"_prefix_output_keys",
"(",
"self",
",",
"output_dict",
",",
"output_name",
")",
":",
"new_outputs",
"=",
"{",
"}",
"for",
"key",
",",
"val",
"in",
"output_dict",
".",
"items",
"(",
")",
":",
"key",
"=",
"self",
".",
"_prefix_key",
"(",
"key",
"... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/saved_model/model_utils/export_output.py#L297-L315 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Draft/draftobjects/layer.py | python | Layer.__getstate__ | (self) | return self.Type | Return a tuple of objects to save or None. | Return a tuple of objects to save or None. | [
"Return",
"a",
"tuple",
"of",
"objects",
"to",
"save",
"or",
"None",
"."
] | def __getstate__(self):
"""Return a tuple of objects to save or None."""
return self.Type | [
"def",
"__getstate__",
"(",
"self",
")",
":",
"return",
"self",
".",
"Type"
] | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Draft/draftobjects/layer.py#L64-L66 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/turtle.py | python | TNavigator.sety | (self, y) | Set the turtle's second coordinate to y
Argument:
y -- a number (integer or float)
Set the turtle's first coordinate to x, second coordinate remains
unchanged.
Example (for a Turtle instance named turtle):
>>> turtle.position()
(0.00, 40.00)
>>> turtle.... | Set the turtle's second coordinate to y | [
"Set",
"the",
"turtle",
"s",
"second",
"coordinate",
"to",
"y"
] | def sety(self, y):
"""Set the turtle's second coordinate to y
Argument:
y -- a number (integer or float)
Set the turtle's first coordinate to x, second coordinate remains
unchanged.
Example (for a Turtle instance named turtle):
>>> turtle.position()
(0.... | [
"def",
"sety",
"(",
"self",
",",
"y",
")",
":",
"self",
".",
"_goto",
"(",
"Vec2D",
"(",
"self",
".",
"_position",
"[",
"0",
"]",
",",
"y",
")",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/turtle.py#L1725-L1741 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/grit/grit/util.py | python | PathFromRoot | (path) | return os.path.normpath(os.path.join(_root_dir, path)) | Takes a path relative to the root directory for GRIT (the one that grit.py
resides in) and returns a path that is either absolute or relative to the
current working directory (i.e .a path you can use to open the file).
Args:
path: 'rel_dir\file.ext'
Return:
'c:\src\tools\rel_dir\file.ext | Takes a path relative to the root directory for GRIT (the one that grit.py
resides in) and returns a path that is either absolute or relative to the
current working directory (i.e .a path you can use to open the file). | [
"Takes",
"a",
"path",
"relative",
"to",
"the",
"root",
"directory",
"for",
"GRIT",
"(",
"the",
"one",
"that",
"grit",
".",
"py",
"resides",
"in",
")",
"and",
"returns",
"a",
"path",
"that",
"is",
"either",
"absolute",
"or",
"relative",
"to",
"the",
"cu... | def PathFromRoot(path):
'''Takes a path relative to the root directory for GRIT (the one that grit.py
resides in) and returns a path that is either absolute or relative to the
current working directory (i.e .a path you can use to open the file).
Args:
path: 'rel_dir\file.ext'
Return:
'c:\src\tools\r... | [
"def",
"PathFromRoot",
"(",
"path",
")",
":",
"return",
"os",
".",
"path",
".",
"normpath",
"(",
"os",
".",
"path",
".",
"join",
"(",
"_root_dir",
",",
"path",
")",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/grit/grit/util.py#L308-L319 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_core.py | python | SizerItem.GetFlag | (*args, **kwargs) | return _core_.SizerItem_GetFlag(*args, **kwargs) | GetFlag(self) -> int
Get the flag value for this item. | GetFlag(self) -> int | [
"GetFlag",
"(",
"self",
")",
"-",
">",
"int"
] | def GetFlag(*args, **kwargs):
"""
GetFlag(self) -> int
Get the flag value for this item.
"""
return _core_.SizerItem_GetFlag(*args, **kwargs) | [
"def",
"GetFlag",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"SizerItem_GetFlag",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L14215-L14221 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_core.py | python | PyApp.SafeYieldFor | (*args, **kwargs) | return _core_.PyApp_SafeYieldFor(*args, **kwargs) | SafeYieldFor(self, Window win, long eventsToProcess) -> bool | SafeYieldFor(self, Window win, long eventsToProcess) -> bool | [
"SafeYieldFor",
"(",
"self",
"Window",
"win",
"long",
"eventsToProcess",
")",
"-",
">",
"bool"
] | def SafeYieldFor(*args, **kwargs):
"""SafeYieldFor(self, Window win, long eventsToProcess) -> bool"""
return _core_.PyApp_SafeYieldFor(*args, **kwargs) | [
"def",
"SafeYieldFor",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"PyApp_SafeYieldFor",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L7922-L7924 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_core.py | python | Point.Get | (*args, **kwargs) | return _core_.Point_Get(*args, **kwargs) | Get() -> (x,y)
Return the x and y properties as a tuple. | Get() -> (x,y) | [
"Get",
"()",
"-",
">",
"(",
"x",
"y",
")"
] | def Get(*args, **kwargs):
"""
Get() -> (x,y)
Return the x and y properties as a tuple.
"""
return _core_.Point_Get(*args, **kwargs) | [
"def",
"Get",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Point_Get",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L1227-L1233 | |
balloonwj/TeamTalk | dc79c40687e4c9d7bec07ff5c9782be586fd9b41 | win-client/3rdParty/src/json/makerelease.py | python | sourceforge_web_synchro | ( sourceforge_project, doc_dir,
user=None, sftp='sftp' ) | Notes: does not synchronize sub-directory of doc-dir. | Notes: does not synchronize sub-directory of doc-dir. | [
"Notes",
":",
"does",
"not",
"synchronize",
"sub",
"-",
"directory",
"of",
"doc",
"-",
"dir",
"."
] | def sourceforge_web_synchro( sourceforge_project, doc_dir,
user=None, sftp='sftp' ):
"""Notes: does not synchronize sub-directory of doc-dir.
"""
userhost = '%s,%s@web.sourceforge.net' % (user, sourceforge_project)
stdout = run_sftp_batch( userhost, sftp, """
cd htdocs
dir
e... | [
"def",
"sourceforge_web_synchro",
"(",
"sourceforge_project",
",",
"doc_dir",
",",
"user",
"=",
"None",
",",
"sftp",
"=",
"'sftp'",
")",
":",
"userhost",
"=",
"'%s,%s@web.sourceforge.net'",
"%",
"(",
"user",
",",
"sourceforge_project",
")",
"stdout",
"=",
"run_s... | https://github.com/balloonwj/TeamTalk/blob/dc79c40687e4c9d7bec07ff5c9782be586fd9b41/win-client/3rdParty/src/json/makerelease.py#L192-L237 | ||
apache/trafodion | 8455c839ad6b6d7b6e04edda5715053095b78046 | install/python-installer/prettytable.py | python | PrettyTable._get_horizontal_char | (self) | return self._horizontal_char | The charcter used when printing table borders to draw horizontal lines
Arguments:
horizontal_char - single character string used to draw horizontal lines | The charcter used when printing table borders to draw horizontal lines | [
"The",
"charcter",
"used",
"when",
"printing",
"table",
"borders",
"to",
"draw",
"horizontal",
"lines"
] | def _get_horizontal_char(self):
"""The charcter used when printing table borders to draw horizontal lines
Arguments:
horizontal_char - single character string used to draw horizontal lines"""
return self._horizontal_char | [
"def",
"_get_horizontal_char",
"(",
"self",
")",
":",
"return",
"self",
".",
"_horizontal_char"
] | https://github.com/apache/trafodion/blob/8455c839ad6b6d7b6e04edda5715053095b78046/install/python-installer/prettytable.py#L666-L672 | |
metashell/metashell | f4177e4854ea00c8dbc722cadab26ef413d798ea | 3rd/templight/llvm/bindings/python/llvm/object.py | python | Relocation.type_number | (self) | return lib.LLVMGetRelocationType(self) | The relocation type, as a long. | The relocation type, as a long. | [
"The",
"relocation",
"type",
"as",
"a",
"long",
"."
] | def type_number(self):
"""The relocation type, as a long."""
if self.expired:
raise Exception('Relocation instance has expired.')
return lib.LLVMGetRelocationType(self) | [
"def",
"type_number",
"(",
"self",
")",
":",
"if",
"self",
".",
"expired",
":",
"raise",
"Exception",
"(",
"'Relocation instance has expired.'",
")",
"return",
"lib",
".",
"LLVMGetRelocationType",
"(",
"self",
")"
] | https://github.com/metashell/metashell/blob/f4177e4854ea00c8dbc722cadab26ef413d798ea/3rd/templight/llvm/bindings/python/llvm/object.py#L391-L396 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/BaseHTTPServer.py | python | BaseHTTPRequestHandler.end_headers | (self) | Send the blank line ending the MIME headers. | Send the blank line ending the MIME headers. | [
"Send",
"the",
"blank",
"line",
"ending",
"the",
"MIME",
"headers",
"."
] | def end_headers(self):
"""Send the blank line ending the MIME headers."""
if self.request_version != 'HTTP/0.9':
self.wfile.write("\r\n") | [
"def",
"end_headers",
"(",
"self",
")",
":",
"if",
"self",
".",
"request_version",
"!=",
"'HTTP/0.9'",
":",
"self",
".",
"wfile",
".",
"write",
"(",
"\"\\r\\n\"",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/BaseHTTPServer.py#L409-L412 | ||
giuspen/cherrytree | 84712f206478fcf9acf30174009ad28c648c6344 | pygtk2/modules/core.py | python | CherryTree.on_drag_motion_cherrytree | (self, widget, drag_context, x, y, timestamp) | return True | Cherry Tree drag motion | Cherry Tree drag motion | [
"Cherry",
"Tree",
"drag",
"motion"
] | def on_drag_motion_cherrytree(self, widget, drag_context, x, y, timestamp):
"""Cherry Tree drag motion"""
if y < cons.TREE_DRAG_EDGE_PROX or y > (widget.get_allocation().height - cons.TREE_DRAG_EDGE_PROX):
delta = -cons.TREE_DRAG_EDGE_SCROLL if y < cons.TREE_DRAG_EDGE_PROX else cons.TREE_DRA... | [
"def",
"on_drag_motion_cherrytree",
"(",
"self",
",",
"widget",
",",
"drag_context",
",",
"x",
",",
"y",
",",
"timestamp",
")",
":",
"if",
"y",
"<",
"cons",
".",
"TREE_DRAG_EDGE_PROX",
"or",
"y",
">",
"(",
"widget",
".",
"get_allocation",
"(",
")",
".",
... | https://github.com/giuspen/cherrytree/blob/84712f206478fcf9acf30174009ad28c648c6344/pygtk2/modules/core.py#L801-L815 | |
Yelp/MOE | 5b5a6a2c6c3cf47320126f7f5894e2a83e347f5c | moe/optimal_learning/python/python_version/python_utils.py | python | build_covariance_matrix | (covariance, points_sampled, noise_variance=None) | return cov_mat | r"""Compute the covariance matrix, ``K``, of a list of points, ``X_i``.
.. NOTE:: These comments are copied from BuildCovarianceMatrix() in gpp_math.cpp.
Matrix is computed as:
``A_{i,j} = covariance(X_i, X_j) + \delta_{i,j}*noise_i``.
where ``\delta_{i,j}`` is the Kronecker ``delta``, equal to 1 if `... | r"""Compute the covariance matrix, ``K``, of a list of points, ``X_i``. | [
"r",
"Compute",
"the",
"covariance",
"matrix",
"K",
"of",
"a",
"list",
"of",
"points",
"X_i",
"."
] | def build_covariance_matrix(covariance, points_sampled, noise_variance=None):
r"""Compute the covariance matrix, ``K``, of a list of points, ``X_i``.
.. NOTE:: These comments are copied from BuildCovarianceMatrix() in gpp_math.cpp.
Matrix is computed as:
``A_{i,j} = covariance(X_i, X_j) + \delta_{i,j}... | [
"def",
"build_covariance_matrix",
"(",
"covariance",
",",
"points_sampled",
",",
"noise_variance",
"=",
"None",
")",
":",
"cov_mat",
"=",
"numpy",
".",
"zeros",
"(",
"(",
"points_sampled",
".",
"shape",
"[",
"0",
"]",
",",
"points_sampled",
".",
"shape",
"["... | https://github.com/Yelp/MOE/blob/5b5a6a2c6c3cf47320126f7f5894e2a83e347f5c/moe/optimal_learning/python/python_version/python_utils.py#L6-L49 | |
rrwick/Unicycler | 96ffea71e3a78d63ade19d6124946773e65cf129 | unicycler/assembly_graph_segment.py | python | Segment.append_to_reverse_sequence | (self, additional_seq) | Adds the given sequence to the end of the reverse sequence (and updates the forward
sequence accordingly). | Adds the given sequence to the end of the reverse sequence (and updates the forward
sequence accordingly). | [
"Adds",
"the",
"given",
"sequence",
"to",
"the",
"end",
"of",
"the",
"reverse",
"sequence",
"(",
"and",
"updates",
"the",
"forward",
"sequence",
"accordingly",
")",
"."
] | def append_to_reverse_sequence(self, additional_seq):
"""
Adds the given sequence to the end of the reverse sequence (and updates the forward
sequence accordingly).
"""
self.reverse_sequence = self.reverse_sequence + additional_seq
self.forward_sequence = reverse_compleme... | [
"def",
"append_to_reverse_sequence",
"(",
"self",
",",
"additional_seq",
")",
":",
"self",
".",
"reverse_sequence",
"=",
"self",
".",
"reverse_sequence",
"+",
"additional_seq",
"self",
".",
"forward_sequence",
"=",
"reverse_complement",
"(",
"self",
".",
"reverse_se... | https://github.com/rrwick/Unicycler/blob/96ffea71e3a78d63ade19d6124946773e65cf129/unicycler/assembly_graph_segment.py#L165-L171 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/shutil.py | python | _make_tarball | (base_name, base_dir, compress="gzip", verbose=0, dry_run=0,
owner=None, group=None, logger=None) | return archive_name | Create a (possibly compressed) tar file from all the files under
'base_dir'.
'compress' must be "gzip" (the default), "bzip2", "xz", or None.
'owner' and 'group' can be used to define an owner and a group for the
archive that is being built. If not provided, the current owner and group
will be use... | Create a (possibly compressed) tar file from all the files under
'base_dir'. | [
"Create",
"a",
"(",
"possibly",
"compressed",
")",
"tar",
"file",
"from",
"all",
"the",
"files",
"under",
"base_dir",
"."
] | def _make_tarball(base_name, base_dir, compress="gzip", verbose=0, dry_run=0,
owner=None, group=None, logger=None):
"""Create a (possibly compressed) tar file from all the files under
'base_dir'.
'compress' must be "gzip" (the default), "bzip2", "xz", or None.
'owner' and 'group' can... | [
"def",
"_make_tarball",
"(",
"base_name",
",",
"base_dir",
",",
"compress",
"=",
"\"gzip\"",
",",
"verbose",
"=",
"0",
",",
"dry_run",
"=",
"0",
",",
"owner",
"=",
"None",
",",
"group",
"=",
"None",
",",
"logger",
"=",
"None",
")",
":",
"if",
"compre... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/shutil.py#L617-L680 | |
larroy/clearskies_core | 3574ddf0edc8555454c7044126e786a6c29444dc | tools/gyp/pylib/gyp/msvs_emulation.py | python | ExpandMacros | (string, expansions) | return string | Expand $(Variable) per expansions dict. See MsvsSettings.GetVSMacroEnv
for the canonical way to retrieve a suitable dict. | Expand $(Variable) per expansions dict. See MsvsSettings.GetVSMacroEnv
for the canonical way to retrieve a suitable dict. | [
"Expand",
"$",
"(",
"Variable",
")",
"per",
"expansions",
"dict",
".",
"See",
"MsvsSettings",
".",
"GetVSMacroEnv",
"for",
"the",
"canonical",
"way",
"to",
"retrieve",
"a",
"suitable",
"dict",
"."
] | def ExpandMacros(string, expansions):
"""Expand $(Variable) per expansions dict. See MsvsSettings.GetVSMacroEnv
for the canonical way to retrieve a suitable dict."""
if '$' in string:
for old, new in expansions.iteritems():
assert '$(' not in new, new
string = string.replace(old, new)
return str... | [
"def",
"ExpandMacros",
"(",
"string",
",",
"expansions",
")",
":",
"if",
"'$'",
"in",
"string",
":",
"for",
"old",
",",
"new",
"in",
"expansions",
".",
"iteritems",
"(",
")",
":",
"assert",
"'$('",
"not",
"in",
"new",
",",
"new",
"string",
"=",
"stri... | https://github.com/larroy/clearskies_core/blob/3574ddf0edc8555454c7044126e786a6c29444dc/tools/gyp/pylib/gyp/msvs_emulation.py#L833-L840 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/lib-tk/Tkinter.py | python | Spinbox.scan_dragto | (self, x) | return self.scan("dragto", x) | Compute the difference between the given x argument
and the x argument to the last scan mark command
It then adjusts the view left or right by 10 times the
difference in x-coordinates. This command is typically
associated with mouse motion events in the widget, to
produce the ef... | Compute the difference between the given x argument
and the x argument to the last scan mark command | [
"Compute",
"the",
"difference",
"between",
"the",
"given",
"x",
"argument",
"and",
"the",
"x",
"argument",
"to",
"the",
"last",
"scan",
"mark",
"command"
] | def scan_dragto(self, x):
"""Compute the difference between the given x argument
and the x argument to the last scan mark command
It then adjusts the view left or right by 10 times the
difference in x-coordinates. This command is typically
associated with mouse motion events in ... | [
"def",
"scan_dragto",
"(",
"self",
",",
"x",
")",
":",
"return",
"self",
".",
"scan",
"(",
"\"dragto\"",
",",
"x",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/lib-tk/Tkinter.py#L3480-L3490 | |
cornell-zhang/heterocl | 6d9e4b4acc2ee2707b2d25b27298c0335bccedfd | python/heterocl/tvm/contrib/graph_runtime.py | python | GraphModule.debug_get_output | (self, node, out) | return out | Run graph upto node and get the output to out
Parameters
----------
node : int / str
The node index or name
out : NDArray
The output array container | Run graph upto node and get the output to out | [
"Run",
"graph",
"upto",
"node",
"and",
"get",
"the",
"output",
"to",
"out"
] | def debug_get_output(self, node, out):
"""Run graph upto node and get the output to out
Parameters
----------
node : int / str
The node index or name
out : NDArray
The output array container
"""
if hasattr(self, '_debug_get_output'):
... | [
"def",
"debug_get_output",
"(",
"self",
",",
"node",
",",
"out",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"'_debug_get_output'",
")",
":",
"self",
".",
"_debug_get_output",
"(",
"node",
",",
"out",
")",
"else",
":",
"raise",
"RuntimeError",
"(",
"\"P... | https://github.com/cornell-zhang/heterocl/blob/6d9e4b4acc2ee2707b2d25b27298c0335bccedfd/python/heterocl/tvm/contrib/graph_runtime.py#L128-L143 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/numpy/multiarray.py | python | bitwise_or | (x1, x2, out=None, **kwargs) | return _mx_nd_np.bitwise_or(x1, x2, out=out) | r"""
Compute the bit-wise OR of two arrays element-wise.
Parameters
----------
x1, x2 : ndarray or scalar
Only integer and boolean types are handled. If x1.shape != x2.shape,
they must be broadcastable to a common shape (which becomes the shape of the output).
out : ndarray, optiona... | r"""
Compute the bit-wise OR of two arrays element-wise. | [
"r",
"Compute",
"the",
"bit",
"-",
"wise",
"OR",
"of",
"two",
"arrays",
"element",
"-",
"wise",
"."
] | def bitwise_or(x1, x2, out=None, **kwargs):
r"""
Compute the bit-wise OR of two arrays element-wise.
Parameters
----------
x1, x2 : ndarray or scalar
Only integer and boolean types are handled. If x1.shape != x2.shape,
they must be broadcastable to a common shape (which becomes the ... | [
"def",
"bitwise_or",
"(",
"x1",
",",
"x2",
",",
"out",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_mx_nd_np",
".",
"bitwise_or",
"(",
"x1",
",",
"x2",
",",
"out",
"=",
"out",
")"
] | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/numpy/multiarray.py#L9747-L9780 | |
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/ops/math_ops.py | python | _ReductionDims | (x, reduction_indices) | Returns range(0, rank(x)) if reduction_indices is None. | Returns range(0, rank(x)) if reduction_indices is None. | [
"Returns",
"range",
"(",
"0",
"rank",
"(",
"x",
"))",
"if",
"reduction_indices",
"is",
"None",
"."
] | def _ReductionDims(x, reduction_indices):
"""Returns range(0, rank(x)) if reduction_indices is None."""
if reduction_indices is not None:
return reduction_indices
else:
# Fast path: avoid creating Rank and Range ops if ndims is known.
if isinstance(x, ops.Tensor) and x.get_shape().ndims is not None:
... | [
"def",
"_ReductionDims",
"(",
"x",
",",
"reduction_indices",
")",
":",
"if",
"reduction_indices",
"is",
"not",
"None",
":",
"return",
"reduction_indices",
"else",
":",
"# Fast path: avoid creating Rank and Range ops if ndims is known.",
"if",
"isinstance",
"(",
"x",
","... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/ops/math_ops.py#L1004-L1019 | ||
mingchen/protobuf-ios | 0958df34558cd54cb7b6e6ca5c8855bf3d475046 | compiler/python/google/protobuf/service.py | python | Service.CallMethod | (self, method_descriptor, rpc_controller,
request, done) | Calls a method of the service specified by method_descriptor.
If "done" is None then the call is blocking and the response
message will be returned directly. Otherwise the call is asynchronous
and "done" will later be called with the response value.
In the blocking case, RpcException will be raised o... | Calls a method of the service specified by method_descriptor. | [
"Calls",
"a",
"method",
"of",
"the",
"service",
"specified",
"by",
"method_descriptor",
"."
] | def CallMethod(self, method_descriptor, rpc_controller,
request, done):
"""Calls a method of the service specified by method_descriptor.
If "done" is None then the call is blocking and the response
message will be returned directly. Otherwise the call is asynchronous
and "done" will l... | [
"def",
"CallMethod",
"(",
"self",
",",
"method_descriptor",
",",
"rpc_controller",
",",
"request",
",",
"done",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/mingchen/protobuf-ios/blob/0958df34558cd54cb7b6e6ca5c8855bf3d475046/compiler/python/google/protobuf/service.py#L61-L87 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/Jinja2/py3/jinja2/bccache.py | python | BytecodeCache.dump_bytecode | (self, bucket: Bucket) | Subclasses have to override this method to write the bytecode
from a bucket back to the cache. If it unable to do so it must not
fail silently but raise an exception. | Subclasses have to override this method to write the bytecode
from a bucket back to the cache. If it unable to do so it must not
fail silently but raise an exception. | [
"Subclasses",
"have",
"to",
"override",
"this",
"method",
"to",
"write",
"the",
"bytecode",
"from",
"a",
"bucket",
"back",
"to",
"the",
"cache",
".",
"If",
"it",
"unable",
"to",
"do",
"so",
"it",
"must",
"not",
"fail",
"silently",
"but",
"raise",
"an",
... | def dump_bytecode(self, bucket: Bucket) -> None:
"""Subclasses have to override this method to write the bytecode
from a bucket back to the cache. If it unable to do so it must not
fail silently but raise an exception.
"""
raise NotImplementedError() | [
"def",
"dump_bytecode",
"(",
"self",
",",
"bucket",
":",
"Bucket",
")",
"->",
"None",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/Jinja2/py3/jinja2/bccache.py#L137-L142 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/ogl/_lines.py | python | LineShape.Unlink | (self) | Unlink the line from the nodes at either end. | Unlink the line from the nodes at either end. | [
"Unlink",
"the",
"line",
"from",
"the",
"nodes",
"at",
"either",
"end",
"."
] | def Unlink(self):
"""Unlink the line from the nodes at either end."""
if self._to:
self._to.GetLines().remove(self)
if self._from:
self._from.GetLines().remove(self)
self._to = None
self._from = None
for i in range(3):
if self._labelObj... | [
"def",
"Unlink",
"(",
"self",
")",
":",
"if",
"self",
".",
"_to",
":",
"self",
".",
"_to",
".",
"GetLines",
"(",
")",
".",
"remove",
"(",
"self",
")",
"if",
"self",
".",
"_from",
":",
"self",
".",
"_from",
".",
"GetLines",
"(",
")",
".",
"remov... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/ogl/_lines.py#L477-L489 | ||
OSGeo/gdal | 3748fc4ba4fba727492774b2b908a2130c864a83 | swig/python/osgeo/gdal.py | python | Band.GetMaskBand | (self, *args) | return _gdal.Band_GetMaskBand(self, *args) | r"""GetMaskBand(Band self) -> Band | r"""GetMaskBand(Band self) -> Band | [
"r",
"GetMaskBand",
"(",
"Band",
"self",
")",
"-",
">",
"Band"
] | def GetMaskBand(self, *args):
r"""GetMaskBand(Band self) -> Band"""
return _gdal.Band_GetMaskBand(self, *args) | [
"def",
"GetMaskBand",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_gdal",
".",
"Band_GetMaskBand",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/OSGeo/gdal/blob/3748fc4ba4fba727492774b2b908a2130c864a83/swig/python/osgeo/gdal.py#L3532-L3534 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/recordio.py | python | MXRecordIO.close | (self) | Closes the record file. | Closes the record file. | [
"Closes",
"the",
"record",
"file",
"."
] | def close(self):
"""Closes the record file."""
if not self.is_open:
return
if self.writable:
check_call(_LIB.MXRecordIOWriterFree(self.handle))
else:
check_call(_LIB.MXRecordIOReaderFree(self.handle))
self.is_open = False
self.pid = Non... | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_open",
":",
"return",
"if",
"self",
".",
"writable",
":",
"check_call",
"(",
"_LIB",
".",
"MXRecordIOWriterFree",
"(",
"self",
".",
"handle",
")",
")",
"else",
":",
"check_call",
"(",... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/recordio.py#L126-L135 | ||
mapnik/mapnik | f3da900c355e1d15059c4a91b00203dcc9d9f0ef | scons/scons-local-4.1.0/SCons/Scanner/Fortran.py | python | FortranScan | (path_variable="FORTRANPATH") | return scanner | Return a prototype Scanner instance for scanning source files
for Fortran USE & INCLUDE statements | Return a prototype Scanner instance for scanning source files
for Fortran USE & INCLUDE statements | [
"Return",
"a",
"prototype",
"Scanner",
"instance",
"for",
"scanning",
"source",
"files",
"for",
"Fortran",
"USE",
"&",
"INCLUDE",
"statements"
] | def FortranScan(path_variable="FORTRANPATH"):
"""Return a prototype Scanner instance for scanning source files
for Fortran USE & INCLUDE statements"""
# The USE statement regex matches the following:
#
# USE module_name
# USE :: module_name
# USE, INTRINSIC :: module_name
# USE, NON_INTRINSIC :: modu... | [
"def",
"FortranScan",
"(",
"path_variable",
"=",
"\"FORTRANPATH\"",
")",
":",
"# The USE statement regex matches the following:",
"#",
"# USE module_name",
"# USE :: module_name",
"# USE, INTRINSIC :: module_name",
"# USE, NON_INTRINSIC :: module_name",
"#",
"# Limitations"... | https://github.com/mapnik/mapnik/blob/f3da900c355e1d15059c4a91b00203dcc9d9f0ef/scons/scons-local-4.1.0/SCons/Scanner/Fortran.py#L121-L313 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/lib-tk/ttk.py | python | Entry.__init__ | (self, master=None, widget=None, **kw) | Constructs a Ttk Entry widget with the parent master.
STANDARD OPTIONS
class, cursor, style, takefocus, xscrollcommand
WIDGET-SPECIFIC OPTIONS
exportselection, invalidcommand, justify, show, state,
textvariable, validate, validatecommand, width
VALIDATION... | Constructs a Ttk Entry widget with the parent master. | [
"Constructs",
"a",
"Ttk",
"Entry",
"widget",
"with",
"the",
"parent",
"master",
"."
] | def __init__(self, master=None, widget=None, **kw):
"""Constructs a Ttk Entry widget with the parent master.
STANDARD OPTIONS
class, cursor, style, takefocus, xscrollcommand
WIDGET-SPECIFIC OPTIONS
exportselection, invalidcommand, justify, show, state,
tex... | [
"def",
"__init__",
"(",
"self",
",",
"master",
"=",
"None",
",",
"widget",
"=",
"None",
",",
"*",
"*",
"kw",
")",
":",
"Widget",
".",
"__init__",
"(",
"self",
",",
"master",
",",
"widget",
"or",
"\"ttk::entry\"",
",",
"kw",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/lib-tk/ttk.py#L650-L666 | ||
Kitware/VTK | 5b4df4d90a4f31194d97d3c639dd38ea8f81e8b8 | Wrapping/Python/vtkmodules/gtk/GtkVTKRenderWindowInteractor.py | python | GtkVTKRenderWindowInteractor.OnLeave | (self, wid, event) | return gtk.TRUE | Leaving the vtkRenderWindow. | Leaving the vtkRenderWindow. | [
"Leaving",
"the",
"vtkRenderWindow",
"."
] | def OnLeave(self, wid, event):
"""Leaving the vtkRenderWindow."""
m = self.get_pointer()
ctrl, shift = self._GetCtrlShift(event)
self._Iren.SetEventInformationFlipY(m[0], m[1], ctrl, shift,
chr(0), 0, None)
self._Iren.LeaveEvent()
... | [
"def",
"OnLeave",
"(",
"self",
",",
"wid",
",",
"event",
")",
":",
"m",
"=",
"self",
".",
"get_pointer",
"(",
")",
"ctrl",
",",
"shift",
"=",
"self",
".",
"_GetCtrlShift",
"(",
"event",
")",
"self",
".",
"_Iren",
".",
"SetEventInformationFlipY",
"(",
... | https://github.com/Kitware/VTK/blob/5b4df4d90a4f31194d97d3c639dd38ea8f81e8b8/Wrapping/Python/vtkmodules/gtk/GtkVTKRenderWindowInteractor.py#L207-L214 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/nn/metrics/occlusion_sensitivity.py | python | OcclusionSensitivity.eval | (self) | return sensitivity | Computes the occlusion_sensitivity.
Returns:
A numpy ndarray.
Raises:
RuntimeError: If the update method is not called first, an error will be reported. | Computes the occlusion_sensitivity. | [
"Computes",
"the",
"occlusion_sensitivity",
"."
] | def eval(self):
"""
Computes the occlusion_sensitivity.
Returns:
A numpy ndarray.
Raises:
RuntimeError: If the update method is not called first, an error will be reported.
"""
if not self._is_update:
raise RuntimeError("Please c... | [
"def",
"eval",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_is_update",
":",
"raise",
"RuntimeError",
"(",
"\"Please call the 'update' method before calling 'eval' method.\"",
")",
"sensitivity",
"=",
"self",
".",
"_baseline",
"-",
"np",
".",
"squeeze",
"(",... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/nn/metrics/occlusion_sensitivity.py#L202-L218 | |
synfig/synfig | a5ec91db5b751dc12e4400ccfb5c063fd6d2d928 | synfig-studio/plugins/lottie-exporter/properties/valueKeyframe.py | python | gen_value_Keyframe | (curve_list, animated, i) | Generates the dictionary corresponding to properties/valueKeyframe.json in lottie
documentation
Args:
curve_list (list) : Bezier curve in Lottie format
animated (lxml.etree._Element) : Synfig format animation
i (int) : Iterator for animation
... | Generates the dictionary corresponding to properties/valueKeyframe.json in lottie
documentation | [
"Generates",
"the",
"dictionary",
"corresponding",
"to",
"properties",
"/",
"valueKeyframe",
".",
"json",
"in",
"lottie",
"documentation"
] | def gen_value_Keyframe(curve_list, animated, i):
"""
Generates the dictionary corresponding to properties/valueKeyframe.json in lottie
documentation
Args:
curve_list (list) : Bezier curve in Lottie format
animated (lxml.etree._Element) : Synfig format animation
... | [
"def",
"gen_value_Keyframe",
"(",
"curve_list",
",",
"animated",
",",
"i",
")",
":",
"lottie",
"=",
"curve_list",
"[",
"-",
"1",
"]",
"waypoint",
",",
"next_waypoint",
"=",
"animated",
"[",
"i",
"]",
",",
"animated",
"[",
"i",
"+",
"1",
"]",
"cur_get_a... | https://github.com/synfig/synfig/blob/a5ec91db5b751dc12e4400ccfb5c063fd6d2d928/synfig-studio/plugins/lottie-exporter/properties/valueKeyframe.py#L65-L152 | ||
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/examples/learn/wide_n_deep_tutorial.py | python | maybe_download | () | return train_file_name, test_file_name | May be downloads training data and returns train and test file names. | May be downloads training data and returns train and test file names. | [
"May",
"be",
"downloads",
"training",
"data",
"and",
"returns",
"train",
"and",
"test",
"file",
"names",
"."
] | def maybe_download():
"""May be downloads training data and returns train and test file names."""
if FLAGS.train_data:
train_file_name = FLAGS.train_data
else:
train_file = tempfile.NamedTemporaryFile(delete=False)
urllib.request.urlretrieve("https://archive.ics.uci.edu/ml/machine-learning-databases/a... | [
"def",
"maybe_download",
"(",
")",
":",
"if",
"FLAGS",
".",
"train_data",
":",
"train_file_name",
"=",
"FLAGS",
".",
"train_data",
"else",
":",
"train_file",
"=",
"tempfile",
".",
"NamedTemporaryFile",
"(",
"delete",
"=",
"False",
")",
"urllib",
".",
"reques... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/examples/learn/wide_n_deep_tutorial.py#L53-L73 | |
dmlc/nnvm | dab5ce8ab6adbf4edd8bd2fa89f1a99f343b6e38 | python/nnvm/compiler/compile_engine.py | python | Engine.__getitem__ | (self, key) | return _get_cache_item(key) | Clear the existing cached functions. | Clear the existing cached functions. | [
"Clear",
"the",
"existing",
"cached",
"functions",
"."
] | def __getitem__(self, key):
"""Clear the existing cached functions."""
return _get_cache_item(key) | [
"def",
"__getitem__",
"(",
"self",
",",
"key",
")",
":",
"return",
"_get_cache_item",
"(",
"key",
")"
] | https://github.com/dmlc/nnvm/blob/dab5ce8ab6adbf4edd8bd2fa89f1a99f343b6e38/python/nnvm/compiler/compile_engine.py#L63-L65 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/Tkinter.py | python | Wm.wm_maxsize | (self, width=None, height=None) | return self._getints(self.tk.call(
'wm', 'maxsize', self._w, width, height)) | Set max WIDTH and HEIGHT for this widget. If the window is gridded
the values are given in grid units. Return the current values if None
is given. | Set max WIDTH and HEIGHT for this widget. If the window is gridded
the values are given in grid units. Return the current values if None
is given. | [
"Set",
"max",
"WIDTH",
"and",
"HEIGHT",
"for",
"this",
"widget",
".",
"If",
"the",
"window",
"is",
"gridded",
"the",
"values",
"are",
"given",
"in",
"grid",
"units",
".",
"Return",
"the",
"current",
"values",
"if",
"None",
"is",
"given",
"."
] | def wm_maxsize(self, width=None, height=None):
"""Set max WIDTH and HEIGHT for this widget. If the window is gridded
the values are given in grid units. Return the current values if None
is given."""
return self._getints(self.tk.call(
'wm', 'maxsize', self._w, width, height)) | [
"def",
"wm_maxsize",
"(",
"self",
",",
"width",
"=",
"None",
",",
"height",
"=",
"None",
")",
":",
"return",
"self",
".",
"_getints",
"(",
"self",
".",
"tk",
".",
"call",
"(",
"'wm'",
",",
"'maxsize'",
",",
"self",
".",
"_w",
",",
"width",
",",
"... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/Tkinter.py#L1651-L1656 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/ftplib.py | python | FTP.cwd | (self, dirname) | return self.voidcmd(cmd) | Change to a directory. | Change to a directory. | [
"Change",
"to",
"a",
"directory",
"."
] | def cwd(self, dirname):
'''Change to a directory.'''
if dirname == '..':
try:
return self.voidcmd('CDUP')
except error_perm, msg:
if msg.args[0][:3] != '500':
raise
elif dirname == '':
dirname = '.' # does n... | [
"def",
"cwd",
"(",
"self",
",",
"dirname",
")",
":",
"if",
"dirname",
"==",
"'..'",
":",
"try",
":",
"return",
"self",
".",
"voidcmd",
"(",
"'CDUP'",
")",
"except",
"error_perm",
",",
"msg",
":",
"if",
"msg",
".",
"args",
"[",
"0",
"]",
"[",
":",... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/ftplib.py#L542-L553 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/general_fitting/general_fitting_view.py | python | GeneralFittingView.switch_to_single | (self) | Switches the view to single fit mode. | Switches the view to single fit mode. | [
"Switches",
"the",
"view",
"to",
"single",
"fit",
"mode",
"."
] | def switch_to_single(self) -> None:
"""Switches the view to single fit mode."""
super().switch_to_single()
self.set_workspace_combo_box_label(SINGLE_FIT_LABEL)
self.general_fitting_options.disable_simultaneous_fit_options() | [
"def",
"switch_to_single",
"(",
"self",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"switch_to_single",
"(",
")",
"self",
".",
"set_workspace_combo_box_label",
"(",
"SINGLE_FIT_LABEL",
")",
"self",
".",
"general_fitting_options",
".",
"disable_simultaneous_fit_o... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/general_fitting/general_fitting_view.py#L76-L80 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/cffi/pkgconfig.py | python | call | (libname, flag, encoding=sys.getfilesystemencoding()) | return bout | Calls pkg-config and returns the output if found | Calls pkg-config and returns the output if found | [
"Calls",
"pkg",
"-",
"config",
"and",
"returns",
"the",
"output",
"if",
"found"
] | def call(libname, flag, encoding=sys.getfilesystemencoding()):
"""Calls pkg-config and returns the output if found
"""
a = ["pkg-config", "--print-errors"]
a.append(flag)
a.append(libname)
try:
pc = subprocess.Popen(a, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
except Environmen... | [
"def",
"call",
"(",
"libname",
",",
"flag",
",",
"encoding",
"=",
"sys",
".",
"getfilesystemencoding",
"(",
")",
")",
":",
"a",
"=",
"[",
"\"pkg-config\"",
",",
"\"--print-errors\"",
"]",
"a",
".",
"append",
"(",
"flag",
")",
"a",
".",
"append",
"(",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/cffi/pkgconfig.py#L26-L57 | |
SequoiaDB/SequoiaDB | 2894ed7e5bd6fe57330afc900cf76d0ff0df9f64 | driver/python/pysequoiadb/client.py | python | client.list_collections | (self) | return result | List all collections in current database.
Return values:
a cursor object of collection.
Exceptions:
pysequoiadb.error.SDBBaseError | List all collections in current database. | [
"List",
"all",
"collections",
"in",
"current",
"database",
"."
] | def list_collections(self):
"""List all collections in current database.
Return values:
a cursor object of collection.
Exceptions:
pysequoiadb.error.SDBBaseError
"""
result = cursor()
try:
rc = sdb.sdb_list_collections(self._client, resu... | [
"def",
"list_collections",
"(",
"self",
")",
":",
"result",
"=",
"cursor",
"(",
")",
"try",
":",
"rc",
"=",
"sdb",
".",
"sdb_list_collections",
"(",
"self",
".",
"_client",
",",
"result",
".",
"_cursor",
")",
"raise_if_error",
"(",
"rc",
",",
"\"Failed t... | https://github.com/SequoiaDB/SequoiaDB/blob/2894ed7e5bd6fe57330afc900cf76d0ff0df9f64/driver/python/pysequoiadb/client.py#L761-L777 | |
mapnik/mapnik | f3da900c355e1d15059c4a91b00203dcc9d9f0ef | scons/scons-local-4.1.0/SCons/Action.py | python | FunctionAction.get_presig | (self, target, source, env) | Return the signature contents of this callable action. | Return the signature contents of this callable action. | [
"Return",
"the",
"signature",
"contents",
"of",
"this",
"callable",
"action",
"."
] | def get_presig(self, target, source, env):
"""Return the signature contents of this callable action."""
try:
return self.gc(target, source, env)
except AttributeError:
return self.funccontents | [
"def",
"get_presig",
"(",
"self",
",",
"target",
",",
"source",
",",
"env",
")",
":",
"try",
":",
"return",
"self",
".",
"gc",
"(",
"target",
",",
"source",
",",
"env",
")",
"except",
"AttributeError",
":",
"return",
"self",
".",
"funccontents"
] | https://github.com/mapnik/mapnik/blob/f3da900c355e1d15059c4a91b00203dcc9d9f0ef/scons/scons-local-4.1.0/SCons/Action.py#L1315-L1320 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/math_grad.py | python | _SparseSegmentMeanGrad | (op, grad) | return (math_ops.sparse_segment_mean_grad(grad, op.inputs[1], op.inputs[2],
dim0), None, None) | Gradient for SparseSegmentMean. | Gradient for SparseSegmentMean. | [
"Gradient",
"for",
"SparseSegmentMean",
"."
] | def _SparseSegmentMeanGrad(op, grad):
"""Gradient for SparseSegmentMean."""
dim0 = array_ops.shape(op.inputs[0])[0]
return (math_ops.sparse_segment_mean_grad(grad, op.inputs[1], op.inputs[2],
dim0), None, None) | [
"def",
"_SparseSegmentMeanGrad",
"(",
"op",
",",
"grad",
")",
":",
"dim0",
"=",
"array_ops",
".",
"shape",
"(",
"op",
".",
"inputs",
"[",
"0",
"]",
")",
"[",
"0",
"]",
"return",
"(",
"math_ops",
".",
"sparse_segment_mean_grad",
"(",
"grad",
",",
"op",
... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/math_grad.py#L178-L182 | |
nnrg/opennero | 43e12a1bcba6e228639db3886fec1dc47ddc24cb | mods/Maze/environment.py | python | EgocentricMazeEnvironment.__init__ | (self, granularity = 1) | Constructor
@param granularity - the number of steps it takes to cover the whole WALK_BY distance | Constructor | [
"Constructor"
] | def __init__(self, granularity = 1):
"""
Constructor
@param granularity - the number of steps it takes to cover the whole WALK_BY distance
"""
MazeEnvironment.__init__(self)
action_info = FeatureVectorInfo() # describes the actions
observation_info = FeatureVector... | [
"def",
"__init__",
"(",
"self",
",",
"granularity",
"=",
"1",
")",
":",
"MazeEnvironment",
".",
"__init__",
"(",
"self",
")",
"action_info",
"=",
"FeatureVectorInfo",
"(",
")",
"# describes the actions",
"observation_info",
"=",
"FeatureVectorInfo",
"(",
")",
"#... | https://github.com/nnrg/opennero/blob/43e12a1bcba6e228639db3886fec1dc47ddc24cb/mods/Maze/environment.py#L414-L438 | ||
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/buildscripts/eslint.py | python | main | () | Main entry point | Main entry point | [
"Main",
"entry",
"point"
] | def main():
"""Main entry point
"""
success = False
usage = "%prog [-e <eslint>] [-d] lint|lint-patch|fix [glob patterns] "
description = "lint runs ESLint on provided patterns or all .js files under jstests/ "\
"and src/mongo. lint-patch runs ESLint against .js files modified in t... | [
"def",
"main",
"(",
")",
":",
"success",
"=",
"False",
"usage",
"=",
"\"%prog [-e <eslint>] [-d] lint|lint-patch|fix [glob patterns] \"",
"description",
"=",
"\"lint runs ESLint on provided patterns or all .js files under jstests/ \"",
"\"and src/mongo. lint-patch runs ESLint against .js... | https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/buildscripts/eslint.py#L261-L303 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/_extends/parse/standard_method.py | python | float_bool | (x) | return x != 0.0 | Implementation of `float_bool`. | Implementation of `float_bool`. | [
"Implementation",
"of",
"float_bool",
"."
] | def float_bool(x):
"""Implementation of `float_bool`."""
return x != 0.0 | [
"def",
"float_bool",
"(",
"x",
")",
":",
"return",
"x",
"!=",
"0.0"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/_extends/parse/standard_method.py#L1683-L1685 | |
keyboardio/Kaleidoscope | d59604e98b2439d108647f15be52984a6837d360 | bin/cpplint.py | python | IsBlockInNameSpace | (nesting_state, is_forward_declaration) | return (len(nesting_state.stack) > 1 and
nesting_state.stack[-1].check_namespace_indentation and
isinstance(nesting_state.stack[-2], _NamespaceInfo)) | Checks that the new block is directly in a namespace.
Args:
nesting_state: The _NestingState object that contains info about our state.
is_forward_declaration: If the class is a forward declared class.
Returns:
Whether or not the new block is directly in a namespace. | Checks that the new block is directly in a namespace. | [
"Checks",
"that",
"the",
"new",
"block",
"is",
"directly",
"in",
"a",
"namespace",
"."
] | def IsBlockInNameSpace(nesting_state, is_forward_declaration):
"""Checks that the new block is directly in a namespace.
Args:
nesting_state: The _NestingState object that contains info about our state.
is_forward_declaration: If the class is a forward declared class.
Returns:
Whether or not the new b... | [
"def",
"IsBlockInNameSpace",
"(",
"nesting_state",
",",
"is_forward_declaration",
")",
":",
"if",
"is_forward_declaration",
":",
"return",
"len",
"(",
"nesting_state",
".",
"stack",
")",
">=",
"1",
"and",
"(",
"isinstance",
"(",
"nesting_state",
".",
"stack",
"[... | https://github.com/keyboardio/Kaleidoscope/blob/d59604e98b2439d108647f15be52984a6837d360/bin/cpplint.py#L5973-L5989 | |
nileshkulkarni/csm | 0e6e0e7d4f725fd36f2414c0be4b9d83197aa1fc | csm/utils/transformations.py | python | projection_from_matrix | (matrix, pseudo=False) | Return projection plane and perspective point from projection matrix.
Return values are same as arguments for projection_matrix function:
point, normal, direction, perspective, and pseudo.
>>> point = numpy.random.random(3) - 0.5
>>> normal = numpy.random.random(3) - 0.5
>>> direct = numpy.random.... | Return projection plane and perspective point from projection matrix. | [
"Return",
"projection",
"plane",
"and",
"perspective",
"point",
"from",
"projection",
"matrix",
"."
] | def projection_from_matrix(matrix, pseudo=False):
"""Return projection plane and perspective point from projection matrix.
Return values are same as arguments for projection_matrix function:
point, normal, direction, perspective, and pseudo.
>>> point = numpy.random.random(3) - 0.5
>>> normal = nu... | [
"def",
"projection_from_matrix",
"(",
"matrix",
",",
"pseudo",
"=",
"False",
")",
":",
"M",
"=",
"numpy",
".",
"array",
"(",
"matrix",
",",
"dtype",
"=",
"numpy",
".",
"float64",
",",
"copy",
"=",
"False",
")",
"M33",
"=",
"M",
"[",
":",
"3",
",",
... | https://github.com/nileshkulkarni/csm/blob/0e6e0e7d4f725fd36f2414c0be4b9d83197aa1fc/csm/utils/transformations.py#L523-L593 | ||
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/buildscripts/eslint.py | python | lint_patch | (eslint, infile) | return True | Lint patch command entry point | Lint patch command entry point | [
"Lint",
"patch",
"command",
"entry",
"point"
] | def lint_patch(eslint, infile):
"""Lint patch command entry point
"""
files = git.get_files_to_check_from_patch(infile, is_interesting_file)
# Patch may have files that we do not want to check which is fine
if files:
return _lint_files(eslint, files)
return True | [
"def",
"lint_patch",
"(",
"eslint",
",",
"infile",
")",
":",
"files",
"=",
"git",
".",
"get_files_to_check_from_patch",
"(",
"infile",
",",
"is_interesting_file",
")",
"# Patch may have files that we do not want to check which is fine",
"if",
"files",
":",
"return",
"_l... | https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/buildscripts/eslint.py#L217-L225 | |
MegEngine/MegEngine | ce9ad07a27ec909fb8db4dd67943d24ba98fb93a | imperative/python/megengine/data/sampler.py | python | MapSampler.batch | (self) | return iter(batch_index) | r"""Batch method provides a batch indices generator. | r"""Batch method provides a batch indices generator. | [
"r",
"Batch",
"method",
"provides",
"a",
"batch",
"indices",
"generator",
"."
] | def batch(self) -> Iterator[List[Any]]:
r"""Batch method provides a batch indices generator."""
indices = list(self.sample())
# user might pass the world_size parameter without dist,
# so dist.is_distributed() should not be used
if self.world_size > 1:
indices = self... | [
"def",
"batch",
"(",
"self",
")",
"->",
"Iterator",
"[",
"List",
"[",
"Any",
"]",
"]",
":",
"indices",
"=",
"list",
"(",
"self",
".",
"sample",
"(",
")",
")",
"# user might pass the world_size parameter without dist,",
"# so dist.is_distributed() should not be used"... | https://github.com/MegEngine/MegEngine/blob/ce9ad07a27ec909fb8db4dd67943d24ba98fb93a/imperative/python/megengine/data/sampler.py#L127-L142 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/difflib.py | python | SequenceMatcher.get_matching_blocks | (self) | return map(Match._make, self.matching_blocks) | Return list of triples describing matching subsequences.
Each triple is of the form (i, j, n), and means that
a[i:i+n] == b[j:j+n]. The triples are monotonically increasing in
i and in j. New in Python 2.5, it's also guaranteed that if
(i, j, n) and (i', j', n') are adjacent triples i... | Return list of triples describing matching subsequences. | [
"Return",
"list",
"of",
"triples",
"describing",
"matching",
"subsequences",
"."
] | def get_matching_blocks(self):
"""Return list of triples describing matching subsequences.
Each triple is of the form (i, j, n), and means that
a[i:i+n] == b[j:j+n]. The triples are monotonically increasing in
i and in j. New in Python 2.5, it's also guaranteed that if
(i, j, ... | [
"def",
"get_matching_blocks",
"(",
"self",
")",
":",
"if",
"self",
".",
"matching_blocks",
"is",
"not",
"None",
":",
"return",
"self",
".",
"matching_blocks",
"la",
",",
"lb",
"=",
"len",
"(",
"self",
".",
"a",
")",
",",
"len",
"(",
"self",
".",
"b",... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/difflib.py#L460-L529 | |
SequoiaDB/SequoiaDB | 2894ed7e5bd6fe57330afc900cf76d0ff0df9f64 | tools/server/php_linux/libxml2/lib/python2.4/site-packages/libxml2.py | python | uCSIsCJKCompatibilityIdeographs | (code) | return ret | Check whether the character is part of
CJKCompatibilityIdeographs UCS Block | Check whether the character is part of
CJKCompatibilityIdeographs UCS Block | [
"Check",
"whether",
"the",
"character",
"is",
"part",
"of",
"CJKCompatibilityIdeographs",
"UCS",
"Block"
] | def uCSIsCJKCompatibilityIdeographs(code):
"""Check whether the character is part of
CJKCompatibilityIdeographs UCS Block """
ret = libxml2mod.xmlUCSIsCJKCompatibilityIdeographs(code)
return ret | [
"def",
"uCSIsCJKCompatibilityIdeographs",
"(",
"code",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlUCSIsCJKCompatibilityIdeographs",
"(",
"code",
")",
"return",
"ret"
] | https://github.com/SequoiaDB/SequoiaDB/blob/2894ed7e5bd6fe57330afc900cf76d0ff0df9f64/tools/server/php_linux/libxml2/lib/python2.4/site-packages/libxml2.py#L2149-L2153 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/train/callback/_checkpoint.py | python | CheckpointConfig.enc_mode | (self) | return self._enc_mode | Get the value of _enc_mode | Get the value of _enc_mode | [
"Get",
"the",
"value",
"of",
"_enc_mode"
] | def enc_mode(self):
"""Get the value of _enc_mode"""
return self._enc_mode | [
"def",
"enc_mode",
"(",
"self",
")",
":",
"return",
"self",
".",
"_enc_mode"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/train/callback/_checkpoint.py#L240-L242 | |
etotheipi/BitcoinArmory | 2a6fc5355bb0c6fe26e387ccba30a5baafe8cd98 | armoryengine/Transaction.py | python | getUnspentTxOutsForAddr160List | (addr160List) | You have a list of addresses (or just one) and you want to get all the
unspent TxOuts for it. This can either be for computing its balance, or
for sweeping the address(es).
This will return a list of pairs of UTXOs
This isn't the most efficient method for producing the pairs
NOTE: At the moment, this... | You have a list of addresses (or just one) and you want to get all the
unspent TxOuts for it. This can either be for computing its balance, or
for sweeping the address(es). | [
"You",
"have",
"a",
"list",
"of",
"addresses",
"(",
"or",
"just",
"one",
")",
"and",
"you",
"want",
"to",
"get",
"all",
"the",
"unspent",
"TxOuts",
"for",
"it",
".",
"This",
"can",
"either",
"be",
"for",
"computing",
"its",
"balance",
"or",
"for",
"s... | def getUnspentTxOutsForAddr160List(addr160List):
'''
You have a list of addresses (or just one) and you want to get all the
unspent TxOuts for it. This can either be for computing its balance, or
for sweeping the address(es).
This will return a list of pairs of UTXOs
This isn't the most efficient me... | [
"def",
"getUnspentTxOutsForAddr160List",
"(",
"addr160List",
")",
":",
"if",
"TheBDM",
".",
"getState",
"(",
")",
"==",
"BDM_BLOCKCHAIN_READY",
":",
"if",
"not",
"isinstance",
"(",
"addr160List",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"addr160List",
... | https://github.com/etotheipi/BitcoinArmory/blob/2a6fc5355bb0c6fe26e387ccba30a5baafe8cd98/armoryengine/Transaction.py#L2813-L2861 | ||
NeoGeographyToolkit/StereoPipeline | eedf54a919fb5cce1ab0e280bb0df4050763aa11 | src/asp/IceBridge/icebridge_common.py | python | csvIndexFile | (folder) | return htmlIndexFile(folder) + ".csv" | Return the clean csv version of the html index file for this folder (if appropriate) | Return the clean csv version of the html index file for this folder (if appropriate) | [
"Return",
"the",
"clean",
"csv",
"version",
"of",
"the",
"html",
"index",
"file",
"for",
"this",
"folder",
"(",
"if",
"appropriate",
")"
] | def csvIndexFile(folder):
'''Return the clean csv version of the html index file for this folder (if appropriate) '''
return htmlIndexFile(folder) + ".csv" | [
"def",
"csvIndexFile",
"(",
"folder",
")",
":",
"return",
"htmlIndexFile",
"(",
"folder",
")",
"+",
"\".csv\""
] | https://github.com/NeoGeographyToolkit/StereoPipeline/blob/eedf54a919fb5cce1ab0e280bb0df4050763aa11/src/asp/IceBridge/icebridge_common.py#L151-L153 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py2/numpy/polynomial/chebyshev.py | python | chebvander3d | (x, y, z, deg) | return v.reshape(v.shape[:-3] + (-1,)) | Pseudo-Vandermonde matrix of given degrees.
Returns the pseudo-Vandermonde matrix of degrees `deg` and sample
points `(x, y, z)`. If `l, m, n` are the given degrees in `x, y, z`,
then The pseudo-Vandermonde matrix is defined by
.. math:: V[..., (m+1)(n+1)i + (n+1)j + k] = T_i(x)*T_j(y)*T_k(z),
wh... | Pseudo-Vandermonde matrix of given degrees. | [
"Pseudo",
"-",
"Vandermonde",
"matrix",
"of",
"given",
"degrees",
"."
] | def chebvander3d(x, y, z, deg):
"""Pseudo-Vandermonde matrix of given degrees.
Returns the pseudo-Vandermonde matrix of degrees `deg` and sample
points `(x, y, z)`. If `l, m, n` are the given degrees in `x, y, z`,
then The pseudo-Vandermonde matrix is defined by
.. math:: V[..., (m+1)(n+1)i + (n+1... | [
"def",
"chebvander3d",
"(",
"x",
",",
"y",
",",
"z",
",",
"deg",
")",
":",
"ideg",
"=",
"[",
"int",
"(",
"d",
")",
"for",
"d",
"in",
"deg",
"]",
"is_valid",
"=",
"[",
"id",
"==",
"d",
"and",
"id",
">=",
"0",
"for",
"id",
",",
"d",
"in",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py2/numpy/polynomial/chebyshev.py#L1542-L1604 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/ttk.py | python | Widget.__init__ | (self, master, widgetname, kw=None) | Constructs a Ttk Widget with the parent master.
STANDARD OPTIONS
class, cursor, takefocus, style
SCROLLABLE WIDGET OPTIONS
xscrollcommand, yscrollcommand
LABEL WIDGET OPTIONS
text, textvariable, underline, image, compound, width
WIDGET STATES
... | Constructs a Ttk Widget with the parent master. | [
"Constructs",
"a",
"Ttk",
"Widget",
"with",
"the",
"parent",
"master",
"."
] | def __init__(self, master, widgetname, kw=None):
"""Constructs a Ttk Widget with the parent master.
STANDARD OPTIONS
class, cursor, takefocus, style
SCROLLABLE WIDGET OPTIONS
xscrollcommand, yscrollcommand
LABEL WIDGET OPTIONS
text, textvariable,... | [
"def",
"__init__",
"(",
"self",
",",
"master",
",",
"widgetname",
",",
"kw",
"=",
"None",
")",
":",
"master",
"=",
"setup_master",
"(",
"master",
")",
"if",
"not",
"getattr",
"(",
"master",
",",
"'_tile_loaded'",
",",
"False",
")",
":",
"# Load tile now,... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/ttk.py#L531-L555 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/multiclass.py | python | _fit_binary | (estimator, X, y, classes=None) | return estimator | Fit a single binary estimator. | Fit a single binary estimator. | [
"Fit",
"a",
"single",
"binary",
"estimator",
"."
] | def _fit_binary(estimator, X, y, classes=None):
"""Fit a single binary estimator."""
unique_y = np.unique(y)
if len(unique_y) == 1:
if classes is not None:
if y[0] == -1:
c = 0
else:
c = y[0]
warnings.warn("Label %s is present in al... | [
"def",
"_fit_binary",
"(",
"estimator",
",",
"X",
",",
"y",
",",
"classes",
"=",
"None",
")",
":",
"unique_y",
"=",
"np",
".",
"unique",
"(",
"y",
")",
"if",
"len",
"(",
"unique_y",
")",
"==",
"1",
":",
"if",
"classes",
"is",
"not",
"None",
":",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/multiclass.py#L66-L81 | |
networkit/networkit | 695b7a786a894a303fa8587597d5ef916e797729 | networkit/GraphMLIO.py | python | GraphMLSAX.endElement | (self, name) | Finalizes parsing of the started Element and processes retrieved data. | Finalizes parsing of the started Element and processes retrieved data. | [
"Finalizes",
"parsing",
"of",
"the",
"started",
"Element",
"and",
"processes",
"retrieved",
"data",
"."
] | def endElement(self, name):
""" Finalizes parsing of the started Element and processes retrieved data."""
data = self.getCharacterData()
if name == "edge":
u = self.edgestack[len(self.edgestack)-1][0]
v = self.edgestack[len(self.edgestack)-1][1]
self.edgestack.pop()
if self.weighted:
#print ("iden... | [
"def",
"endElement",
"(",
"self",
",",
"name",
")",
":",
"data",
"=",
"self",
".",
"getCharacterData",
"(",
")",
"if",
"name",
"==",
"\"edge\"",
":",
"u",
"=",
"self",
".",
"edgestack",
"[",
"len",
"(",
"self",
".",
"edgestack",
")",
"-",
"1",
"]",... | https://github.com/networkit/networkit/blob/695b7a786a894a303fa8587597d5ef916e797729/networkit/GraphMLIO.py#L51-L66 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/idlelib/Debugger.py | python | StackViewer.popup_event | (self, event) | override base method | override base method | [
"override",
"base",
"method"
] | def popup_event(self, event):
"override base method"
if self.stack:
return ScrolledList.popup_event(self, event) | [
"def",
"popup_event",
"(",
"self",
",",
"event",
")",
":",
"if",
"self",
".",
"stack",
":",
"return",
"ScrolledList",
".",
"popup_event",
"(",
"self",
",",
"event",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/idlelib/Debugger.py#L364-L367 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/tornado/tornado-6/tornado/options.py | python | define | (
name: str,
default: Any = None,
type: Optional[type] = None,
help: Optional[str] = None,
metavar: Optional[str] = None,
multiple: bool = False,
group: Optional[str] = None,
callback: Optional[Callable[[Any], None]] = None,
) | return options.define(
name,
default=default,
type=type,
help=help,
metavar=metavar,
multiple=multiple,
group=group,
callback=callback,
) | Defines an option in the global namespace.
See `OptionParser.define`. | Defines an option in the global namespace. | [
"Defines",
"an",
"option",
"in",
"the",
"global",
"namespace",
"."
] | def define(
name: str,
default: Any = None,
type: Optional[type] = None,
help: Optional[str] = None,
metavar: Optional[str] = None,
multiple: bool = False,
group: Optional[str] = None,
callback: Optional[Callable[[Any], None]] = None,
) -> None:
"""Defines an option in the global nam... | [
"def",
"define",
"(",
"name",
":",
"str",
",",
"default",
":",
"Any",
"=",
"None",
",",
"type",
":",
"Optional",
"[",
"type",
"]",
"=",
"None",
",",
"help",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"metavar",
":",
"Optional",
"[",
"str... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/tornado/tornado-6/tornado/options.py#L674-L697 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/resolution/legacy/resolver.py | python | Resolver._populate_link | (self, req) | Ensure that if a link can be found for this, that it is found.
Note that req.link may still be None - if the requirement is already
installed and not needed to be upgraded based on the return value of
_is_upgrade_allowed().
If preparer.require_hashes is True, don't use the wheel cache,... | Ensure that if a link can be found for this, that it is found. | [
"Ensure",
"that",
"if",
"a",
"link",
"can",
"be",
"found",
"for",
"this",
"that",
"it",
"is",
"found",
"."
] | def _populate_link(self, req):
# type: (InstallRequirement) -> None
"""Ensure that if a link can be found for this, that it is found.
Note that req.link may still be None - if the requirement is already
installed and not needed to be upgraded based on the return value of
_is_upg... | [
"def",
"_populate_link",
"(",
"self",
",",
"req",
")",
":",
"# type: (InstallRequirement) -> None",
"if",
"req",
".",
"link",
"is",
"None",
":",
"req",
".",
"link",
"=",
"self",
".",
"_find_requirement_link",
"(",
"req",
")",
"if",
"self",
".",
"wheel_cache"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/resolution/legacy/resolver.py#L287-L315 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/html.py | python | HtmlContainerCell.GetBackgroundColour | (*args, **kwargs) | return _html.HtmlContainerCell_GetBackgroundColour(*args, **kwargs) | GetBackgroundColour(self) -> Colour | GetBackgroundColour(self) -> Colour | [
"GetBackgroundColour",
"(",
"self",
")",
"-",
">",
"Colour"
] | def GetBackgroundColour(*args, **kwargs):
"""GetBackgroundColour(self) -> Colour"""
return _html.HtmlContainerCell_GetBackgroundColour(*args, **kwargs) | [
"def",
"GetBackgroundColour",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_html",
".",
"HtmlContainerCell_GetBackgroundColour",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/html.py#L853-L855 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.