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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/lib-tk/Tix.py | python | Tree.getmode | (self, entrypath) | return self.tk.call(self._w, 'getmode', entrypath) | Returns the current mode of the entry given by entryPath. | Returns the current mode of the entry given by entryPath. | [
"Returns",
"the",
"current",
"mode",
"of",
"the",
"entry",
"given",
"by",
"entryPath",
"."
] | def getmode(self, entrypath):
'''Returns the current mode of the entry given by entryPath.'''
return self.tk.call(self._w, 'getmode', entrypath) | [
"def",
"getmode",
"(",
"self",
",",
"entrypath",
")",
":",
"return",
"self",
".",
"tk",
".",
"call",
"(",
"self",
".",
"_w",
",",
"'getmode'",
",",
"entrypath",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/lib-tk/Tix.py#L1529-L1531 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/debug/lib/debug_gradients.py | python | GradientsDebugger.gradient_tensor | (self, x_tensor) | return self._gradient_tensors[x_tensor_name] | Get the gradient tensor of an x-tensor.
Args:
x_tensor: (`tf.Tensor`, `tf.Variable` or `str`) The x-tensor object or its
name. x-tensor refers to the independent `tf.Tensor`, i.e., the tensor
on the denominator of the differentiation.
Returns:
If found, the gradient tensor.
Ra... | Get the gradient tensor of an x-tensor. | [
"Get",
"the",
"gradient",
"tensor",
"of",
"an",
"x",
"-",
"tensor",
"."
] | def gradient_tensor(self, x_tensor):
"""Get the gradient tensor of an x-tensor.
Args:
x_tensor: (`tf.Tensor`, `tf.Variable` or `str`) The x-tensor object or its
name. x-tensor refers to the independent `tf.Tensor`, i.e., the tensor
on the denominator of the differentiation.
Returns:
... | [
"def",
"gradient_tensor",
"(",
"self",
",",
"x_tensor",
")",
":",
"x_tensor_name",
"=",
"self",
".",
"_get_tensor_name",
"(",
"x_tensor",
")",
"if",
"x_tensor_name",
"not",
"in",
"self",
".",
"_gradient_tensors",
":",
"raise",
"LookupError",
"(",
"\"This Gradien... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/debug/lib/debug_gradients.py#L314-L335 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/ros/roslib/src/roslib/network.py | python | is_local_address | (hostname) | return True | @param hostname: host name/address
@type hostname: str
@return True: if hostname maps to a local address, False otherwise. False conditions include invalid hostnames. | [] | def is_local_address(hostname):
"""
@param hostname: host name/address
@type hostname: str
@return True: if hostname maps to a local address, False otherwise. False conditions include invalid hostnames.
"""
try:
reverse_ip = socket.gethostbyname(hostname)
except socket.error:
... | [
"def",
"is_local_address",
"(",
"hostname",
")",
":",
"try",
":",
"reverse_ip",
"=",
"socket",
".",
"gethostbyname",
"(",
"hostname",
")",
"except",
"socket",
".",
"error",
":",
"return",
"False",
"# 127. check is due to #1260",
"if",
"reverse_ip",
"not",
"in",
... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros/roslib/src/roslib/network.py#L116-L129 | ||
hpi-xnor/BMXNet | ed0b201da6667887222b8e4b5f997c4f6b61943d | python/mxnet/engine.py | python | bulk | (size) | return _BulkScope(size) | Bulk execution bundles many operators to run together.
This can improve performance when running a lot of small
operators sequentially.
Returns a scope for managing bulk size::
with mx.engine.bulk(10):
x = mx.nd.zeros((1,))
for i in range(100):
x += 1 | Bulk execution bundles many operators to run together.
This can improve performance when running a lot of small
operators sequentially. | [
"Bulk",
"execution",
"bundles",
"many",
"operators",
"to",
"run",
"together",
".",
"This",
"can",
"improve",
"performance",
"when",
"running",
"a",
"lot",
"of",
"small",
"operators",
"sequentially",
"."
] | def bulk(size):
"""Bulk execution bundles many operators to run together.
This can improve performance when running a lot of small
operators sequentially.
Returns a scope for managing bulk size::
with mx.engine.bulk(10):
x = mx.nd.zeros((1,))
for i in range(100):
... | [
"def",
"bulk",
"(",
"size",
")",
":",
"return",
"_BulkScope",
"(",
"size",
")"
] | https://github.com/hpi-xnor/BMXNet/blob/ed0b201da6667887222b8e4b5f997c4f6b61943d/python/mxnet/engine.py#L63-L75 | |
NVIDIA/MDL-SDK | aa9642b2546ad7b6236b5627385d882c2ed83c5d | src/mdl/jit/llvm/dist/utils/lit/lit/run.py | python | Run.consume_test_result | (self, pool_result) | Test completion callback for worker_run_one_test
Updates the test result status in the parent process. Each task in the
pool returns the test index and the result, and we use the index to look
up the original test object. Also updates the progress bar as tasks
complete. | Test completion callback for worker_run_one_test | [
"Test",
"completion",
"callback",
"for",
"worker_run_one_test"
] | def consume_test_result(self, pool_result):
"""Test completion callback for worker_run_one_test
Updates the test result status in the parent process. Each task in the
pool returns the test index and the result, and we use the index to look
up the original test object. Also updates the p... | [
"def",
"consume_test_result",
"(",
"self",
",",
"pool_result",
")",
":",
"# Don't add any more test results after we've hit the maximum failure",
"# count. Otherwise we're racing with the main thread, which is going",
"# to terminate the process pool soon.",
"if",
"self",
".",
"hit_max_... | https://github.com/NVIDIA/MDL-SDK/blob/aa9642b2546ad7b6236b5627385d882c2ed83c5d/src/mdl/jit/llvm/dist/utils/lit/lit/run.py#L159-L186 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/operations/math_ops.py | python | NMSWithMask.__init__ | (self, iou_threshold=0.5) | Initialize NMSWithMask | Initialize NMSWithMask | [
"Initialize",
"NMSWithMask"
] | def __init__(self, iou_threshold=0.5):
"""Initialize NMSWithMask"""
validator.check_value_type("iou_threshold", iou_threshold, [float], self.name)
self.init_prim_io_names(inputs=['bboxes'], outputs=['selected_boxes', 'selected_idx', 'selected_mask'])
self.is_ge = context.get_context("ena... | [
"def",
"__init__",
"(",
"self",
",",
"iou_threshold",
"=",
"0.5",
")",
":",
"validator",
".",
"check_value_type",
"(",
"\"iou_threshold\"",
",",
"iou_threshold",
",",
"[",
"float",
"]",
",",
"self",
".",
"name",
")",
"self",
".",
"init_prim_io_names",
"(",
... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/operations/math_ops.py#L4527-L4531 | ||
serguei-k/maya-math-nodes | 669ace5366356c6038ef63ba7d5574f18a583ae9 | python/maya_math_nodes/expression_parser.py | python | Number.__init__ | (self, value, is_angle=False) | Initialize AST node
Args:
value (int | float | list[float]): Value held by this AST node
is_angle (bool): Treat value as angle type | Initialize AST node | [
"Initialize",
"AST",
"node"
] | def __init__(self, value, is_angle=False):
"""Initialize AST node
Args:
value (int | float | list[float]): Value held by this AST node
is_angle (bool): Treat value as angle type
"""
self.value = value
if isinstance(value, list):
if len(value)... | [
"def",
"__init__",
"(",
"self",
",",
"value",
",",
"is_angle",
"=",
"False",
")",
":",
"self",
".",
"value",
"=",
"value",
"if",
"isinstance",
"(",
"value",
",",
"list",
")",
":",
"if",
"len",
"(",
"value",
")",
"==",
"3",
":",
"if",
"is_angle",
... | https://github.com/serguei-k/maya-math-nodes/blob/669ace5366356c6038ef63ba7d5574f18a583ae9/python/maya_math_nodes/expression_parser.py#L8-L32 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/asyncio/futures.py | python | Future.__init__ | (self, *, loop=None) | Initialize the future.
The optional event_loop argument allows explicitly setting the event
loop object used by the future. If it's not provided, the future uses
the default event loop. | Initialize the future. | [
"Initialize",
"the",
"future",
"."
] | def __init__(self, *, loop=None):
"""Initialize the future.
The optional event_loop argument allows explicitly setting the event
loop object used by the future. If it's not provided, the future uses
the default event loop.
"""
if loop is None:
self._loop = ev... | [
"def",
"__init__",
"(",
"self",
",",
"*",
",",
"loop",
"=",
"None",
")",
":",
"if",
"loop",
"is",
"None",
":",
"self",
".",
"_loop",
"=",
"events",
".",
"get_event_loop",
"(",
")",
"else",
":",
"self",
".",
"_loop",
"=",
"loop",
"self",
".",
"_ca... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/asyncio/futures.py#L71-L85 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/jedi/jedi/evaluate/imports.py | python | Importer.str_import_path | (self) | return tuple(
name.value if isinstance(name, tree.Name) else name
for name in self.import_path
) | Returns the import path as pure strings instead of `Name`. | Returns the import path as pure strings instead of `Name`. | [
"Returns",
"the",
"import",
"path",
"as",
"pure",
"strings",
"instead",
"of",
"Name",
"."
] | def str_import_path(self):
"""Returns the import path as pure strings instead of `Name`."""
return tuple(
name.value if isinstance(name, tree.Name) else name
for name in self.import_path
) | [
"def",
"str_import_path",
"(",
"self",
")",
":",
"return",
"tuple",
"(",
"name",
".",
"value",
"if",
"isinstance",
"(",
"name",
",",
"tree",
".",
"Name",
")",
"else",
"name",
"for",
"name",
"in",
"self",
".",
"import_path",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/jedi/jedi/evaluate/imports.py#L259-L264 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython-genutils/ipython_genutils/ipstruct.py | python | Struct.__iadd__ | (self, other) | return self | s += s2 is a shorthand for s.merge(s2).
Examples
--------
>>> s = Struct(a=10,b=30)
>>> s2 = Struct(a=20,c=40)
>>> s += s2
>>> sorted(s.keys())
['a', 'b', 'c'] | s += s2 is a shorthand for s.merge(s2). | [
"s",
"+",
"=",
"s2",
"is",
"a",
"shorthand",
"for",
"s",
".",
"merge",
"(",
"s2",
")",
"."
] | def __iadd__(self, other):
"""s += s2 is a shorthand for s.merge(s2).
Examples
--------
>>> s = Struct(a=10,b=30)
>>> s2 = Struct(a=20,c=40)
>>> s += s2
>>> sorted(s.keys())
['a', 'b', 'c']
"""
self.merge(other)
return self | [
"def",
"__iadd__",
"(",
"self",
",",
"other",
")",
":",
"self",
".",
"merge",
"(",
"other",
")",
"return",
"self"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython-genutils/ipython_genutils/ipstruct.py#L138-L151 | |
FlightGear/flightgear | cf4801e11c5b69b107f87191584eefda3c5a9b26 | scripts/python/TerraSync/terrasync/virtual_path.py | python | VirtualPath.suffix | (self) | return name[pos:] if pos != -1 else '' | The extension of the final component, if any.
>>> VirtualPath('/my/library/setup.py').suffix
'.py'
>>> VirtualPath('/my/library.tar.gz').suffix
'.gz'
>>> VirtualPath('/my/library').suffix
'' | The extension of the final component, if any. | [
"The",
"extension",
"of",
"the",
"final",
"component",
"if",
"any",
"."
] | def suffix(self):
"""The extension of the final component, if any.
>>> VirtualPath('/my/library/setup.py').suffix
'.py'
>>> VirtualPath('/my/library.tar.gz').suffix
'.gz'
>>> VirtualPath('/my/library').suffix
''
"""
name = self.name
pos =... | [
"def",
"suffix",
"(",
"self",
")",
":",
"name",
"=",
"self",
".",
"name",
"pos",
"=",
"name",
".",
"rfind",
"(",
"'.'",
")",
"return",
"name",
"[",
"pos",
":",
"]",
"if",
"pos",
"!=",
"-",
"1",
"else",
"''"
] | https://github.com/FlightGear/flightgear/blob/cf4801e11c5b69b107f87191584eefda3c5a9b26/scripts/python/TerraSync/terrasync/virtual_path.py#L299-L312 | |
smilehao/xlua-framework | a03801538be2b0e92d39332d445b22caca1ef61f | ConfigData/trunk/tools/protobuf-2.5.0/protobuf-2.5.0/python/build/lib/google/protobuf/internal/enum_type_wrapper.py | python | EnumTypeWrapper.Name | (self, number) | Returns a string containing the name of an enum value. | Returns a string containing the name of an enum value. | [
"Returns",
"a",
"string",
"containing",
"the",
"name",
"of",
"an",
"enum",
"value",
"."
] | def Name(self, number):
"""Returns a string containing the name of an enum value."""
if number in self._enum_type.values_by_number:
return self._enum_type.values_by_number[number].name
raise ValueError('Enum %s has no name defined for value %d' % (
self._enum_type.name, number)) | [
"def",
"Name",
"(",
"self",
",",
"number",
")",
":",
"if",
"number",
"in",
"self",
".",
"_enum_type",
".",
"values_by_number",
":",
"return",
"self",
".",
"_enum_type",
".",
"values_by_number",
"[",
"number",
"]",
".",
"name",
"raise",
"ValueError",
"(",
... | https://github.com/smilehao/xlua-framework/blob/a03801538be2b0e92d39332d445b22caca1ef61f/ConfigData/trunk/tools/protobuf-2.5.0/protobuf-2.5.0/python/build/lib/google/protobuf/internal/enum_type_wrapper.py#L51-L56 | ||
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/jar.py | python | Jar | (env, target = None, source = [], *args, **kw) | return env.JarFile(target = target, source = target_nodes, *args, **kw) | A pseudo-Builder wrapper around the separate Jar sources{File,Dir}
Builders. | A pseudo-Builder wrapper around the separate Jar sources{File,Dir}
Builders. | [
"A",
"pseudo",
"-",
"Builder",
"wrapper",
"around",
"the",
"separate",
"Jar",
"sources",
"{",
"File",
"Dir",
"}",
"Builders",
"."
] | def Jar(env, target = None, source = [], *args, **kw):
"""
A pseudo-Builder wrapper around the separate Jar sources{File,Dir}
Builders.
"""
# jar target should not be a list so assume they passed
# no target and want implicit target to be made and the arg
# was actaully the list of sources
... | [
"def",
"Jar",
"(",
"env",
",",
"target",
"=",
"None",
",",
"source",
"=",
"[",
"]",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"# jar target should not be a list so assume they passed",
"# no target and want implicit target to be made and the arg",
"# was actaul... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/jar.py#L94-L199 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/third_party/web-page-replay/third_party/dns/rdataclass.py | python | from_text | (text) | return value | Convert text into a DNS rdata class value.
@param text: the text
@type text: string
@rtype: int
@raises dns.rdataclass.UnknownRdataClass: the class is unknown
@raises ValueError: the rdata class value is not >= 0 and <= 65535 | Convert text into a DNS rdata class value. | [
"Convert",
"text",
"into",
"a",
"DNS",
"rdata",
"class",
"value",
"."
] | def from_text(text):
"""Convert text into a DNS rdata class value.
@param text: the text
@type text: string
@rtype: int
@raises dns.rdataclass.UnknownRdataClass: the class is unknown
@raises ValueError: the rdata class value is not >= 0 and <= 65535
"""
value = _by_text.get(text.upper()... | [
"def",
"from_text",
"(",
"text",
")",
":",
"value",
"=",
"_by_text",
".",
"get",
"(",
"text",
".",
"upper",
"(",
")",
")",
"if",
"value",
"is",
"None",
":",
"match",
"=",
"_unknown_class_pattern",
".",
"match",
"(",
"text",
")",
"if",
"match",
"==",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/third_party/web-page-replay/third_party/dns/rdataclass.py#L72-L89 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/scipy/signal/lti_conversion.py | python | abcd_normalize | (A=None, B=None, C=None, D=None) | return A, B, C, D | Check state-space matrices and ensure they are two-dimensional.
If enough information on the system is provided, that is, enough
properly-shaped arrays are passed to the function, the missing ones
are built from this information, ensuring the correct number of
rows and columns. Otherwise a ValueError i... | Check state-space matrices and ensure they are two-dimensional. | [
"Check",
"state",
"-",
"space",
"matrices",
"and",
"ensure",
"they",
"are",
"two",
"-",
"dimensional",
"."
] | def abcd_normalize(A=None, B=None, C=None, D=None):
"""Check state-space matrices and ensure they are two-dimensional.
If enough information on the system is provided, that is, enough
properly-shaped arrays are passed to the function, the missing ones
are built from this information, ensuring the corre... | [
"def",
"abcd_normalize",
"(",
"A",
"=",
"None",
",",
"B",
"=",
"None",
",",
"C",
"=",
"None",
",",
"D",
"=",
"None",
")",
":",
"A",
",",
"B",
",",
"C",
",",
"D",
"=",
"map",
"(",
"_atleast_2d_or_none",
",",
"(",
"A",
",",
"B",
",",
"C",
","... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/signal/lti_conversion.py#L151-L195 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py3/sklearn/model_selection/_validation.py | python | _shuffle | (y, groups, random_state) | return _safe_indexing(y, indices) | Return a shuffled copy of y eventually shuffle among same groups. | Return a shuffled copy of y eventually shuffle among same groups. | [
"Return",
"a",
"shuffled",
"copy",
"of",
"y",
"eventually",
"shuffle",
"among",
"same",
"groups",
"."
] | def _shuffle(y, groups, random_state):
"""Return a shuffled copy of y eventually shuffle among same groups."""
if groups is None:
indices = random_state.permutation(len(y))
else:
indices = np.arange(len(groups))
for group in np.unique(groups):
this_mask = (groups == group... | [
"def",
"_shuffle",
"(",
"y",
",",
"groups",
",",
"random_state",
")",
":",
"if",
"groups",
"is",
"None",
":",
"indices",
"=",
"random_state",
".",
"permutation",
"(",
"len",
"(",
"y",
")",
")",
"else",
":",
"indices",
"=",
"np",
".",
"arange",
"(",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/model_selection/_validation.py#L1068-L1077 | |
RoboJackets/robocup-software | bce13ce53ddb2ecb9696266d980722c34617dc15 | rj_gameplay/rj_gameplay/situation/decision_tree/analyzer.py | python | Analyzer.analyze_situation | (
self, world_state: stp.rc.WorldState
) | Returns the best situation for the current world state based on a hardcoded
decision tree.
:param world_state: The current state of the world.
:param game_info: The information about the state of the game.
:return: The best situation for the current world state. | Returns the best situation for the current world state based on a hardcoded
decision tree.
:param world_state: The current state of the world.
:param game_info: The information about the state of the game.
:return: The best situation for the current world state. | [
"Returns",
"the",
"best",
"situation",
"for",
"the",
"current",
"world",
"state",
"based",
"on",
"a",
"hardcoded",
"decision",
"tree",
".",
":",
"param",
"world_state",
":",
"The",
"current",
"state",
"of",
"the",
"world",
".",
":",
"param",
"game_info",
"... | def analyze_situation(
self, world_state: stp.rc.WorldState
) -> stp.situation.ISituation:
"""Returns the best situation for the current world state based on a hardcoded
decision tree.
:param world_state: The current state of the world.
:param game_info: The information about... | [
"def",
"analyze_situation",
"(",
"self",
",",
"world_state",
":",
"stp",
".",
"rc",
".",
"WorldState",
")",
"->",
"stp",
".",
"situation",
".",
"ISituation",
":",
"game_info",
"=",
"world_state",
".",
"game_info",
"heuristics",
"=",
"HeuristicInformation",
"("... | https://github.com/RoboJackets/robocup-software/blob/bce13ce53ddb2ecb9696266d980722c34617dc15/rj_gameplay/rj_gameplay/situation/decision_tree/analyzer.py#L164-L181 | ||
google/nucleus | 68d3947fafba1337f294c0668a6e1c7f3f1273e3 | nucleus/util/vis.py | python | locus_id_with_alt | (example) | return '{}_{}'.format(locus_id, alt) | Get complete locus ID from a DeepVariant example.
Args:
example: a DeepVariant make_examples output example.
Returns:
str in the form "chr:pos_ref_alt. | Get complete locus ID from a DeepVariant example. | [
"Get",
"complete",
"locus",
"ID",
"from",
"a",
"DeepVariant",
"example",
"."
] | def locus_id_with_alt(example):
"""Get complete locus ID from a DeepVariant example.
Args:
example: a DeepVariant make_examples output example.
Returns:
str in the form "chr:pos_ref_alt.
"""
variant = variant_from_example(example)
locus_id = locus_id_from_variant(variant)
alt = alt_from_example(... | [
"def",
"locus_id_with_alt",
"(",
"example",
")",
":",
"variant",
"=",
"variant_from_example",
"(",
"example",
")",
"locus_id",
"=",
"locus_id_from_variant",
"(",
"variant",
")",
"alt",
"=",
"alt_from_example",
"(",
"example",
")",
"return",
"'{}_{}'",
".",
"form... | https://github.com/google/nucleus/blob/68d3947fafba1337f294c0668a6e1c7f3f1273e3/nucleus/util/vis.py#L547-L559 | |
floatlazer/semantic_slam | 657814a1ba484de6b7f6f9d07c564566c8121f13 | semantic_cloud/include/ptsemseg/utils.py | python | alpha_blend | (input_image, segmentation_mask, alpha=0.5) | return blended | Alpha Blending utility to overlay RGB masks on RBG images
:param input_image is a np.ndarray with 3 channels
:param segmentation_mask is a np.ndarray with 3 channels
:param alpha is a float value | Alpha Blending utility to overlay RGB masks on RBG images
:param input_image is a np.ndarray with 3 channels
:param segmentation_mask is a np.ndarray with 3 channels
:param alpha is a float value | [
"Alpha",
"Blending",
"utility",
"to",
"overlay",
"RGB",
"masks",
"on",
"RBG",
"images",
":",
"param",
"input_image",
"is",
"a",
"np",
".",
"ndarray",
"with",
"3",
"channels",
":",
"param",
"segmentation_mask",
"is",
"a",
"np",
".",
"ndarray",
"with",
"3",
... | def alpha_blend(input_image, segmentation_mask, alpha=0.5):
"""Alpha Blending utility to overlay RGB masks on RBG images
:param input_image is a np.ndarray with 3 channels
:param segmentation_mask is a np.ndarray with 3 channels
:param alpha is a float value
"""
blended = np.zeros(i... | [
"def",
"alpha_blend",
"(",
"input_image",
",",
"segmentation_mask",
",",
"alpha",
"=",
"0.5",
")",
":",
"blended",
"=",
"np",
".",
"zeros",
"(",
"input_image",
".",
"size",
",",
"dtype",
"=",
"np",
".",
"float32",
")",
"blended",
"=",
"input_image",
"*",... | https://github.com/floatlazer/semantic_slam/blob/657814a1ba484de6b7f6f9d07c564566c8121f13/semantic_cloud/include/ptsemseg/utils.py#L41-L50 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/array_grad.py | python | _SliceGrad | (op, grad) | return array_ops.pad(grad, paddings), None, None | Gradient for Slice op. | Gradient for Slice op. | [
"Gradient",
"for",
"Slice",
"op",
"."
] | def _SliceGrad(op, grad):
"""Gradient for Slice op."""
# Create an Nx2 padding where the first column represents how many
# zeros are to be prepended for each dimension, and the second
# column indicates how many zeros are appended.
#
# The number of zeros to append is the shape of the input
# elementwise... | [
"def",
"_SliceGrad",
"(",
"op",
",",
"grad",
")",
":",
"# Create an Nx2 padding where the first column represents how many",
"# zeros are to be prepended for each dimension, and the second",
"# column indicates how many zeros are appended.",
"#",
"# The number of zeros to append is the shape... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/array_grad.py#L236-L260 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_internal/utils/wheel.py | python | pkg_resources_distribution_for_wheel | (wheel_zip, name, location) | return DistInfoDistribution(
location=location, metadata=metadata, project_name=name
) | Get a pkg_resources distribution given a wheel.
:raises UnsupportedWheel: on any errors | Get a pkg_resources distribution given a wheel. | [
"Get",
"a",
"pkg_resources",
"distribution",
"given",
"a",
"wheel",
"."
] | def pkg_resources_distribution_for_wheel(wheel_zip, name, location):
# type: (ZipFile, str, str) -> Distribution
"""Get a pkg_resources distribution given a wheel.
:raises UnsupportedWheel: on any errors
"""
info_dir, _ = parse_wheel(wheel_zip, name)
metadata_files = [
p for p... | [
"def",
"pkg_resources_distribution_for_wheel",
"(",
"wheel_zip",
",",
"name",
",",
"location",
")",
":",
"# type: (ZipFile, str, str) -> Distribution",
"info_dir",
",",
"_",
"=",
"parse_wheel",
"(",
"wheel_zip",
",",
"name",
")",
"metadata_files",
"=",
"[",
"p",
"fo... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_internal/utils/wheel.py#L101-L169 | |
MegEngine/MegEngine | ce9ad07a27ec909fb8db4dd67943d24ba98fb93a | imperative/python/megengine/functional/elemwise.py | python | equal | (x, y) | return _elwise(x, y, mode=Elemwise.Mode.EQ) | r"""Element-wise `(x == y)`.
Examples:
.. testcode::
import numpy as np
from megengine import tensor
import megengine.functional as F
x = tensor(np.arange(0, 6, dtype=np.float32).reshape(2, 3))
y = tensor(np.arange(0, 6, dtype=np.float32).resha... | r"""Element-wise `(x == y)`. | [
"r",
"Element",
"-",
"wise",
"(",
"x",
"==",
"y",
")",
"."
] | def equal(x, y):
r"""Element-wise `(x == y)`.
Examples:
.. testcode::
import numpy as np
from megengine import tensor
import megengine.functional as F
x = tensor(np.arange(0, 6, dtype=np.float32).reshape(2, 3))
y = tensor(np.arange(0, 6, dt... | [
"def",
"equal",
"(",
"x",
",",
"y",
")",
":",
"return",
"_elwise",
"(",
"x",
",",
"y",
",",
"mode",
"=",
"Elemwise",
".",
"Mode",
".",
"EQ",
")"
] | https://github.com/MegEngine/MegEngine/blob/ce9ad07a27ec909fb8db4dd67943d24ba98fb93a/imperative/python/megengine/functional/elemwise.py#L467-L490 | |
monacoinproject/monacoin | 0d94a247eeabf0c1ed43ff1e1a62d115043a056e | src/crc32c/.ycm_extra_conf.py | python | FlagsForClangComplete | (file_path, build_root) | return clang_complete_flags | Reads the .clang_complete flags for a source file.
Args:
file_path: The path to the source file. Should be inside the project. Used
to locate the relevant .clang_complete file.
build_root: The current directory when running the Clang compiler for this
file. Should be an absolute path.
Return... | Reads the .clang_complete flags for a source file. | [
"Reads",
"the",
".",
"clang_complete",
"flags",
"for",
"a",
"source",
"file",
"."
] | def FlagsForClangComplete(file_path, build_root):
"""Reads the .clang_complete flags for a source file.
Args:
file_path: The path to the source file. Should be inside the project. Used
to locate the relevant .clang_complete file.
build_root: The current directory when running the Clang compiler for t... | [
"def",
"FlagsForClangComplete",
"(",
"file_path",
",",
"build_root",
")",
":",
"clang_complete_path",
"=",
"FindNearest",
"(",
"'.clang_complete'",
",",
"file_path",
",",
"build_root",
")",
"if",
"clang_complete_path",
"is",
"None",
":",
"return",
"None",
"clang_com... | https://github.com/monacoinproject/monacoin/blob/0d94a247eeabf0c1ed43ff1e1a62d115043a056e/src/crc32c/.ycm_extra_conf.py#L106-L122 | |
bh107/bohrium | 5b83e7117285fefc7779ed0e9acb0f8e74c7e068 | bridge/npbackend/bohrium/summations.py | python | prod | (a, axis=None, dtype=None, out=None) | Product of array elements over a given axis.
Parameters
----------
a : array_like
Elements to multiply.
axis : None or int or tuple of ints, optional
Axis or axes along which a multiply is performed.
The default (`axis` = `None`) is perform a multiply over all
the dimens... | Product of array elements over a given axis. | [
"Product",
"of",
"array",
"elements",
"over",
"a",
"given",
"axis",
"."
] | def prod(a, axis=None, dtype=None, out=None):
"""
Product of array elements over a given axis.
Parameters
----------
a : array_like
Elements to multiply.
axis : None or int or tuple of ints, optional
Axis or axes along which a multiply is performed.
The default (`axis` =... | [
"def",
"prod",
"(",
"a",
",",
"axis",
"=",
"None",
",",
"dtype",
"=",
"None",
",",
"out",
"=",
"None",
")",
":",
"if",
"not",
"bhary",
".",
"check",
"(",
"a",
")",
"and",
"not",
"bhary",
".",
"check",
"(",
"out",
")",
":",
"return",
"numpy",
... | https://github.com/bh107/bohrium/blob/5b83e7117285fefc7779ed0e9acb0f8e74c7e068/bridge/npbackend/bohrium/summations.py#L99-L164 | ||
gnina/gnina | b9ae032f52fc7a8153987bde09c0efa3620d8bb6 | caffe/scripts/cpp_lint.py | python | ProcessFile | (filename, vlevel, extra_check_functions=[]) | Does google-lint on a single file.
Args:
filename: The name of the file to parse.
vlevel: The level of errors to report. Every error of confidence
>= verbose_level will be reported. 0 is a good default.
extra_check_functions: An array of additional check functions that will be
... | Does google-lint on a single file. | [
"Does",
"google",
"-",
"lint",
"on",
"a",
"single",
"file",
"."
] | def ProcessFile(filename, vlevel, extra_check_functions=[]):
"""Does google-lint on a single file.
Args:
filename: The name of the file to parse.
vlevel: The level of errors to report. Every error of confidence
>= verbose_level will be reported. 0 is a good default.
extra_check_functions: An ar... | [
"def",
"ProcessFile",
"(",
"filename",
",",
"vlevel",
",",
"extra_check_functions",
"=",
"[",
"]",
")",
":",
"_SetVerboseLevel",
"(",
"vlevel",
")",
"try",
":",
"# Support the UNIX convention of using \"-\" for stdin. Note that",
"# we are not opening the file with universal... | https://github.com/gnina/gnina/blob/b9ae032f52fc7a8153987bde09c0efa3620d8bb6/caffe/scripts/cpp_lint.py#L4693-L4758 | ||
microsoft/EdgeML | ef9f8a77f096acbdeb941014791f8eda1c1bc35b | examples/pytorch/vision/Face_Detection/layers/bbox_utils.py | python | point_form | (boxes) | return torch.cat((boxes[:, :2] - boxes[:, 2:] / 2, # xmin, ymin
boxes[:, :2] + boxes[:, 2:] / 2), 1) | Convert prior_boxes to (xmin, ymin, xmax, ymax)
representation for comparison to point form ground truth data.
Args:
boxes: (tensor) center-size default boxes from priorbox layers.
Return:
boxes: (tensor) Converted xmin, ymin, xmax, ymax form of boxes. | Convert prior_boxes to (xmin, ymin, xmax, ymax)
representation for comparison to point form ground truth data.
Args:
boxes: (tensor) center-size default boxes from priorbox layers.
Return:
boxes: (tensor) Converted xmin, ymin, xmax, ymax form of boxes. | [
"Convert",
"prior_boxes",
"to",
"(",
"xmin",
"ymin",
"xmax",
"ymax",
")",
"representation",
"for",
"comparison",
"to",
"point",
"form",
"ground",
"truth",
"data",
".",
"Args",
":",
"boxes",
":",
"(",
"tensor",
")",
"center",
"-",
"size",
"default",
"boxes"... | def point_form(boxes):
""" Convert prior_boxes to (xmin, ymin, xmax, ymax)
representation for comparison to point form ground truth data.
Args:
boxes: (tensor) center-size default boxes from priorbox layers.
Return:
boxes: (tensor) Converted xmin, ymin, xmax, ymax form of boxes.
"""
... | [
"def",
"point_form",
"(",
"boxes",
")",
":",
"return",
"torch",
".",
"cat",
"(",
"(",
"boxes",
"[",
":",
",",
":",
"2",
"]",
"-",
"boxes",
"[",
":",
",",
"2",
":",
"]",
"/",
"2",
",",
"# xmin, ymin",
"boxes",
"[",
":",
",",
":",
"2",
"]",
"... | https://github.com/microsoft/EdgeML/blob/ef9f8a77f096acbdeb941014791f8eda1c1bc35b/examples/pytorch/vision/Face_Detection/layers/bbox_utils.py#L7-L16 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py2/setuptools/dist.py | python | Distribution.feature_is_included | (self, name) | return getattr(self, self._feature_attrname(name)) | Return 1 if feature is included, 0 if excluded, 'None' if unknown | Return 1 if feature is included, 0 if excluded, 'None' if unknown | [
"Return",
"1",
"if",
"feature",
"is",
"included",
"0",
"if",
"excluded",
"None",
"if",
"unknown"
] | def feature_is_included(self, name):
"""Return 1 if feature is included, 0 if excluded, 'None' if unknown"""
return getattr(self, self._feature_attrname(name)) | [
"def",
"feature_is_included",
"(",
"self",
",",
"name",
")",
":",
"return",
"getattr",
"(",
"self",
",",
"self",
".",
"_feature_attrname",
"(",
"name",
")",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py2/setuptools/dist.py#L859-L861 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/dtypes/cast.py | python | maybe_infer_dtype_type | (element) | return tipo | Try to infer an object's dtype, for use in arithmetic ops.
Uses `element.dtype` if that's available.
Objects implementing the iterator protocol are cast to a NumPy array,
and from there the array's type is used.
Parameters
----------
element : object
Possibly has a `.dtype` attribute, ... | Try to infer an object's dtype, for use in arithmetic ops. | [
"Try",
"to",
"infer",
"an",
"object",
"s",
"dtype",
"for",
"use",
"in",
"arithmetic",
"ops",
"."
] | def maybe_infer_dtype_type(element):
"""
Try to infer an object's dtype, for use in arithmetic ops.
Uses `element.dtype` if that's available.
Objects implementing the iterator protocol are cast to a NumPy array,
and from there the array's type is used.
Parameters
----------
element : o... | [
"def",
"maybe_infer_dtype_type",
"(",
"element",
")",
":",
"tipo",
"=",
"None",
"if",
"hasattr",
"(",
"element",
",",
"\"dtype\"",
")",
":",
"tipo",
"=",
"element",
".",
"dtype",
"elif",
"is_list_like",
"(",
"element",
")",
":",
"element",
"=",
"np",
"."... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/dtypes/cast.py#L682-L713 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_controls.py | python | ListCtrl.FindItem | (*args, **kwargs) | return _controls_.ListCtrl_FindItem(*args, **kwargs) | FindItem(self, long start, String str, bool partial=False) -> long | FindItem(self, long start, String str, bool partial=False) -> long | [
"FindItem",
"(",
"self",
"long",
"start",
"String",
"str",
"bool",
"partial",
"=",
"False",
")",
"-",
">",
"long"
] | def FindItem(*args, **kwargs):
"""FindItem(self, long start, String str, bool partial=False) -> long"""
return _controls_.ListCtrl_FindItem(*args, **kwargs) | [
"def",
"FindItem",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"ListCtrl_FindItem",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_controls.py#L4669-L4671 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/ragged/ragged_conversion_ops.py | python | _get_row_partition_type_tensor_pairs_tail | (rt_value) | return [] | Gets a list of the row partitions for rt_value.
If parent_indices are defined, then they are used. Otherwise, row_splits
are used.
This assumes that rt_input is nested inside another RaggedTensor. If it is
a tensor, then return an empty list.
Args:
rt_value: a ragged tensor value. May be a tensor.
R... | Gets a list of the row partitions for rt_value. | [
"Gets",
"a",
"list",
"of",
"the",
"row",
"partitions",
"for",
"rt_value",
"."
] | def _get_row_partition_type_tensor_pairs_tail(rt_value):
"""Gets a list of the row partitions for rt_value.
If parent_indices are defined, then they are used. Otherwise, row_splits
are used.
This assumes that rt_input is nested inside another RaggedTensor. If it is
a tensor, then return an empty list.
Ar... | [
"def",
"_get_row_partition_type_tensor_pairs_tail",
"(",
"rt_value",
")",
":",
"if",
"isinstance",
"(",
"rt_value",
",",
"ragged_tensor",
".",
"RaggedTensor",
")",
":",
"tail",
"=",
"_get_row_partition_type_tensor_pairs_tail",
"(",
"rt_value",
".",
"values",
")",
"if"... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/ragged/ragged_conversion_ops.py#L56-L77 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemWebCommunicator/AWS/common-code/lib/AWSIoTPythonSDK/MQTTLib.py | python | AWSIoTMQTTThingJobsClient.createJobSubscription | (self, callback, jobExecutionType=jobExecutionTopicType.JOB_WILDCARD_TOPIC, jobReplyType=jobExecutionTopicReplyType.JOB_REQUEST_TYPE, jobId=None) | return self._AWSIoTMQTTClient.subscribe(topic, self._QoS, callback) | **Description**
Synchronously creates an MQTT subscription to a jobs related topic based on the provided arguments
**Syntax**
.. code:: python
#Subscribe to notify-next topic to monitor change in job referred to by $next
myAWSIoTMQTTJobsClient.createJobSubscription(callba... | **Description** | [
"**",
"Description",
"**"
] | def createJobSubscription(self, callback, jobExecutionType=jobExecutionTopicType.JOB_WILDCARD_TOPIC, jobReplyType=jobExecutionTopicReplyType.JOB_REQUEST_TYPE, jobId=None):
"""
**Description**
Synchronously creates an MQTT subscription to a jobs related topic based on the provided arguments
... | [
"def",
"createJobSubscription",
"(",
"self",
",",
"callback",
",",
"jobExecutionType",
"=",
"jobExecutionTopicType",
".",
"JOB_WILDCARD_TOPIC",
",",
"jobReplyType",
"=",
"jobExecutionTopicReplyType",
".",
"JOB_REQUEST_TYPE",
",",
"jobId",
"=",
"None",
")",
":",
"topic... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemWebCommunicator/AWS/common-code/lib/AWSIoTPythonSDK/MQTTLib.py#L1547-L1589 | |
microsoft/CNTK | e9396480025b9ca457d26b6f33dd07c474c6aa04 | bindings/python/cntk/ops/functions.py | python | Function.forward | (self, arguments, outputs=None, keep_for_backward=None, device=None, as_numpy=True) | return state, output_map | Computes the values of speficied variables in ``outputs``, using values
provided in ``arguments`` that correspond to each input `Variable` of
the function (i.e. those that have ``is_input = True``).
Example:
>>> # Example of passing dense data
>>> v = C.input_variable(sh... | Computes the values of speficied variables in ``outputs``, using values
provided in ``arguments`` that correspond to each input `Variable` of
the function (i.e. those that have ``is_input = True``). | [
"Computes",
"the",
"values",
"of",
"speficied",
"variables",
"in",
"outputs",
"using",
"values",
"provided",
"in",
"arguments",
"that",
"correspond",
"to",
"each",
"input",
"Variable",
"of",
"the",
"function",
"(",
"i",
".",
"e",
".",
"those",
"that",
"have"... | def forward(self, arguments, outputs=None, keep_for_backward=None, device=None, as_numpy=True):
'''
Computes the values of speficied variables in ``outputs``, using values
provided in ``arguments`` that correspond to each input `Variable` of
the function (i.e. those that have ``is_input ... | [
"def",
"forward",
"(",
"self",
",",
"arguments",
",",
"outputs",
"=",
"None",
",",
"keep_for_backward",
"=",
"None",
",",
"device",
"=",
"None",
",",
"as_numpy",
"=",
"True",
")",
":",
"if",
"device",
"is",
"None",
":",
"device",
"=",
"DeviceDescriptor",... | https://github.com/microsoft/CNTK/blob/e9396480025b9ca457d26b6f33dd07c474c6aa04/bindings/python/cntk/ops/functions.py#L737-L872 | |
apache/openoffice | 97289b2620590d8b431bcc408f87252db6203818 | main/toolkit/src2xml/source/macroparser.py | python | MacroParser.parseArgs | (self, buffer) | return vars, buffer[i+1:] | Parse arguments.
The buffer is expected to be formatted like '(a, b, c)' where the first
character is the open paren. | Parse arguments. | [
"Parse",
"arguments",
"."
] | def parseArgs (self, buffer):
"""Parse arguments.
The buffer is expected to be formatted like '(a, b, c)' where the first
character is the open paren.
"""
scope = 0
buf = ''
vars = []
content = ''
bufSize = len(buffer)
i = 0
while i < bufSize:
... | [
"def",
"parseArgs",
"(",
"self",
",",
"buffer",
")",
":",
"scope",
"=",
"0",
"buf",
"=",
"''",
"vars",
"=",
"[",
"]",
"content",
"=",
"''",
"bufSize",
"=",
"len",
"(",
"buffer",
")",
"i",
"=",
"0",
"while",
"i",
"<",
"bufSize",
":",
"c",
"=",
... | https://github.com/apache/openoffice/blob/97289b2620590d8b431bcc408f87252db6203818/main/toolkit/src2xml/source/macroparser.py#L66-L103 | |
facebook/ThreatExchange | 31914a51820c73c8a0daffe62ccca29a6e3d359e | api-reference-examples/python/pytx/pytx/access_token.py | python | get_access_token | () | return __ACCESS_TOKEN | Returns the existing access token if access_token() has been called.
Will attempt to access_token() in the case that there is no access token.
:raises: :class:`errors.pytxAccessTokenError` if there is no access token. | Returns the existing access token if access_token() has been called.
Will attempt to access_token() in the case that there is no access token. | [
"Returns",
"the",
"existing",
"access",
"token",
"if",
"access_token",
"()",
"has",
"been",
"called",
".",
"Will",
"attempt",
"to",
"access_token",
"()",
"in",
"the",
"case",
"that",
"there",
"is",
"no",
"access",
"token",
"."
] | def get_access_token():
"""
Returns the existing access token if access_token() has been called.
Will attempt to access_token() in the case that there is no access token.
:raises: :class:`errors.pytxAccessTokenError` if there is no access token.
"""
global __ACCESS_TOKEN
if not __ACCESS_TO... | [
"def",
"get_access_token",
"(",
")",
":",
"global",
"__ACCESS_TOKEN",
"if",
"not",
"__ACCESS_TOKEN",
":",
"access_token",
"(",
")",
"if",
"not",
"__ACCESS_TOKEN",
":",
"raise",
"pytxAccessTokenError",
"(",
"'Must access_token() before instantiating'",
")",
"return",
"... | https://github.com/facebook/ThreatExchange/blob/31914a51820c73c8a0daffe62ccca29a6e3d359e/api-reference-examples/python/pytx/pytx/access_token.py#L28-L43 | |
sdhash/sdhash | b9eff63e4e5867e910f41fd69032bbb1c94a2a5e | sdhash-ui/serverui/sdhashsrv/sdhashsrv.py | python | Iface.displayResultsList | (self, user, json) | Parameters:
- user
- json | Parameters:
- user
- json | [
"Parameters",
":",
"-",
"user",
"-",
"json"
] | def displayResultsList(self, user, json):
"""
Parameters:
- user
- json
"""
pass | [
"def",
"displayResultsList",
"(",
"self",
",",
"user",
",",
"json",
")",
":",
"pass"
] | https://github.com/sdhash/sdhash/blob/b9eff63e4e5867e910f41fd69032bbb1c94a2a5e/sdhash-ui/serverui/sdhashsrv/sdhashsrv.py#L115-L121 | ||
GeometryCollective/boundary-first-flattening | 8250e5a0e85980ec50b5e8aa8f49dd6519f915cd | deps/nanogui/docs/exhale.py | python | specificationsForKind | (kind) | return directive | Returns the relevant modifiers for the restructured text directive associated with
the input kind. The only considered values for the default implementation are
``class`` and ``struct``, for which the return value is exactly::
" :members:\\n :protected-members:\\n :undoc-members:\\n"
Format... | Returns the relevant modifiers for the restructured text directive associated with
the input kind. The only considered values for the default implementation are
``class`` and ``struct``, for which the return value is exactly:: | [
"Returns",
"the",
"relevant",
"modifiers",
"for",
"the",
"restructured",
"text",
"directive",
"associated",
"with",
"the",
"input",
"kind",
".",
"The",
"only",
"considered",
"values",
"for",
"the",
"default",
"implementation",
"are",
"class",
"and",
"struct",
"f... | def specificationsForKind(kind):
'''
Returns the relevant modifiers for the restructured text directive associated with
the input kind. The only considered values for the default implementation are
``class`` and ``struct``, for which the return value is exactly::
" :members:\\n :protected-... | [
"def",
"specificationsForKind",
"(",
"kind",
")",
":",
"# use the custom directives function",
"if",
"EXHALE_CUSTOM_SPECIFICATIONS_FUNCTION",
"is",
"not",
"None",
":",
"return",
"EXHALE_CUSTOM_SPECIFICATIONS_FUNCTION",
"(",
"kind",
")",
"# otherwise, just provide class and struct... | https://github.com/GeometryCollective/boundary-first-flattening/blob/8250e5a0e85980ec50b5e8aa8f49dd6519f915cd/deps/nanogui/docs/exhale.py#L536-L594 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/ftplib.py | python | FTP.rename | (self, fromname, toname) | return self.voidcmd('RNTO ' + toname) | Rename a file. | Rename a file. | [
"Rename",
"a",
"file",
"."
] | def rename(self, fromname, toname):
'''Rename a file.'''
resp = self.sendcmd('RNFR ' + fromname)
if resp[0] != '3':
raise error_reply, resp
return self.voidcmd('RNTO ' + toname) | [
"def",
"rename",
"(",
"self",
",",
"fromname",
",",
"toname",
")",
":",
"resp",
"=",
"self",
".",
"sendcmd",
"(",
"'RNFR '",
"+",
"fromname",
")",
"if",
"resp",
"[",
"0",
"]",
"!=",
"'3'",
":",
"raise",
"error_reply",
",",
"resp",
"return",
"self",
... | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/ftplib.py#L511-L516 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/ir_utils.py | python | has_no_side_effect | (rhs, lives, call_table) | return True | Returns True if this expression has no side effects that
would prevent re-ordering. | Returns True if this expression has no side effects that
would prevent re-ordering. | [
"Returns",
"True",
"if",
"this",
"expression",
"has",
"no",
"side",
"effects",
"that",
"would",
"prevent",
"re",
"-",
"ordering",
"."
] | def has_no_side_effect(rhs, lives, call_table):
""" Returns True if this expression has no side effects that
would prevent re-ordering.
"""
if isinstance(rhs, ir.Expr) and rhs.op == 'call':
func_name = rhs.func.name
if func_name not in call_table or call_table[func_name] == []:
... | [
"def",
"has_no_side_effect",
"(",
"rhs",
",",
"lives",
",",
"call_table",
")",
":",
"if",
"isinstance",
"(",
"rhs",
",",
"ir",
".",
"Expr",
")",
"and",
"rhs",
".",
"op",
"==",
"'call'",
":",
"func_name",
"=",
"rhs",
".",
"func",
".",
"name",
"if",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/ir_utils.py#L647-L686 | |
cmu-db/noisepage | 79276e68fe83322f1249e8a8be96bd63c583ae56 | build-support/asan_symbolize.py | python | LLVMSymbolizer.symbolize | (self, addr, binary, offset) | return result | Overrides Symbolizer.symbolize. | Overrides Symbolizer.symbolize. | [
"Overrides",
"Symbolizer",
".",
"symbolize",
"."
] | def symbolize(self, addr, binary, offset):
"""Overrides Symbolizer.symbolize."""
if not self.pipe:
return None
result = []
try:
symbolizer_input = '%s %s' % (binary, offset)
if DEBUG:
print(symbolizer_input)
self.pipe.stdin.write(symbolizer_input)
self.pipe.stdin.wr... | [
"def",
"symbolize",
"(",
"self",
",",
"addr",
",",
"binary",
",",
"offset",
")",
":",
"if",
"not",
"self",
".",
"pipe",
":",
"return",
"None",
"result",
"=",
"[",
"]",
"try",
":",
"symbolizer_input",
"=",
"'%s %s'",
"%",
"(",
"binary",
",",
"offset",... | https://github.com/cmu-db/noisepage/blob/79276e68fe83322f1249e8a8be96bd63c583ae56/build-support/asan_symbolize.py#L71-L97 | |
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/resmokelib/powercycle/powercycle.py | python | MongodControl.get_mongod_option | (self, option) | return self.options_map[option] | Return tuple of (value, form). | Return tuple of (value, form). | [
"Return",
"tuple",
"of",
"(",
"value",
"form",
")",
"."
] | def get_mongod_option(self, option):
"""Return tuple of (value, form)."""
return self.options_map[option] | [
"def",
"get_mongod_option",
"(",
"self",
",",
"option",
")",
":",
"return",
"self",
".",
"options_map",
"[",
"option",
"]"
] | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/resmokelib/powercycle/powercycle.py#L639-L641 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/core/strings/accessor.py | python | StringMethods.pad | (self, width, side="left", fillchar=" ") | return self._wrap_result(result) | Pad strings in the Series/Index up to width.
Parameters
----------
width : int
Minimum width of resulting string; additional characters will be filled
with character defined in `fillchar`.
side : {'left', 'right', 'both'}, default 'left'
Side from whi... | Pad strings in the Series/Index up to width. | [
"Pad",
"strings",
"in",
"the",
"Series",
"/",
"Index",
"up",
"to",
"width",
"."
] | def pad(self, width, side="left", fillchar=" "):
"""
Pad strings in the Series/Index up to width.
Parameters
----------
width : int
Minimum width of resulting string; additional characters will be filled
with character defined in `fillchar`.
side ... | [
"def",
"pad",
"(",
"self",
",",
"width",
",",
"side",
"=",
"\"left\"",
",",
"fillchar",
"=",
"\" \"",
")",
":",
"if",
"not",
"isinstance",
"(",
"fillchar",
",",
"str",
")",
":",
"msg",
"=",
"f\"fillchar must be a character, not {type(fillchar).__name__}\"",
"r... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/strings/accessor.py#L1451-L1516 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/stc.py | python | StyledTextCtrl.AutoCompSetChooseSingle | (*args, **kwargs) | return _stc.StyledTextCtrl_AutoCompSetChooseSingle(*args, **kwargs) | AutoCompSetChooseSingle(self, bool chooseSingle)
Should a single item auto-completion list automatically choose the item. | AutoCompSetChooseSingle(self, bool chooseSingle) | [
"AutoCompSetChooseSingle",
"(",
"self",
"bool",
"chooseSingle",
")"
] | def AutoCompSetChooseSingle(*args, **kwargs):
"""
AutoCompSetChooseSingle(self, bool chooseSingle)
Should a single item auto-completion list automatically choose the item.
"""
return _stc.StyledTextCtrl_AutoCompSetChooseSingle(*args, **kwargs) | [
"def",
"AutoCompSetChooseSingle",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_AutoCompSetChooseSingle",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/stc.py#L3129-L3135 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/internals/blocks.py | python | TimeDeltaBlock.to_native_types | (self, slicer=None, na_rep=None, quoting=None, **kwargs) | return rvalues | convert to our native types format, slicing if desired | convert to our native types format, slicing if desired | [
"convert",
"to",
"our",
"native",
"types",
"format",
"slicing",
"if",
"desired"
] | def to_native_types(self, slicer=None, na_rep=None, quoting=None, **kwargs):
""" convert to our native types format, slicing if desired """
values = self.values
if slicer is not None:
values = values[:, slicer]
mask = isna(values)
rvalues = np.empty(values.shape, dt... | [
"def",
"to_native_types",
"(",
"self",
",",
"slicer",
"=",
"None",
",",
"na_rep",
"=",
"None",
",",
"quoting",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"values",
"=",
"self",
".",
"values",
"if",
"slicer",
"is",
"not",
"None",
":",
"values",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/internals/blocks.py#L2522-L2544 | |
SIPp/sipp | f44d0cf5dec0013eff8fd7b4da885d455aa82e0e | 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/SIPp/sipp/blob/f44d0cf5dec0013eff8fd7b4da885d455aa82e0e/cpplint.py#L749-L792 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/http/client.py | python | HTTPResponse.info | (self) | return self.headers | Returns an instance of the class mimetools.Message containing
meta-information associated with the URL.
When the method is HTTP, these headers are those returned by
the server at the head of the retrieved HTML page (including
Content-Length and Content-Type).
When the method is... | Returns an instance of the class mimetools.Message containing
meta-information associated with the URL. | [
"Returns",
"an",
"instance",
"of",
"the",
"class",
"mimetools",
".",
"Message",
"containing",
"meta",
"-",
"information",
"associated",
"with",
"the",
"URL",
"."
] | def info(self):
'''Returns an instance of the class mimetools.Message containing
meta-information associated with the URL.
When the method is HTTP, these headers are those returned by
the server at the head of the retrieved HTML page (including
Content-Length and Content-Type).
... | [
"def",
"info",
"(",
"self",
")",
":",
"return",
"self",
".",
"headers"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/http/client.py#L751-L772 | |
apple/swift | 469f72fdae2ea828b3b6c0d7d62d7e4cf98c4893 | utils/swift_build_support/swift_build_support/productpipeline_list_builder.py | python | ProductPipelineListBuilder.add_impl_product | (self, product_cls, is_enabled) | Add a non-impl product to the current pipeline begin constructed | Add a non-impl product to the current pipeline begin constructed | [
"Add",
"a",
"non",
"-",
"impl",
"product",
"to",
"the",
"current",
"pipeline",
"begin",
"constructed"
] | def add_impl_product(self, product_cls, is_enabled):
"""Add a non-impl product to the current pipeline begin constructed"""
assert(self.current_pipeline is not None)
assert(self.is_current_pipeline_impl)
assert(product_cls.is_build_script_impl_product())
self.current_pipeline.app... | [
"def",
"add_impl_product",
"(",
"self",
",",
"product_cls",
",",
"is_enabled",
")",
":",
"assert",
"(",
"self",
".",
"current_pipeline",
"is",
"not",
"None",
")",
"assert",
"(",
"self",
".",
"is_current_pipeline_impl",
")",
"assert",
"(",
"product_cls",
".",
... | https://github.com/apple/swift/blob/469f72fdae2ea828b3b6c0d7d62d7e4cf98c4893/utils/swift_build_support/swift_build_support/productpipeline_list_builder.py#L103-L108 | ||
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/tools/inspector_protocol/jinja2/sandbox.py | python | SandboxedEnvironment.call_binop | (self, context, operator, left, right) | return self.binop_table[operator](left, right) | For intercepted binary operator calls (:meth:`intercepted_binops`)
this function is executed instead of the builtin operator. This can
be used to fine tune the behavior of certain operators.
.. versionadded:: 2.6 | For intercepted binary operator calls (:meth:`intercepted_binops`)
this function is executed instead of the builtin operator. This can
be used to fine tune the behavior of certain operators. | [
"For",
"intercepted",
"binary",
"operator",
"calls",
"(",
":",
"meth",
":",
"intercepted_binops",
")",
"this",
"function",
"is",
"executed",
"instead",
"of",
"the",
"builtin",
"operator",
".",
"This",
"can",
"be",
"used",
"to",
"fine",
"tune",
"the",
"behavi... | def call_binop(self, context, operator, left, right):
"""For intercepted binary operator calls (:meth:`intercepted_binops`)
this function is executed instead of the builtin operator. This can
be used to fine tune the behavior of certain operators.
.. versionadded:: 2.6
"""
... | [
"def",
"call_binop",
"(",
"self",
",",
"context",
",",
"operator",
",",
"left",
",",
"right",
")",
":",
"return",
"self",
".",
"binop_table",
"[",
"operator",
"]",
"(",
"left",
",",
"right",
")"
] | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/inspector_protocol/jinja2/sandbox.py#L341-L348 | |
VowpalWabbit/vowpal_wabbit | 866b8fa88ff85a957c7eb72065ea44518b9ba416 | python/vowpalwabbit/pyvw.py | python | SearchTask.predict | (self, my_example, useOracle: bool = False) | return self._output | Predict on the example
Args:
my_example (Example):
example used for prediction
useOracle : Use oracle for this prediction
Returns:
int: prediction of this example | Predict on the example | [
"Predict",
"on",
"the",
"example"
] | def predict(self, my_example, useOracle: bool = False):
"""Predict on the example
Args:
my_example (Example):
example used for prediction
useOracle : Use oracle for this prediction
Returns:
int: prediction of this example
"""
... | [
"def",
"predict",
"(",
"self",
",",
"my_example",
",",
"useOracle",
":",
"bool",
"=",
"False",
")",
":",
"self",
".",
"_call_vw",
"(",
"my_example",
",",
"isTest",
"=",
"True",
",",
"useOracle",
"=",
"useOracle",
")",
"return",
"self",
".",
"_output"
] | https://github.com/VowpalWabbit/vowpal_wabbit/blob/866b8fa88ff85a957c7eb72065ea44518b9ba416/python/vowpalwabbit/pyvw.py#L271-L283 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_gdi.py | python | NativePixelData.__nonzero__ | (*args, **kwargs) | return _gdi_.NativePixelData___nonzero__(*args, **kwargs) | __nonzero__(self) -> bool | __nonzero__(self) -> bool | [
"__nonzero__",
"(",
"self",
")",
"-",
">",
"bool"
] | def __nonzero__(*args, **kwargs):
"""__nonzero__(self) -> bool"""
return _gdi_.NativePixelData___nonzero__(*args, **kwargs) | [
"def",
"__nonzero__",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"NativePixelData___nonzero__",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_gdi.py#L1062-L1064 | |
Samsung/veles | 95ed733c2e49bc011ad98ccf2416ecec23fbf352 | veles/logger.py | python | Logger.logger | (self) | return self._logger_ | Returns the logger associated with this object. | Returns the logger associated with this object. | [
"Returns",
"the",
"logger",
"associated",
"with",
"this",
"object",
"."
] | def logger(self):
"""Returns the logger associated with this object.
"""
return self._logger_ | [
"def",
"logger",
"(",
"self",
")",
":",
"return",
"self",
".",
"_logger_"
] | https://github.com/Samsung/veles/blob/95ed733c2e49bc011ad98ccf2416ecec23fbf352/veles/logger.py#L163-L166 | |
gimli-org/gimli | 17aa2160de9b15ababd9ef99e89b1bc3277bbb23 | pygimli/physics/petro/modelling.py | python | PetroJointModelling.setMesh | (self, mesh) | TODO. | TODO. | [
"TODO",
"."
] | def setMesh(self, mesh):
"""TODO."""
self.mesh = mesh
for fi in self.fops:
fi.setMesh(mesh)
self.setRegionManager(self.fops[0].regionManagerRef())
self.initJacobian() | [
"def",
"setMesh",
"(",
"self",
",",
"mesh",
")",
":",
"self",
".",
"mesh",
"=",
"mesh",
"for",
"fi",
"in",
"self",
".",
"fops",
":",
"fi",
".",
"setMesh",
"(",
"mesh",
")",
"self",
".",
"setRegionManager",
"(",
"self",
".",
"fops",
"[",
"0",
"]",... | https://github.com/gimli-org/gimli/blob/17aa2160de9b15ababd9ef99e89b1bc3277bbb23/pygimli/physics/petro/modelling.py#L84-L91 | ||
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py | python | AndroidMkWriter.NormalizeIncludePaths | (self, include_paths) | return normalized | Normalize include_paths.
Convert absolute paths to relative to the Android top directory.
Args:
include_paths: A list of unprocessed include paths.
Returns:
A list of normalized include paths. | Normalize include_paths.
Convert absolute paths to relative to the Android top directory. | [
"Normalize",
"include_paths",
".",
"Convert",
"absolute",
"paths",
"to",
"relative",
"to",
"the",
"Android",
"top",
"directory",
"."
] | def NormalizeIncludePaths(self, include_paths):
""" Normalize include_paths.
Convert absolute paths to relative to the Android top directory.
Args:
include_paths: A list of unprocessed include paths.
Returns:
A list of normalized include paths.
"""
normalized = []
for path in in... | [
"def",
"NormalizeIncludePaths",
"(",
"self",
",",
"include_paths",
")",
":",
"normalized",
"=",
"[",
"]",
"for",
"path",
"in",
"include_paths",
":",
"if",
"path",
"[",
"0",
"]",
"==",
"'/'",
":",
"path",
"=",
"gyp",
".",
"common",
".",
"RelativePath",
... | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py#L690-L704 | |
ROCmSoftwarePlatform/hipCaffe | 4ec5d482515cce532348553b6db6d00d015675d5 | scripts/cpp_lint.py | python | IsErrorSuppressedByNolint | (category, linenum) | return (linenum in _error_suppressions.get(category, set()) or
linenum in _error_suppressions.get(None, set())) | Returns true if the specified error category is suppressed on this line.
Consults the global error_suppressions map populated by
ParseNolintSuppressions/ResetNolintSuppressions.
Args:
category: str, the category of the error.
linenum: int, the current line number.
Returns:
bool, True iff the error... | Returns true if the specified error category is suppressed on this line. | [
"Returns",
"true",
"if",
"the",
"specified",
"error",
"category",
"is",
"suppressed",
"on",
"this",
"line",
"."
] | def IsErrorSuppressedByNolint(category, linenum):
"""Returns true if the specified error category is suppressed on this line.
Consults the global error_suppressions map populated by
ParseNolintSuppressions/ResetNolintSuppressions.
Args:
category: str, the category of the error.
linenum: int, the curre... | [
"def",
"IsErrorSuppressedByNolint",
"(",
"category",
",",
"linenum",
")",
":",
"return",
"(",
"linenum",
"in",
"_error_suppressions",
".",
"get",
"(",
"category",
",",
"set",
"(",
")",
")",
"or",
"linenum",
"in",
"_error_suppressions",
".",
"get",
"(",
"None... | https://github.com/ROCmSoftwarePlatform/hipCaffe/blob/4ec5d482515cce532348553b6db6d00d015675d5/scripts/cpp_lint.py#L500-L513 | |
gromacs/gromacs | 7dec3a3f99993cf5687a122de3e12de31c21c399 | python_packaging/src/gmxapi/abc.py | python | OperationDirector.resource_factory | (self,
source: typing.Union[Context, None],
target: typing.Optional[Context] = None) | Get an appropriate resource factory.
The ResourceFactory converts resources (in the form produced by the *source* Context)
to the form consumed by the operation in the *target* Context.
A *source* of None indicates that the source is an arbitrary Python function
signature, or to try to... | Get an appropriate resource factory. | [
"Get",
"an",
"appropriate",
"resource",
"factory",
"."
] | def resource_factory(self,
source: typing.Union[Context, None],
target: typing.Optional[Context] = None) \
-> typing.Union[ResourceFactory, typing.Callable]:
"""Get an appropriate resource factory.
The ResourceFactory converts resources (in ... | [
"def",
"resource_factory",
"(",
"self",
",",
"source",
":",
"typing",
".",
"Union",
"[",
"Context",
",",
"None",
"]",
",",
"target",
":",
"typing",
".",
"Optional",
"[",
"Context",
"]",
"=",
"None",
")",
"->",
"typing",
".",
"Union",
"[",
"ResourceFact... | https://github.com/gromacs/gromacs/blob/7dec3a3f99993cf5687a122de3e12de31c21c399/python_packaging/src/gmxapi/abc.py#L595-L627 | ||
ArduPilot/ardupilot | 6e684b3496122b8158ac412b609d00004b7ac306 | Tools/mavproxy_modules/sitl_calibration.py | python | AccelcalController.report_from_msg | (self, m) | return None | Return true if successful, false if failed, None if unknown | Return true if successful, false if failed, None if unknown | [
"Return",
"true",
"if",
"successful",
"false",
"if",
"failed",
"None",
"if",
"unknown"
] | def report_from_msg(self, m):
'''Return true if successful, false if failed, None if unknown'''
text = str(m.text)
if 'Calibration successful' in text:
return True
elif 'Calibration FAILED' in text:
return False
return None | [
"def",
"report_from_msg",
"(",
"self",
",",
"m",
")",
":",
"text",
"=",
"str",
"(",
"m",
".",
"text",
")",
"if",
"'Calibration successful'",
"in",
"text",
":",
"return",
"True",
"elif",
"'Calibration FAILED'",
"in",
"text",
":",
"return",
"False",
"return"... | https://github.com/ArduPilot/ardupilot/blob/6e684b3496122b8158ac412b609d00004b7ac306/Tools/mavproxy_modules/sitl_calibration.py#L176-L183 | |
GoSSIP-SJTU/Armariris | ad5d868482956b2194a77b39c8d543c7c2318200 | tools/clang/bindings/python/clang/cindex.py | python | SourceLocation.line | (self) | return self._get_instantiation()[1] | Get the line represented by this source location. | Get the line represented by this source location. | [
"Get",
"the",
"line",
"represented",
"by",
"this",
"source",
"location",
"."
] | def line(self):
"""Get the line represented by this source location."""
return self._get_instantiation()[1] | [
"def",
"line",
"(",
"self",
")",
":",
"return",
"self",
".",
"_get_instantiation",
"(",
")",
"[",
"1",
"]"
] | https://github.com/GoSSIP-SJTU/Armariris/blob/ad5d868482956b2194a77b39c8d543c7c2318200/tools/clang/bindings/python/clang/cindex.py#L203-L205 | |
trilinos/Trilinos | 6168be6dd51e35e1cd681e9c4b24433e709df140 | packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriReflectOperation.py | python | PhactoriReflectOperation.CreateParaViewFilter | (self, inInputFilter) | return newParaViewFilter | create the reflect (and group) filter for ParaView | create the reflect (and group) filter for ParaView | [
"create",
"the",
"reflect",
"(",
"and",
"group",
")",
"filter",
"for",
"ParaView"
] | def CreateParaViewFilter(self, inInputFilter):
"""create the reflect (and group) filter for ParaView"""
if PhactoriDbg(100):
myDebugPrint3("PhactoriReflectOperation.CreateParaViewFilter "
"entered\n", 100)
savedActiveSource = GetActiveSource()
self.mInternalReflectFilter = Reflect(inIn... | [
"def",
"CreateParaViewFilter",
"(",
"self",
",",
"inInputFilter",
")",
":",
"if",
"PhactoriDbg",
"(",
"100",
")",
":",
"myDebugPrint3",
"(",
"\"PhactoriReflectOperation.CreateParaViewFilter \"",
"\"entered\\n\"",
",",
"100",
")",
"savedActiveSource",
"=",
"GetActiveSour... | https://github.com/trilinos/Trilinos/blob/6168be6dd51e35e1cd681e9c4b24433e709df140/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriReflectOperation.py#L58-L87 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/graph_editor/subgraph.py | python | SubGraphView.remap_inputs | (self, new_input_indices) | return res | Remap the inputs of the subgraph.
If the inputs of the original subgraph are [t0, t1, t2], remapping to [2,0]
will create a new instance whose inputs is [t2, t0].
Note that this is only modifying the view: the underlying `tf.Graph` is not
affected.
Args:
new_input_indices: an iterable of in... | Remap the inputs of the subgraph. | [
"Remap",
"the",
"inputs",
"of",
"the",
"subgraph",
"."
] | def remap_inputs(self, new_input_indices):
"""Remap the inputs of the subgraph.
If the inputs of the original subgraph are [t0, t1, t2], remapping to [2,0]
will create a new instance whose inputs is [t2, t0].
Note that this is only modifying the view: the underlying `tf.Graph` is not
affected.
... | [
"def",
"remap_inputs",
"(",
"self",
",",
"new_input_indices",
")",
":",
"res",
"=",
"self",
".",
"copy",
"(",
")",
"res",
".",
"_remap_inputs",
"(",
"new_input_indices",
")",
"# pylint: disable=protected-access",
"return",
"res"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/graph_editor/subgraph.py#L363-L384 | |
alexozer/jankdrone | c4b403eb254b41b832ab2bdfade12ba59c99e5dc | shm/lib/pyratemp/tools.py | python | mail | (maildir, template, data, messageid_domainname=None) | return mailname | Create a mail from a pyratemp-template and store it in a maildir.
:Parameters:
- maildir: maildir-directory
- template: template-file
- data: data for the template (dictionary)
- messageid_domainname: domainname for the created messageid
:Returns:
the filename (with... | Create a mail from a pyratemp-template and store it in a maildir. | [
"Create",
"a",
"mail",
"from",
"a",
"pyratemp",
"-",
"template",
"and",
"store",
"it",
"in",
"a",
"maildir",
"."
] | def mail(maildir, template, data, messageid_domainname=None):
"""Create a mail from a pyratemp-template and store it in a maildir.
:Parameters:
- maildir: maildir-directory
- template: template-file
- data: data for the template (dictionary)
- messageid_domainname: domainna... | [
"def",
"mail",
"(",
"maildir",
",",
"template",
",",
"data",
",",
"messageid_domainname",
"=",
"None",
")",
":",
"# create mail",
"t",
"=",
"time",
".",
"time",
"(",
")",
"if",
"\"date\"",
"not",
"in",
"data",
":",
"data",
"[",
"\"date\"",
"]",
"=",
... | https://github.com/alexozer/jankdrone/blob/c4b403eb254b41b832ab2bdfade12ba59c99e5dc/shm/lib/pyratemp/tools.py#L72-L112 | |
moderngl/moderngl | 32fe79927e02b0fa893b3603d677bdae39771e14 | moderngl/texture.py | python | Texture.depth | (self) | return self._depth | bool: Is the texture a depth texture? | bool: Is the texture a depth texture? | [
"bool",
":",
"Is",
"the",
"texture",
"a",
"depth",
"texture?"
] | def depth(self) -> bool:
'''
bool: Is the texture a depth texture?
'''
return self._depth | [
"def",
"depth",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_depth"
] | https://github.com/moderngl/moderngl/blob/32fe79927e02b0fa893b3603d677bdae39771e14/moderngl/texture.py#L293-L298 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/ros_comm/rosgraph/src/rosgraph/impl/graph.py | python | Graph.bad_update | (self) | return updated | Update loop for nodes with bad connectivity. We box them separately
so that we can maintain the good performance of the normal update loop.
Once a node is on the bad list it stays there. | Update loop for nodes with bad connectivity. We box them separately
so that we can maintain the good performance of the normal update loop.
Once a node is on the bad list it stays there. | [
"Update",
"loop",
"for",
"nodes",
"with",
"bad",
"connectivity",
".",
"We",
"box",
"them",
"separately",
"so",
"that",
"we",
"can",
"maintain",
"the",
"good",
"performance",
"of",
"the",
"normal",
"update",
"loop",
".",
"Once",
"a",
"node",
"is",
"on",
"... | def bad_update(self):
"""
Update loop for nodes with bad connectivity. We box them separately
so that we can maintain the good performance of the normal update loop.
Once a node is on the bad list it stays there.
"""
last_node_refresh = self.last_node_refresh
# n... | [
"def",
"bad_update",
"(",
"self",
")",
":",
"last_node_refresh",
"=",
"self",
".",
"last_node_refresh",
"# nodes left to check",
"try",
":",
"self",
".",
"bad_nodes_lock",
".",
"acquire",
"(",
")",
"# make copy due to multithreading",
"update_queue",
"=",
"self",
".... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros_comm/rosgraph/src/rosgraph/impl/graph.py#L482-L520 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/decorator/decorator.py | python | FunctionMaker.create | (cls, obj, body, evaldict, defaults=None,
doc=None, module=None, addsource=True, **attrs) | return self.make(body, evaldict, addsource, **attrs) | Create a function from the strings name, signature and body.
evaldict is the evaluation dictionary. If addsource is true an
attribute __source__ is added to the result. The attributes attrs
are added, if any. | Create a function from the strings name, signature and body.
evaldict is the evaluation dictionary. If addsource is true an
attribute __source__ is added to the result. The attributes attrs
are added, if any. | [
"Create",
"a",
"function",
"from",
"the",
"strings",
"name",
"signature",
"and",
"body",
".",
"evaldict",
"is",
"the",
"evaluation",
"dictionary",
".",
"If",
"addsource",
"is",
"true",
"an",
"attribute",
"__source__",
"is",
"added",
"to",
"the",
"result",
".... | def create(cls, obj, body, evaldict, defaults=None,
doc=None, module=None, addsource=True, **attrs):
"""
Create a function from the strings name, signature and body.
evaldict is the evaluation dictionary. If addsource is true an
attribute __source__ is added to the result.... | [
"def",
"create",
"(",
"cls",
",",
"obj",
",",
"body",
",",
"evaldict",
",",
"defaults",
"=",
"None",
",",
"doc",
"=",
"None",
",",
"module",
"=",
"None",
",",
"addsource",
"=",
"True",
",",
"*",
"*",
"attrs",
")",
":",
"if",
"isinstance",
"(",
"o... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/decorator/decorator.py#L197-L221 | |
GJDuck/LowFat | ecf6a0f0fa1b73a27a626cf493cc39e477b6faea | llvm-4.0.0.src/projects/compiler-rt/lib/sanitizer_common/scripts/cpplint.py | python | _VerboseLevel | () | return _cpplint_state.verbose_level | Returns the module's verbosity setting. | Returns the module's verbosity setting. | [
"Returns",
"the",
"module",
"s",
"verbosity",
"setting",
"."
] | def _VerboseLevel():
"""Returns the module's verbosity setting."""
return _cpplint_state.verbose_level | [
"def",
"_VerboseLevel",
"(",
")",
":",
"return",
"_cpplint_state",
".",
"verbose_level"
] | https://github.com/GJDuck/LowFat/blob/ecf6a0f0fa1b73a27a626cf493cc39e477b6faea/llvm-4.0.0.src/projects/compiler-rt/lib/sanitizer_common/scripts/cpplint.py#L641-L643 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/ops/losses/losses_impl.py | python | absolute_difference | (
labels, predictions, weights=1.0, scope=None,
loss_collection=ops.GraphKeys.LOSSES,
reduction=Reduction.SUM_BY_NONZERO_WEIGHTS) | Adds an Absolute Difference loss to the training procedure.
`weights` acts as a coefficient for the loss. If a scalar is provided, then
the loss is simply scaled by the given value. If `weights` is a `Tensor` of
shape `[batch_size]`, then the total loss for each sample of the batch is
rescaled by the correspon... | Adds an Absolute Difference loss to the training procedure. | [
"Adds",
"an",
"Absolute",
"Difference",
"loss",
"to",
"the",
"training",
"procedure",
"."
] | def absolute_difference(
labels, predictions, weights=1.0, scope=None,
loss_collection=ops.GraphKeys.LOSSES,
reduction=Reduction.SUM_BY_NONZERO_WEIGHTS):
"""Adds an Absolute Difference loss to the training procedure.
`weights` acts as a coefficient for the loss. If a scalar is provided, then
the loss... | [
"def",
"absolute_difference",
"(",
"labels",
",",
"predictions",
",",
"weights",
"=",
"1.0",
",",
"scope",
"=",
"None",
",",
"loss_collection",
"=",
"ops",
".",
"GraphKeys",
".",
"LOSSES",
",",
"reduction",
"=",
"Reduction",
".",
"SUM_BY_NONZERO_WEIGHTS",
")",... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/losses/losses_impl.py#L187-L231 | ||
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TRnd.LoadXml | (self, *args) | return _snap.TRnd_LoadXml(self, *args) | LoadXml(TRnd self, PXmlTok const & XmlTok, TStr Nm)
Parameters:
XmlTok: PXmlTok const &
Nm: TStr const & | LoadXml(TRnd self, PXmlTok const & XmlTok, TStr Nm) | [
"LoadXml",
"(",
"TRnd",
"self",
"PXmlTok",
"const",
"&",
"XmlTok",
"TStr",
"Nm",
")"
] | def LoadXml(self, *args):
"""
LoadXml(TRnd self, PXmlTok const & XmlTok, TStr Nm)
Parameters:
XmlTok: PXmlTok const &
Nm: TStr const &
"""
return _snap.TRnd_LoadXml(self, *args) | [
"def",
"LoadXml",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_snap",
".",
"TRnd_LoadXml",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L7558-L7567 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/swf/layer1.py | python | Layer1.describe_workflow_type | (self, domain, workflow_name, workflow_version) | return self.json_request('DescribeWorkflowType', {
'domain': domain,
'workflowType': {'name': workflow_name,
'version': workflow_version}
}) | Returns information about the specified workflow type. This
includes configuration settings specified when the type was
registered and other information such as creation date,
current status, etc.
:type domain: string
:param domain: The name of the domain in which this workflow
... | Returns information about the specified workflow type. This
includes configuration settings specified when the type was
registered and other information such as creation date,
current status, etc. | [
"Returns",
"information",
"about",
"the",
"specified",
"workflow",
"type",
".",
"This",
"includes",
"configuration",
"settings",
"specified",
"when",
"the",
"type",
"was",
"registered",
"and",
"other",
"information",
"such",
"as",
"creation",
"date",
"current",
"s... | def describe_workflow_type(self, domain, workflow_name, workflow_version):
"""
Returns information about the specified workflow type. This
includes configuration settings specified when the type was
registered and other information such as creation date,
current status, etc.
... | [
"def",
"describe_workflow_type",
"(",
"self",
",",
"domain",
",",
"workflow_name",
",",
"workflow_version",
")",
":",
"return",
"self",
".",
"json_request",
"(",
"'DescribeWorkflowType'",
",",
"{",
"'domain'",
":",
"domain",
",",
"'workflowType'",
":",
"{",
"'na... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/swf/layer1.py#L986-L1009 | |
PaddlePaddle/PaddleOCR | b756bf5f8c90142e0d89d3db0163965c686b6ffe | deploy/pdserving/ocr_reader.py | python | CharacterOps.decode | (self, text_index, is_remove_duplicate=False) | return text | convert text-index into text-label. | convert text-index into text-label. | [
"convert",
"text",
"-",
"index",
"into",
"text",
"-",
"label",
"."
] | def decode(self, text_index, is_remove_duplicate=False):
""" convert text-index into text-label. """
char_list = []
char_num = self.get_char_num()
if self.loss_type == "attention":
beg_idx = self.get_beg_end_flag_idx("beg")
end_idx = self.get_beg_end_flag_idx("en... | [
"def",
"decode",
"(",
"self",
",",
"text_index",
",",
"is_remove_duplicate",
"=",
"False",
")",
":",
"char_list",
"=",
"[",
"]",
"char_num",
"=",
"self",
".",
"get_char_num",
"(",
")",
"if",
"self",
".",
"loss_type",
"==",
"\"attention\"",
":",
"beg_idx",
... | https://github.com/PaddlePaddle/PaddleOCR/blob/b756bf5f8c90142e0d89d3db0163965c686b6ffe/deploy/pdserving/ocr_reader.py#L298-L318 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/distributed/fleet/base/distributed_strategy.py | python | DistributedStrategy.amp_configs | (self) | return get_msg_dict(self.strategy.amp_configs) | Set automatic mixed precision training configurations. In general, amp has serveral configurable
settings that can be configured through a dict.
**Notes**:
init_loss_scaling(float): The initial loss scaling factor. Default 32768.
use_dynamic_loss_scaling(bool): Whether to use d... | Set automatic mixed precision training configurations. In general, amp has serveral configurable
settings that can be configured through a dict. | [
"Set",
"automatic",
"mixed",
"precision",
"training",
"configurations",
".",
"In",
"general",
"amp",
"has",
"serveral",
"configurable",
"settings",
"that",
"can",
"be",
"configured",
"through",
"a",
"dict",
"."
] | def amp_configs(self):
"""
Set automatic mixed precision training configurations. In general, amp has serveral configurable
settings that can be configured through a dict.
**Notes**:
init_loss_scaling(float): The initial loss scaling factor. Default 32768.
use_d... | [
"def",
"amp_configs",
"(",
"self",
")",
":",
"return",
"get_msg_dict",
"(",
"self",
".",
"strategy",
".",
"amp_configs",
")"
] | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/distributed/fleet/base/distributed_strategy.py#L544-L597 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/_op_impl/_custom_op/batchnorm_fold2_grad_reduce.py | python | _batchnorm_fold2_grad_reduce_tbe | () | return | _BatchNormFold2GradReduce TBE register | _BatchNormFold2GradReduce TBE register | [
"_BatchNormFold2GradReduce",
"TBE",
"register"
] | def _batchnorm_fold2_grad_reduce_tbe():
"""_BatchNormFold2GradReduce TBE register"""
return | [
"def",
"_batchnorm_fold2_grad_reduce_tbe",
"(",
")",
":",
"return"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/_op_impl/_custom_op/batchnorm_fold2_grad_reduce.py#L43-L45 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/stringold.py | python | capitalize | (s) | return s.capitalize() | capitalize(s) -> string
Return a copy of the string s with only its first character
capitalized. | capitalize(s) -> string | [
"capitalize",
"(",
"s",
")",
"-",
">",
"string"
] | def capitalize(s):
"""capitalize(s) -> string
Return a copy of the string s with only its first character
capitalized.
"""
return s.capitalize() | [
"def",
"capitalize",
"(",
"s",
")",
":",
"return",
"s",
".",
"capitalize",
"(",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/stringold.py#L359-L366 | |
tfwu/FaceDetection-ConvNet-3D | f9251c48eb40c5aec8fba7455115c355466555be | python/build/lib.linux-x86_64-2.7/mxnet/lr_scheduler.py | python | LRScheduler.__init__ | (self) | base_lr : float
the initial learning rate | base_lr : float
the initial learning rate | [
"base_lr",
":",
"float",
"the",
"initial",
"learning",
"rate"
] | def __init__(self):
"""
base_lr : float
the initial learning rate
"""
self.base_lr = 0.01 | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"base_lr",
"=",
"0.01"
] | https://github.com/tfwu/FaceDetection-ConvNet-3D/blob/f9251c48eb40c5aec8fba7455115c355466555be/python/build/lib.linux-x86_64-2.7/mxnet/lr_scheduler.py#L9-L14 | ||
llvm-mirror/lldb | d01083a850f577b85501a0902b52fd0930de72c7 | third_party/Python/module/pexpect-4.6/pexpect/popen_spawn.py | python | PopenSpawn.writelines | (self, sequence) | This calls write() for each element in the sequence.
The sequence can be any iterable object producing strings, typically a
list of strings. This does not add line separators. There is no return
value. | This calls write() for each element in the sequence. | [
"This",
"calls",
"write",
"()",
"for",
"each",
"element",
"in",
"the",
"sequence",
"."
] | def writelines(self, sequence):
'''This calls write() for each element in the sequence.
The sequence can be any iterable object producing strings, typically a
list of strings. This does not add line separators. There is no return
value.
'''
for s in sequence:
... | [
"def",
"writelines",
"(",
"self",
",",
"sequence",
")",
":",
"for",
"s",
"in",
"sequence",
":",
"self",
".",
"send",
"(",
"s",
")"
] | https://github.com/llvm-mirror/lldb/blob/d01083a850f577b85501a0902b52fd0930de72c7/third_party/Python/module/pexpect-4.6/pexpect/popen_spawn.py#L122-L130 | ||
tfwu/FaceDetection-ConvNet-3D | f9251c48eb40c5aec8fba7455115c355466555be | python/build/lib.linux-x86_64-2.7/mxnet/symbol.py | python | Symbol.save | (self, fname) | Save symbol into file.
You can also use pickle to do the job if you only work on python.
The advantage of load/save is the file is language agnostic.
This means the file saved using save can be loaded by other language binding of mxnet.
You also get the benefit being able to directly lo... | Save symbol into file. | [
"Save",
"symbol",
"into",
"file",
"."
] | def save(self, fname):
"""Save symbol into file.
You can also use pickle to do the job if you only work on python.
The advantage of load/save is the file is language agnostic.
This means the file saved using save can be loaded by other language binding of mxnet.
You also get the... | [
"def",
"save",
"(",
"self",
",",
"fname",
")",
":",
"if",
"not",
"isinstance",
"(",
"fname",
",",
"string_types",
")",
":",
"raise",
"TypeError",
"(",
"'fname need to be string'",
")",
"check_call",
"(",
"_LIB",
".",
"MXSymbolSaveToFile",
"(",
"self",
".",
... | https://github.com/tfwu/FaceDetection-ConvNet-3D/blob/f9251c48eb40c5aec8fba7455115c355466555be/python/build/lib.linux-x86_64-2.7/mxnet/symbol.py#L499-L521 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/optimize/_numdiff.py | python | group_columns | (A, order=0) | return groups | Group columns of a 2-d matrix for sparse finite differencing [1]_.
Two columns are in the same group if in each row at least one of them
has zero. A greedy sequential algorithm is used to construct groups.
Parameters
----------
A : array_like or sparse matrix, shape (m, n)
Matrix of which ... | Group columns of a 2-d matrix for sparse finite differencing [1]_. | [
"Group",
"columns",
"of",
"a",
"2",
"-",
"d",
"matrix",
"for",
"sparse",
"finite",
"differencing",
"[",
"1",
"]",
"_",
"."
] | def group_columns(A, order=0):
"""Group columns of a 2-d matrix for sparse finite differencing [1]_.
Two columns are in the same group if in each row at least one of them
has zero. A greedy sequential algorithm is used to construct groups.
Parameters
----------
A : array_like or sparse matrix,... | [
"def",
"group_columns",
"(",
"A",
",",
"order",
"=",
"0",
")",
":",
"if",
"issparse",
"(",
"A",
")",
":",
"A",
"=",
"csc_matrix",
"(",
"A",
")",
"else",
":",
"A",
"=",
"np",
".",
"atleast_2d",
"(",
"A",
")",
"A",
"=",
"(",
"A",
"!=",
"0",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/optimize/_numdiff.py#L117-L175 | |
cvxpy/cvxpy | 5165b4fb750dfd237de8659383ef24b4b2e33aaf | cvxpy/atoms/pnorm.py | python | Pnorm.is_incr | (self, idx) | return self.p < 1 or (self.p > 1 and self.args[0].is_nonneg()) | Is the composition non-decreasing in argument idx? | Is the composition non-decreasing in argument idx? | [
"Is",
"the",
"composition",
"non",
"-",
"decreasing",
"in",
"argument",
"idx?"
] | def is_incr(self, idx) -> bool:
"""Is the composition non-decreasing in argument idx?
"""
return self.p < 1 or (self.p > 1 and self.args[0].is_nonneg()) | [
"def",
"is_incr",
"(",
"self",
",",
"idx",
")",
"->",
"bool",
":",
"return",
"self",
".",
"p",
"<",
"1",
"or",
"(",
"self",
".",
"p",
">",
"1",
"and",
"self",
".",
"args",
"[",
"0",
"]",
".",
"is_nonneg",
"(",
")",
")"
] | https://github.com/cvxpy/cvxpy/blob/5165b4fb750dfd237de8659383ef24b4b2e33aaf/cvxpy/atoms/pnorm.py#L193-L196 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Source/ThirdParty/CEF3/pristine/cef_source/tools/automate/automate-git.py | python | remove_deps_entry | (path, entry) | Remove an entry from the Chromium DEPS file at the specified path. | Remove an entry from the Chromium DEPS file at the specified path. | [
"Remove",
"an",
"entry",
"from",
"the",
"Chromium",
"DEPS",
"file",
"at",
"the",
"specified",
"path",
"."
] | def remove_deps_entry(path, entry):
""" Remove an entry from the Chromium DEPS file at the specified path. """
msg('Updating DEPS file: %s' % path)
if not options.dryrun:
# Read the DEPS file.
fp = open(path, 'r')
lines = fp.readlines()
fp.close()
# Write the DEPS file.
# Each entry takes... | [
"def",
"remove_deps_entry",
"(",
"path",
",",
"entry",
")",
":",
"msg",
"(",
"'Updating DEPS file: %s'",
"%",
"path",
")",
"if",
"not",
"options",
".",
"dryrun",
":",
"# Read the DEPS file.",
"fp",
"=",
"open",
"(",
"path",
",",
"'r'",
")",
"lines",
"=",
... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Source/ThirdParty/CEF3/pristine/cef_source/tools/automate/automate-git.py#L213-L234 | ||
forkineye/ESPixelStick | 22926f1c0d1131f1369fc7cad405689a095ae3cb | dist/bin/pyserial/serial/tools/list_ports_osx.py | python | get_string_property | (device_type, property) | return output | Search the given device for the specified string property
@param device_type Type of Device
@param property String to search for
@return Python string containing the value, or None if not found. | Search the given device for the specified string property | [
"Search",
"the",
"given",
"device",
"for",
"the",
"specified",
"string",
"property"
] | def get_string_property(device_type, property):
"""
Search the given device for the specified string property
@param device_type Type of Device
@param property String to search for
@return Python string containing the value, or None if not found.
"""
key = cf.CFStringCreateWithCString(
... | [
"def",
"get_string_property",
"(",
"device_type",
",",
"property",
")",
":",
"key",
"=",
"cf",
".",
"CFStringCreateWithCString",
"(",
"kCFAllocatorDefault",
",",
"property",
".",
"encode",
"(",
"\"mac_roman\"",
")",
",",
"kCFStringEncodingMacRoman",
")",
"CFContaine... | https://github.com/forkineye/ESPixelStick/blob/22926f1c0d1131f1369fc7cad405689a095ae3cb/dist/bin/pyserial/serial/tools/list_ports_osx.py#L79-L104 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py | python | Timestamp.ToMilliseconds | (self) | return (self.seconds * _MILLIS_PER_SECOND +
self.nanos // _NANOS_PER_MILLISECOND) | Converts Timestamp to milliseconds since epoch. | Converts Timestamp to milliseconds since epoch. | [
"Converts",
"Timestamp",
"to",
"milliseconds",
"since",
"epoch",
"."
] | def ToMilliseconds(self):
"""Converts Timestamp to milliseconds since epoch."""
return (self.seconds * _MILLIS_PER_SECOND +
self.nanos // _NANOS_PER_MILLISECOND) | [
"def",
"ToMilliseconds",
"(",
"self",
")",
":",
"return",
"(",
"self",
".",
"seconds",
"*",
"_MILLIS_PER_SECOND",
"+",
"self",
".",
"nanos",
"//",
"_NANOS_PER_MILLISECOND",
")"
] | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L198-L201 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/build/waf-1.7.13/lmbrwaflib/third_party.py | python | CachedThirdPartyLibReader.apply | (self, ctx, platform, configuration) | Apply the environment values for the 3rd party environment definitions to the current configuration context
:param ctx: The current configuration context
:param platform: The current platform to apply for
:param configuration: The current configuration to apply for | Apply the environment values for the 3rd party environment definitions to the current configuration context | [
"Apply",
"the",
"environment",
"values",
"for",
"the",
"3rd",
"party",
"environment",
"definitions",
"to",
"the",
"current",
"configuration",
"context"
] | def apply(self, ctx, platform, configuration):
"""
Apply the environment values for the 3rd party environment definitions to the current configuration context
:param ctx: The current configuration context
:param platform: The current platform to apply for
:par... | [
"def",
"apply",
"(",
"self",
",",
"ctx",
",",
"platform",
",",
"configuration",
")",
":",
"if",
"self",
".",
"cache_obj",
".",
"is_cache_dirty",
"(",
")",
":",
"# If the cache is marked dirty, re-initialize it",
"self",
".",
"reset_cache_obj",
"(",
"ctx",
")",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/build/waf-1.7.13/lmbrwaflib/third_party.py#L2553-L2574 | ||
devsisters/libquic | 8954789a056d8e7d5fcb6452fd1572ca57eb5c4e | src/third_party/protobuf/python/google/protobuf/internal/well_known_types.py | python | Timestamp.FromMicroseconds | (self, micros) | Converts microseconds since epoch to Timestamp. | Converts microseconds since epoch to Timestamp. | [
"Converts",
"microseconds",
"since",
"epoch",
"to",
"Timestamp",
"."
] | def FromMicroseconds(self, micros):
"""Converts microseconds since epoch to Timestamp."""
self.seconds = micros // _MICROS_PER_SECOND
self.nanos = (micros % _MICROS_PER_SECOND) * _NANOS_PER_MICROSECOND | [
"def",
"FromMicroseconds",
"(",
"self",
",",
"micros",
")",
":",
"self",
".",
"seconds",
"=",
"micros",
"//",
"_MICROS_PER_SECOND",
"self",
".",
"nanos",
"=",
"(",
"micros",
"%",
"_MICROS_PER_SECOND",
")",
"*",
"_NANOS_PER_MICROSECOND"
] | https://github.com/devsisters/libquic/blob/8954789a056d8e7d5fcb6452fd1572ca57eb5c4e/src/third_party/protobuf/python/google/protobuf/internal/well_known_types.py#L211-L214 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/python_message.py | python | _ExtensionDict.__setitem__ | (self, extension_handle, value) | If extension_handle specifies a non-repeated, scalar extension
field, sets the value of that field. | If extension_handle specifies a non-repeated, scalar extension
field, sets the value of that field. | [
"If",
"extension_handle",
"specifies",
"a",
"non",
"-",
"repeated",
"scalar",
"extension",
"field",
"sets",
"the",
"value",
"of",
"that",
"field",
"."
] | def __setitem__(self, extension_handle, value):
"""If extension_handle specifies a non-repeated, scalar extension
field, sets the value of that field.
"""
_VerifyExtensionHandle(self._extended_message, extension_handle)
if (extension_handle.label == _FieldDescriptor.LABEL_REPEATED or
exten... | [
"def",
"__setitem__",
"(",
"self",
",",
"extension_handle",
",",
"value",
")",
":",
"_VerifyExtensionHandle",
"(",
"self",
".",
"_extended_message",
",",
"extension_handle",
")",
"if",
"(",
"extension_handle",
".",
"label",
"==",
"_FieldDescriptor",
".",
"LABEL_RE... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/python_message.py#L1497-L1516 | ||
nnrg/opennero | 43e12a1bcba6e228639db3886fec1dc47ddc24cb | mods/NERO/environment.py | python | AgentState.update_damage | (self) | return damage | Update the damage for an agent, returning the current damage. | Update the damage for an agent, returning the current damage. | [
"Update",
"the",
"damage",
"for",
"an",
"agent",
"returning",
"the",
"current",
"damage",
"."
] | def update_damage(self):
"""
Update the damage for an agent, returning the current damage.
"""
self.total_damage += self.curr_damage
damage = self.curr_damage
self.curr_damage = 0
return damage | [
"def",
"update_damage",
"(",
"self",
")",
":",
"self",
".",
"total_damage",
"+=",
"self",
".",
"curr_damage",
"damage",
"=",
"self",
".",
"curr_damage",
"self",
".",
"curr_damage",
"=",
"0",
"return",
"damage"
] | https://github.com/nnrg/opennero/blob/43e12a1bcba6e228639db3886fec1dc47ddc24cb/mods/NERO/environment.py#L44-L51 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_windows.py | python | PrintPreview.GetZoom | (*args, **kwargs) | return _windows_.PrintPreview_GetZoom(*args, **kwargs) | GetZoom(self) -> int | GetZoom(self) -> int | [
"GetZoom",
"(",
"self",
")",
"-",
">",
"int"
] | def GetZoom(*args, **kwargs):
"""GetZoom(self) -> int"""
return _windows_.PrintPreview_GetZoom(*args, **kwargs) | [
"def",
"GetZoom",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"PrintPreview_GetZoom",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_windows.py#L5629-L5631 | |
klzgrad/naiveproxy | ed2c513637c77b18721fe428d7ed395b4d284c83 | src/tools/grit/grit/gather/chrome_html.py | python | GetImageList | (
base_path, filename, scale_factors, distribution,
filename_expansion_function=None) | return images | Generate the list of images which match the provided scale factors.
Takes an image filename and checks for files of the same name in folders
corresponding to the supported scale factors. If the file is from a
chrome://theme/ source, inserts supported @Nx scale factors as high DPI
versions.
Args:
base_pa... | Generate the list of images which match the provided scale factors. | [
"Generate",
"the",
"list",
"of",
"images",
"which",
"match",
"the",
"provided",
"scale",
"factors",
"."
] | def GetImageList(
base_path, filename, scale_factors, distribution,
filename_expansion_function=None):
"""Generate the list of images which match the provided scale factors.
Takes an image filename and checks for files of the same name in folders
corresponding to the supported scale factors. If the file ... | [
"def",
"GetImageList",
"(",
"base_path",
",",
"filename",
",",
"scale_factors",
",",
"distribution",
",",
"filename_expansion_function",
"=",
"None",
")",
":",
"# Any matches for which a chrome URL handler will serve all scale factors",
"# can simply request all scale factors.",
... | https://github.com/klzgrad/naiveproxy/blob/ed2c513637c77b18721fe428d7ed395b4d284c83/src/tools/grit/grit/gather/chrome_html.py#L56-L111 | |
OAID/Caffe-HRT | aae71e498ab842c6f92bcc23fc668423615a4d65 | scripts/cpp_lint.py | python | CheckForNewlineAtEOF | (filename, lines, error) | Logs an error if there is no newline char at the end of the file.
Args:
filename: The name of the current file.
lines: An array of strings, each representing a line of the file.
error: The function to call with any errors found. | Logs an error if there is no newline char at the end of the file. | [
"Logs",
"an",
"error",
"if",
"there",
"is",
"no",
"newline",
"char",
"at",
"the",
"end",
"of",
"the",
"file",
"."
] | def CheckForNewlineAtEOF(filename, lines, error):
"""Logs an error if there is no newline char at the end of the file.
Args:
filename: The name of the current file.
lines: An array of strings, each representing a line of the file.
error: The function to call with any errors found.
"""
# The array ... | [
"def",
"CheckForNewlineAtEOF",
"(",
"filename",
",",
"lines",
",",
"error",
")",
":",
"# The array lines() was created by adding two newlines to the",
"# original file (go figure), then splitting on \\n.",
"# To verify that the file ends in \\n, we just have to make sure the",
"# last-but-... | https://github.com/OAID/Caffe-HRT/blob/aae71e498ab842c6f92bcc23fc668423615a4d65/scripts/cpp_lint.py#L1508-L1523 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/richtext.py | python | TextBoxAttr.SetBoxStyleName | (*args, **kwargs) | return _richtext.TextBoxAttr_SetBoxStyleName(*args, **kwargs) | SetBoxStyleName(self, String name) | SetBoxStyleName(self, String name) | [
"SetBoxStyleName",
"(",
"self",
"String",
"name",
")"
] | def SetBoxStyleName(*args, **kwargs):
"""SetBoxStyleName(self, String name)"""
return _richtext.TextBoxAttr_SetBoxStyleName(*args, **kwargs) | [
"def",
"SetBoxStyleName",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"TextBoxAttr_SetBoxStyleName",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/richtext.py#L832-L834 | |
cybermaggedon/cyberprobe | f826dbc35ad3a79019cb871c0bc3fb1236130b3e | indicators/cyberprobe/logictree.py | python | And.dump_logic_tree | (self, indent=0) | Dumps out a logic tree in human-readable form | Dumps out a logic tree in human-readable form | [
"Dumps",
"out",
"a",
"logic",
"tree",
"in",
"human",
"-",
"readable",
"form"
] | def dump_logic_tree(self, indent=0):
""" Dumps out a logic tree in human-readable form """
for v in range(0, indent): sys.stdout.write(" ")
print("%s: and" % self.id)
for v in self.e:
v.dump_logic_tree(indent+1) | [
"def",
"dump_logic_tree",
"(",
"self",
",",
"indent",
"=",
"0",
")",
":",
"for",
"v",
"in",
"range",
"(",
"0",
",",
"indent",
")",
":",
"sys",
".",
"stdout",
".",
"write",
"(",
"\" \"",
")",
"print",
"(",
"\"%s: and\"",
"%",
"self",
".",
"id",
"... | https://github.com/cybermaggedon/cyberprobe/blob/f826dbc35ad3a79019cb871c0bc3fb1236130b3e/indicators/cyberprobe/logictree.py#L85-L91 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/ma/mrecords.py | python | MaskedRecords.harden_mask | (self) | Forces the mask to hard. | Forces the mask to hard. | [
"Forces",
"the",
"mask",
"to",
"hard",
"."
] | def harden_mask(self):
"""
Forces the mask to hard.
"""
self._hardmask = True | [
"def",
"harden_mask",
"(",
"self",
")",
":",
"self",
".",
"_hardmask",
"=",
"True"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/ma/mrecords.py#L406-L411 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/nn_impl.py | python | _sum_rows | (x) | return array_ops.reshape(math_ops.matmul(x, ones), [-1]) | Returns a vector summing up each row of the matrix x. | Returns a vector summing up each row of the matrix x. | [
"Returns",
"a",
"vector",
"summing",
"up",
"each",
"row",
"of",
"the",
"matrix",
"x",
"."
] | def _sum_rows(x):
"""Returns a vector summing up each row of the matrix x."""
# _sum_rows(x) is equivalent to math_ops.reduce_sum(x, 1) when x is
# a matrix. The gradient of _sum_rows(x) is more efficient than
# reduce_sum(x, 1)'s gradient in today's implementation. Therefore,
# we use _sum_rows(x) in the nc... | [
"def",
"_sum_rows",
"(",
"x",
")",
":",
"# _sum_rows(x) is equivalent to math_ops.reduce_sum(x, 1) when x is",
"# a matrix. The gradient of _sum_rows(x) is more efficient than",
"# reduce_sum(x, 1)'s gradient in today's implementation. Therefore,",
"# we use _sum_rows(x) in the nce_loss() computa... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/nn_impl.py#L1809-L1819 | |
google/zooshi | 05390b98f79eed8ef26ec4ab2c3aea3790b1165c | scripts/export.py | python | zip_binary | (zip_file, path, filename, output_dir) | Finds and adds a binary to the given zip file.
Given a path to search, find the binary file and add it to the zip archive at
the location given in the output_dir.
Args:
zip_file: The zip archive to add the binary to.
path: Where to search for the binary.
filename: The binary to search for. This will... | Finds and adds a binary to the given zip file. | [
"Finds",
"and",
"adds",
"a",
"binary",
"to",
"the",
"given",
"zip",
"file",
"."
] | def zip_binary(zip_file, path, filename, output_dir):
"""Finds and adds a binary to the given zip file.
Given a path to search, find the binary file and add it to the zip archive at
the location given in the output_dir.
Args:
zip_file: The zip archive to add the binary to.
path: Where to search for th... | [
"def",
"zip_binary",
"(",
"zip_file",
",",
"path",
",",
"filename",
",",
"output_dir",
")",
":",
"binary",
"=",
"find_file",
"(",
"path",
",",
"filename",
")",
"or",
"find_file",
"(",
"path",
",",
"filename",
"+",
"'.exe'",
")",
"if",
"binary",
":",
"o... | https://github.com/google/zooshi/blob/05390b98f79eed8ef26ec4ab2c3aea3790b1165c/scripts/export.py#L63-L90 | ||
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/external/bazel_tools/third_party/py/gflags/__init__.py | python | Flag.Type | (self) | return self.parser.Type() | Returns: a string that describes the type of this Flag. | Returns: a string that describes the type of this Flag. | [
"Returns",
":",
"a",
"string",
"that",
"describes",
"the",
"type",
"of",
"this",
"Flag",
"."
] | def Type(self):
"""Returns: a string that describes the type of this Flag."""
# NOTE: we use strings, and not the types.*Type constants because
# our flags can have more exotic types, e.g., 'comma separated list
# of strings', 'whitespace separated list of strings', etc.
return self.parser.Type() | [
"def",
"Type",
"(",
"self",
")",
":",
"# NOTE: we use strings, and not the types.*Type constants because",
"# our flags can have more exotic types, e.g., 'comma separated list",
"# of strings', 'whitespace separated list of strings', etc.",
"return",
"self",
".",
"parser",
".",
"Type",
... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/external/bazel_tools/third_party/py/gflags/__init__.py#L1930-L1935 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/genericmessagedialog.py | python | GenericMessageDialog.GetMessage | (self) | return self._message | Returns a string representing the main :class:`GenericMessageDialog` message.
.. versionadded:: 0.9.3 | Returns a string representing the main :class:`GenericMessageDialog` message. | [
"Returns",
"a",
"string",
"representing",
"the",
"main",
":",
"class",
":",
"GenericMessageDialog",
"message",
"."
] | def GetMessage(self):
"""
Returns a string representing the main :class:`GenericMessageDialog` message.
.. versionadded:: 0.9.3
"""
return self._message | [
"def",
"GetMessage",
"(",
"self",
")",
":",
"return",
"self",
".",
"_message"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/genericmessagedialog.py#L1526-L1533 | |
apache/arrow | af33dd1157eb8d7d9bfac25ebf61445b793b7943 | python/pyarrow/jvm.py | python | record_batch | (jvm_vector_schema_root) | return pa.RecordBatch.from_arrays(
arrays,
pa_schema.names,
metadata=pa_schema.metadata
) | Construct a (Python) RecordBatch from a JVM VectorSchemaRoot
Parameters
----------
jvm_vector_schema_root : org.apache.arrow.vector.VectorSchemaRoot
Returns
-------
record_batch: pyarrow.RecordBatch | Construct a (Python) RecordBatch from a JVM VectorSchemaRoot | [
"Construct",
"a",
"(",
"Python",
")",
"RecordBatch",
"from",
"a",
"JVM",
"VectorSchemaRoot"
] | def record_batch(jvm_vector_schema_root):
"""
Construct a (Python) RecordBatch from a JVM VectorSchemaRoot
Parameters
----------
jvm_vector_schema_root : org.apache.arrow.vector.VectorSchemaRoot
Returns
-------
record_batch: pyarrow.RecordBatch
"""
pa_schema = schema(jvm_vector... | [
"def",
"record_batch",
"(",
"jvm_vector_schema_root",
")",
":",
"pa_schema",
"=",
"schema",
"(",
"jvm_vector_schema_root",
".",
"getSchema",
"(",
")",
")",
"arrays",
"=",
"[",
"]",
"for",
"name",
"in",
"pa_schema",
".",
"names",
":",
"arrays",
".",
"append",... | https://github.com/apache/arrow/blob/af33dd1157eb8d7d9bfac25ebf61445b793b7943/python/pyarrow/jvm.py#L313-L335 | |
google/ion | ef47f3b824050499ce5c6f774b366f6c4dbce0af | ion/build.py | python | TargetBuilder.GypEnv | (self) | return env | Returns the environment variables to use when running gyp.
By default, this just returns a copy of os.environ.
Returns:
A dictionary of environment variables. | Returns the environment variables to use when running gyp. | [
"Returns",
"the",
"environment",
"variables",
"to",
"use",
"when",
"running",
"gyp",
"."
] | def GypEnv(self):
"""Returns the environment variables to use when running gyp.
By default, this just returns a copy of os.environ.
Returns:
A dictionary of environment variables.
"""
env = os.environ.copy()
env['GYP_CROSSCOMPILE'] = '1'
return env | [
"def",
"GypEnv",
"(",
"self",
")",
":",
"env",
"=",
"os",
".",
"environ",
".",
"copy",
"(",
")",
"env",
"[",
"'GYP_CROSSCOMPILE'",
"]",
"=",
"'1'",
"return",
"env"
] | https://github.com/google/ion/blob/ef47f3b824050499ce5c6f774b366f6c4dbce0af/ion/build.py#L482-L492 | |
SpenceKonde/megaTinyCore | 1c4a70b18a149fe6bcb551dfa6db11ca50b8997b | megaavr/tools/libs/pymcuprog/backend.py | python | Backend._is_connected_to_hid_tool | (self) | return self.connected_to_tool and isinstance(self.transport, HidTransportBase) | Check if a connection to a USB HID tool is active | Check if a connection to a USB HID tool is active | [
"Check",
"if",
"a",
"connection",
"to",
"a",
"USB",
"HID",
"tool",
"is",
"active"
] | def _is_connected_to_hid_tool(self):
"""
Check if a connection to a USB HID tool is active
"""
return self.connected_to_tool and isinstance(self.transport, HidTransportBase) | [
"def",
"_is_connected_to_hid_tool",
"(",
"self",
")",
":",
"return",
"self",
".",
"connected_to_tool",
"and",
"isinstance",
"(",
"self",
".",
"transport",
",",
"HidTransportBase",
")"
] | https://github.com/SpenceKonde/megaTinyCore/blob/1c4a70b18a149fe6bcb551dfa6db11ca50b8997b/megaavr/tools/libs/pymcuprog/backend.py#L637-L641 | |
nvdla/sw | 79538ba1b52b040a4a4645f630e457fa01839e90 | umd/external/protobuf-2.6/python/google/protobuf/descriptor_pool.py | python | DescriptorPool._ConvertEnumDescriptor | (self, enum_proto, package=None, file_desc=None,
containing_type=None, scope=None) | return desc | Make a protobuf EnumDescriptor given an EnumDescriptorProto protobuf.
Args:
enum_proto: The descriptor_pb2.EnumDescriptorProto protobuf message.
package: Optional package name for the new message EnumDescriptor.
file_desc: The file containing the enum descriptor.
containing_type: The type c... | Make a protobuf EnumDescriptor given an EnumDescriptorProto protobuf. | [
"Make",
"a",
"protobuf",
"EnumDescriptor",
"given",
"an",
"EnumDescriptorProto",
"protobuf",
"."
] | def _ConvertEnumDescriptor(self, enum_proto, package=None, file_desc=None,
containing_type=None, scope=None):
"""Make a protobuf EnumDescriptor given an EnumDescriptorProto protobuf.
Args:
enum_proto: The descriptor_pb2.EnumDescriptorProto protobuf message.
package: Opt... | [
"def",
"_ConvertEnumDescriptor",
"(",
"self",
",",
"enum_proto",
",",
"package",
"=",
"None",
",",
"file_desc",
"=",
"None",
",",
"containing_type",
"=",
"None",
",",
"scope",
"=",
"None",
")",
":",
"if",
"package",
":",
"enum_name",
"=",
"'.'",
".",
"jo... | https://github.com/nvdla/sw/blob/79538ba1b52b040a4a4645f630e457fa01839e90/umd/external/protobuf-2.6/python/google/protobuf/descriptor_pool.py#L401-L437 | |
forkineye/ESPixelStick | 22926f1c0d1131f1369fc7cad405689a095ae3cb | dist/bin/esptool/serial/serialposix.py | python | Serial.open | (self) | \
Open port with current settings. This may throw a SerialException
if the port cannot be opened. | \
Open port with current settings. This may throw a SerialException
if the port cannot be opened. | [
"\\",
"Open",
"port",
"with",
"current",
"settings",
".",
"This",
"may",
"throw",
"a",
"SerialException",
"if",
"the",
"port",
"cannot",
"be",
"opened",
"."
] | def open(self):
"""\
Open port with current settings. This may throw a SerialException
if the port cannot be opened."""
if self._port is None:
raise SerialException("Port must be configured before it can be used.")
if self.is_open:
raise SerialException("P... | [
"def",
"open",
"(",
"self",
")",
":",
"if",
"self",
".",
"_port",
"is",
"None",
":",
"raise",
"SerialException",
"(",
"\"Port must be configured before it can be used.\"",
")",
"if",
"self",
".",
"is_open",
":",
"raise",
"SerialException",
"(",
"\"Port is already ... | https://github.com/forkineye/ESPixelStick/blob/22926f1c0d1131f1369fc7cad405689a095ae3cb/dist/bin/esptool/serial/serialposix.py#L254-L299 | ||
rdkit/rdkit | ede860ae316d12d8568daf5ee800921c3389c84e | rdkit/sping/pid.py | python | Canvas.drawLines | (self, lineList, color=None, width=None, dash=None, **kwargs) | Draw a set of lines of uniform color and width. \
lineList: a list of (x1,y1,x2,y2) line coordinates. | Draw a set of lines of uniform color and width. \
lineList: a list of (x1,y1,x2,y2) line coordinates. | [
"Draw",
"a",
"set",
"of",
"lines",
"of",
"uniform",
"color",
"and",
"width",
".",
"\\",
"lineList",
":",
"a",
"list",
"of",
"(",
"x1",
"y1",
"x2",
"y2",
")",
"line",
"coordinates",
"."
] | def drawLines(self, lineList, color=None, width=None, dash=None, **kwargs):
"Draw a set of lines of uniform color and width. \
lineList: a list of (x1,y1,x2,y2) line coordinates."
# default implementation:
for x1, y1, x2, y2 in lineList:
self.drawLine(x1, y1, x2... | [
"def",
"drawLines",
"(",
"self",
",",
"lineList",
",",
"color",
"=",
"None",
",",
"width",
"=",
"None",
",",
"dash",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# default implementation:",
"for",
"x1",
",",
"y1",
",",
"x2",
",",
"y2",
"in",
"l... | https://github.com/rdkit/rdkit/blob/ede860ae316d12d8568daf5ee800921c3389c84e/rdkit/sping/pid.py#L418-L424 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_internal/req/req_tracker.py | python | RequirementTracker.remove | (self, req) | Remove an InstallRequirement from build tracking. | Remove an InstallRequirement from build tracking. | [
"Remove",
"an",
"InstallRequirement",
"from",
"build",
"tracking",
"."
] | def remove(self, req):
# type: (InstallRequirement) -> None
"""Remove an InstallRequirement from build tracking.
"""
assert req.link
# Delete the created file and the corresponding entries.
os.unlink(self._entry_path(req.link))
self._entries.remove(req)
... | [
"def",
"remove",
"(",
"self",
",",
"req",
")",
":",
"# type: (InstallRequirement) -> None",
"assert",
"req",
".",
"link",
"# Delete the created file and the corresponding entries.",
"os",
".",
"unlink",
"(",
"self",
".",
"_entry_path",
"(",
"req",
".",
"link",
")",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_internal/req/req_tracker.py#L243-L263 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/setuptools/_vendor/six.py | python | _add_doc | (func, doc) | Add documentation to a function. | Add documentation to a function. | [
"Add",
"documentation",
"to",
"a",
"function",
"."
] | def _add_doc(func, doc):
"""Add documentation to a function."""
func.__doc__ = doc | [
"def",
"_add_doc",
"(",
"func",
",",
"doc",
")",
":",
"func",
".",
"__doc__",
"=",
"doc"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/setuptools/_vendor/six.py#L75-L77 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.