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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/check_ops.py | python | assert_less_equal_v2 | (x, y, message=None, summarize=None, name=None) | return assert_less_equal(x=x, y=y,
summarize=summarize, message=message, name=name) | Assert the condition `x <= y` holds element-wise.
This Op checks that `x[i] <= y[i]` holds for every pair of (possibly
broadcast) elements of `x` and `y`. If both `x` and `y` are empty, this is
trivially satisfied.
If `x` is not less or equal than `y` element-wise, `message`, as well as the
first `summarize... | Assert the condition `x <= y` holds element-wise. | [
"Assert",
"the",
"condition",
"x",
"<",
"=",
"y",
"holds",
"element",
"-",
"wise",
"."
] | def assert_less_equal_v2(x, y, message=None, summarize=None, name=None):
"""Assert the condition `x <= y` holds element-wise.
This Op checks that `x[i] <= y[i]` holds for every pair of (possibly
broadcast) elements of `x` and `y`. If both `x` and `y` are empty, this is
trivially satisfied.
If `x` is not les... | [
"def",
"assert_less_equal_v2",
"(",
"x",
",",
"y",
",",
"message",
"=",
"None",
",",
"summarize",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"return",
"assert_less_equal",
"(",
"x",
"=",
"x",
",",
"y",
"=",
"y",
",",
"summarize",
"=",
"summariz... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/check_ops.py#L883-L915 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/specs/python/specs_lib.py | python | check_keywords | (spec) | Check for common Python keywords in spec.
This function discourages the use of complex constructs
in TensorFlow specs; it doesn't completely prohibit them
(if necessary, we could check the AST).
Args:
spec: spec string
Raises:
ValueError: raised if spec contains a prohibited keyword. | Check for common Python keywords in spec. | [
"Check",
"for",
"common",
"Python",
"keywords",
"in",
"spec",
"."
] | def check_keywords(spec):
"""Check for common Python keywords in spec.
This function discourages the use of complex constructs
in TensorFlow specs; it doesn't completely prohibit them
(if necessary, we could check the AST).
Args:
spec: spec string
Raises:
ValueError: raised if spec contains a... | [
"def",
"check_keywords",
"(",
"spec",
")",
":",
"spec",
"=",
"re",
".",
"sub",
"(",
"QUOTED",
",",
"\"\"",
",",
"spec",
")",
"match",
"=",
"re",
".",
"search",
"(",
"KEYWORDS",
",",
"spec",
")",
"if",
"match",
":",
"raise",
"ValueError",
"(",
"\"ke... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/specs/python/specs_lib.py#L37-L53 | ||
nasa/fprime | 595cf3682d8365943d86c1a6fe7c78f0a116acf0 | Autocoders/Python/src/fprime_ac/generators/visitors/PortHVisitor.py | python | PortHVisitor.finishSourceFilesVisit | (self, obj) | Defined to generate ending static code within files. | Defined to generate ending static code within files. | [
"Defined",
"to",
"generate",
"ending",
"static",
"code",
"within",
"files",
"."
] | def finishSourceFilesVisit(self, obj):
"""
Defined to generate ending static code within files.
"""
c = finishPortH.finishPortH()
if obj.get_namespace() is None:
c.namespace_list = None
else:
c.namespace_list = obj.get_namespace().split("::")
... | [
"def",
"finishSourceFilesVisit",
"(",
"self",
",",
"obj",
")",
":",
"c",
"=",
"finishPortH",
".",
"finishPortH",
"(",
")",
"if",
"obj",
".",
"get_namespace",
"(",
")",
"is",
"None",
":",
"c",
".",
"namespace_list",
"=",
"None",
"else",
":",
"c",
".",
... | https://github.com/nasa/fprime/blob/595cf3682d8365943d86c1a6fe7c78f0a116acf0/Autocoders/Python/src/fprime_ac/generators/visitors/PortHVisitor.py#L409-L439 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/distutils/cmd.py | python | Command.ensure_string | (self, option, default=None) | Ensure that 'option' is a string; if not defined, set it to
'default'. | Ensure that 'option' is a string; if not defined, set it to
'default'. | [
"Ensure",
"that",
"option",
"is",
"a",
"string",
";",
"if",
"not",
"defined",
"set",
"it",
"to",
"default",
"."
] | def ensure_string(self, option, default=None):
"""Ensure that 'option' is a string; if not defined, set it to
'default'.
"""
self._ensure_stringlike(option, "string", default) | [
"def",
"ensure_string",
"(",
"self",
",",
"option",
",",
"default",
"=",
"None",
")",
":",
"self",
".",
"_ensure_stringlike",
"(",
"option",
",",
"\"string\"",
",",
"default",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/distutils/cmd.py#L217-L221 | ||
bareos/bareos | 56a10bb368b0a81e977bb51304033fe49d59efb0 | python-bareos/bareos/bsock/lowlevel.py | python | LowLevel.receive_and_evaluate_response_message | (self) | return (code, text) | Retrieve a message and evaluate it.
Only used during in the authentication phase.
Returns:
2-tuple: (code, text). | Retrieve a message and evaluate it. | [
"Retrieve",
"a",
"message",
"and",
"evaluate",
"it",
"."
] | def receive_and_evaluate_response_message(self):
"""Retrieve a message and evaluate it.
Only used during in the authentication phase.
Returns:
2-tuple: (code, text).
"""
regex_str = r"^(\d\d\d\d){0}(.*)$".format(
Constants.record_separator_compat_regex
... | [
"def",
"receive_and_evaluate_response_message",
"(",
"self",
")",
":",
"regex_str",
"=",
"r\"^(\\d\\d\\d\\d){0}(.*)$\"",
".",
"format",
"(",
"Constants",
".",
"record_separator_compat_regex",
")",
"regex",
"=",
"bytes",
"(",
"bytearray",
"(",
"regex_str",
",",
"\"utf8... | https://github.com/bareos/bareos/blob/56a10bb368b0a81e977bb51304033fe49d59efb0/python-bareos/bareos/bsock/lowlevel.py#L345-L362 | |
rdiankov/openrave | d1a23023fd4b58f077d2ca949ceaf1b91f3f13d7 | python/databases/grasping.py | python | GraspingModel.moveToPreshape | (self,grasp,execute=True,outputtraj=None,outputtrajobj=None) | return trajdata | uses a planner to safely move the hand to the preshape and returns the trajectory | uses a planner to safely move the hand to the preshape and returns the trajectory | [
"uses",
"a",
"planner",
"to",
"safely",
"move",
"the",
"hand",
"to",
"the",
"preshape",
"and",
"returns",
"the",
"trajectory"
] | def moveToPreshape(self,grasp,execute=True,outputtraj=None,outputtrajobj=None):
"""uses a planner to safely move the hand to the preshape and returns the trajectory"""
trajdata = []
with self.robot:
self.robot.SetActiveDOFs(self.manip.GetArmIndices())
trajdata.append(self... | [
"def",
"moveToPreshape",
"(",
"self",
",",
"grasp",
",",
"execute",
"=",
"True",
",",
"outputtraj",
"=",
"None",
",",
"outputtrajobj",
"=",
"None",
")",
":",
"trajdata",
"=",
"[",
"]",
"with",
"self",
".",
"robot",
":",
"self",
".",
"robot",
".",
"Se... | https://github.com/rdiankov/openrave/blob/d1a23023fd4b58f077d2ca949ceaf1b91f3f13d7/python/databases/grasping.py#L791-L815 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/learn/python/learn/estimators/state_saving_rnn_estimator.py | python | _get_state_names | (cell) | return [
'{}_{}'.format(rnn_common.RNNKeys.STATE_PREFIX, i)
for i in range(len(state_size))] | Gets the state names for an `RNNCell`.
Args:
cell: A `RNNCell` to be used in the RNN.
Returns:
State names in the form of a string, a list of strings, or a list of
string pairs, depending on the type of `cell.state_size`.
Raises:
TypeError: If cell.state_size is of type TensorShape. | Gets the state names for an `RNNCell`. | [
"Gets",
"the",
"state",
"names",
"for",
"an",
"RNNCell",
"."
] | def _get_state_names(cell):
"""Gets the state names for an `RNNCell`.
Args:
cell: A `RNNCell` to be used in the RNN.
Returns:
State names in the form of a string, a list of strings, or a list of
string pairs, depending on the type of `cell.state_size`.
Raises:
TypeError: If cell.state_size is... | [
"def",
"_get_state_names",
"(",
"cell",
")",
":",
"state_size",
"=",
"cell",
".",
"state_size",
"if",
"isinstance",
"(",
"state_size",
",",
"tensor_shape",
".",
"TensorShape",
")",
":",
"raise",
"TypeError",
"(",
"'cell.state_size of type TensorShape is not supported.... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/learn/python/learn/estimators/state_saving_rnn_estimator.py#L192-L222 | |
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | scripts/Python/static-binding/lldb.py | python | SBTarget.FindCompileUnits | (self, sb_file_spec) | return _lldb.SBTarget_FindCompileUnits(self, sb_file_spec) | FindCompileUnits(SBTarget self, SBFileSpec sb_file_spec) -> SBSymbolContextList
Find compile units related to *this target and passed source
file.
@param[in] sb_file_spec
A lldb::SBFileSpec object that contains source file
specification.
@return
A ... | FindCompileUnits(SBTarget self, SBFileSpec sb_file_spec) -> SBSymbolContextList | [
"FindCompileUnits",
"(",
"SBTarget",
"self",
"SBFileSpec",
"sb_file_spec",
")",
"-",
">",
"SBSymbolContextList"
] | def FindCompileUnits(self, sb_file_spec):
"""
FindCompileUnits(SBTarget self, SBFileSpec sb_file_spec) -> SBSymbolContextList
Find compile units related to *this target and passed source
file.
@param[in] sb_file_spec
A lldb::SBFileSpec object that contains source f... | [
"def",
"FindCompileUnits",
"(",
"self",
",",
"sb_file_spec",
")",
":",
"return",
"_lldb",
".",
"SBTarget_FindCompileUnits",
"(",
"self",
",",
"sb_file_spec",
")"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L10648-L10664 | |
nvdla/sw | 79538ba1b52b040a4a4645f630e457fa01839e90 | umd/external/protobuf-2.6/python/mox.py | python | IsAlmost.equals | (self, rhs) | Check to see if RHS is almost equal to float_value
Args:
rhs: the value to compare to float_value
Returns:
bool | Check to see if RHS is almost equal to float_value | [
"Check",
"to",
"see",
"if",
"RHS",
"is",
"almost",
"equal",
"to",
"float_value"
] | def equals(self, rhs):
"""Check to see if RHS is almost equal to float_value
Args:
rhs: the value to compare to float_value
Returns:
bool
"""
try:
return round(rhs-self._float_value, self._places) == 0
except TypeError:
# This is probably because either float_value or ... | [
"def",
"equals",
"(",
"self",
",",
"rhs",
")",
":",
"try",
":",
"return",
"round",
"(",
"rhs",
"-",
"self",
".",
"_float_value",
",",
"self",
".",
"_places",
")",
"==",
"0",
"except",
"TypeError",
":",
"# This is probably because either float_value or rhs is n... | https://github.com/nvdla/sw/blob/79538ba1b52b040a4a4645f630e457fa01839e90/umd/external/protobuf-2.6/python/mox.py#L846-L860 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/cmd.py | python | Cmd.precmd | (self, line) | return line | Hook method executed just before the command line is
interpreted, but after the input prompt is generated and issued. | Hook method executed just before the command line is
interpreted, but after the input prompt is generated and issued. | [
"Hook",
"method",
"executed",
"just",
"before",
"the",
"command",
"line",
"is",
"interpreted",
"but",
"after",
"the",
"input",
"prompt",
"is",
"generated",
"and",
"issued",
"."
] | def precmd(self, line):
"""Hook method executed just before the command line is
interpreted, but after the input prompt is generated and issued.
"""
return line | [
"def",
"precmd",
"(",
"self",
",",
"line",
")",
":",
"return",
"line"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/cmd.py#L150-L155 | |
potassco/clingo | e0c91d8f95cc28de1c480a871f9c97c30de83d40 | examples/clingo/dl/app.py | python | DLPropagator.propagate | (self, control: PropagateControl, changes: Sequence[int]) | Add edges that became true to the graph to check for negative cycles. | Add edges that became true to the graph to check for negative cycles. | [
"Add",
"edges",
"that",
"became",
"true",
"to",
"the",
"graph",
"to",
"check",
"for",
"negative",
"cycles",
"."
] | def propagate(self, control: PropagateControl, changes: Sequence[int]):
'''
Add edges that became true to the graph to check for negative cycles.
'''
state = self._state(control.thread_id)
level = control.assignment.decision_level
for lit in changes:
for edge ... | [
"def",
"propagate",
"(",
"self",
",",
"control",
":",
"PropagateControl",
",",
"changes",
":",
"Sequence",
"[",
"int",
"]",
")",
":",
"state",
"=",
"self",
".",
"_state",
"(",
"control",
".",
"thread_id",
")",
"level",
"=",
"control",
".",
"assignment",
... | https://github.com/potassco/clingo/blob/e0c91d8f95cc28de1c480a871f9c97c30de83d40/examples/clingo/dl/app.py#L294-L307 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/grid.py | python | GridTableBase.GetAttr | (*args, **kwargs) | return _grid.GridTableBase_GetAttr(*args, **kwargs) | GetAttr(self, int row, int col, int kind) -> GridCellAttr | GetAttr(self, int row, int col, int kind) -> GridCellAttr | [
"GetAttr",
"(",
"self",
"int",
"row",
"int",
"col",
"int",
"kind",
")",
"-",
">",
"GridCellAttr"
] | def GetAttr(*args, **kwargs):
"""GetAttr(self, int row, int col, int kind) -> GridCellAttr"""
return _grid.GridTableBase_GetAttr(*args, **kwargs) | [
"def",
"GetAttr",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_grid",
".",
"GridTableBase_GetAttr",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/grid.py#L906-L908 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/plugins/algorithms/AlignAndFocusPowderFromFiles.py | python | AlignAndFocusPowderFromFiles.__isCharacterizationsNeeded | (self) | return False | Determine if the characterization file is needed by checking if
all the properties it would set are already specified | Determine if the characterization file is needed by checking if
all the properties it would set are already specified | [
"Determine",
"if",
"the",
"characterization",
"file",
"is",
"needed",
"by",
"checking",
"if",
"all",
"the",
"properties",
"it",
"would",
"set",
"are",
"already",
"specified"
] | def __isCharacterizationsNeeded(self):
'''Determine if the characterization file is needed by checking if
all the properties it would set are already specified'''
if not self.charac:
return False
for name in PROPS_IN_PD_CHARACTER:
if self.getProperty(name).isDefa... | [
"def",
"__isCharacterizationsNeeded",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"charac",
":",
"return",
"False",
"for",
"name",
"in",
"PROPS_IN_PD_CHARACTER",
":",
"if",
"self",
".",
"getProperty",
"(",
"name",
")",
".",
"isDefault",
":",
"return",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/AlignAndFocusPowderFromFiles.py#L199-L209 | |
epam/Indigo | 30e40b4b1eb9bae0207435a26cfcb81ddcc42be1 | api/python/indigo/__init__.py | python | IndigoObject.iterateRGroupFragments | (self) | return self.dispatcher.IndigoObject(
self.dispatcher,
self.dispatcher._checkResult(
Indigo._lib.indigoIterateRGroupFragments(self.id)
),
) | RGroup method iterates r-group fragments
Returns:
IndigoObject: r-group fragment iterator | RGroup method iterates r-group fragments | [
"RGroup",
"method",
"iterates",
"r",
"-",
"group",
"fragments"
] | def iterateRGroupFragments(self):
"""RGroup method iterates r-group fragments
Returns:
IndigoObject: r-group fragment iterator
"""
self.dispatcher._setSessionId()
return self.dispatcher.IndigoObject(
self.dispatcher,
self.dispatcher._checkResu... | [
"def",
"iterateRGroupFragments",
"(",
"self",
")",
":",
"self",
".",
"dispatcher",
".",
"_setSessionId",
"(",
")",
"return",
"self",
".",
"dispatcher",
".",
"IndigoObject",
"(",
"self",
".",
"dispatcher",
",",
"self",
".",
"dispatcher",
".",
"_checkResult",
... | https://github.com/epam/Indigo/blob/30e40b4b1eb9bae0207435a26cfcb81ddcc42be1/api/python/indigo/__init__.py#L1002-L1014 | |
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | chrome/tools/build/win/dependencies.py | python | VerifyDependents | (pe_name, dependents, delay_loaded, list_file, verbose) | return max(deps_result, delayed_result) | Compare the actual dependents to the expected ones. | Compare the actual dependents to the expected ones. | [
"Compare",
"the",
"actual",
"dependents",
"to",
"the",
"expected",
"ones",
"."
] | def VerifyDependents(pe_name, dependents, delay_loaded, list_file, verbose):
"""Compare the actual dependents to the expected ones."""
scope = {}
try:
execfile(list_file, scope)
except:
raise Error("Failed to load " + list_file)
# The dependency files have dependencies in two section - dependents and... | [
"def",
"VerifyDependents",
"(",
"pe_name",
",",
"dependents",
",",
"delay_loaded",
",",
"list_file",
",",
"verbose",
")",
":",
"scope",
"=",
"{",
"}",
"try",
":",
"execfile",
"(",
"list_file",
",",
"scope",
")",
"except",
":",
"raise",
"Error",
"(",
"\"F... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/chrome/tools/build/win/dependencies.py#L153-L197 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/arrays/categorical.py | python | Categorical.astype | (self, dtype: Dtype, copy: bool = True) | return np.array(self, dtype=dtype, copy=copy) | Coerce this type to another dtype
Parameters
----------
dtype : numpy dtype or pandas type
copy : bool, default True
By default, astype always returns a newly allocated object.
If copy is set to False and dtype is categorical, the original
object is r... | Coerce this type to another dtype | [
"Coerce",
"this",
"type",
"to",
"another",
"dtype"
] | def astype(self, dtype: Dtype, copy: bool = True) -> ArrayLike:
"""
Coerce this type to another dtype
Parameters
----------
dtype : numpy dtype or pandas type
copy : bool, default True
By default, astype always returns a newly allocated object.
If... | [
"def",
"astype",
"(",
"self",
",",
"dtype",
":",
"Dtype",
",",
"copy",
":",
"bool",
"=",
"True",
")",
"->",
"ArrayLike",
":",
"if",
"is_categorical_dtype",
"(",
"dtype",
")",
":",
"dtype",
"=",
"cast",
"(",
"Union",
"[",
"str",
",",
"CategoricalDtype",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/arrays/categorical.py#L477-L502 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/executor.py | python | check_feed_shape_type | (var, feed, num_places=1) | return True | Returns True if the variable doesn't require feed check or it is compatible
with the shape and have same dtype as the fed value.
A dimension is compatible with the other if:
1. The length of the dimensions are same.
2. Each non-negative number of the two dimensions are same.
3. For negative number ... | Returns True if the variable doesn't require feed check or it is compatible
with the shape and have same dtype as the fed value. | [
"Returns",
"True",
"if",
"the",
"variable",
"doesn",
"t",
"require",
"feed",
"check",
"or",
"it",
"is",
"compatible",
"with",
"the",
"shape",
"and",
"have",
"same",
"dtype",
"as",
"the",
"fed",
"value",
"."
] | def check_feed_shape_type(var, feed, num_places=1):
"""
Returns True if the variable doesn't require feed check or it is compatible
with the shape and have same dtype as the fed value.
A dimension is compatible with the other if:
1. The length of the dimensions are same.
2. Each non-negative nu... | [
"def",
"check_feed_shape_type",
"(",
"var",
",",
"feed",
",",
"num_places",
"=",
"1",
")",
":",
"if",
"var",
".",
"desc",
".",
"need_check_feed",
"(",
")",
":",
"diff_shape",
"=",
"core",
".",
"diff_tensor_shape",
"(",
"feed",
",",
"var",
".",
"desc",
... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/executor.py#L213-L250 | |
numworks/epsilon | 8952d2f8b1de1c3f064eec8ffcea804c5594ba4c | build/device/usb/core.py | python | Device.is_kernel_driver_active | (self, interface) | return self._ctx.backend.is_kernel_driver_active(
self._ctx.handle,
interface) | r"""Determine if there is kernel driver associated with the interface.
If a kernel driver is active, the object will be unable to perform
I/O.
The interface parameter is the device interface number to check. | r"""Determine if there is kernel driver associated with the interface. | [
"r",
"Determine",
"if",
"there",
"is",
"kernel",
"driver",
"associated",
"with",
"the",
"interface",
"."
] | def is_kernel_driver_active(self, interface):
r"""Determine if there is kernel driver associated with the interface.
If a kernel driver is active, the object will be unable to perform
I/O.
The interface parameter is the device interface number to check.
"""
self._ctx.ma... | [
"def",
"is_kernel_driver_active",
"(",
"self",
",",
"interface",
")",
":",
"self",
".",
"_ctx",
".",
"managed_open",
"(",
")",
"return",
"self",
".",
"_ctx",
".",
"backend",
".",
"is_kernel_driver_active",
"(",
"self",
".",
"_ctx",
".",
"handle",
",",
"int... | https://github.com/numworks/epsilon/blob/8952d2f8b1de1c3f064eec8ffcea804c5594ba4c/build/device/usb/core.py#L1089-L1100 | |
forkineye/ESPixelStick | 22926f1c0d1131f1369fc7cad405689a095ae3cb | dist/bin/esptool/serial/rfc2217.py | python | Serial.get_modem_state | (self) | \
get last modem state (cached value. If value is "old", request a new
one. This cache helps that we don't issue to many requests when e.g. all
status lines, one after the other is queried by the user (CTS, DSR
etc.) | \
get last modem state (cached value. If value is "old", request a new
one. This cache helps that we don't issue to many requests when e.g. all
status lines, one after the other is queried by the user (CTS, DSR
etc.) | [
"\\",
"get",
"last",
"modem",
"state",
"(",
"cached",
"value",
".",
"If",
"value",
"is",
"old",
"request",
"a",
"new",
"one",
".",
"This",
"cache",
"helps",
"that",
"we",
"don",
"t",
"issue",
"to",
"many",
"requests",
"when",
"e",
".",
"g",
".",
"a... | def get_modem_state(self):
"""\
get last modem state (cached value. If value is "old", request a new
one. This cache helps that we don't issue to many requests when e.g. all
status lines, one after the other is queried by the user (CTS, DSR
etc.)
"""
# active mode... | [
"def",
"get_modem_state",
"(",
"self",
")",
":",
"# active modem state polling enabled? is the value fresh enough?",
"if",
"self",
".",
"_poll_modem_state",
"and",
"self",
".",
"_modemstate_timeout",
".",
"expired",
"(",
")",
":",
"if",
"self",
".",
"logger",
":",
"... | https://github.com/forkineye/ESPixelStick/blob/22926f1c0d1131f1369fc7cad405689a095ae3cb/dist/bin/esptool/serial/rfc2217.py#L892-L925 | ||
msracver/Deep-Image-Analogy | 632b9287b42552e32dad64922967c8c9ec7fc4d3 | scripts/cpp_lint.py | python | FilesBelongToSameModule | (filename_cc, filename_h) | return files_belong_to_same_module, common_path | Check if these two filenames belong to the same module.
The concept of a 'module' here is a as follows:
foo.h, foo-inl.h, foo.cc, foo_test.cc and foo_unittest.cc belong to the
same 'module' if they are in the same directory.
some/path/public/xyzzy and some/path/internal/xyzzy are also considered
to belong to... | Check if these two filenames belong to the same module. | [
"Check",
"if",
"these",
"two",
"filenames",
"belong",
"to",
"the",
"same",
"module",
"."
] | def FilesBelongToSameModule(filename_cc, filename_h):
"""Check if these two filenames belong to the same module.
The concept of a 'module' here is a as follows:
foo.h, foo-inl.h, foo.cc, foo_test.cc and foo_unittest.cc belong to the
same 'module' if they are in the same directory.
some/path/public/xyzzy and ... | [
"def",
"FilesBelongToSameModule",
"(",
"filename_cc",
",",
"filename_h",
")",
":",
"if",
"not",
"filename_cc",
".",
"endswith",
"(",
"'.cc'",
")",
":",
"return",
"(",
"False",
",",
"''",
")",
"filename_cc",
"=",
"filename_cc",
"[",
":",
"-",
"len",
"(",
... | https://github.com/msracver/Deep-Image-Analogy/blob/632b9287b42552e32dad64922967c8c9ec7fc4d3/scripts/cpp_lint.py#L4399-L4451 | |
arangodb/arangodb | 0d658689c7d1b721b314fa3ca27d38303e1570c8 | 3rdParty/V8/v7.9.317/tools/v8_presubmit.py | python | SourceFileProcessor.RunOnFiles | (self, files) | return self.ProcessFiles(all_files) | Runs processor only on affected files. | Runs processor only on affected files. | [
"Runs",
"processor",
"only",
"on",
"affected",
"files",
"."
] | def RunOnFiles(self, files):
"""Runs processor only on affected files."""
# Helper for getting directory pieces.
dirs = lambda f: dirname(f).split(os.sep)
# Path offsets where to look (to be in sync with RunOnPath).
# Normalize '.' to check for it with str.startswith.
search_paths = [('' if p ... | [
"def",
"RunOnFiles",
"(",
"self",
",",
"files",
")",
":",
"# Helper for getting directory pieces.",
"dirs",
"=",
"lambda",
"f",
":",
"dirname",
"(",
"f",
")",
".",
"split",
"(",
"os",
".",
"sep",
")",
"# Path offsets where to look (to be in sync with RunOnPath).",
... | https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/V8/v7.9.317/tools/v8_presubmit.py#L195-L214 | |
swift/swift | 12d031cf8177fdec0137f9aa7e2912fa23c4416b | 3rdParty/SCons/scons-3.0.1/engine/SCons/cpp.py | python | PreProcessor._do_if_else_condition | (self, condition) | Common logic for evaluating the conditions on #if, #ifdef and
#ifndef lines. | Common logic for evaluating the conditions on #if, #ifdef and
#ifndef lines. | [
"Common",
"logic",
"for",
"evaluating",
"the",
"conditions",
"on",
"#if",
"#ifdef",
"and",
"#ifndef",
"lines",
"."
] | def _do_if_else_condition(self, condition):
"""
Common logic for evaluating the conditions on #if, #ifdef and
#ifndef lines.
"""
self.save()
d = self.dispatch_table
if condition:
self.start_handling_includes()
d['elif'] = self.stop_handling... | [
"def",
"_do_if_else_condition",
"(",
"self",
",",
"condition",
")",
":",
"self",
".",
"save",
"(",
")",
"d",
"=",
"self",
".",
"dispatch_table",
"if",
"condition",
":",
"self",
".",
"start_handling_includes",
"(",
")",
"d",
"[",
"'elif'",
"]",
"=",
"self... | https://github.com/swift/swift/blob/12d031cf8177fdec0137f9aa7e2912fa23c4416b/3rdParty/SCons/scons-3.0.1/engine/SCons/cpp.py#L421-L435 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/Queue.py | python | Queue.task_done | (self) | Indicate that a formerly enqueued task is complete.
Used by Queue consumer threads. For each get() used to fetch a task,
a subsequent call to task_done() tells the queue that the processing
on the task is complete.
If a join() is currently blocking, it will resume when all items
... | Indicate that a formerly enqueued task is complete. | [
"Indicate",
"that",
"a",
"formerly",
"enqueued",
"task",
"is",
"complete",
"."
] | def task_done(self):
"""Indicate that a formerly enqueued task is complete.
Used by Queue consumer threads. For each get() used to fetch a task,
a subsequent call to task_done() tells the queue that the processing
on the task is complete.
If a join() is currently blocking, it ... | [
"def",
"task_done",
"(",
"self",
")",
":",
"self",
".",
"all_tasks_done",
".",
"acquire",
"(",
")",
"try",
":",
"unfinished",
"=",
"self",
".",
"unfinished_tasks",
"-",
"1",
"if",
"unfinished",
"<=",
"0",
":",
"if",
"unfinished",
"<",
"0",
":",
"raise"... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/Queue.py#L45-L68 | ||
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/python/psutil/psutil/__init__.py | python | Process.username | (self) | The name of the user that owns the process.
On UNIX this is calculated by using *real* process uid. | The name of the user that owns the process.
On UNIX this is calculated by using *real* process uid. | [
"The",
"name",
"of",
"the",
"user",
"that",
"owns",
"the",
"process",
".",
"On",
"UNIX",
"this",
"is",
"calculated",
"by",
"using",
"*",
"real",
"*",
"process",
"uid",
"."
] | def username(self):
"""The name of the user that owns the process.
On UNIX this is calculated by using *real* process uid.
"""
if _POSIX:
if pwd is None:
# might happen if python was installed from sources
raise ImportError(
... | [
"def",
"username",
"(",
"self",
")",
":",
"if",
"_POSIX",
":",
"if",
"pwd",
"is",
"None",
":",
"# might happen if python was installed from sources",
"raise",
"ImportError",
"(",
"\"requires pwd module shipped with standard python\"",
")",
"return",
"pwd",
".",
"getpwui... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/psutil/psutil/__init__.py#L557-L568 | ||
priyankchheda/algorithms | c361aa9071573fa9966d5b02d05e524815abcf2b | priority_queue/minheap.py | python | MinHeap.is_empty | (self) | return self.length() == 0 | checks if heap is empty or not | checks if heap is empty or not | [
"checks",
"if",
"heap",
"is",
"empty",
"or",
"not"
] | def is_empty(self):
""" checks if heap is empty or not """
return self.length() == 0 | [
"def",
"is_empty",
"(",
"self",
")",
":",
"return",
"self",
".",
"length",
"(",
")",
"==",
"0"
] | https://github.com/priyankchheda/algorithms/blob/c361aa9071573fa9966d5b02d05e524815abcf2b/priority_queue/minheap.py#L19-L21 | |
weolar/miniblink49 | 1c4678db0594a4abde23d3ebbcc7cd13c3170777 | third_party/jinja2/environment.py | python | Environment.join_path | (self, template, parent) | return template | Join a template with the parent. By default all the lookups are
relative to the loader root so this method returns the `template`
parameter unchanged, but if the paths should be relative to the
parent template, this function can be used to calculate the real
template name.
Subc... | Join a template with the parent. By default all the lookups are
relative to the loader root so this method returns the `template`
parameter unchanged, but if the paths should be relative to the
parent template, this function can be used to calculate the real
template name. | [
"Join",
"a",
"template",
"with",
"the",
"parent",
".",
"By",
"default",
"all",
"the",
"lookups",
"are",
"relative",
"to",
"the",
"loader",
"root",
"so",
"this",
"method",
"returns",
"the",
"template",
"parameter",
"unchanged",
"but",
"if",
"the",
"paths",
... | def join_path(self, template, parent):
"""Join a template with the parent. By default all the lookups are
relative to the loader root so this method returns the `template`
parameter unchanged, but if the paths should be relative to the
parent template, this function can be used to calcu... | [
"def",
"join_path",
"(",
"self",
",",
"template",
",",
"parent",
")",
":",
"return",
"template"
] | https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/third_party/jinja2/environment.py#L744-L754 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py3/sklearn/preprocessing/_encoders.py | python | OrdinalEncoder.inverse_transform | (self, X) | return X_tr | Convert the data back to the original representation.
Parameters
----------
X : array-like or sparse matrix, shape [n_samples, n_encoded_features]
The transformed data.
Returns
-------
X_tr : array-like, shape [n_samples, n_features]
Inverse tran... | Convert the data back to the original representation. | [
"Convert",
"the",
"data",
"back",
"to",
"the",
"original",
"representation",
"."
] | def inverse_transform(self, X):
"""
Convert the data back to the original representation.
Parameters
----------
X : array-like or sparse matrix, shape [n_samples, n_encoded_features]
The transformed data.
Returns
-------
X_tr : array-like, sh... | [
"def",
"inverse_transform",
"(",
"self",
",",
"X",
")",
":",
"check_is_fitted",
"(",
"self",
")",
"X",
"=",
"check_array",
"(",
"X",
",",
"accept_sparse",
"=",
"'csr'",
")",
"n_samples",
",",
"_",
"=",
"X",
".",
"shape",
"n_features",
"=",
"len",
"(",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/preprocessing/_encoders.py#L650-L684 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/_extends/parallel_compile/tbe_compiler/tbe_helper.py | python | adjust_custom_op_info | (compute_op_info) | adjust custom op info
:param compute_op_info:
:return: | adjust custom op info
:param compute_op_info:
:return: | [
"adjust",
"custom",
"op",
"info",
":",
"param",
"compute_op_info",
":",
":",
"return",
":"
] | def adjust_custom_op_info(compute_op_info):
"""
adjust custom op info
:param compute_op_info:
:return:
"""
py_module_path = compute_op_info["py_module_path"]
if os.path.isfile(py_module_path):
py_module_path, file_name = os.path.split(py_module_path)
module_name, _ = os.path.... | [
"def",
"adjust_custom_op_info",
"(",
"compute_op_info",
")",
":",
"py_module_path",
"=",
"compute_op_info",
"[",
"\"py_module_path\"",
"]",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"py_module_path",
")",
":",
"py_module_path",
",",
"file_name",
"=",
"os",
".... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/_extends/parallel_compile/tbe_compiler/tbe_helper.py#L261-L272 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/bdb.py | python | Bdb.set_next | (self, frame) | Stop on the next line in or below the given frame. | Stop on the next line in or below the given frame. | [
"Stop",
"on",
"the",
"next",
"line",
"in",
"or",
"below",
"the",
"given",
"frame",
"."
] | def set_next(self, frame):
"""Stop on the next line in or below the given frame."""
self._set_stopinfo(frame, None) | [
"def",
"set_next",
"(",
"self",
",",
"frame",
")",
":",
"self",
".",
"_set_stopinfo",
"(",
"frame",
",",
"None",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/bdb.py#L308-L310 | ||
facebook/wangle | 2e7e3fbb3a15c4986d6fe0e36c31daeeba614ce3 | build/fbcode_builder/CMake/make_fbpy_archive.py | python | build_install_dir | (args, path_map) | Create a directory that contains all of the sources, with a __main__
module to run the program. | Create a directory that contains all of the sources, with a __main__
module to run the program. | [
"Create",
"a",
"directory",
"that",
"contains",
"all",
"of",
"the",
"sources",
"with",
"a",
"__main__",
"module",
"to",
"run",
"the",
"program",
"."
] | def build_install_dir(args, path_map):
"""Create a directory that contains all of the sources, with a __main__
module to run the program.
"""
# Populate a temporary directory first, then rename to the destination
# location. This ensures that we don't ever leave a halfway-built
# directory behi... | [
"def",
"build_install_dir",
"(",
"args",
",",
"path_map",
")",
":",
"# Populate a temporary directory first, then rename to the destination",
"# location. This ensures that we don't ever leave a halfway-built",
"# directory behind at the output path if something goes wrong.",
"dest_dir",
"=... | https://github.com/facebook/wangle/blob/2e7e3fbb3a15c4986d6fe0e36c31daeeba614ce3/build/fbcode_builder/CMake/make_fbpy_archive.py#L167-L179 | ||
Haivision/srt | c885ed152d8222800bd498167b90031de5878228 | scripts/changelog/changelog.py | python | main | (git_log) | Script designed to create changelog out of .csv SRT git log | Script designed to create changelog out of .csv SRT git log | [
"Script",
"designed",
"to",
"create",
"changelog",
"out",
"of",
".",
"csv",
"SRT",
"git",
"log"
] | def main(git_log):
""" Script designed to create changelog out of .csv SRT git log """
df = pd.read_csv(git_log, sep = '|', names = ['commit', 'message', 'author', 'email'])
df['area'] = df['message'].apply(define_area)
df['message'] = df['message'].apply(delete_prefix)
core = df[df['area']=='core... | [
"def",
"main",
"(",
"git_log",
")",
":",
"df",
"=",
"pd",
".",
"read_csv",
"(",
"git_log",
",",
"sep",
"=",
"'|'",
",",
"names",
"=",
"[",
"'commit'",
",",
"'message'",
",",
"'author'",
",",
"'email'",
"]",
")",
"df",
"[",
"'area'",
"]",
"=",
"df... | https://github.com/Haivision/srt/blob/c885ed152d8222800bd498167b90031de5878228/scripts/changelog/changelog.py#L49-L96 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/grid.py | python | GridEditorCreatedEvent.SetCol | (*args, **kwargs) | return _grid.GridEditorCreatedEvent_SetCol(*args, **kwargs) | SetCol(self, int col) | SetCol(self, int col) | [
"SetCol",
"(",
"self",
"int",
"col",
")"
] | def SetCol(*args, **kwargs):
"""SetCol(self, int col)"""
return _grid.GridEditorCreatedEvent_SetCol(*args, **kwargs) | [
"def",
"SetCol",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_grid",
".",
"GridEditorCreatedEvent_SetCol",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/grid.py#L2483-L2485 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py2/numpy/polynomial/chebyshev.py | python | chebmul | (c1, c2) | return pu.trimseq(ret) | Multiply one Chebyshev series by another.
Returns the product of two Chebyshev series `c1` * `c2`. The arguments
are sequences of coefficients, from lowest order "term" to highest,
e.g., [1,2,3] represents the series ``T_0 + 2*T_1 + 3*T_2``.
Parameters
----------
c1, c2 : array_like
1... | Multiply one Chebyshev series by another. | [
"Multiply",
"one",
"Chebyshev",
"series",
"by",
"another",
"."
] | def chebmul(c1, c2):
"""
Multiply one Chebyshev series by another.
Returns the product of two Chebyshev series `c1` * `c2`. The arguments
are sequences of coefficients, from lowest order "term" to highest,
e.g., [1,2,3] represents the series ``T_0 + 2*T_1 + 3*T_2``.
Parameters
----------
... | [
"def",
"chebmul",
"(",
"c1",
",",
"c2",
")",
":",
"# c1, c2 are trimmed copies",
"[",
"c1",
",",
"c2",
"]",
"=",
"pu",
".",
"as_series",
"(",
"[",
"c1",
",",
"c2",
"]",
")",
"z1",
"=",
"_cseries_to_zseries",
"(",
"c1",
")",
"z2",
"=",
"_cseries_to_zs... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py2/numpy/polynomial/chebyshev.py#L710-L756 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_windows.py | python | PreviewControlBar.GetPrintPreview | (*args, **kwargs) | return _windows_.PreviewControlBar_GetPrintPreview(*args, **kwargs) | GetPrintPreview(self) -> PrintPreview | GetPrintPreview(self) -> PrintPreview | [
"GetPrintPreview",
"(",
"self",
")",
"-",
">",
"PrintPreview"
] | def GetPrintPreview(*args, **kwargs):
"""GetPrintPreview(self) -> PrintPreview"""
return _windows_.PreviewControlBar_GetPrintPreview(*args, **kwargs) | [
"def",
"GetPrintPreview",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"PreviewControlBar_GetPrintPreview",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_windows.py#L5545-L5547 | |
Z3Prover/z3 | d745d03afdfdf638d66093e2bfbacaf87187f35b | src/api/python/z3/z3.py | python | is_rational_value | (a) | return is_arith(a) and a.is_real() and _is_numeral(a.ctx, a.as_ast()) | Return `True` if `a` is rational value of sort Real.
>>> is_rational_value(RealVal(1))
True
>>> is_rational_value(RealVal("3/5"))
True
>>> is_rational_value(IntVal(1))
False
>>> is_rational_value(1)
False
>>> n = Real('x') + 1
>>> n.arg(1)
1
>>> is_rational_value(n.arg(1... | Return `True` if `a` is rational value of sort Real. | [
"Return",
"True",
"if",
"a",
"is",
"rational",
"value",
"of",
"sort",
"Real",
"."
] | def is_rational_value(a):
"""Return `True` if `a` is rational value of sort Real.
>>> is_rational_value(RealVal(1))
True
>>> is_rational_value(RealVal("3/5"))
True
>>> is_rational_value(IntVal(1))
False
>>> is_rational_value(1)
False
>>> n = Real('x') + 1
>>> n.arg(1)
1
... | [
"def",
"is_rational_value",
"(",
"a",
")",
":",
"return",
"is_arith",
"(",
"a",
")",
"and",
"a",
".",
"is_real",
"(",
")",
"and",
"_is_numeral",
"(",
"a",
".",
"ctx",
",",
"a",
".",
"as_ast",
"(",
")",
")"
] | https://github.com/Z3Prover/z3/blob/d745d03afdfdf638d66093e2bfbacaf87187f35b/src/api/python/z3/z3.py#L2721-L2740 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/pipeline/pipeline/pipeline.py | python | get_root_list | (class_path=None, cursor=None, count=50) | return result_dict | Gets a list root Pipelines.
Args:
class_path: Optional. If supplied, only return root Pipelines with the
given class_path. By default all root pipelines are returned.
cursor: Optional. When supplied, the cursor returned from the last call to
get_root_list which indicates where to pick up.
cou... | Gets a list root Pipelines. | [
"Gets",
"a",
"list",
"root",
"Pipelines",
"."
] | def get_root_list(class_path=None, cursor=None, count=50):
"""Gets a list root Pipelines.
Args:
class_path: Optional. If supplied, only return root Pipelines with the
given class_path. By default all root pipelines are returned.
cursor: Optional. When supplied, the cursor returned from the last call ... | [
"def",
"get_root_list",
"(",
"class_path",
"=",
"None",
",",
"cursor",
"=",
"None",
",",
"count",
"=",
"50",
")",
":",
"query",
"=",
"_PipelineRecord",
".",
"all",
"(",
"cursor",
"=",
"cursor",
")",
"if",
"class_path",
":",
"query",
".",
"filter",
"(",... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/pipeline/pipeline/pipeline.py#L3202-L3274 | |
yuxng/PoseCNN | 9f3dd7b7bce21dcafc05e8f18ccc90da3caabd04 | lib/datasets/shapenet_scene.py | python | shapenet_scene.gt_roidb | (self) | return gt_roidb | Return the database of ground-truth regions of interest.
This function loads/saves from/to a cache file to speed up future calls. | Return the database of ground-truth regions of interest. | [
"Return",
"the",
"database",
"of",
"ground",
"-",
"truth",
"regions",
"of",
"interest",
"."
] | def gt_roidb(self):
"""
Return the database of ground-truth regions of interest.
This function loads/saves from/to a cache file to speed up future calls.
"""
cache_file = os.path.join(self.cache_path, self.name + '_gt_roidb.pkl')
if os.path.exists(cache_file):
... | [
"def",
"gt_roidb",
"(",
"self",
")",
":",
"cache_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"cache_path",
",",
"self",
".",
"name",
"+",
"'_gt_roidb.pkl'",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"cache_file",
")",
":",
... | https://github.com/yuxng/PoseCNN/blob/9f3dd7b7bce21dcafc05e8f18ccc90da3caabd04/lib/datasets/shapenet_scene.py#L118-L139 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/mailbox.py | python | Maildir._create_tmp | (self) | Create a file in the tmp subdirectory and open and return it. | Create a file in the tmp subdirectory and open and return it. | [
"Create",
"a",
"file",
"in",
"the",
"tmp",
"subdirectory",
"and",
"open",
"and",
"return",
"it",
"."
] | def _create_tmp(self):
"""Create a file in the tmp subdirectory and open and return it."""
now = time.time()
hostname = socket.gethostname()
if '/' in hostname:
hostname = hostname.replace('/', r'\057')
if ':' in hostname:
hostname = hostname.replace(':', ... | [
"def",
"_create_tmp",
"(",
"self",
")",
":",
"now",
"=",
"time",
".",
"time",
"(",
")",
"hostname",
"=",
"socket",
".",
"gethostname",
"(",
")",
"if",
"'/'",
"in",
"hostname",
":",
"hostname",
"=",
"hostname",
".",
"replace",
"(",
"'/'",
",",
"r'\\05... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/mailbox.py#L473-L499 | ||
facebook/folly | 744a0a698074d1b013813065fe60f545aa2c9b94 | build/fbcode_builder/getdeps/builder.py | python | CargoBuilder._resolve_dep_to_crates | (build_source_dir, dep_to_git) | return dep_to_crates | This function traverse the build_source_dir in search of Cargo.toml
files, extracts the crate names from them using _extract_crates
function and returns a merged result containing crate names per
dependency name from all Cargo.toml files in the project. | This function traverse the build_source_dir in search of Cargo.toml
files, extracts the crate names from them using _extract_crates
function and returns a merged result containing crate names per
dependency name from all Cargo.toml files in the project. | [
"This",
"function",
"traverse",
"the",
"build_source_dir",
"in",
"search",
"of",
"Cargo",
".",
"toml",
"files",
"extracts",
"the",
"crate",
"names",
"from",
"them",
"using",
"_extract_crates",
"function",
"and",
"returns",
"a",
"merged",
"result",
"containing",
... | def _resolve_dep_to_crates(build_source_dir, dep_to_git):
"""
This function traverse the build_source_dir in search of Cargo.toml
files, extracts the crate names from them using _extract_crates
function and returns a merged result containing crate names per
dependency name from a... | [
"def",
"_resolve_dep_to_crates",
"(",
"build_source_dir",
",",
"dep_to_git",
")",
":",
"if",
"not",
"dep_to_git",
":",
"return",
"{",
"}",
"# no deps, so don't waste time traversing files",
"dep_to_crates",
"=",
"{",
"}",
"for",
"root",
",",
"_",
",",
"files",
"in... | https://github.com/facebook/folly/blob/744a0a698074d1b013813065fe60f545aa2c9b94/build/fbcode_builder/getdeps/builder.py#L1431-L1450 | |
naver/sling | 5671cd445a2caae0b4dd0332299e4cfede05062c | webkit/Tools/Scripts/webkitpy/style/checkers/cpp.py | python | parameter_list | (elided_lines, start_position, end_position) | Generator for a function's parameters. | Generator for a function's parameters. | [
"Generator",
"for",
"a",
"function",
"s",
"parameters",
"."
] | def parameter_list(elided_lines, start_position, end_position):
"""Generator for a function's parameters."""
# Create new positions that omit the outer parenthesis of the parameters.
start_position = Position(row=start_position.row, column=start_position.column + 1)
end_position = Position(row=end_posit... | [
"def",
"parameter_list",
"(",
"elided_lines",
",",
"start_position",
",",
"end_position",
")",
":",
"# Create new positions that omit the outer parenthesis of the parameters.",
"start_position",
"=",
"Position",
"(",
"row",
"=",
"start_position",
".",
"row",
",",
"column",
... | https://github.com/naver/sling/blob/5671cd445a2caae0b4dd0332299e4cfede05062c/webkit/Tools/Scripts/webkitpy/style/checkers/cpp.py#L463-L486 | ||
nileshkulkarni/csm | 0e6e0e7d4f725fd36f2414c0be4b9d83197aa1fc | csm/utils/transformations.py | python | quaternion_inverse | (quaternion) | return q / numpy.dot(q, q) | Return inverse of quaternion.
>>> q0 = random_quaternion()
>>> q1 = quaternion_inverse(q0)
>>> numpy.allclose(quaternion_multiply(q0, q1), [1, 0, 0, 0])
True | Return inverse of quaternion. | [
"Return",
"inverse",
"of",
"quaternion",
"."
] | def quaternion_inverse(quaternion):
"""Return inverse of quaternion.
>>> q0 = random_quaternion()
>>> q1 = quaternion_inverse(q0)
>>> numpy.allclose(quaternion_multiply(q0, q1), [1, 0, 0, 0])
True
"""
q = numpy.array(quaternion, dtype=numpy.float64, copy=True)
numpy.negative(q[1:], q[1... | [
"def",
"quaternion_inverse",
"(",
"quaternion",
")",
":",
"q",
"=",
"numpy",
".",
"array",
"(",
"quaternion",
",",
"dtype",
"=",
"numpy",
".",
"float64",
",",
"copy",
"=",
"True",
")",
"numpy",
".",
"negative",
"(",
"q",
"[",
"1",
":",
"]",
",",
"q... | https://github.com/nileshkulkarni/csm/blob/0e6e0e7d4f725fd36f2414c0be4b9d83197aa1fc/csm/utils/transformations.py#L1397-L1408 | |
jubatus/jubatus | 1251ce551bac980488a6313728e72b3fe0b79a9f | tools/codestyle/cpplint/cpplint.py | python | FileInfo.RepositoryName | (self) | return fullname | FullName after removing the local path to the repository.
If we have a real absolute path name here we can try to do something smart:
detecting the root of the checkout and truncating /path/to/checkout from
the name so that we get header guards that don't include things like
"C:\Documents and Settings\... | FullName after removing the local path to the repository. | [
"FullName",
"after",
"removing",
"the",
"local",
"path",
"to",
"the",
"repository",
"."
] | def RepositoryName(self):
"""FullName after removing the local path to the repository.
If we have a real absolute path name here we can try to do something smart:
detecting the root of the checkout and truncating /path/to/checkout from
the name so that we get header guards that don't include things lik... | [
"def",
"RepositoryName",
"(",
"self",
")",
":",
"fullname",
"=",
"self",
".",
"FullName",
"(",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"fullname",
")",
":",
"project_dir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"fullname",
")",
"if",
... | https://github.com/jubatus/jubatus/blob/1251ce551bac980488a6313728e72b3fe0b79a9f/tools/codestyle/cpplint/cpplint.py#L704-L747 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_controls.py | python | TextAttr.HasBulletNumber | (*args, **kwargs) | return _controls_.TextAttr_HasBulletNumber(*args, **kwargs) | HasBulletNumber(self) -> bool | HasBulletNumber(self) -> bool | [
"HasBulletNumber",
"(",
"self",
")",
"-",
">",
"bool"
] | def HasBulletNumber(*args, **kwargs):
"""HasBulletNumber(self) -> bool"""
return _controls_.TextAttr_HasBulletNumber(*args, **kwargs) | [
"def",
"HasBulletNumber",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"TextAttr_HasBulletNumber",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_controls.py#L1856-L1858 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/framework/errors.py | python | DeadlineExceededError.__init__ | (self, node_def, op, message) | Creates a `DeadlineExceededError`. | Creates a `DeadlineExceededError`. | [
"Creates",
"a",
"DeadlineExceededError",
"."
] | def __init__(self, node_def, op, message):
"""Creates a `DeadlineExceededError`."""
super(DeadlineExceededError, self).__init__(node_def, op, message,
DEADLINE_EXCEEDED) | [
"def",
"__init__",
"(",
"self",
",",
"node_def",
",",
"op",
",",
"message",
")",
":",
"super",
"(",
"DeadlineExceededError",
",",
"self",
")",
".",
"__init__",
"(",
"node_def",
",",
"op",
",",
"message",
",",
"DEADLINE_EXCEEDED",
")"
] | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/framework/errors.py#L217-L220 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | base/android/jni_generator/jni_generator.py | python | ExtractCalledByNatives | (contents) | return MangleCalledByNatives(called_by_natives) | Parses all methods annotated with @CalledByNative.
Args:
contents: the contents of the java file.
Returns:
A list of dict with information about the annotated methods.
TODO(bulach): return a CalledByNative object.
Raises:
ParseError: if unable to parse. | Parses all methods annotated with @CalledByNative. | [
"Parses",
"all",
"methods",
"annotated",
"with",
"@CalledByNative",
"."
] | def ExtractCalledByNatives(contents):
"""Parses all methods annotated with @CalledByNative.
Args:
contents: the contents of the java file.
Returns:
A list of dict with information about the annotated methods.
TODO(bulach): return a CalledByNative object.
Raises:
ParseError: if unable to parse... | [
"def",
"ExtractCalledByNatives",
"(",
"contents",
")",
":",
"called_by_natives",
"=",
"[",
"]",
"for",
"match",
"in",
"re",
".",
"finditer",
"(",
"RE_CALLED_BY_NATIVE",
",",
"contents",
")",
":",
"called_by_natives",
"+=",
"[",
"CalledByNative",
"(",
"system_cla... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/base/android/jni_generator/jni_generator.py#L443-L472 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/compiler/xla/xla.py | python | _get_scaffold | (captured_scaffold_fn) | return scaffold | Retrieves the Scaffold from `captured_scaffold_fn`. | Retrieves the Scaffold from `captured_scaffold_fn`. | [
"Retrieves",
"the",
"Scaffold",
"from",
"captured_scaffold_fn",
"."
] | def _get_scaffold(captured_scaffold_fn):
"""Retrieves the Scaffold from `captured_scaffold_fn`."""
scaffold_fn = captured_scaffold_fn.get()
if not scaffold_fn:
return None
scaffold = scaffold_fn()
if scaffold is None:
raise ValueError(
'TPUEstimatorSpec.scaffold_fn returns None, which is not... | [
"def",
"_get_scaffold",
"(",
"captured_scaffold_fn",
")",
":",
"scaffold_fn",
"=",
"captured_scaffold_fn",
".",
"get",
"(",
")",
"if",
"not",
"scaffold_fn",
":",
"return",
"None",
"scaffold",
"=",
"scaffold_fn",
"(",
")",
"if",
"scaffold",
"is",
"None",
":",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/compiler/xla/xla.py#L557-L569 | |
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/python/configobj/configobj.py | python | Section.restore_defaults | (self) | Recursively restore default values to all members
that have them.
This method will only work for a ConfigObj that was created
with a configspec and has been validated.
It doesn't delete or modify entries without default values. | Recursively restore default values to all members
that have them.
This method will only work for a ConfigObj that was created
with a configspec and has been validated.
It doesn't delete or modify entries without default values. | [
"Recursively",
"restore",
"default",
"values",
"to",
"all",
"members",
"that",
"have",
"them",
".",
"This",
"method",
"will",
"only",
"work",
"for",
"a",
"ConfigObj",
"that",
"was",
"created",
"with",
"a",
"configspec",
"and",
"has",
"been",
"validated",
"."... | def restore_defaults(self):
"""
Recursively restore default values to all members
that have them.
This method will only work for a ConfigObj that was created
with a configspec and has been validated.
It doesn't delete or modify entries without default va... | [
"def",
"restore_defaults",
"(",
"self",
")",
":",
"for",
"key",
"in",
"self",
".",
"default_values",
":",
"self",
".",
"restore_default",
"(",
"key",
")",
"for",
"section",
"in",
"self",
".",
"sections",
":",
"self",
"[",
"section",
"]",
".",
"restore_de... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/configobj/configobj.py#L1067-L1081 | ||
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | gpu/command_buffer/build_gles2_cmd_buffer.py | python | GENnHandler.WriteImmediateHandlerImplementation | (self, func, file) | Overrriden from TypeHandler. | Overrriden from TypeHandler. | [
"Overrriden",
"from",
"TypeHandler",
"."
] | def WriteImmediateHandlerImplementation(self, func, file):
"""Overrriden from TypeHandler."""
file.Write(" if (!%sHelper(n, %s)) {\n"
" return error::kInvalidArguments;\n"
" }\n" %
(func.original_name, func.GetLastOriginalArg().name)) | [
"def",
"WriteImmediateHandlerImplementation",
"(",
"self",
",",
"func",
",",
"file",
")",
":",
"file",
".",
"Write",
"(",
"\" if (!%sHelper(n, %s)) {\\n\"",
"\" return error::kInvalidArguments;\\n\"",
"\" }\\n\"",
"%",
"(",
"func",
".",
"original_name",
",",
"func"... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/gpu/command_buffer/build_gles2_cmd_buffer.py#L2774-L2779 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/plugins/algorithms/MRInspectData.py | python | poly_bck_signal | (value, *p) | return values | Function for a polynomial + Gaussian signal
f = a + b*(x-center) + c*(x-center)**2 + Gaussian(x) + bck
where bck is a minimum threshold that is zero when the polynomial+Gaussian
has a value greater than it. | Function for a polynomial + Gaussian signal | [
"Function",
"for",
"a",
"polynomial",
"+",
"Gaussian",
"signal"
] | def poly_bck_signal(value, *p):
"""
Function for a polynomial + Gaussian signal
f = a + b*(x-center) + c*(x-center)**2 + Gaussian(x) + bck
where bck is a minimum threshold that is zero when the polynomial+Gaussian
has a value greater than it.
"""
coord = code_to_coord(value... | [
"def",
"poly_bck_signal",
"(",
"value",
",",
"*",
"p",
")",
":",
"coord",
"=",
"code_to_coord",
"(",
"value",
")",
"A",
",",
"mu_x",
",",
"sigma_x",
",",
"mu_y",
",",
"sigma_y",
",",
"poly_a",
",",
"poly_b",
",",
"poly_c",
",",
"center",
",",
"backgr... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/MRInspectData.py#L552-L574 | |
google/tink | 59bb34495d1cb8f9d9dbc0f0a52c4f9e21491a14 | python/tink/streaming_aead/_decrypting_stream.py | python | RawDecryptingStream.readable | (self) | return True | Return True if the stream can be read from. | Return True if the stream can be read from. | [
"Return",
"True",
"if",
"the",
"stream",
"can",
"be",
"read",
"from",
"."
] | def readable(self) -> bool:
"""Return True if the stream can be read from."""
return True | [
"def",
"readable",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"True"
] | https://github.com/google/tink/blob/59bb34495d1cb8f9d9dbc0f0a52c4f9e21491a14/python/tink/streaming_aead/_decrypting_stream.py#L138-L140 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/interpolate/interpolate.py | python | NdPPoly.antiderivative | (self, nu) | return p | Construct a new piecewise polynomial representing the antiderivative.
Antiderivative is also the indefinite integral of the function,
and derivative is its inverse operation.
Parameters
----------
nu : ndim-tuple of int
Order of derivatives to evaluate for each dime... | Construct a new piecewise polynomial representing the antiderivative. | [
"Construct",
"a",
"new",
"piecewise",
"polynomial",
"representing",
"the",
"antiderivative",
"."
] | def antiderivative(self, nu):
"""
Construct a new piecewise polynomial representing the antiderivative.
Antiderivative is also the indefinite integral of the function,
and derivative is its inverse operation.
Parameters
----------
nu : ndim-tuple of int
... | [
"def",
"antiderivative",
"(",
"self",
",",
"nu",
")",
":",
"p",
"=",
"self",
".",
"construct_fast",
"(",
"self",
".",
"c",
".",
"copy",
"(",
")",
",",
"self",
".",
"x",
",",
"self",
".",
"extrapolate",
")",
"for",
"axis",
",",
"n",
"in",
"enumera... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/interpolate/interpolate.py#L2162-L2194 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/python/summary/impl/reservoir.py | python | Reservoir.__init__ | (self, size, seed=0) | Creates a new reservoir.
Args:
size: The number of values to keep in the reservoir for each tag. If 0,
all values will be kept.
seed: The seed of the random number generator to use when sampling.
Different values for |seed| will produce different samples from the same
input item... | Creates a new reservoir. | [
"Creates",
"a",
"new",
"reservoir",
"."
] | def __init__(self, size, seed=0):
"""Creates a new reservoir.
Args:
size: The number of values to keep in the reservoir for each tag. If 0,
all values will be kept.
seed: The seed of the random number generator to use when sampling.
Different values for |seed| will produce different... | [
"def",
"__init__",
"(",
"self",
",",
"size",
",",
"seed",
"=",
"0",
")",
":",
"if",
"size",
"<",
"0",
"or",
"size",
"!=",
"round",
"(",
"size",
")",
":",
"raise",
"ValueError",
"(",
"'size must be nonegative integer, was %s'",
"%",
"size",
")",
"self",
... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/python/summary/impl/reservoir.py#L58-L77 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/propgrid.py | python | PropertyGridManager.InsertPage | (*args, **kwargs) | return _propgrid.PropertyGridManager_InsertPage(*args, **kwargs) | InsertPage(self, int index, String label, Bitmap bmp=wxNullBitmap, PropertyGridPage pageObj=None) -> PropertyGridPage | InsertPage(self, int index, String label, Bitmap bmp=wxNullBitmap, PropertyGridPage pageObj=None) -> PropertyGridPage | [
"InsertPage",
"(",
"self",
"int",
"index",
"String",
"label",
"Bitmap",
"bmp",
"=",
"wxNullBitmap",
"PropertyGridPage",
"pageObj",
"=",
"None",
")",
"-",
">",
"PropertyGridPage"
] | def InsertPage(*args, **kwargs):
"""InsertPage(self, int index, String label, Bitmap bmp=wxNullBitmap, PropertyGridPage pageObj=None) -> PropertyGridPage"""
return _propgrid.PropertyGridManager_InsertPage(*args, **kwargs) | [
"def",
"InsertPage",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PropertyGridManager_InsertPage",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/propgrid.py#L3524-L3526 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/futures/__init__.py | python | Future.done | (self) | return super().done() | r"""
Return ``True`` if this ``Future`` is done. A ``Future`` is done if it
has a result or an exception.
If the value contains tensors that reside on GPUs, ``Future.done()``
will return ``True`` even if the asynchronous kernels that are
populating those tensors haven't yet comp... | r"""
Return ``True`` if this ``Future`` is done. A ``Future`` is done if it
has a result or an exception. | [
"r",
"Return",
"True",
"if",
"this",
"Future",
"is",
"done",
".",
"A",
"Future",
"is",
"done",
"if",
"it",
"has",
"a",
"result",
"or",
"an",
"exception",
"."
] | def done(self) -> bool:
r"""
Return ``True`` if this ``Future`` is done. A ``Future`` is done if it
has a result or an exception.
If the value contains tensors that reside on GPUs, ``Future.done()``
will return ``True`` even if the asynchronous kernels that are
populatin... | [
"def",
"done",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"super",
"(",
")",
".",
"done",
"(",
")"
] | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/futures/__init__.py#L40-L51 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/Tkinter.py | python | Text.window_cget | (self, index, option) | return self.tk.call(self._w, 'window', 'cget', index, option) | Return the value of OPTION of an embedded window at INDEX. | Return the value of OPTION of an embedded window at INDEX. | [
"Return",
"the",
"value",
"of",
"OPTION",
"of",
"an",
"embedded",
"window",
"at",
"INDEX",
"."
] | def window_cget(self, index, option):
"""Return the value of OPTION of an embedded window at INDEX."""
if option[:1] != '-':
option = '-' + option
if option[-1:] == '_':
option = option[:-1]
return self.tk.call(self._w, 'window', 'cget', index, option) | [
"def",
"window_cget",
"(",
"self",
",",
"index",
",",
"option",
")",
":",
"if",
"option",
"[",
":",
"1",
"]",
"!=",
"'-'",
":",
"option",
"=",
"'-'",
"+",
"option",
"if",
"option",
"[",
"-",
"1",
":",
"]",
"==",
"'_'",
":",
"option",
"=",
"opti... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/Tkinter.py#L3166-L3172 | |
protocolbuffers/protobuf | b5ab0b7a18b7336c60130f4ddb2d97c51792f896 | python/google/protobuf/internal/containers.py | python | RepeatedCompositeFieldContainer.pop | (self, key=-1) | return value | Removes and returns an item at a given index. Similar to list.pop(). | Removes and returns an item at a given index. Similar to list.pop(). | [
"Removes",
"and",
"returns",
"an",
"item",
"at",
"a",
"given",
"index",
".",
"Similar",
"to",
"list",
".",
"pop",
"()",
"."
] | def pop(self, key=-1):
"""Removes and returns an item at a given index. Similar to list.pop()."""
value = self._values[key]
self.__delitem__(key)
return value | [
"def",
"pop",
"(",
"self",
",",
"key",
"=",
"-",
"1",
")",
":",
"value",
"=",
"self",
".",
"_values",
"[",
"key",
"]",
"self",
".",
"__delitem__",
"(",
"key",
")",
"return",
"value"
] | https://github.com/protocolbuffers/protobuf/blob/b5ab0b7a18b7336c60130f4ddb2d97c51792f896/python/google/protobuf/internal/containers.py#L289-L293 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/xmlrpc/server.py | python | SimpleXMLRPCDispatcher.system_multicall | (self, call_list) | return results | system.multicall([{'methodName': 'add', 'params': [2, 2]}, ...]) => \
[[4], ...]
Allows the caller to package multiple XML-RPC calls into a single
request.
See http://www.xmlrpc.com/discuss/msgReader$1208 | system.multicall([{'methodName': 'add', 'params': [2, 2]}, ...]) => \
[[4], ...] | [
"system",
".",
"multicall",
"(",
"[",
"{",
"methodName",
":",
"add",
"params",
":",
"[",
"2",
"2",
"]",
"}",
"...",
"]",
")",
"=",
">",
"\\",
"[[",
"4",
"]",
"...",
"]"
] | def system_multicall(self, call_list):
"""system.multicall([{'methodName': 'add', 'params': [2, 2]}, ...]) => \
[[4], ...]
Allows the caller to package multiple XML-RPC calls into a single
request.
See http://www.xmlrpc.com/discuss/msgReader$1208
"""
results = []
... | [
"def",
"system_multicall",
"(",
"self",
",",
"call_list",
")",
":",
"results",
"=",
"[",
"]",
"for",
"call",
"in",
"call_list",
":",
"method_name",
"=",
"call",
"[",
"'methodName'",
"]",
"params",
"=",
"call",
"[",
"'params'",
"]",
"try",
":",
"# XXX A m... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/xmlrpc/server.py#L347-L381 | |
BSVino/DoubleAction | c550b168a3e919926c198c30240f506538b92e75 | mp/src/thirdparty/protobuf-2.3.0/python/google/protobuf/text_format.py | python | _Tokenizer.ConsumeInt32 | (self) | return result | Consumes a signed 32bit integer number.
Returns:
The integer parsed.
Raises:
ParseError: If a signed 32bit integer couldn't be consumed. | Consumes a signed 32bit integer number. | [
"Consumes",
"a",
"signed",
"32bit",
"integer",
"number",
"."
] | def ConsumeInt32(self):
"""Consumes a signed 32bit integer number.
Returns:
The integer parsed.
Raises:
ParseError: If a signed 32bit integer couldn't be consumed.
"""
try:
result = self._ParseInteger(self.token, is_signed=True, is_long=False)
except ValueError, e:
rais... | [
"def",
"ConsumeInt32",
"(",
"self",
")",
":",
"try",
":",
"result",
"=",
"self",
".",
"_ParseInteger",
"(",
"self",
".",
"token",
",",
"is_signed",
"=",
"True",
",",
"is_long",
"=",
"False",
")",
"except",
"ValueError",
",",
"e",
":",
"raise",
"self",
... | https://github.com/BSVino/DoubleAction/blob/c550b168a3e919926c198c30240f506538b92e75/mp/src/thirdparty/protobuf-2.3.0/python/google/protobuf/text_format.py#L410-L424 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/distutils/filelist.py | python | _find_all_simple | (path) | return filter(os.path.isfile, results) | Find all files under 'path' | Find all files under 'path' | [
"Find",
"all",
"files",
"under",
"path"
] | def _find_all_simple(path):
"""
Find all files under 'path'
"""
results = (
os.path.join(base, file)
for base, dirs, files in os.walk(path, followlinks=True)
for file in files
)
return filter(os.path.isfile, results) | [
"def",
"_find_all_simple",
"(",
"path",
")",
":",
"results",
"=",
"(",
"os",
".",
"path",
".",
"join",
"(",
"base",
",",
"file",
")",
"for",
"base",
",",
"dirs",
",",
"files",
"in",
"os",
".",
"walk",
"(",
"path",
",",
"followlinks",
"=",
"True",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/distutils/filelist.py#L246-L255 | |
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/task_generation/evg_config_builder.py | python | EvgConfigBuilder.generate_suite | (self, split_params: SuiteSplitParameters,
gen_params: ResmokeGenTaskParams) | Add configuration to generate a split version of the specified resmoke suite.
:param split_params: Parameters of how resmoke suite should be split.
:param gen_params: Parameters of how evergreen configuration should be generated. | Add configuration to generate a split version of the specified resmoke suite. | [
"Add",
"configuration",
"to",
"generate",
"a",
"split",
"version",
"of",
"the",
"specified",
"resmoke",
"suite",
"."
] | def generate_suite(self, split_params: SuiteSplitParameters,
gen_params: ResmokeGenTaskParams) -> None:
"""
Add configuration to generate a split version of the specified resmoke suite.
:param split_params: Parameters of how resmoke suite should be split.
:param g... | [
"def",
"generate_suite",
"(",
"self",
",",
"split_params",
":",
"SuiteSplitParameters",
",",
"gen_params",
":",
"ResmokeGenTaskParams",
")",
"->",
"None",
":",
"generated_suite",
"=",
"self",
".",
"suite_split_service",
".",
"split_suite",
"(",
"split_params",
")",
... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/task_generation/evg_config_builder.py#L63-L76 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/layers/base.py | python | Layer._get_node_attribute_at_index | (self, node_index, attr, attr_name) | Private utility to retrieves an attribute (e.g. inputs) from a node.
This is used to implement the methods:
- get_input_shape_at
- get_output_shape_at
- get_input_at
etc...
Arguments:
node_index: Integer index of the node from which
to retrieve the attribute... | Private utility to retrieves an attribute (e.g. inputs) from a node. | [
"Private",
"utility",
"to",
"retrieves",
"an",
"attribute",
"(",
"e",
".",
"g",
".",
"inputs",
")",
"from",
"a",
"node",
"."
] | def _get_node_attribute_at_index(self, node_index, attr, attr_name):
"""Private utility to retrieves an attribute (e.g. inputs) from a node.
This is used to implement the methods:
- get_input_shape_at
- get_output_shape_at
- get_input_at
etc...
Arguments:
node_index... | [
"def",
"_get_node_attribute_at_index",
"(",
"self",
",",
"node_index",
",",
"attr",
",",
"attr_name",
")",
":",
"assert",
"context",
".",
"in_graph_mode",
"(",
")",
"if",
"not",
"self",
".",
"_inbound_nodes",
":",
"raise",
"RuntimeError",
"(",
"'The layer has ne... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/layers/base.py#L748-L783 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/plan/robotoptimize.py | python | RobotOptimizationProblem.addIKObjective | (self,obj,weight=None) | Adds a new IKObjective to the problem. If weight is not None, it is
added as a soft constraint. | Adds a new IKObjective to the problem. If weight is not None, it is
added as a soft constraint. | [
"Adds",
"a",
"new",
"IKObjective",
"to",
"the",
"problem",
".",
"If",
"weight",
"is",
"not",
"None",
"it",
"is",
"added",
"as",
"a",
"soft",
"constraint",
"."
] | def addIKObjective(self,obj,weight=None):
"""Adds a new IKObjective to the problem. If weight is not None, it is
added as a soft constraint."""
assert isinstance(obj,IKObjective)
self.addEquality(self.context.ik.residual(obj,self.context.setConfig("robot",self.q)),weight)
if ha... | [
"def",
"addIKObjective",
"(",
"self",
",",
"obj",
",",
"weight",
"=",
"None",
")",
":",
"assert",
"isinstance",
"(",
"obj",
",",
"IKObjective",
")",
"self",
".",
"addEquality",
"(",
"self",
".",
"context",
".",
"ik",
".",
"residual",
"(",
"obj",
",",
... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/plan/robotoptimize.py#L152-L161 | ||
tangzhenyu/Scene-Text-Understanding | 0f7ffc7aea5971a50cdc03d33d0a41075285948b | ctpn_crnn_ocr/CTPN/caffe/scripts/cpp_lint.py | python | CheckForMultilineCommentsAndStrings | (filename, clean_lines, linenum, error) | Logs an error if we see /* ... */ or "..." that extend past one line.
/* ... */ comments are legit inside macros, for one line.
Otherwise, we prefer // comments, so it's ok to warn about the
other. Likewise, it's ok for strings to extend across multiple
lines, as long as a line continuation character (backsla... | Logs an error if we see /* ... */ or "..." that extend past one line. | [
"Logs",
"an",
"error",
"if",
"we",
"see",
"/",
"*",
"...",
"*",
"/",
"or",
"...",
"that",
"extend",
"past",
"one",
"line",
"."
] | def CheckForMultilineCommentsAndStrings(filename, clean_lines, linenum, error):
"""Logs an error if we see /* ... */ or "..." that extend past one line.
/* ... */ comments are legit inside macros, for one line.
Otherwise, we prefer // comments, so it's ok to warn about the
other. Likewise, it's ok for strings... | [
"def",
"CheckForMultilineCommentsAndStrings",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"# Remove all \\\\ (escaped backslashes) from the line. They are OK, and the",
"# secon... | https://github.com/tangzhenyu/Scene-Text-Understanding/blob/0f7ffc7aea5971a50cdc03d33d0a41075285948b/ctpn_crnn_ocr/CTPN/caffe/scripts/cpp_lint.py#L1526-L1561 | ||
yun-liu/RCF | 91bfb054ad04187dbbe21e539e165ad9bd3ff00b | scripts/cpp_lint.py | python | _IncludeState.CheckNextIncludeOrder | (self, header_type) | return '' | Returns a non-empty error message if the next header is out of order.
This function also updates the internal state to be ready to check
the next include.
Args:
header_type: One of the _XXX_HEADER constants defined above.
Returns:
The empty string if the header is in the right order, or a... | Returns a non-empty error message if the next header is out of order. | [
"Returns",
"a",
"non",
"-",
"empty",
"error",
"message",
"if",
"the",
"next",
"header",
"is",
"out",
"of",
"order",
"."
] | def CheckNextIncludeOrder(self, header_type):
"""Returns a non-empty error message if the next header is out of order.
This function also updates the internal state to be ready to check
the next include.
Args:
header_type: One of the _XXX_HEADER constants defined above.
Returns:
The e... | [
"def",
"CheckNextIncludeOrder",
"(",
"self",
",",
"header_type",
")",
":",
"error_message",
"=",
"(",
"'Found %s after %s'",
"%",
"(",
"self",
".",
"_TYPE_NAMES",
"[",
"header_type",
"]",
",",
"self",
".",
"_SECTION_NAMES",
"[",
"self",
".",
"_section",
"]",
... | https://github.com/yun-liu/RCF/blob/91bfb054ad04187dbbe21e539e165ad9bd3ff00b/scripts/cpp_lint.py#L633-L684 | |
LLNL/lbann | 26083e6c86050302ce33148aea70f62e61cacb92 | python/lbann/contrib/olcf/systems.py | python | gpus_per_node | (system = system()) | return _system_params[system].gpus_per_node | Number of GPUs per node. | Number of GPUs per node. | [
"Number",
"of",
"GPUs",
"per",
"node",
"."
] | def gpus_per_node(system = system()):
"""Number of GPUs per node."""
if not is_olcf_system(system):
raise RuntimeError('unknown system (' + system + ')')
return _system_params[system].gpus_per_node | [
"def",
"gpus_per_node",
"(",
"system",
"=",
"system",
"(",
")",
")",
":",
"if",
"not",
"is_olcf_system",
"(",
"system",
")",
":",
"raise",
"RuntimeError",
"(",
"'unknown system ('",
"+",
"system",
"+",
"')'",
")",
"return",
"_system_params",
"[",
"system",
... | https://github.com/LLNL/lbann/blob/26083e6c86050302ce33148aea70f62e61cacb92/python/lbann/contrib/olcf/systems.py#L40-L44 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/rsa/rsa/_version200.py | python | str642int | (string) | return integer | Converts a base64 encoded string into an integer.
The chars of this string in in the range '0'-'9','A'-'Z','a'-'z','-','_'
>>> str642int('7MyqL')
123456789 | Converts a base64 encoded string into an integer.
The chars of this string in in the range '0'-'9','A'-'Z','a'-'z','-','_'
>>> str642int('7MyqL')
123456789 | [
"Converts",
"a",
"base64",
"encoded",
"string",
"into",
"an",
"integer",
".",
"The",
"chars",
"of",
"this",
"string",
"in",
"in",
"the",
"range",
"0",
"-",
"9",
"A",
"-",
"Z",
"a",
"-",
"z",
"-",
"_",
">>>",
"str642int",
"(",
"7MyqL",
")",
"1234567... | def str642int(string):
"""Converts a base64 encoded string into an integer.
The chars of this string in in the range '0'-'9','A'-'Z','a'-'z','-','_'
>>> str642int('7MyqL')
123456789
"""
if not (type(string) is types.ListType or type(string) is types.StringType):
raise TypeError("Yo... | [
"def",
"str642int",
"(",
"string",
")",
":",
"if",
"not",
"(",
"type",
"(",
"string",
")",
"is",
"types",
".",
"ListType",
"or",
"type",
"(",
"string",
")",
"is",
"types",
".",
"StringType",
")",
":",
"raise",
"TypeError",
"(",
"\"You must pass a string ... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/rsa/rsa/_version200.py#L161-L178 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py | python | QuoteForRspFile | (arg, quote_cmd=True) | return arg | Quote a command line argument so that it appears as one argument when
processed via cmd.exe and parsed by CommandLineToArgvW (as is typical for
Windows programs). | Quote a command line argument so that it appears as one argument when
processed via cmd.exe and parsed by CommandLineToArgvW (as is typical for
Windows programs). | [
"Quote",
"a",
"command",
"line",
"argument",
"so",
"that",
"it",
"appears",
"as",
"one",
"argument",
"when",
"processed",
"via",
"cmd",
".",
"exe",
"and",
"parsed",
"by",
"CommandLineToArgvW",
"(",
"as",
"is",
"typical",
"for",
"Windows",
"programs",
")",
... | def QuoteForRspFile(arg, quote_cmd=True):
"""Quote a command line argument so that it appears as one argument when
processed via cmd.exe and parsed by CommandLineToArgvW (as is typical for
Windows programs)."""
# See http://goo.gl/cuFbX and http://goo.gl/dhPnp including the comment
# threads. This i... | [
"def",
"QuoteForRspFile",
"(",
"arg",
",",
"quote_cmd",
"=",
"True",
")",
":",
"# See http://goo.gl/cuFbX and http://goo.gl/dhPnp including the comment",
"# threads. This is actually the quoting rules for CommandLineToArgvW, not",
"# for the shell, because the shell doesn't do anything in Wi... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py#L23-L60 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/idlelib/config.py | python | IdleConf.GetExtraHelpSourceList | (self, configSet) | return helpSources | Return list of extra help sources from a given configSet.
Valid configSets are 'user' or 'default'. Return a list of tuples of
the form (menu_item , path_to_help_file , option), or return the empty
list. 'option' is the sequence number of the help resource. 'option'
values determine ... | Return list of extra help sources from a given configSet. | [
"Return",
"list",
"of",
"extra",
"help",
"sources",
"from",
"a",
"given",
"configSet",
"."
] | def GetExtraHelpSourceList(self, configSet):
"""Return list of extra help sources from a given configSet.
Valid configSets are 'user' or 'default'. Return a list of tuples of
the form (menu_item , path_to_help_file , option), or return the empty
list. 'option' is the sequence number o... | [
"def",
"GetExtraHelpSourceList",
"(",
"self",
",",
"configSet",
")",
":",
"helpSources",
"=",
"[",
"]",
"if",
"configSet",
"==",
"'user'",
":",
"cfgParser",
"=",
"self",
".",
"userCfg",
"[",
"'main'",
"]",
"elif",
"configSet",
"==",
"'default'",
":",
"cfgP... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/idlelib/config.py#L687-L717 | |
llvm/llvm-project | ffa6262cb4e2a335d26416fad39a581b4f98c5f4 | clang/tools/scan-build-py/lib/libscanbuild/report.py | python | read_bugs | (output_dir, html) | Generate a unique sequence of bugs from given output directory.
Duplicates can be in a project if the same module was compiled multiple
times with different compiler options. These would be better to show in
the final report (cover) only once. | Generate a unique sequence of bugs from given output directory. | [
"Generate",
"a",
"unique",
"sequence",
"of",
"bugs",
"from",
"given",
"output",
"directory",
"."
] | def read_bugs(output_dir, html):
# type: (str, bool) -> Generator[Dict[str, Any], None, None]
""" Generate a unique sequence of bugs from given output directory.
Duplicates can be in a project if the same module was compiled multiple
times with different compiler options. These would be better to show ... | [
"def",
"read_bugs",
"(",
"output_dir",
",",
"html",
")",
":",
"# type: (str, bool) -> Generator[Dict[str, Any], None, None]",
"def",
"empty",
"(",
"file_name",
")",
":",
"return",
"os",
".",
"stat",
"(",
"file_name",
")",
".",
"st_size",
"==",
"0",
"duplicate",
... | https://github.com/llvm/llvm-project/blob/ffa6262cb4e2a335d26416fad39a581b4f98c5f4/clang/tools/scan-build-py/lib/libscanbuild/report.py#L261-L284 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_controls.py | python | PreTreeCtrl | (*args, **kwargs) | return val | PreTreeCtrl() -> TreeCtrl | PreTreeCtrl() -> TreeCtrl | [
"PreTreeCtrl",
"()",
"-",
">",
"TreeCtrl"
] | def PreTreeCtrl(*args, **kwargs):
"""PreTreeCtrl() -> TreeCtrl"""
val = _controls_.new_PreTreeCtrl(*args, **kwargs)
return val | [
"def",
"PreTreeCtrl",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"val",
"=",
"_controls_",
".",
"new_PreTreeCtrl",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"val"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_controls.py#L5593-L5596 | |
H-uru/Plasma | c2140ea046e82e9c199e257a7f2e7edb42602871 | Scripts/Python/plasma/Plasma.py | python | PtGetClientName | (avatarKey=None) | This will return the name of the client that is owned by the avatar
- avatarKey is the ptKey of the avatar to get the client name of.
If avatarKey is omitted then the local avatar is used | This will return the name of the client that is owned by the avatar
- avatarKey is the ptKey of the avatar to get the client name of.
If avatarKey is omitted then the local avatar is used | [
"This",
"will",
"return",
"the",
"name",
"of",
"the",
"client",
"that",
"is",
"owned",
"by",
"the",
"avatar",
"-",
"avatarKey",
"is",
"the",
"ptKey",
"of",
"the",
"avatar",
"to",
"get",
"the",
"client",
"name",
"of",
".",
"If",
"avatarKey",
"is",
"omit... | def PtGetClientName(avatarKey=None):
"""This will return the name of the client that is owned by the avatar
- avatarKey is the ptKey of the avatar to get the client name of.
If avatarKey is omitted then the local avatar is used"""
pass | [
"def",
"PtGetClientName",
"(",
"avatarKey",
"=",
"None",
")",
":",
"pass"
] | https://github.com/H-uru/Plasma/blob/c2140ea046e82e9c199e257a7f2e7edb42602871/Scripts/Python/plasma/Plasma.py#L404-L408 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/plugins/algorithms/ReflectometrySliceEventWorkspace.py | python | ReflectometrySliceEventWorkspace._create_filter | (self) | Generate the splitter workspace for performing the filtering for each required slice | Generate the splitter workspace for performing the filtering for each required slice | [
"Generate",
"the",
"splitter",
"workspace",
"for",
"performing",
"the",
"filtering",
"for",
"each",
"required",
"slice"
] | def _create_filter(self):
"""Generate the splitter workspace for performing the filtering for each required slice"""
alg = self.createChildAlgorithm("GenerateEventsFilter")
for property_name in self._filter_properties:
alg.setProperty(property_name, self.getPropertyValue(property_nam... | [
"def",
"_create_filter",
"(",
"self",
")",
":",
"alg",
"=",
"self",
".",
"createChildAlgorithm",
"(",
"\"GenerateEventsFilter\"",
")",
"for",
"property_name",
"in",
"self",
".",
"_filter_properties",
":",
"alg",
".",
"setProperty",
"(",
"property_name",
",",
"se... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/ReflectometrySliceEventWorkspace.py#L95-L104 | ||
fatih/subvim | 241b6d170597857105da219c9b7d36059e9f11fb | vim/base/ultisnips/plugin/UltiSnips/__init__.py | python | SnippetManager.file_to_edit | (self, ft) | return edit | Gets a file to edit based on the given filetype.
If no filetype is given, uses the current filetype from Vim.
Checks 'g:UltiSnipsSnippetsDir' and uses it if it exists
If a non-shipped file already exists, it uses it.
Otherwise uses a file in ~/.vim/ or ~/vimfiles | Gets a file to edit based on the given filetype.
If no filetype is given, uses the current filetype from Vim. | [
"Gets",
"a",
"file",
"to",
"edit",
"based",
"on",
"the",
"given",
"filetype",
".",
"If",
"no",
"filetype",
"is",
"given",
"uses",
"the",
"current",
"filetype",
"from",
"Vim",
"."
] | def file_to_edit(self, ft):
""" Gets a file to edit based on the given filetype.
If no filetype is given, uses the current filetype from Vim.
Checks 'g:UltiSnipsSnippetsDir' and uses it if it exists
If a non-shipped file already exists, it uses it.
Otherwise uses a file in ~/.vi... | [
"def",
"file_to_edit",
"(",
"self",
",",
"ft",
")",
":",
"edit",
"=",
"None",
"existing",
"=",
"self",
".",
"base_snippet_files_for",
"(",
"ft",
",",
"False",
")",
"filename",
"=",
"ft",
"+",
"\".snippets\"",
"if",
"_vim",
".",
"eval",
"(",
"\"exists('g:... | https://github.com/fatih/subvim/blob/241b6d170597857105da219c9b7d36059e9f11fb/vim/base/ultisnips/plugin/UltiSnips/__init__.py#L951-L985 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_windows.py | python | LayoutAlgorithm.LayoutWindow | (*args, **kwargs) | return _windows_.LayoutAlgorithm_LayoutWindow(*args, **kwargs) | LayoutWindow(self, Window parent, Window mainWindow=None) -> bool | LayoutWindow(self, Window parent, Window mainWindow=None) -> bool | [
"LayoutWindow",
"(",
"self",
"Window",
"parent",
"Window",
"mainWindow",
"=",
"None",
")",
"-",
">",
"bool"
] | def LayoutWindow(*args, **kwargs):
"""LayoutWindow(self, Window parent, Window mainWindow=None) -> bool"""
return _windows_.LayoutAlgorithm_LayoutWindow(*args, **kwargs) | [
"def",
"LayoutWindow",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"LayoutAlgorithm_LayoutWindow",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_windows.py#L2101-L2103 | |
rdiankov/openrave | d1a23023fd4b58f077d2ca949ceaf1b91f3f13d7 | sandbox/mintime/MintimeProblemZMP.py | python | MintimeProblemZMP.dynamics_coefficients | (self,s) | return self.linear_interpolate(s,transpose(array([self.ax_vect,self.bx_vect,self.cx_vect,self.ay_vect,self.by_vect,self.cy_vect,self.d_vect,self.e_vect,self.f_vect]))) | Compute the dynamics coefficients at a given point by interpolation
s -- point on the trajectory | Compute the dynamics coefficients at a given point by interpolation | [
"Compute",
"the",
"dynamics",
"coefficients",
"at",
"a",
"given",
"point",
"by",
"interpolation"
] | def dynamics_coefficients(self,s):
"""Compute the dynamics coefficients at a given point by interpolation
s -- point on the trajectory
"""
return self.linear_interpolate(s,transpose(array([self.ax_vect,self.bx_vect,self.cx_vect,self.ay_vect,self.by_vect,self.cy_vect,self.d_vect,self.e_... | [
"def",
"dynamics_coefficients",
"(",
"self",
",",
"s",
")",
":",
"return",
"self",
".",
"linear_interpolate",
"(",
"s",
",",
"transpose",
"(",
"array",
"(",
"[",
"self",
".",
"ax_vect",
",",
"self",
".",
"bx_vect",
",",
"self",
".",
"cx_vect",
",",
"se... | https://github.com/rdiankov/openrave/blob/d1a23023fd4b58f077d2ca949ceaf1b91f3f13d7/sandbox/mintime/MintimeProblemZMP.py#L88-L94 | |
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/linter/git_base.py | python | Repository.is_commit | (self, revision) | return not self._callgit("cat-file", ["-e", "{0}^{{commit}}".format(revision)]) | Return True if the specified hash is a valid git commit. | Return True if the specified hash is a valid git commit. | [
"Return",
"True",
"if",
"the",
"specified",
"hash",
"is",
"a",
"valid",
"git",
"commit",
"."
] | def is_commit(self, revision):
"""Return True if the specified hash is a valid git commit."""
# cat-file -e returns 0 if it is a valid hash
return not self._callgit("cat-file", ["-e", "{0}^{{commit}}".format(revision)]) | [
"def",
"is_commit",
"(",
"self",
",",
"revision",
")",
":",
"# cat-file -e returns 0 if it is a valid hash",
"return",
"not",
"self",
".",
"_callgit",
"(",
"\"cat-file\"",
",",
"[",
"\"-e\"",
",",
"\"{0}^{{commit}}\"",
".",
"format",
"(",
"revision",
")",
"]",
"... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/linter/git_base.py#L116-L119 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/pdb.py | python | Pdb.do_pp | (self, arg) | pp expression
Pretty-print the value of the expression. | pp expression
Pretty-print the value of the expression. | [
"pp",
"expression",
"Pretty",
"-",
"print",
"the",
"value",
"of",
"the",
"expression",
"."
] | def do_pp(self, arg):
"""pp expression
Pretty-print the value of the expression.
"""
try:
self.message(pprint.pformat(self._getval(arg)))
except:
pass | [
"def",
"do_pp",
"(",
"self",
",",
"arg",
")",
":",
"try",
":",
"self",
".",
"message",
"(",
"pprint",
".",
"pformat",
"(",
"self",
".",
"_getval",
"(",
"arg",
")",
")",
")",
"except",
":",
"pass"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/pdb.py#L1183-L1190 | ||
RobotLocomotion/drake | 0e18a34604c45ed65bc9018a54f7610f91cdad5b | bindings/pydrake/systems/drawing.py | python | plot_system_graphviz | (system, **kwargs) | return plot_graphviz(system.GetGraphvizString(**kwargs)) | Renders a System's Graphviz representation in `matplotlib`. | Renders a System's Graphviz representation in `matplotlib`. | [
"Renders",
"a",
"System",
"s",
"Graphviz",
"representation",
"in",
"matplotlib",
"."
] | def plot_system_graphviz(system, **kwargs):
"""Renders a System's Graphviz representation in `matplotlib`."""
return plot_graphviz(system.GetGraphvizString(**kwargs)) | [
"def",
"plot_system_graphviz",
"(",
"system",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"plot_graphviz",
"(",
"system",
".",
"GetGraphvizString",
"(",
"*",
"*",
"kwargs",
")",
")"
] | https://github.com/RobotLocomotion/drake/blob/0e18a34604c45ed65bc9018a54f7610f91cdad5b/bindings/pydrake/systems/drawing.py#L36-L38 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/keras/_impl/keras/models.py | python | Sequential.predict | (self, x, batch_size=32, verbose=0) | return self.model.predict(x, batch_size=batch_size, verbose=verbose) | Generates output predictions for the input samples.
The input samples are processed batch by batch.
Arguments:
x: the input data, as a Numpy array.
batch_size: integer.
verbose: verbosity mode, 0 or 1.
Returns:
A Numpy array of predictions. | Generates output predictions for the input samples. | [
"Generates",
"output",
"predictions",
"for",
"the",
"input",
"samples",
"."
] | def predict(self, x, batch_size=32, verbose=0):
"""Generates output predictions for the input samples.
The input samples are processed batch by batch.
Arguments:
x: the input data, as a Numpy array.
batch_size: integer.
verbose: verbosity mode, 0 or 1.
Returns:
A Numpy... | [
"def",
"predict",
"(",
"self",
",",
"x",
",",
"batch_size",
"=",
"32",
",",
"verbose",
"=",
"0",
")",
":",
"if",
"not",
"self",
".",
"built",
":",
"self",
".",
"build",
"(",
")",
"return",
"self",
".",
"model",
".",
"predict",
"(",
"x",
",",
"b... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/keras/_impl/keras/models.py#L874-L889 | |
pothosware/SoapySDR | 00e0312c3e464e1026b7c84a2359b1fea7d65796 | swig/python/apps/SimpleSiggen.py | python | siggen_app | (
args,
rate,
ampl=0.7,
freq=None,
tx_bw=None,
tx_chan=0,
tx_gain=None,
tx_ant=None,
clock_rate=None,
wave_freq=None
) | Generate signal until an interrupt signal is received. | Generate signal until an interrupt signal is received. | [
"Generate",
"signal",
"until",
"an",
"interrupt",
"signal",
"is",
"received",
"."
] | def siggen_app(
args,
rate,
ampl=0.7,
freq=None,
tx_bw=None,
tx_chan=0,
tx_gain=None,
tx_ant=None,
clock_rate=None,
wave_freq=None
):
"""Generate signal until an interrupt signal is received."""
if wave_freq is None:
wave_f... | [
"def",
"siggen_app",
"(",
"args",
",",
"rate",
",",
"ampl",
"=",
"0.7",
",",
"freq",
"=",
"None",
",",
"tx_bw",
"=",
"None",
",",
"tx_chan",
"=",
"0",
",",
"tx_gain",
"=",
"None",
",",
"tx_ant",
"=",
"None",
",",
"clock_rate",
"=",
"None",
",",
"... | https://github.com/pothosware/SoapySDR/blob/00e0312c3e464e1026b7c84a2359b1fea7d65796/swig/python/apps/SimpleSiggen.py#L22-L111 | ||
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/lldb/third_party/Python/module/pexpect-2.4/examples/fix_cvs_files.py | python | walk_and_clean_cvs_binaries | (arg, dirname, names) | This contains the logic for processing files. This is the os.path.walk
callback. This skips dirnames that end in CVS. | This contains the logic for processing files. This is the os.path.walk
callback. This skips dirnames that end in CVS. | [
"This",
"contains",
"the",
"logic",
"for",
"processing",
"files",
".",
"This",
"is",
"the",
"os",
".",
"path",
".",
"walk",
"callback",
".",
"This",
"skips",
"dirnames",
"that",
"end",
"in",
"CVS",
"."
] | def walk_and_clean_cvs_binaries(arg, dirname, names):
"""This contains the logic for processing files. This is the os.path.walk
callback. This skips dirnames that end in CVS. """
if len(dirname) > 3 and dirname[-3:] == 'CVS':
return
for n in names:
fullpath = os.path.joi... | [
"def",
"walk_and_clean_cvs_binaries",
"(",
"arg",
",",
"dirname",
",",
"names",
")",
":",
"if",
"len",
"(",
"dirname",
")",
">",
"3",
"and",
"dirname",
"[",
"-",
"3",
":",
"]",
"==",
"'CVS'",
":",
"return",
"for",
"n",
"in",
"names",
":",
"fullpath",... | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/third_party/Python/module/pexpect-2.4/examples/fix_cvs_files.py#L72-L86 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | gpu/command_buffer/build_gles2_cmd_buffer.py | python | GLGenerator.WriteClientContextStateImpl | (self, filename) | Writes the context state client side implementation. | Writes the context state client side implementation. | [
"Writes",
"the",
"context",
"state",
"client",
"side",
"implementation",
"."
] | def WriteClientContextStateImpl(self, filename):
"""Writes the context state client side implementation."""
file = CHeaderWriter(
filename,
"// It is included by client_context_state.cc\n")
code = []
for capability in _CAPABILITY_FLAGS:
code.append("%s(%s)" %
(cap... | [
"def",
"WriteClientContextStateImpl",
"(",
"self",
",",
"filename",
")",
":",
"file",
"=",
"CHeaderWriter",
"(",
"filename",
",",
"\"// It is included by client_context_state.cc\\n\"",
")",
"code",
"=",
"[",
"]",
"for",
"capability",
"in",
"_CAPABILITY_FLAGS",
":",
... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/gpu/command_buffer/build_gles2_cmd_buffer.py#L7242-L7289 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/linalg/python/ops/linear_operator.py | python | LinearOperator.solve | (self, rhs, adjoint=False, adjoint_arg=False, name="solve") | Solve (exact or approx) `R` (batch) systems of equations: `A X = rhs`.
The returned `Tensor` will be close to an exact solution if `A` is well
conditioned. Otherwise closeness will vary. See class docstring for details.
Examples:
```python
# Make an operator acting like batch matrix A. Assume A.... | Solve (exact or approx) `R` (batch) systems of equations: `A X = rhs`. | [
"Solve",
"(",
"exact",
"or",
"approx",
")",
"R",
"(",
"batch",
")",
"systems",
"of",
"equations",
":",
"A",
"X",
"=",
"rhs",
"."
] | def solve(self, rhs, adjoint=False, adjoint_arg=False, name="solve"):
"""Solve (exact or approx) `R` (batch) systems of equations: `A X = rhs`.
The returned `Tensor` will be close to an exact solution if `A` is well
conditioned. Otherwise closeness will vary. See class docstring for details.
Examples:... | [
"def",
"solve",
"(",
"self",
",",
"rhs",
",",
"adjoint",
"=",
"False",
",",
"adjoint_arg",
"=",
"False",
",",
"name",
"=",
"\"solve\"",
")",
":",
"if",
"self",
".",
"is_non_singular",
"is",
"False",
":",
"raise",
"NotImplementedError",
"(",
"\"Exact solve ... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/linalg/python/ops/linear_operator.py#L731-L788 | ||
Tokutek/mongo | 0653eabe2c5b9d12b4814617cb7fb2d799937a0f | buildscripts/moduleconfig.py | python | configure_modules | (modules, conf, env) | Run the configure() function in the build.py python modules for each module in "modules"
(as created by discover_modules).
The configure() function should prepare the Mongo build system for building the module. | Run the configure() function in the build.py python modules for each module in "modules"
(as created by discover_modules). | [
"Run",
"the",
"configure",
"()",
"function",
"in",
"the",
"build",
".",
"py",
"python",
"modules",
"for",
"each",
"module",
"in",
"modules",
"(",
"as",
"created",
"by",
"discover_modules",
")",
"."
] | def configure_modules(modules, conf, env):
""" Run the configure() function in the build.py python modules for each module in "modules"
(as created by discover_modules).
The configure() function should prepare the Mongo build system for building the module.
"""
for module in modules:
name =... | [
"def",
"configure_modules",
"(",
"modules",
",",
"conf",
",",
"env",
")",
":",
"for",
"module",
"in",
"modules",
":",
"name",
"=",
"module",
".",
"name",
"print",
"\"configuring module: %s\"",
"%",
"name",
"root",
"=",
"os",
".",
"path",
".",
"dirname",
... | https://github.com/Tokutek/mongo/blob/0653eabe2c5b9d12b4814617cb7fb2d799937a0f/buildscripts/moduleconfig.py#L65-L76 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/email/headerregistry.py | python | HeaderRegistry.map_to_type | (self, name, cls) | Register cls as the specialized class for handling "name" headers. | Register cls as the specialized class for handling "name" headers. | [
"Register",
"cls",
"as",
"the",
"specialized",
"class",
"for",
"handling",
"name",
"headers",
"."
] | def map_to_type(self, name, cls):
"""Register cls as the specialized class for handling "name" headers.
"""
self.registry[name.lower()] = cls | [
"def",
"map_to_type",
"(",
"self",
",",
"name",
",",
"cls",
")",
":",
"self",
".",
"registry",
"[",
"name",
".",
"lower",
"(",
")",
"]",
"=",
"cls"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/email/headerregistry.py#L574-L578 | ||
yushroom/FishEngine | a4b9fb9b0a6dc202f7990e75f4b7d8d5163209d9 | Script/reflect/clang/cindex.py | python | Type.argument_types | (self) | return ArgumentsIterator(self) | Retrieve a container for the non-variadic arguments for this type.
The returned object is iterable and indexable. Each item in the
container is a Type instance. | Retrieve a container for the non-variadic arguments for this type. | [
"Retrieve",
"a",
"container",
"for",
"the",
"non",
"-",
"variadic",
"arguments",
"for",
"this",
"type",
"."
] | def argument_types(self):
"""Retrieve a container for the non-variadic arguments for this type.
The returned object is iterable and indexable. Each item in the
container is a Type instance.
"""
class ArgumentsIterator(collections.Sequence):
def __init__(self, parent)... | [
"def",
"argument_types",
"(",
"self",
")",
":",
"class",
"ArgumentsIterator",
"(",
"collections",
".",
"Sequence",
")",
":",
"def",
"__init__",
"(",
"self",
",",
"parent",
")",
":",
"self",
".",
"parent",
"=",
"parent",
"self",
".",
"length",
"=",
"None"... | https://github.com/yushroom/FishEngine/blob/a4b9fb9b0a6dc202f7990e75f4b7d8d5163209d9/Script/reflect/clang/cindex.py#L1939-L1975 | |
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Editor/Python/windows/Lib/site-packages/pip/compat/dictconfig.py | python | BaseConfigurator.cfg_convert | (self, value) | return d | Default converter for the cfg:// protocol. | Default converter for the cfg:// protocol. | [
"Default",
"converter",
"for",
"the",
"cfg",
":",
"//",
"protocol",
"."
] | def cfg_convert(self, value):
"""Default converter for the cfg:// protocol."""
rest = value
m = self.WORD_PATTERN.match(rest)
if m is None:
raise ValueError("Unable to convert %r" % value)
else:
rest = rest[m.end():]
d = self.config[m.groups()[... | [
"def",
"cfg_convert",
"(",
"self",
",",
"value",
")",
":",
"rest",
"=",
"value",
"m",
"=",
"self",
".",
"WORD_PATTERN",
".",
"match",
"(",
"rest",
")",
"if",
"m",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"Unable to convert %r\"",
"%",
"value",
... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Editor/Python/windows/Lib/site-packages/pip/compat/dictconfig.py#L194-L226 | |
OpenMS/OpenMS | 9fd86bbc406ee390f3b7cb640f38d63695b33b59 | tools/PythonExtensionChecker.py | python | DoxygenXMLFile.get_pxd_from_class | (self, dfile, internal_file_name, xml_output_path) | return res | Generate a viable PXD file | Generate a viable PXD file | [
"Generate",
"a",
"viable",
"PXD",
"file"
] | def get_pxd_from_class(self, dfile, internal_file_name, xml_output_path):
"""
Generate a viable PXD file
"""
compound = dfile.compound
comp_name = compound.get_compoundname()
#
# Step 1: generate cimport includes
#
includes = ""
if len(co... | [
"def",
"get_pxd_from_class",
"(",
"self",
",",
"dfile",
",",
"internal_file_name",
",",
"xml_output_path",
")",
":",
"compound",
"=",
"dfile",
".",
"compound",
"comp_name",
"=",
"compound",
".",
"get_compoundname",
"(",
")",
"#",
"# Step 1: generate cimport includes... | https://github.com/OpenMS/OpenMS/blob/9fd86bbc406ee390f3b7cb640f38d63695b33b59/tools/PythonExtensionChecker.py#L369-L517 | |
metashell/metashell | f4177e4854ea00c8dbc722cadab26ef413d798ea | 3rd/templight/llvm/utils/docker/scripts/llvm_checksum/llvm_checksum.py | python | ComputeLLVMChecksums | (root_path, projects) | return project_checksums | Compute checksums for LLVM sources checked out using svn.
Args:
root_path: a directory of llvm checkout.
projects: a list of LLVMProject instances, which describe checkout paths,
relative to root_path.
Returns:
A dict mapping from project name to project checksum. | Compute checksums for LLVM sources checked out using svn. | [
"Compute",
"checksums",
"for",
"LLVM",
"sources",
"checked",
"out",
"using",
"svn",
"."
] | def ComputeLLVMChecksums(root_path, projects):
"""Compute checksums for LLVM sources checked out using svn.
Args:
root_path: a directory of llvm checkout.
projects: a list of LLVMProject instances, which describe checkout paths,
relative to root_path.
Returns:
A dict mapping from project name ... | [
"def",
"ComputeLLVMChecksums",
"(",
"root_path",
",",
"projects",
")",
":",
"hash_algo",
"=",
"hashlib",
".",
"sha256",
"def",
"collapse_svn_substitutions",
"(",
"contents",
")",
":",
"# Replace svn substitutions for $Date$ and $LastChangedDate$.",
"# Unfortunately, these are... | https://github.com/metashell/metashell/blob/f4177e4854ea00c8dbc722cadab26ef413d798ea/3rd/templight/llvm/utils/docker/scripts/llvm_checksum/llvm_checksum.py#L68-L128 | |
interpretml/interpret | 29466bffc04505fe4f836a83fcfebfd313ac8454 | python/interpret-core/interpret/glassbox/ebm/bin.py | python | EBMPreprocessor.fit_transform | (self, X, y=None, sample_weight=None) | return self.fit(X, y, sample_weight).transform(X) | Fits and Transform on provided samples.
Args:
X: Numpy array for samples.
y: Unused. Only included for scikit-learn compatibility
sample_weight: Per-sample weights
Returns:
Transformed numpy array. | Fits and Transform on provided samples. | [
"Fits",
"and",
"Transform",
"on",
"provided",
"samples",
"."
] | def fit_transform(self, X, y=None, sample_weight=None):
""" Fits and Transform on provided samples.
Args:
X: Numpy array for samples.
y: Unused. Only included for scikit-learn compatibility
sample_weight: Per-sample weights
Returns:
Transformed n... | [
"def",
"fit_transform",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
",",
"sample_weight",
"=",
"None",
")",
":",
"X",
",",
"_",
"=",
"clean_X",
"(",
"X",
")",
"# materialize any iterators first",
"return",
"self",
".",
"fit",
"(",
"X",
",",
"y",
",... | https://github.com/interpretml/interpret/blob/29466bffc04505fe4f836a83fcfebfd313ac8454/python/interpret-core/interpret/glassbox/ebm/bin.py#L1794-L1807 | |
lrjconan/GRAN | 43cb4433e6f69401c3a4a6e946ea75da6ec35d72 | model/gran_mixture_bernoulli.py | python | mixture_bernoulli_loss | (label, log_theta, log_alpha, adj_loss_func,
subgraph_idx, subgraph_idx_base, num_canonical_order,
sum_order_log_prob=False, return_neg_log_prob=False, reduction="mean") | Compute likelihood for mixture of Bernoulli model
Args:
label: E X 1, see comments above
log_theta: E X D, see comments above
log_alpha: E X D, see comments above
adj_loss_func: BCE loss
subgraph_idx: E X 1, see comments above
subgraph_idx_base: B+1, cumulative # of edges in the... | Compute likelihood for mixture of Bernoulli model | [
"Compute",
"likelihood",
"for",
"mixture",
"of",
"Bernoulli",
"model"
] | def mixture_bernoulli_loss(label, log_theta, log_alpha, adj_loss_func,
subgraph_idx, subgraph_idx_base, num_canonical_order,
sum_order_log_prob=False, return_neg_log_prob=False, reduction="mean"):
"""
Compute likelihood for mixture of Bernoulli model
Arg... | [
"def",
"mixture_bernoulli_loss",
"(",
"label",
",",
"log_theta",
",",
"log_alpha",
",",
"adj_loss_func",
",",
"subgraph_idx",
",",
"subgraph_idx_base",
",",
"num_canonical_order",
",",
"sum_order_log_prob",
"=",
"False",
",",
"return_neg_log_prob",
"=",
"False",
",",
... | https://github.com/lrjconan/GRAN/blob/43cb4433e6f69401c3a4a6e946ea75da6ec35d72/model/gran_mixture_bernoulli.py#L461-L550 | ||
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/contrib/learn/python/learn/datasets/mnist.py | python | DataSet.next_batch | (self, batch_size, fake_data=False) | return self._images[start:end], self._labels[start:end] | Return the next `batch_size` examples from this data set. | Return the next `batch_size` examples from this data set. | [
"Return",
"the",
"next",
"batch_size",
"examples",
"from",
"this",
"data",
"set",
"."
] | def next_batch(self, batch_size, fake_data=False):
"""Return the next `batch_size` examples from this data set."""
if fake_data:
fake_image = [1] * 784
if self.one_hot:
fake_label = [1] + [0] * 9
else:
fake_label = 0
return [fake_image for _ in xrange(batch_size)], [
... | [
"def",
"next_batch",
"(",
"self",
",",
"batch_size",
",",
"fake_data",
"=",
"False",
")",
":",
"if",
"fake_data",
":",
"fake_image",
"=",
"[",
"1",
"]",
"*",
"784",
"if",
"self",
".",
"one_hot",
":",
"fake_label",
"=",
"[",
"1",
"]",
"+",
"[",
"0",... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/contrib/learn/python/learn/datasets/mnist.py#L138-L164 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/posixpath.py | python | join | (a, *p) | return path | Join two or more pathname components, inserting '/' as needed.
If any component is an absolute path, all previous path components
will be discarded. An empty last part will result in a path that
ends with a separator. | Join two or more pathname components, inserting '/' as needed.
If any component is an absolute path, all previous path components
will be discarded. An empty last part will result in a path that
ends with a separator. | [
"Join",
"two",
"or",
"more",
"pathname",
"components",
"inserting",
"/",
"as",
"needed",
".",
"If",
"any",
"component",
"is",
"an",
"absolute",
"path",
"all",
"previous",
"path",
"components",
"will",
"be",
"discarded",
".",
"An",
"empty",
"last",
"part",
... | def join(a, *p):
"""Join two or more pathname components, inserting '/' as needed.
If any component is an absolute path, all previous path components
will be discarded. An empty last part will result in a path that
ends with a separator."""
path = a
for b in p:
if b.startswith('/'):
... | [
"def",
"join",
"(",
"a",
",",
"*",
"p",
")",
":",
"path",
"=",
"a",
"for",
"b",
"in",
"p",
":",
"if",
"b",
".",
"startswith",
"(",
"'/'",
")",
":",
"path",
"=",
"b",
"elif",
"path",
"==",
"''",
"or",
"path",
".",
"endswith",
"(",
"'/'",
")"... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/posixpath.py#L68-L81 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/telemetry/internal/platform/android_platform_backend.py | python | AndroidPlatformBackend.SetDebugApp | (self, package) | Set application to debugging.
Args:
package: The full package name string of the application. | Set application to debugging. | [
"Set",
"application",
"to",
"debugging",
"."
] | def SetDebugApp(self, package):
"""Set application to debugging.
Args:
package: The full package name string of the application.
"""
if self._device.IsUserBuild():
logging.debug('User build device, setting debug app')
self._device.RunShellCommand(
['am', 'set-debug-app', '--... | [
"def",
"SetDebugApp",
"(",
"self",
",",
"package",
")",
":",
"if",
"self",
".",
"_device",
".",
"IsUserBuild",
"(",
")",
":",
"logging",
".",
"debug",
"(",
"'User build device, setting debug app'",
")",
"self",
".",
"_device",
".",
"RunShellCommand",
"(",
"[... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/telemetry/internal/platform/android_platform_backend.py#L642-L651 | ||
OAID/Tengine | 66b2c22ad129d25e2fc6de3b22a608bb54dd90db | tools/align_tool/align_with_onnx.py | python | AlignOnnx._align_by_layer | (self, outputs, result) | align output by layers
:param outputs:
:param result:
:return: | align output by layers
:param outputs:
:param result:
:return: | [
"align",
"output",
"by",
"layers",
":",
"param",
"outputs",
":",
":",
"param",
"result",
":",
":",
"return",
":"
] | def _align_by_layer(self, outputs, result):
"""
align output by layers
:param outputs:
:param result:
:return:
"""
print('-------------------------------------------------')
tm_txt_list = os.listdir(self.tengine_output_path)
check_make_folder(self.... | [
"def",
"_align_by_layer",
"(",
"self",
",",
"outputs",
",",
"result",
")",
":",
"print",
"(",
"'-------------------------------------------------'",
")",
"tm_txt_list",
"=",
"os",
".",
"listdir",
"(",
"self",
".",
"tengine_output_path",
")",
"check_make_folder",
"("... | https://github.com/OAID/Tengine/blob/66b2c22ad129d25e2fc6de3b22a608bb54dd90db/tools/align_tool/align_with_onnx.py#L252-L297 | ||
domino-team/openwrt-cc | 8b181297c34d14d3ca521cc9f31430d561dbc688 | package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/npm/node_modules/node-gyp/gyp/tools/pretty_gyp.py | python | prettyprint_input | (lines) | Does the main work of indenting the input based on the brace counts. | Does the main work of indenting the input based on the brace counts. | [
"Does",
"the",
"main",
"work",
"of",
"indenting",
"the",
"input",
"based",
"on",
"the",
"brace",
"counts",
"."
] | def prettyprint_input(lines):
"""Does the main work of indenting the input based on the brace counts."""
indent = 0
basic_offset = 2
last_line = ""
for line in lines:
if COMMENT_RE.match(line):
print line
else:
line = line.strip('\r\n\t ') # Otherwise doesn't strip \r on Unix.
if le... | [
"def",
"prettyprint_input",
"(",
"lines",
")",
":",
"indent",
"=",
"0",
"basic_offset",
"=",
"2",
"last_line",
"=",
"\"\"",
"for",
"line",
"in",
"lines",
":",
"if",
"COMMENT_RE",
".",
"match",
"(",
"line",
")",
":",
"print",
"line",
"else",
":",
"line"... | https://github.com/domino-team/openwrt-cc/blob/8b181297c34d14d3ca521cc9f31430d561dbc688/package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/npm/node_modules/node-gyp/gyp/tools/pretty_gyp.py#L115-L138 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/_osx_support.py | python | customize_config_vars | (_config_vars) | return _config_vars | Customize Python build configuration variables.
Called internally from sysconfig with a mutable mapping
containing name/value pairs parsed from the configured
makefile used to build this interpreter. Returns
the mapping updated as needed to reflect the environment
in which the interpreter is runni... | Customize Python build configuration variables. | [
"Customize",
"Python",
"build",
"configuration",
"variables",
"."
] | def customize_config_vars(_config_vars):
"""Customize Python build configuration variables.
Called internally from sysconfig with a mutable mapping
containing name/value pairs parsed from the configured
makefile used to build this interpreter. Returns
the mapping updated as needed to reflect the e... | [
"def",
"customize_config_vars",
"(",
"_config_vars",
")",
":",
"if",
"not",
"_supports_universal_builds",
"(",
")",
":",
"# On Mac OS X before 10.4, check if -arch and -isysroot",
"# are in CFLAGS or LDFLAGS and remove them if they are.",
"# This is needed when building extensions on a 1... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/_osx_support.py#L362-L400 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/img2py.py | python | img2py | (image_file, python_file,
append=DEFAULT_APPEND,
compressed=DEFAULT_COMPRESSED,
maskClr=DEFAULT_MASKCLR,
imgName=DEFAULT_IMGNAME,
icon=DEFAULT_ICON,
catalog=DEFAULT_CATALOG,
functionCompatible=DEFAULT_COMPATIBLE,
functionCompatibile... | Converts an image file to a data structure written in a Python file
--image_file: string; the path of the source image file
--python_file: string; the path of the destination python file
--other arguments: they are equivalent to the command-line arguments | Converts an image file to a data structure written in a Python file
--image_file: string; the path of the source image file
--python_file: string; the path of the destination python file
--other arguments: they are equivalent to the command-line arguments | [
"Converts",
"an",
"image",
"file",
"to",
"a",
"data",
"structure",
"written",
"in",
"a",
"Python",
"file",
"--",
"image_file",
":",
"string",
";",
"the",
"path",
"of",
"the",
"source",
"image",
"file",
"--",
"python_file",
":",
"string",
";",
"the",
"pat... | def img2py(image_file, python_file,
append=DEFAULT_APPEND,
compressed=DEFAULT_COMPRESSED,
maskClr=DEFAULT_MASKCLR,
imgName=DEFAULT_IMGNAME,
icon=DEFAULT_ICON,
catalog=DEFAULT_CATALOG,
functionCompatible=DEFAULT_COMPATIBLE,
functionC... | [
"def",
"img2py",
"(",
"image_file",
",",
"python_file",
",",
"append",
"=",
"DEFAULT_APPEND",
",",
"compressed",
"=",
"DEFAULT_COMPRESSED",
",",
"maskClr",
"=",
"DEFAULT_MASKCLR",
",",
"imgName",
"=",
"DEFAULT_IMGNAME",
",",
"icon",
"=",
"DEFAULT_ICON",
",",
"ca... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/img2py.py#L127-L266 | ||
okex/V3-Open-API-SDK | c5abb0db7e2287718e0055e17e57672ce0ec7fd9 | okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_vendor/distlib/database.py | python | DependencyGraph.topological_sort | (self) | return result, list(alist.keys()) | Perform a topological sort of the graph.
:return: A tuple, the first element of which is a topologically sorted
list of distributions, and the second element of which is a
list of distributions that cannot be sorted because they have
circular dependencies and s... | Perform a topological sort of the graph.
:return: A tuple, the first element of which is a topologically sorted
list of distributions, and the second element of which is a
list of distributions that cannot be sorted because they have
circular dependencies and s... | [
"Perform",
"a",
"topological",
"sort",
"of",
"the",
"graph",
".",
":",
"return",
":",
"A",
"tuple",
"the",
"first",
"element",
"of",
"which",
"is",
"a",
"topologically",
"sorted",
"list",
"of",
"distributions",
"and",
"the",
"second",
"element",
"of",
"whi... | def topological_sort(self):
"""
Perform a topological sort of the graph.
:return: A tuple, the first element of which is a topologically sorted
list of distributions, and the second element of which is a
list of distributions that cannot be sorted because they h... | [
"def",
"topological_sort",
"(",
"self",
")",
":",
"result",
"=",
"[",
"]",
"# Make a shallow copy of the adjacency list",
"alist",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"self",
".",
"adjacency_list",
".",
"items",
"(",
")",
":",
"alist",
"[",
"k",
"... | https://github.com/okex/V3-Open-API-SDK/blob/c5abb0db7e2287718e0055e17e57672ce0ec7fd9/okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_vendor/distlib/database.py#L1186-L1215 | |
hakuna-m/wubiuefi | caec1af0a09c78fd5a345180ada1fe45e0c63493 | src/pypack/modulegraph/pkg_resources.py | python | Requirement.__init__ | (self, project_name, specs, extras) | DO NOT CALL THIS UNDOCUMENTED METHOD; use Requirement.parse()! | DO NOT CALL THIS UNDOCUMENTED METHOD; use Requirement.parse()! | [
"DO",
"NOT",
"CALL",
"THIS",
"UNDOCUMENTED",
"METHOD",
";",
"use",
"Requirement",
".",
"parse",
"()",
"!"
] | def __init__(self, project_name, specs, extras):
"""DO NOT CALL THIS UNDOCUMENTED METHOD; use Requirement.parse()!"""
self.unsafe_name, project_name = project_name, safe_name(project_name)
self.project_name, self.key = project_name, project_name.lower()
index = [(parse_version(v),state_m... | [
"def",
"__init__",
"(",
"self",
",",
"project_name",
",",
"specs",
",",
"extras",
")",
":",
"self",
".",
"unsafe_name",
",",
"project_name",
"=",
"project_name",
",",
"safe_name",
"(",
"project_name",
")",
"self",
".",
"project_name",
",",
"self",
".",
"ke... | https://github.com/hakuna-m/wubiuefi/blob/caec1af0a09c78fd5a345180ada1fe45e0c63493/src/pypack/modulegraph/pkg_resources.py#L2113-L2125 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.