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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
hakuna-m/wubiuefi | caec1af0a09c78fd5a345180ada1fe45e0c63493 | src/openpgp/sap/list.py | python | deliteralize | (msgs) | return outlist | String-ify literal messages.
:Parameters:
- `msgs`: list of message instances
:Returns: list of same messages, except that all literals will have been
magically converted to strings
Sample literal output::
Filename: the_file.txt
Modified: 1234567890
Fo... | String-ify literal messages.
:Parameters:
- `msgs`: list of message instances | [
"String",
"-",
"ify",
"literal",
"messages",
".",
":",
"Parameters",
":",
"-",
"msgs",
":",
"list",
"of",
"message",
"instances"
] | def deliteralize(msgs):
"""String-ify literal messages.
:Parameters:
- `msgs`: list of message instances
:Returns: list of same messages, except that all literals will have been
magically converted to strings
Sample literal output::
Filename: the_file.txt
... | [
"def",
"deliteralize",
"(",
"msgs",
")",
":",
"outlist",
"=",
"[",
"]",
"for",
"msg",
"in",
"msgs",
":",
"if",
"hasattr",
"(",
"msg",
",",
"'literals'",
")",
":",
"for",
"pkt",
"in",
"msg",
".",
"literals",
":",
"msg",
"=",
"linesep",
".",
"join",
... | https://github.com/hakuna-m/wubiuefi/blob/caec1af0a09c78fd5a345180ada1fe45e0c63493/src/openpgp/sap/list.py#L32-L78 | |
cvxpy/cvxpy | 5165b4fb750dfd237de8659383ef24b4b2e33aaf | cvxpy/reductions/complex2real/atom_canonicalizers/psd_canon.py | python | psd_canon | (expr, real_args, imag_args, real2imag) | return [expr.copy([matrix])], None | Canonicalize functions that take a Hermitian matrix. | Canonicalize functions that take a Hermitian matrix. | [
"Canonicalize",
"functions",
"that",
"take",
"a",
"Hermitian",
"matrix",
"."
] | def psd_canon(expr, real_args, imag_args, real2imag):
"""Canonicalize functions that take a Hermitian matrix.
"""
if imag_args[0] is None:
matrix = real_args[0]
else:
if real_args[0] is None:
real_args[0] = np.zeros(imag_args[0].shape)
matrix = bmat([[real_args[0], -i... | [
"def",
"psd_canon",
"(",
"expr",
",",
"real_args",
",",
"imag_args",
",",
"real2imag",
")",
":",
"if",
"imag_args",
"[",
"0",
"]",
"is",
"None",
":",
"matrix",
"=",
"real_args",
"[",
"0",
"]",
"else",
":",
"if",
"real_args",
"[",
"0",
"]",
"is",
"N... | https://github.com/cvxpy/cvxpy/blob/5165b4fb750dfd237de8659383ef24b4b2e33aaf/cvxpy/reductions/complex2real/atom_canonicalizers/psd_canon.py#L22-L32 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/summary/summary.py | python | tensor_summary | (name,
tensor,
summary_description=None,
collections=None,
summary_metadata=None,
family=None,
display_name=None) | return val | Outputs a `Summary` protocol buffer with a serialized tensor.proto.
Args:
name: A name for the generated node. If display_name is not set, it will
also serve as the tag name in TensorBoard. (In that case, the tag
name will inherit tf name scopes.)
tensor: A tensor of any type and shape to seriali... | Outputs a `Summary` protocol buffer with a serialized tensor.proto. | [
"Outputs",
"a",
"Summary",
"protocol",
"buffer",
"with",
"a",
"serialized",
"tensor",
".",
"proto",
"."
] | def tensor_summary(name,
tensor,
summary_description=None,
collections=None,
summary_metadata=None,
family=None,
display_name=None):
"""Outputs a `Summary` protocol buffer with a serialized tensor.proto.
... | [
"def",
"tensor_summary",
"(",
"name",
",",
"tensor",
",",
"summary_description",
"=",
"None",
",",
"collections",
"=",
"None",
",",
"summary_metadata",
"=",
"None",
",",
"family",
"=",
"None",
",",
"display_name",
"=",
"None",
")",
":",
"if",
"summary_metada... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/summary/summary.py#L275-L327 | |
emscripten-core/emscripten | 0d413d3c5af8b28349682496edc14656f5700c2f | third_party/websockify/websockify/websocket.py | python | WebSocketServer.poll | (self) | Run periodically while waiting for connections. | Run periodically while waiting for connections. | [
"Run",
"periodically",
"while",
"waiting",
"for",
"connections",
"."
] | def poll(self):
""" Run periodically while waiting for connections. """
#self.vmsg("Running poll()")
pass | [
"def",
"poll",
"(",
"self",
")",
":",
"#self.vmsg(\"Running poll()\")",
"pass"
] | https://github.com/emscripten-core/emscripten/blob/0d413d3c5af8b28349682496edc14656f5700c2f/third_party/websockify/websockify/websocket.py#L889-L892 | ||
freeorion/freeorion | c266a40eccd3a99a17de8fe57c36ef6ba3771665 | default/python/AI/ShipDesignAI.py | python | ShipDesigner._calc_rating_for_name | (self) | return self.design_stats.structure | Return a rough rating for the design independent of special requirements and species.
The design name should not depend on the strength of the enemy or upon some additional requests we have
for the design but only compare the basic functionality. If not overloaded in the subclass, this function
... | Return a rough rating for the design independent of special requirements and species. | [
"Return",
"a",
"rough",
"rating",
"for",
"the",
"design",
"independent",
"of",
"special",
"requirements",
"and",
"species",
"."
] | def _calc_rating_for_name(self):
"""Return a rough rating for the design independent of special requirements and species.
The design name should not depend on the strength of the enemy or upon some additional requests we have
for the design but only compare the basic functionality. If not overl... | [
"def",
"_calc_rating_for_name",
"(",
"self",
")",
":",
"self",
".",
"update_stats",
"(",
"ignore_species",
"=",
"True",
")",
"return",
"self",
".",
"design_stats",
".",
"structure"
] | https://github.com/freeorion/freeorion/blob/c266a40eccd3a99a17de8fe57c36ef6ba3771665/default/python/AI/ShipDesignAI.py#L1366-L1376 | |
simsong/bulk_extractor | 738911df22b7066ca9e1662f4131fb44090a4196 | python/dfxml.py | python | registry_value_object.__init__ | (self) | List for the string-list type of value. | List for the string-list type of value. | [
"List",
"for",
"the",
"string",
"-",
"list",
"type",
"of",
"value",
"."
] | def __init__(self):
registry_cell_object.__init__(self)
self.value_data = None
self._cell_type = "registry_value_object"
#TODO Replace to be in line with fileobjects: fileobject.hashdigest is a dictionary
self._hashcache = dict()
"""List for the string-list type of va... | [
"def",
"__init__",
"(",
"self",
")",
":",
"registry_cell_object",
".",
"__init__",
"(",
"self",
")",
"self",
".",
"value_data",
"=",
"None",
"self",
".",
"_cell_type",
"=",
"\"registry_value_object\"",
"#TODO Replace to be in line with fileobjects: fileobject.hashdigest i... | https://github.com/simsong/bulk_extractor/blob/738911df22b7066ca9e1662f4131fb44090a4196/python/dfxml.py#L550-L560 | ||
p4lang/behavioral-model | 81ce0163f0770c6b9d6056a28ce2e0cc035bb6e9 | mininet/p4_mininet.py | python | P4Switch.check_switch_started | (self, pid) | While the process is running (pid exists), we check if the Thrift
server has been started. If the Thrift server is ready, we assume that
the switch was started successfully. This is only reliable if the Thrift
server is started at the end of the init process | While the process is running (pid exists), we check if the Thrift
server has been started. If the Thrift server is ready, we assume that
the switch was started successfully. This is only reliable if the Thrift
server is started at the end of the init process | [
"While",
"the",
"process",
"is",
"running",
"(",
"pid",
"exists",
")",
"we",
"check",
"if",
"the",
"Thrift",
"server",
"has",
"been",
"started",
".",
"If",
"the",
"Thrift",
"server",
"is",
"ready",
"we",
"assume",
"that",
"the",
"switch",
"was",
"started... | def check_switch_started(self, pid):
"""While the process is running (pid exists), we check if the Thrift
server has been started. If the Thrift server is ready, we assume that
the switch was started successfully. This is only reliable if the Thrift
server is started at the end of the in... | [
"def",
"check_switch_started",
"(",
"self",
",",
"pid",
")",
":",
"while",
"True",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"os",
".",
"path",
".",
"join",
"(",
"\"/proc\"",
",",
"str",
"(",
"pid",
")",
")",
")",
":",
"return",
"F... | https://github.com/p4lang/behavioral-model/blob/81ce0163f0770c6b9d6056a28ce2e0cc035bb6e9/mininet/p4_mininet.py#L94-L109 | ||
google/earthenterprise | 0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9 | earth_enterprise/src/server/wsgi/serve/push/search/util/search_schema_table_util.py | python | SearchSchemaTableUtil.__init__ | (self, poi_db_connection) | Inits SearchSchemaTableUtil.
Args:
poi_db_connection: gepoi database coneection. | Inits SearchSchemaTableUtil. | [
"Inits",
"SearchSchemaTableUtil",
"."
] | def __init__(self, poi_db_connection):
"""Inits SearchSchemaTableUtil.
Args:
poi_db_connection: gepoi database coneection.
"""
self._poi_db_connection = poi_db_connection | [
"def",
"__init__",
"(",
"self",
",",
"poi_db_connection",
")",
":",
"self",
".",
"_poi_db_connection",
"=",
"poi_db_connection"
] | https://github.com/google/earthenterprise/blob/0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9/earth_enterprise/src/server/wsgi/serve/push/search/util/search_schema_table_util.py#L37-L43 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/ragged/ragged_shape.py | python | RaggedShape._with_num_row_partitions | (self, num_row_partitions) | Creates an identical shape with the given num_row_partitions.
Note that the shape must be statically refactorable to this rank.
In particular:
* rank must be known.
* num_row_partitions must be a nonnegative int.
* num_row_partitions must be less than the rank of the shape
* num_row_partitions ... | Creates an identical shape with the given num_row_partitions. | [
"Creates",
"an",
"identical",
"shape",
"with",
"the",
"given",
"num_row_partitions",
"."
] | def _with_num_row_partitions(self, num_row_partitions):
"""Creates an identical shape with the given num_row_partitions.
Note that the shape must be statically refactorable to this rank.
In particular:
* rank must be known.
* num_row_partitions must be a nonnegative int.
* num_row_partitions mu... | [
"def",
"_with_num_row_partitions",
"(",
"self",
",",
"num_row_partitions",
")",
":",
"rank",
"=",
"self",
".",
"rank",
"if",
"rank",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"Rank must be known to adjust num_row_partitions\"",
")",
"if",
"not",
"isinstance",... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/ragged/ragged_shape.py#L677-L730 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Tools/pybench/pybench.py | python | Test.compatible | (self, other) | return 1 | Return 1/0 depending on whether the test is compatible
with the other Test instance or not. | Return 1/0 depending on whether the test is compatible
with the other Test instance or not. | [
"Return",
"1",
"/",
"0",
"depending",
"on",
"whether",
"the",
"test",
"is",
"compatible",
"with",
"the",
"other",
"Test",
"instance",
"or",
"not",
"."
] | def compatible(self, other):
""" Return 1/0 depending on whether the test is compatible
with the other Test instance or not.
"""
if self.version != other.version:
return 0
if self.rounds != other.rounds:
return 0
return 1 | [
"def",
"compatible",
"(",
"self",
",",
"other",
")",
":",
"if",
"self",
".",
"version",
"!=",
"other",
".",
"version",
":",
"return",
"0",
"if",
"self",
".",
"rounds",
"!=",
"other",
".",
"rounds",
":",
"return",
"0",
"return",
"1"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Tools/pybench/pybench.py#L252-L262 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/training/coordinator.py | python | LooperThread.start_loop | (self) | Called when the thread starts. | Called when the thread starts. | [
"Called",
"when",
"the",
"thread",
"starts",
"."
] | def start_loop(self):
"""Called when the thread starts."""
pass | [
"def",
"start_loop",
"(",
"self",
")",
":",
"pass"
] | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/training/coordinator.py#L497-L499 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/mailbox.py | python | Maildir.flush | (self) | Write any pending changes to disk. | Write any pending changes to disk. | [
"Write",
"any",
"pending",
"changes",
"to",
"disk",
"."
] | def flush(self):
"""Write any pending changes to disk."""
# Maildir changes are always written immediately, so there's nothing
# to do.
pass | [
"def",
"flush",
"(",
"self",
")",
":",
"# Maildir changes are always written immediately, so there's nothing",
"# to do.",
"pass"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/mailbox.py#L395-L399 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_misc.py | python | ConfigBase.WriteInt | (*args, **kwargs) | return _misc_.ConfigBase_WriteInt(*args, **kwargs) | WriteInt(self, String key, long value) -> bool
write the value (return True on success) | WriteInt(self, String key, long value) -> bool | [
"WriteInt",
"(",
"self",
"String",
"key",
"long",
"value",
")",
"-",
">",
"bool"
] | def WriteInt(*args, **kwargs):
"""
WriteInt(self, String key, long value) -> bool
write the value (return True on success)
"""
return _misc_.ConfigBase_WriteInt(*args, **kwargs) | [
"def",
"WriteInt",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"ConfigBase_WriteInt",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_misc.py#L3295-L3301 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/re.py | python | escape | (pattern) | Escape special characters in a string. | Escape special characters in a string. | [
"Escape",
"special",
"characters",
"in",
"a",
"string",
"."
] | def escape(pattern):
"""
Escape special characters in a string.
"""
if isinstance(pattern, str):
return pattern.translate(_special_chars_map)
else:
pattern = str(pattern, 'latin1')
return pattern.translate(_special_chars_map).encode('latin1') | [
"def",
"escape",
"(",
"pattern",
")",
":",
"if",
"isinstance",
"(",
"pattern",
",",
"str",
")",
":",
"return",
"pattern",
".",
"translate",
"(",
"_special_chars_map",
")",
"else",
":",
"pattern",
"=",
"str",
"(",
"pattern",
",",
"'latin1'",
")",
"return"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/re.py#L270-L278 | ||
cvxpy/cvxpy | 5165b4fb750dfd237de8659383ef24b4b2e33aaf | cvxpy/constraints/nonpos.py | python | Inequality.size | (self) | return self.expr.size | int : The size of the constrained expression. | int : The size of the constrained expression. | [
"int",
":",
"The",
"size",
"of",
"the",
"constrained",
"expression",
"."
] | def size(self):
"""int : The size of the constrained expression."""
return self.expr.size | [
"def",
"size",
"(",
"self",
")",
":",
"return",
"self",
".",
"expr",
".",
"size"
] | https://github.com/cvxpy/cvxpy/blob/5165b4fb750dfd237de8659383ef24b4b2e33aaf/cvxpy/constraints/nonpos.py#L176-L178 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py | python | _AddWinLinkRules | (master_ninja, embed_manifest) | Adds link rules for Windows platform to |master_ninja|. | Adds link rules for Windows platform to |master_ninja|. | [
"Adds",
"link",
"rules",
"for",
"Windows",
"platform",
"to",
"|master_ninja|",
"."
] | def _AddWinLinkRules(master_ninja, embed_manifest):
"""Adds link rules for Windows platform to |master_ninja|."""
def FullLinkCommand(ldcmd, out, binary_type):
resource_name = {"exe": "1", "dll": "2"}[binary_type]
return (
"%(python)s gyp-win-tool link-with-manifests $arch %(embed)s... | [
"def",
"_AddWinLinkRules",
"(",
"master_ninja",
",",
"embed_manifest",
")",
":",
"def",
"FullLinkCommand",
"(",
"ldcmd",
",",
"out",
",",
"binary_type",
")",
":",
"resource_name",
"=",
"{",
"\"exe\"",
":",
"\"1\"",
",",
"\"dll\"",
":",
"\"2\"",
"}",
"[",
"... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py#L2149-L2209 | ||
psi4/psi4 | be533f7f426b6ccc263904e55122899b16663395 | psi4/driver/qcdb/libmintsmolecule.py | python | LibmintsMolecule.set_basis_all_atoms | (self, name, role="BASIS") | Assigns basis *name* to all atoms. | Assigns basis *name* to all atoms. | [
"Assigns",
"basis",
"*",
"name",
"*",
"to",
"all",
"atoms",
"."
] | def set_basis_all_atoms(self, name, role="BASIS"):
"""Assigns basis *name* to all atoms."""
for atom in self.full_atoms:
atom.set_basisset(name, role) | [
"def",
"set_basis_all_atoms",
"(",
"self",
",",
"name",
",",
"role",
"=",
"\"BASIS\"",
")",
":",
"for",
"atom",
"in",
"self",
".",
"full_atoms",
":",
"atom",
".",
"set_basisset",
"(",
"name",
",",
"role",
")"
] | https://github.com/psi4/psi4/blob/be533f7f426b6ccc263904e55122899b16663395/psi4/driver/qcdb/libmintsmolecule.py#L1634-L1637 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/signal/signaltools.py | python | _numeric_arrays | (arrays, kinds='buifc') | return True | See if a list of arrays are all numeric.
Parameters
----------
ndarrays : array or list of arrays
arrays to check if numeric.
numeric_kinds : string-like
The dtypes of the arrays to be checked. If the dtype.kind of
the ndarrays are not in this string the function returns False a... | See if a list of arrays are all numeric. | [
"See",
"if",
"a",
"list",
"of",
"arrays",
"are",
"all",
"numeric",
"."
] | def _numeric_arrays(arrays, kinds='buifc'):
"""
See if a list of arrays are all numeric.
Parameters
----------
ndarrays : array or list of arrays
arrays to check if numeric.
numeric_kinds : string-like
The dtypes of the arrays to be checked. If the dtype.kind of
the ndar... | [
"def",
"_numeric_arrays",
"(",
"arrays",
",",
"kinds",
"=",
"'buifc'",
")",
":",
"if",
"type",
"(",
"arrays",
")",
"==",
"ndarray",
":",
"return",
"arrays",
".",
"dtype",
".",
"kind",
"in",
"kinds",
"for",
"array_",
"in",
"arrays",
":",
"if",
"array_",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/signal/signaltools.py#L443-L461 | |
daijifeng001/caffe-rfcn | 543f8f6a4b7c88256ea1445ae951a12d1ad9cffd | scripts/cpp_lint.py | python | CheckBraces | (filename, clean_lines, linenum, error) | Looks for misplaced braces (e.g. at the end of line).
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found. | Looks for misplaced braces (e.g. at the end of line). | [
"Looks",
"for",
"misplaced",
"braces",
"(",
"e",
".",
"g",
".",
"at",
"the",
"end",
"of",
"line",
")",
"."
] | def CheckBraces(filename, clean_lines, linenum, error):
"""Looks for misplaced braces (e.g. at the end of line).
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any er... | [
"def",
"CheckBraces",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"# get rid of comments and strings",
"if",
"Match",
"(",
"r'\\s*{\\s*$'",
",",
"line",
")",
":",
... | https://github.com/daijifeng001/caffe-rfcn/blob/543f8f6a4b7c88256ea1445ae951a12d1ad9cffd/scripts/cpp_lint.py#L3069-L3240 | ||
okex/V3-Open-API-SDK | c5abb0db7e2287718e0055e17e57672ce0ec7fd9 | okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_vendor/cachecontrol/heuristics.py | python | BaseHeuristic.update_headers | (self, response) | return {} | Update the response headers with any new headers.
NOTE: This SHOULD always include some Warning header to
signify that the response was cached by the client, not
by way of the provided headers. | Update the response headers with any new headers. | [
"Update",
"the",
"response",
"headers",
"with",
"any",
"new",
"headers",
"."
] | def update_headers(self, response):
"""Update the response headers with any new headers.
NOTE: This SHOULD always include some Warning header to
signify that the response was cached by the client, not
by way of the provided headers.
"""
return {} | [
"def",
"update_headers",
"(",
"self",
",",
"response",
")",
":",
"return",
"{",
"}"
] | https://github.com/okex/V3-Open-API-SDK/blob/c5abb0db7e2287718e0055e17e57672ce0ec7fd9/okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_vendor/cachecontrol/heuristics.py#L33-L40 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | SizerFlags.GetBorderInPixels | (*args, **kwargs) | return _core_.SizerFlags_GetBorderInPixels(*args, **kwargs) | GetBorderInPixels(self) -> int
Returns the border value in pixels to be used in the sizer item. | GetBorderInPixels(self) -> int | [
"GetBorderInPixels",
"(",
"self",
")",
"-",
">",
"int"
] | def GetBorderInPixels(*args, **kwargs):
"""
GetBorderInPixels(self) -> int
Returns the border value in pixels to be used in the sizer item.
"""
return _core_.SizerFlags_GetBorderInPixels(*args, **kwargs) | [
"def",
"GetBorderInPixels",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"SizerFlags_GetBorderInPixels",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L13943-L13949 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/httplib.py | python | HTTP.getfile | (self) | return self.file | Provide a getfile, since the superclass' does not use this concept. | Provide a getfile, since the superclass' does not use this concept. | [
"Provide",
"a",
"getfile",
"since",
"the",
"superclass",
"does",
"not",
"use",
"this",
"concept",
"."
] | def getfile(self):
"Provide a getfile, since the superclass' does not use this concept."
return self.file | [
"def",
"getfile",
"(",
"self",
")",
":",
"return",
"self",
".",
"file"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/httplib.py#L1103-L1105 | |
hfinkel/llvm-project-cxxjit | 91084ef018240bbb8e24235ff5cd8c355a9c1a1e | lldb/utils/misc/grep-svn-log.py | python | Log.add_line | (self, a_line) | Add a line to the content, if there is a previous line, commit it. | Add a line to the content, if there is a previous line, commit it. | [
"Add",
"a",
"line",
"to",
"the",
"content",
"if",
"there",
"is",
"a",
"previous",
"line",
"commit",
"it",
"."
] | def add_line(self, a_line):
"""Add a line to the content, if there is a previous line, commit it."""
global separator
if self.prev_line is not None:
print >> self, self.prev_line
self.prev_line = a_line
self.separator_added = (a_line == separator) | [
"def",
"add_line",
"(",
"self",
",",
"a_line",
")",
":",
"global",
"separator",
"if",
"self",
".",
"prev_line",
"is",
"not",
"None",
":",
"print",
">>",
"self",
",",
"self",
".",
"prev_line",
"self",
".",
"prev_line",
"=",
"a_line",
"self",
".",
"separ... | https://github.com/hfinkel/llvm-project-cxxjit/blob/91084ef018240bbb8e24235ff5cd8c355a9c1a1e/lldb/utils/misc/grep-svn-log.py#L31-L37 | ||
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | example/ctc/captcha_generator.py | python | CaptchaGen.__init__ | (self, h, w, font_paths) | Parameters
----------
h: int
Height of the generated images
w: int
Width of the generated images
font_paths: list of str
List of all fonts in ttf format | Parameters
----------
h: int
Height of the generated images
w: int
Width of the generated images
font_paths: list of str
List of all fonts in ttf format | [
"Parameters",
"----------",
"h",
":",
"int",
"Height",
"of",
"the",
"generated",
"images",
"w",
":",
"int",
"Width",
"of",
"the",
"generated",
"images",
"font_paths",
":",
"list",
"of",
"str",
"List",
"of",
"all",
"fonts",
"in",
"ttf",
"format"
] | def __init__(self, h, w, font_paths):
"""
Parameters
----------
h: int
Height of the generated images
w: int
Width of the generated images
font_paths: list of str
List of all fonts in ttf format
"""
self.captcha = ImageC... | [
"def",
"__init__",
"(",
"self",
",",
"h",
",",
"w",
",",
"font_paths",
")",
":",
"self",
".",
"captcha",
"=",
"ImageCaptcha",
"(",
"fonts",
"=",
"font_paths",
")",
"self",
".",
"h",
"=",
"h",
"self",
".",
"w",
"=",
"w"
] | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/example/ctc/captcha_generator.py#L33-L46 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/training/tracking/data_structures.py | python | wrap_or_unwrap | (value) | Wraps input value into trackable data structures.
This is mostly useful for containers like list, dict, etc, which could contain
trackable objects in it. Wrapped data structure will be tracked when
associated with a `tf.Module`, so that save model/checkpoint can properly
track the dependency.
It will also u... | Wraps input value into trackable data structures. | [
"Wraps",
"input",
"value",
"into",
"trackable",
"data",
"structures",
"."
] | def wrap_or_unwrap(value):
"""Wraps input value into trackable data structures.
This is mostly useful for containers like list, dict, etc, which could contain
trackable objects in it. Wrapped data structure will be tracked when
associated with a `tf.Module`, so that save model/checkpoint can properly
track t... | [
"def",
"wrap_or_unwrap",
"(",
"value",
")",
":",
"# pylint: disable=unidiomatic-typecheck",
"# Exact type checking to avoid mucking up custom logic in list/dict",
"# subclasses, e.g. collections.Counter.",
"if",
"isinstance",
"(",
"value",
",",
"NoDependency",
")",
":",
"return",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/training/tracking/data_structures.py#L95-L128 | ||
brndnmtthws/conky | 8f5014b90f1bc9f999beff752a9b369e4885f0d6 | cmake/scripts/clang-format-check-changed.py | python | get_changed_files | (git_bin, excludes, file_extensions) | return output, returncode | Run git status and return the list of changed files | Run git status and return the list of changed files | [
"Run",
"git",
"status",
"and",
"return",
"the",
"list",
"of",
"changed",
"files"
] | def get_changed_files(git_bin, excludes, file_extensions):
"""
Run git status and return the list of changed files
"""
extensions = file_extensions.split(",")
# arguments coming from cmake will be *.xx. We want to remove the *
for i, extension in enumerate(extensions):
if extension[0] ==... | [
"def",
"get_changed_files",
"(",
"git_bin",
",",
"excludes",
",",
"file_extensions",
")",
":",
"extensions",
"=",
"file_extensions",
".",
"split",
"(",
"\",\"",
")",
"# arguments coming from cmake will be *.xx. We want to remove the *",
"for",
"i",
",",
"extension",
"in... | https://github.com/brndnmtthws/conky/blob/8f5014b90f1bc9f999beff752a9b369e4885f0d6/cmake/scripts/clang-format-check-changed.py#L76-L114 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/fractions.py | python | Fraction._richcmp | (self, other, op) | Helper for comparison operators, for internal use only.
Implement comparison between a Rational instance `self`, and
either another Rational instance or a float `other`. If
`other` is not a Rational instance or a float, return
NotImplemented. `op` should be one of the six standard
... | Helper for comparison operators, for internal use only. | [
"Helper",
"for",
"comparison",
"operators",
"for",
"internal",
"use",
"only",
"."
] | def _richcmp(self, other, op):
"""Helper for comparison operators, for internal use only.
Implement comparison between a Rational instance `self`, and
either another Rational instance or a float `other`. If
`other` is not a Rational instance or a float, return
NotImplemented. `... | [
"def",
"_richcmp",
"(",
"self",
",",
"other",
",",
"op",
")",
":",
"# convert other to a Rational instance where reasonable.",
"if",
"isinstance",
"(",
"other",
",",
"numbers",
".",
"Rational",
")",
":",
"return",
"op",
"(",
"self",
".",
"_numerator",
"*",
"ot... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/fractions.py#L588-L608 | ||
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Draft/draftguitools/gui_edit_arch_objects.py | python | ArchWallGuiTools.update_object_from_edit_points | (self, obj, node_idx, v, alt_edit_mode=0) | if node_idx == 0:
edit_arch.updateWall(obj, node_idx, v)
elif node_idx > 0:
if obj.Base:
if utils.get_type(obj.Base) in ["Wire", "Circle", "Rectangle",
"Polygon", "Sketch"]:
self.update(obj.Base, node_idx... | if node_idx == 0:
edit_arch.updateWall(obj, node_idx, v)
elif node_idx > 0:
if obj.Base:
if utils.get_type(obj.Base) in ["Wire", "Circle", "Rectangle",
"Polygon", "Sketch"]:
self.update(obj.Base, node_idx... | [
"if",
"node_idx",
"==",
"0",
":",
"edit_arch",
".",
"updateWall",
"(",
"obj",
"node_idx",
"v",
")",
"elif",
"node_idx",
">",
"0",
":",
"if",
"obj",
".",
"Base",
":",
"if",
"utils",
".",
"get_type",
"(",
"obj",
".",
"Base",
")",
"in",
"[",
"Wire",
... | def update_object_from_edit_points(self, obj, node_idx, v, alt_edit_mode=0):
''' if node_idx == 0:
edit_arch.updateWall(obj, node_idx, v)
elif node_idx > 0:
if obj.Base:
if utils.get_type(obj.Base) in ["Wire", "Circle", "Rectangle",
... | [
"def",
"update_object_from_edit_points",
"(",
"self",
",",
"obj",
",",
"node_idx",
",",
"v",
",",
"alt_edit_mode",
"=",
"0",
")",
":",
"if",
"node_idx",
"==",
"0",
":",
"vz",
"=",
"DraftVecUtils",
".",
"project",
"(",
"v",
",",
"App",
".",
"Vector",
"(... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Draft/draftguitools/gui_edit_arch_objects.py#L63-L74 | ||
mandliya/algorithms_and_data_structures | 60f95dae236d13bd17f20df63268b524a776c8e1 | tree_problems/level_order_tree_traversal_recursive.py | python | Tree.height | (self) | return self.height_util(self.root) | Height of the tree | Height of the tree | [
"Height",
"of",
"the",
"tree"
] | def height(self):
"""Height of the tree"""
return self.height_util(self.root) | [
"def",
"height",
"(",
"self",
")",
":",
"return",
"self",
".",
"height_util",
"(",
"self",
".",
"root",
")"
] | https://github.com/mandliya/algorithms_and_data_structures/blob/60f95dae236d13bd17f20df63268b524a776c8e1/tree_problems/level_order_tree_traversal_recursive.py#L42-L44 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/email/_header_value_parser.py | python | parse_content_transfer_encoding_header | (value) | return cte_header | mechanism | mechanism | [
"mechanism"
] | def parse_content_transfer_encoding_header(value):
""" mechanism
"""
# We should probably validate the values, since the list is fixed.
cte_header = ContentTransferEncoding()
if not value:
cte_header.defects.append(errors.HeaderMissingRequiredValue(
"Missing content transfer enc... | [
"def",
"parse_content_transfer_encoding_header",
"(",
"value",
")",
":",
"# We should probably validate the values, since the list is fixed.",
"cte_header",
"=",
"ContentTransferEncoding",
"(",
")",
"if",
"not",
"value",
":",
"cte_header",
".",
"defects",
".",
"append",
"("... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/email/_header_value_parser.py#L2589-L2618 | |
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Tool/ilink.py | python | generate | (env) | Add Builders and construction variables for ilink to an Environment. | Add Builders and construction variables for ilink to an Environment. | [
"Add",
"Builders",
"and",
"construction",
"variables",
"for",
"ilink",
"to",
"an",
"Environment",
"."
] | def generate(env):
"""Add Builders and construction variables for ilink to an Environment."""
SCons.Tool.createProgBuilder(env)
env['LINK'] = 'ilink'
env['LINKFLAGS'] = SCons.Util.CLVar('')
env['LINKCOM'] = '$LINK $LINKFLAGS /O:$TARGET $SOURCES $_LIBDIRFLAGS $_LIBFLAGS'
env['LI... | [
"def",
"generate",
"(",
"env",
")",
":",
"SCons",
".",
"Tool",
".",
"createProgBuilder",
"(",
"env",
")",
"env",
"[",
"'LINK'",
"]",
"=",
"'ilink'",
"env",
"[",
"'LINKFLAGS'",
"]",
"=",
"SCons",
".",
"Util",
".",
"CLVar",
"(",
"''",
")",
"env",
"["... | https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Tool/ilink.py#L40-L50 | ||
llvm-mirror/lldb | d01083a850f577b85501a0902b52fd0930de72c7 | third_party/Python/module/pexpect-4.6/pexpect/spawnbase.py | python | SpawnBase.flush | (self) | This does nothing. It is here to support the interface for a
File-like object. | This does nothing. It is here to support the interface for a
File-like object. | [
"This",
"does",
"nothing",
".",
"It",
"is",
"here",
"to",
"support",
"the",
"interface",
"for",
"a",
"File",
"-",
"like",
"object",
"."
] | def flush(self):
'''This does nothing. It is here to support the interface for a
File-like object. '''
pass | [
"def",
"flush",
"(",
"self",
")",
":",
"pass"
] | https://github.com/llvm-mirror/lldb/blob/d01083a850f577b85501a0902b52fd0930de72c7/third_party/Python/module/pexpect-4.6/pexpect/spawnbase.py#L506-L509 | ||
trailofbits/llvm-sanitizer-tutorial | d29dfeec7f51fbf234fd0080f28f2b30cd0b6e99 | llvm/tools/clang/bindings/python/clang/cindex.py | python | Type.is_pod | (self) | return conf.lib.clang_isPODType(self) | Determine whether this Type represents plain old data (POD). | Determine whether this Type represents plain old data (POD). | [
"Determine",
"whether",
"this",
"Type",
"represents",
"plain",
"old",
"data",
"(",
"POD",
")",
"."
] | def is_pod(self):
"""Determine whether this Type represents plain old data (POD)."""
return conf.lib.clang_isPODType(self) | [
"def",
"is_pod",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_isPODType",
"(",
"self",
")"
] | https://github.com/trailofbits/llvm-sanitizer-tutorial/blob/d29dfeec7f51fbf234fd0080f28f2b30cd0b6e99/llvm/tools/clang/bindings/python/clang/cindex.py#L2326-L2328 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/boosted_trees/python/ops/quantile_ops.py | python | QuantileAccumulator.get_buckets | (self, stamp_token) | return are_buckets_ready[0], buckets[0] | Returns quantile buckets created during previous flush. | Returns quantile buckets created during previous flush. | [
"Returns",
"quantile",
"buckets",
"created",
"during",
"previous",
"flush",
"."
] | def get_buckets(self, stamp_token):
"""Returns quantile buckets created during previous flush."""
are_buckets_ready, buckets = (
gen_quantile_ops.quantile_accumulator_get_buckets(
quantile_accumulator_handles=[self._quantile_accumulator_handle],
stamp_token=stamp_token))
retu... | [
"def",
"get_buckets",
"(",
"self",
",",
"stamp_token",
")",
":",
"are_buckets_ready",
",",
"buckets",
"=",
"(",
"gen_quantile_ops",
".",
"quantile_accumulator_get_buckets",
"(",
"quantile_accumulator_handles",
"=",
"[",
"self",
".",
"_quantile_accumulator_handle",
"]",
... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/boosted_trees/python/ops/quantile_ops.py#L120-L126 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_gdi.py | python | MirrorDC.__init__ | (self, *args, **kwargs) | __init__(self, DC dc, bool mirror) -> MirrorDC
Creates a mirrored DC associated with the real *dc*. Everything drawn
on the wx.MirrorDC will appear on the *dc*, and will be mirrored if
*mirror* is True. | __init__(self, DC dc, bool mirror) -> MirrorDC | [
"__init__",
"(",
"self",
"DC",
"dc",
"bool",
"mirror",
")",
"-",
">",
"MirrorDC"
] | def __init__(self, *args, **kwargs):
"""
__init__(self, DC dc, bool mirror) -> MirrorDC
Creates a mirrored DC associated with the real *dc*. Everything drawn
on the wx.MirrorDC will appear on the *dc*, and will be mirrored if
*mirror* is True.
"""
_gdi_.MirrorD... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_gdi_",
".",
"MirrorDC_swiginit",
"(",
"self",
",",
"_gdi_",
".",
"new_MirrorDC",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_gdi.py#L5345-L5353 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/numpy/math_ops.py | python | average | (x, axis=None, weights=None, returned=False) | return x_avg | Computes the weighted average along the specified axis.
Args:
x (Tensor): A Tensor to be averaged.
axis (Union[None, int, tuple(int)]): Axis along which to average `x`. Default: `None`.
If the axis is `None`, it will average over all of the elements of the tensor `x`.
If the... | Computes the weighted average along the specified axis. | [
"Computes",
"the",
"weighted",
"average",
"along",
"the",
"specified",
"axis",
"."
] | def average(x, axis=None, weights=None, returned=False):
"""
Computes the weighted average along the specified axis.
Args:
x (Tensor): A Tensor to be averaged.
axis (Union[None, int, tuple(int)]): Axis along which to average `x`. Default: `None`.
If the axis is `None`, it will a... | [
"def",
"average",
"(",
"x",
",",
"axis",
"=",
"None",
",",
"weights",
"=",
"None",
",",
"returned",
"=",
"False",
")",
":",
"_check_input_tensor",
"(",
"x",
")",
"if",
"axis",
"is",
"not",
"None",
":",
"_check_axis_type",
"(",
"axis",
",",
"True",
",... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/numpy/math_ops.py#L1000-L1059 | |
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/buildscripts/resmokelib/sighandler.py | python | _dump_stacks | (logger, header_msg) | Signal handler that will dump the stacks of all threads. | Signal handler that will dump the stacks of all threads. | [
"Signal",
"handler",
"that",
"will",
"dump",
"the",
"stacks",
"of",
"all",
"threads",
"."
] | def _dump_stacks(logger, header_msg):
"""
Signal handler that will dump the stacks of all threads.
"""
sb = []
sb.append(header_msg)
frames = sys._current_frames()
sb.append("Total threads: %d" % (len(frames)))
sb.append("")
for thread_id in frames:
stack = frames[thread_i... | [
"def",
"_dump_stacks",
"(",
"logger",
",",
"header_msg",
")",
":",
"sb",
"=",
"[",
"]",
"sb",
".",
"append",
"(",
"header_msg",
")",
"frames",
"=",
"sys",
".",
"_current_frames",
"(",
")",
"sb",
".",
"append",
"(",
"\"Total threads: %d\"",
"%",
"(",
"l... | https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/buildscripts/resmokelib/sighandler.py#L102-L119 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/third_party/web-page-replay/third_party/dns/name.py | python | Name.canonicalize | (self) | return Name([x.lower() for x in self.labels]) | Return a name which is equal to the current name, but is in
DNSSEC canonical form.
@rtype: dns.name.Name object | Return a name which is equal to the current name, but is in
DNSSEC canonical form. | [
"Return",
"a",
"name",
"which",
"is",
"equal",
"to",
"the",
"current",
"name",
"but",
"is",
"in",
"DNSSEC",
"canonical",
"form",
"."
] | def canonicalize(self):
"""Return a name which is equal to the current name, but is in
DNSSEC canonical form.
@rtype: dns.name.Name object
"""
return Name([x.lower() for x in self.labels]) | [
"def",
"canonicalize",
"(",
"self",
")",
":",
"return",
"Name",
"(",
"[",
"x",
".",
"lower",
"(",
")",
"for",
"x",
"in",
"self",
".",
"labels",
"]",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/third_party/web-page-replay/third_party/dns/name.py#L261-L267 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/shapedbutton.py | python | __SToggleMixin.OnLeftUp | (self, event) | Handles the ``wx.EVT_LEFT_UP`` event for the button.
:param `event`: a :class:`MouseEvent` event to be processed. | Handles the ``wx.EVT_LEFT_UP`` event for the button. | [
"Handles",
"the",
"wx",
".",
"EVT_LEFT_UP",
"event",
"for",
"the",
"button",
"."
] | def OnLeftUp(self, event):
"""
Handles the ``wx.EVT_LEFT_UP`` event for the button.
:param `event`: a :class:`MouseEvent` event to be processed.
"""
if not self.IsEnabled() or not self.HasCapture():
return
if self.HasCapture():
if self._isup !=... | [
"def",
"OnLeftUp",
"(",
"self",
",",
"event",
")",
":",
"if",
"not",
"self",
".",
"IsEnabled",
"(",
")",
"or",
"not",
"self",
".",
"HasCapture",
"(",
")",
":",
"return",
"if",
"self",
".",
"HasCapture",
"(",
")",
":",
"if",
"self",
".",
"_isup",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/shapedbutton.py#L1310-L1326 | ||
tfwu/FaceDetection-ConvNet-3D | f9251c48eb40c5aec8fba7455115c355466555be | python/mxnet/executor.py | python | Executor.backward | (self, out_grads=None) | Do backward pass to get the gradient of arguments.
Parameters
----------
out_grads : NDArray or list of NDArray, optional
Gradient on the outputs to be propagated back.
This parameter is only needed when bind is called
on outputs that are not a loss function. | Do backward pass to get the gradient of arguments. | [
"Do",
"backward",
"pass",
"to",
"get",
"the",
"gradient",
"of",
"arguments",
"."
] | def backward(self, out_grads=None):
"""Do backward pass to get the gradient of arguments.
Parameters
----------
out_grads : NDArray or list of NDArray, optional
Gradient on the outputs to be propagated back.
This parameter is only needed when bind is called
... | [
"def",
"backward",
"(",
"self",
",",
"out_grads",
"=",
"None",
")",
":",
"if",
"out_grads",
"is",
"None",
":",
"out_grads",
"=",
"[",
"]",
"elif",
"isinstance",
"(",
"out_grads",
",",
"NDArray",
")",
":",
"out_grads",
"=",
"[",
"out_grads",
"]",
"for",... | https://github.com/tfwu/FaceDetection-ConvNet-3D/blob/f9251c48eb40c5aec8fba7455115c355466555be/python/mxnet/executor.py#L115-L137 | ||
trilinos/Trilinos | 6168be6dd51e35e1cd681e9c4b24433e709df140 | commonTools/release/updateTrilinosDB.py | python | write_to_csv | (filepath, package_db) | Use the csv module to write the contents of the package database to a
comma-separated value file. | Use the csv module to write the contents of the package database to a
comma-separated value file. | [
"Use",
"the",
"csv",
"module",
"to",
"write",
"the",
"contents",
"of",
"the",
"package",
"database",
"to",
"a",
"comma",
"-",
"separated",
"value",
"file",
"."
] | def write_to_csv(filepath, package_db):
"""
Use the csv module to write the contents of the package database to a
comma-separated value file.
"""
# Setup
trilinosID = get_trilinos_id(package_db)
trilinos_dict = package_db[trilinosID]
fieldnames = ["package_id",
... | [
"def",
"write_to_csv",
"(",
"filepath",
",",
"package_db",
")",
":",
"# Setup",
"trilinosID",
"=",
"get_trilinos_id",
"(",
"package_db",
")",
"trilinos_dict",
"=",
"package_db",
"[",
"trilinosID",
"]",
"fieldnames",
"=",
"[",
"\"package_id\"",
",",
"\"name\"",
"... | https://github.com/trilinos/Trilinos/blob/6168be6dd51e35e1cd681e9c4b24433e709df140/commonTools/release/updateTrilinosDB.py#L356-L381 | ||
rsummers11/CADLab | 976ed959a0b5208bb4173127a7ef732ac73a9b6f | MULAN_universal_lesion_analysis/maskrcnn/utils/model_zoo.py | python | cache_url | (url, model_dir=None, progress=True) | return cached_file | r"""Loads the Torch serialized object at the given URL.
If the object is already present in `model_dir`, it's deserialized and
returned. The filename part of the URL should follow the naming convention
``filename-<sha256>.ext`` where ``<sha256>`` is the first eight or more
digits of the SHA256 hash of t... | r"""Loads the Torch serialized object at the given URL.
If the object is already present in `model_dir`, it's deserialized and
returned. The filename part of the URL should follow the naming convention
``filename-<sha256>.ext`` where ``<sha256>`` is the first eight or more
digits of the SHA256 hash of t... | [
"r",
"Loads",
"the",
"Torch",
"serialized",
"object",
"at",
"the",
"given",
"URL",
".",
"If",
"the",
"object",
"is",
"already",
"present",
"in",
"model_dir",
"it",
"s",
"deserialized",
"and",
"returned",
".",
"The",
"filename",
"part",
"of",
"the",
"URL",
... | def cache_url(url, model_dir=None, progress=True):
r"""Loads the Torch serialized object at the given URL.
If the object is already present in `model_dir`, it's deserialized and
returned. The filename part of the URL should follow the naming convention
``filename-<sha256>.ext`` where ``<sha256>`` is the... | [
"def",
"cache_url",
"(",
"url",
",",
"model_dir",
"=",
"None",
",",
"progress",
"=",
"True",
")",
":",
"if",
"model_dir",
"is",
"None",
":",
"torch_home",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"os",
".",
"getenv",
"(",
"'TORCH_HOME'",
",",
... | https://github.com/rsummers11/CADLab/blob/976ed959a0b5208bb4173127a7ef732ac73a9b6f/MULAN_universal_lesion_analysis/maskrcnn/utils/model_zoo.py#L15-L56 | |
Sigil-Ebook/Sigil | 0d145d3a4874b4a26f7aabd68dbd9d18a2402e52 | src/Resource_Files/plugin_launchers/python/sigil_bs4/element.py | python | Tag.__nonzero__ | (self) | return True | A tag is non-None even if it has no contents. | A tag is non-None even if it has no contents. | [
"A",
"tag",
"is",
"non",
"-",
"None",
"even",
"if",
"it",
"has",
"no",
"contents",
"."
] | def __nonzero__(self):
"A tag is non-None even if it has no contents."
return True | [
"def",
"__nonzero__",
"(",
"self",
")",
":",
"return",
"True"
] | https://github.com/Sigil-Ebook/Sigil/blob/0d145d3a4874b4a26f7aabd68dbd9d18a2402e52/src/Resource_Files/plugin_launchers/python/sigil_bs4/element.py#L1010-L1012 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/extern/flatnotebook.py | python | FlatNotebook.GetPageShapeAngle | (self, page_index) | return result, True | Returns the angle associated to a tab. | Returns the angle associated to a tab. | [
"Returns",
"the",
"angle",
"associated",
"to",
"a",
"tab",
"."
] | def GetPageShapeAngle(self, page_index):
""" Returns the angle associated to a tab. """
if page_index < 0 or page_index >= len(self._pages._pagesInfoVec):
return None, False
result = self._pages._pagesInfoVec[page_index].GetTabAngle()
return result, True | [
"def",
"GetPageShapeAngle",
"(",
"self",
",",
"page_index",
")",
":",
"if",
"page_index",
"<",
"0",
"or",
"page_index",
">=",
"len",
"(",
"self",
".",
"_pages",
".",
"_pagesInfoVec",
")",
":",
"return",
"None",
",",
"False",
"result",
"=",
"self",
".",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/flatnotebook.py#L3485-L3492 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/keras/_impl/keras/preprocessing/image.py | python | apply_transform | (x,
transform_matrix,
channel_axis=0,
fill_mode='nearest',
cval=0.) | return x | Apply the image transformation specified by a matrix.
Arguments:
x: 2D numpy array, single image.
transform_matrix: Numpy array specifying the geometric transformation.
channel_axis: Index of axis for channels in the input tensor.
fill_mode: Points outside the boundaries of the input
... | Apply the image transformation specified by a matrix. | [
"Apply",
"the",
"image",
"transformation",
"specified",
"by",
"a",
"matrix",
"."
] | def apply_transform(x,
transform_matrix,
channel_axis=0,
fill_mode='nearest',
cval=0.):
"""Apply the image transformation specified by a matrix.
Arguments:
x: 2D numpy array, single image.
transform_matrix: Numpy array spec... | [
"def",
"apply_transform",
"(",
"x",
",",
"transform_matrix",
",",
"channel_axis",
"=",
"0",
",",
"fill_mode",
"=",
"'nearest'",
",",
"cval",
"=",
"0.",
")",
":",
"x",
"=",
"np",
".",
"rollaxis",
"(",
"x",
",",
"channel_axis",
",",
"0",
")",
"final_affi... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/keras/_impl/keras/preprocessing/image.py#L219-L253 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/_vendor/six.py | python | with_metaclass | (meta, *bases) | return type.__new__(metaclass, 'temporary_class', (), {}) | Create a base class with a metaclass. | Create a base class with a metaclass. | [
"Create",
"a",
"base",
"class",
"with",
"a",
"metaclass",
"."
] | def with_metaclass(meta, *bases):
"""Create a base class with a metaclass."""
# This requires a bit of explanation: the basic idea is to make a dummy
# metaclass for one level of class instantiation that replaces itself with
# the actual metaclass.
class metaclass(meta):
def __new__(cls, na... | [
"def",
"with_metaclass",
"(",
"meta",
",",
"*",
"bases",
")",
":",
"# This requires a bit of explanation: the basic idea is to make a dummy",
"# metaclass for one level of class instantiation that replaces itself with",
"# the actual metaclass.",
"class",
"metaclass",
"(",
"meta",
")... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/_vendor/six.py#L800-L809 | |
larroy/clearskies_core | 3574ddf0edc8555454c7044126e786a6c29444dc | tools/gyp/pylib/gyp/xcodeproj_file.py | python | PBXProject.AddOrGetProjectReference | (self, other_pbxproject) | return [product_group, project_ref] | Add a reference to another project file (via PBXProject object) to this
one.
Returns [ProductGroup, ProjectRef]. ProductGroup is a PBXGroup object in
this project file that contains a PBXReferenceProxy object for each
product of each PBXNativeTarget in the other project file. ProjectRef is
a PBXF... | Add a reference to another project file (via PBXProject object) to this
one. | [
"Add",
"a",
"reference",
"to",
"another",
"project",
"file",
"(",
"via",
"PBXProject",
"object",
")",
"to",
"this",
"one",
"."
] | def AddOrGetProjectReference(self, other_pbxproject):
"""Add a reference to another project file (via PBXProject object) to this
one.
Returns [ProductGroup, ProjectRef]. ProductGroup is a PBXGroup object in
this project file that contains a PBXReferenceProxy object for each
product of each PBXNati... | [
"def",
"AddOrGetProjectReference",
"(",
"self",
",",
"other_pbxproject",
")",
":",
"if",
"not",
"'projectReferences'",
"in",
"self",
".",
"_properties",
":",
"self",
".",
"_properties",
"[",
"'projectReferences'",
"]",
"=",
"[",
"]",
"product_group",
"=",
"None"... | https://github.com/larroy/clearskies_core/blob/3574ddf0edc8555454c7044126e786a6c29444dc/tools/gyp/pylib/gyp/xcodeproj_file.py#L2664-L2736 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py | python | ValidateMSBuildSettings | (settings, stderr=sys.stderr) | Validates that the names of the settings are valid for MSBuild.
Args:
settings: A dictionary. The key is the tool name. The values are
themselves dictionaries of settings and their values.
stderr: The stream receiving the error messages. | Validates that the names of the settings are valid for MSBuild. | [
"Validates",
"that",
"the",
"names",
"of",
"the",
"settings",
"are",
"valid",
"for",
"MSBuild",
"."
] | def ValidateMSBuildSettings(settings, stderr=sys.stderr):
"""Validates that the names of the settings are valid for MSBuild.
Args:
settings: A dictionary. The key is the tool name. The values are
themselves dictionaries of settings and their values.
stderr: The stream receiving the error ... | [
"def",
"ValidateMSBuildSettings",
"(",
"settings",
",",
"stderr",
"=",
"sys",
".",
"stderr",
")",
":",
"_ValidateSettings",
"(",
"_msbuild_validators",
",",
"settings",
",",
"stderr",
")"
] | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py#L504-L512 | ||
JoseExposito/touchegg | 1f3fda214358d071c05da4bf17c070c33d67b5eb | cmake/cpplint.py | python | CheckInvalidIncrement | (filename, clean_lines, linenum, error) | Checks for invalid increment *count++.
For example following function:
void increment_counter(int* count) {
*count++;
}
is invalid, because it effectively does count++, moving pointer, and should
be replaced with ++*count, (*count)++ or *count += 1.
Args:
filename: The name of the current file.
... | Checks for invalid increment *count++. | [
"Checks",
"for",
"invalid",
"increment",
"*",
"count",
"++",
"."
] | def CheckInvalidIncrement(filename, clean_lines, linenum, error):
"""Checks for invalid increment *count++.
For example following function:
void increment_counter(int* count) {
*count++;
}
is invalid, because it effectively does count++, moving pointer, and should
be replaced with ++*count, (*count)++ ... | [
"def",
"CheckInvalidIncrement",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"if",
"_RE_PATTERN_INVALID_INCREMENT",
".",
"match",
"(",
"line",
")",
":",
"error",
... | https://github.com/JoseExposito/touchegg/blob/1f3fda214358d071c05da4bf17c070c33d67b5eb/cmake/cpplint.py#L2169-L2188 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/framework/python/framework/tensor_util.py | python | with_shape | (expected_shape, tensor) | return tensor | Asserts tensor has expected shape.
If tensor shape and expected_shape, are fully defined, assert they match.
Otherwise, add assert op that will validate the shape when tensor is
evaluated, and set shape on tensor.
Args:
expected_shape: Expected shape to assert, as a 1D array of ints, or tensor
of ... | Asserts tensor has expected shape. | [
"Asserts",
"tensor",
"has",
"expected",
"shape",
"."
] | def with_shape(expected_shape, tensor):
"""Asserts tensor has expected shape.
If tensor shape and expected_shape, are fully defined, assert they match.
Otherwise, add assert op that will validate the shape when tensor is
evaluated, and set shape on tensor.
Args:
expected_shape: Expected shape to assert,... | [
"def",
"with_shape",
"(",
"expected_shape",
",",
"tensor",
")",
":",
"if",
"isinstance",
"(",
"tensor",
",",
"sparse_tensor",
".",
"SparseTensor",
")",
":",
"raise",
"ValueError",
"(",
"'SparseTensor not supported.'",
")",
"# Shape type must be 1D int32.",
"if",
"te... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/framework/python/framework/tensor_util.py#L232-L299 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_gdi.py | python | DC.GetPen | (*args, **kwargs) | return _gdi_.DC_GetPen(*args, **kwargs) | GetPen(self) -> Pen
Gets the current pen | GetPen(self) -> Pen | [
"GetPen",
"(",
"self",
")",
"-",
">",
"Pen"
] | def GetPen(*args, **kwargs):
"""
GetPen(self) -> Pen
Gets the current pen
"""
return _gdi_.DC_GetPen(*args, **kwargs) | [
"def",
"GetPen",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"DC_GetPen",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_gdi.py#L4353-L4359 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/eclib/ctrlbox.py | python | ControlBar.GetControlSizer | (self) | return self._sizer | Get the sizer that is used to layout the contols (horizontal sizer)
@return: wx.BoxSizer | Get the sizer that is used to layout the contols (horizontal sizer)
@return: wx.BoxSizer | [
"Get",
"the",
"sizer",
"that",
"is",
"used",
"to",
"layout",
"the",
"contols",
"(",
"horizontal",
"sizer",
")",
"@return",
":",
"wx",
".",
"BoxSizer"
] | def GetControlSizer(self):
"""Get the sizer that is used to layout the contols (horizontal sizer)
@return: wx.BoxSizer
"""
return self._sizer | [
"def",
"GetControlSizer",
"(",
"self",
")",
":",
"return",
"self",
".",
"_sizer"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/eclib/ctrlbox.py#L486-L491 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/dummy_thread.py | python | interrupt_main | () | Set _interrupt flag to True to have start_new_thread raise
KeyboardInterrupt upon exiting. | Set _interrupt flag to True to have start_new_thread raise
KeyboardInterrupt upon exiting. | [
"Set",
"_interrupt",
"flag",
"to",
"True",
"to",
"have",
"start_new_thread",
"raise",
"KeyboardInterrupt",
"upon",
"exiting",
"."
] | def interrupt_main():
"""Set _interrupt flag to True to have start_new_thread raise
KeyboardInterrupt upon exiting."""
if _main:
raise KeyboardInterrupt
else:
global _interrupt
_interrupt = True | [
"def",
"interrupt_main",
"(",
")",
":",
"if",
"_main",
":",
"raise",
"KeyboardInterrupt",
"else",
":",
"global",
"_interrupt",
"_interrupt",
"=",
"True"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/dummy_thread.py#L138-L145 | ||
perilouswithadollarsign/cstrike15_src | f82112a2388b841d72cb62ca48ab1846dfcc11c8 | thirdparty/protobuf-2.5.0/python/google/protobuf/descriptor.py | python | Descriptor.EnumValueName | (self, enum, value) | return self.enum_types_by_name[enum].values_by_number[value].name | Returns the string name of an enum value.
This is just a small helper method to simplify a common operation.
Args:
enum: string name of the Enum.
value: int, value of the enum.
Returns:
string name of the enum value.
Raises:
KeyError if either the Enum doesn't exist or the va... | Returns the string name of an enum value. | [
"Returns",
"the",
"string",
"name",
"of",
"an",
"enum",
"value",
"."
] | def EnumValueName(self, enum, value):
"""Returns the string name of an enum value.
This is just a small helper method to simplify a common operation.
Args:
enum: string name of the Enum.
value: int, value of the enum.
Returns:
string name of the enum value.
Raises:
KeyErr... | [
"def",
"EnumValueName",
"(",
"self",
",",
"enum",
",",
"value",
")",
":",
"return",
"self",
".",
"enum_types_by_name",
"[",
"enum",
"]",
".",
"values_by_number",
"[",
"value",
"]",
".",
"name"
] | https://github.com/perilouswithadollarsign/cstrike15_src/blob/f82112a2388b841d72cb62ca48ab1846dfcc11c8/thirdparty/protobuf-2.5.0/python/google/protobuf/descriptor.py#L272-L288 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | current/tools/inspector_protocol/jinja2/idtracking.py | python | FrameSymbolVisitor.visit_OverlayScope | (self, node, **kwargs) | Do not visit into overlay scopes. | Do not visit into overlay scopes. | [
"Do",
"not",
"visit",
"into",
"overlay",
"scopes",
"."
] | def visit_OverlayScope(self, node, **kwargs):
"""Do not visit into overlay scopes.""" | [
"def",
"visit_OverlayScope",
"(",
"self",
",",
"node",
",",
"*",
"*",
"kwargs",
")",
":"
] | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/current/tools/inspector_protocol/jinja2/idtracking.py#L285-L286 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/stc.py | python | StyledTextCtrl.VCHome | (*args, **kwargs) | return _stc.StyledTextCtrl_VCHome(*args, **kwargs) | VCHome(self)
Move caret to before first visible character on line.
If already there move to first character on line. | VCHome(self) | [
"VCHome",
"(",
"self",
")"
] | def VCHome(*args, **kwargs):
"""
VCHome(self)
Move caret to before first visible character on line.
If already there move to first character on line.
"""
return _stc.StyledTextCtrl_VCHome(*args, **kwargs) | [
"def",
"VCHome",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_VCHome",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/stc.py#L4579-L4586 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/urllib3/fields.py | python | RequestField._render_part | (self, name, value) | return self.header_formatter(name, value) | Overridable helper function to format a single header parameter. By
default, this calls ``self.header_formatter``.
:param name:
The name of the parameter, a string expected to be ASCII only.
:param value:
The value of the parameter, provided as a unicode string. | Overridable helper function to format a single header parameter. By
default, this calls ``self.header_formatter``. | [
"Overridable",
"helper",
"function",
"to",
"format",
"a",
"single",
"header",
"parameter",
".",
"By",
"default",
"this",
"calls",
"self",
".",
"header_formatter",
"."
] | def _render_part(self, name, value):
"""
Overridable helper function to format a single header parameter. By
default, this calls ``self.header_formatter``.
:param name:
The name of the parameter, a string expected to be ASCII only.
:param value:
The value... | [
"def",
"_render_part",
"(",
"self",
",",
"name",
",",
"value",
")",
":",
"return",
"self",
".",
"header_formatter",
"(",
"name",
",",
"value",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/urllib3/fields.py#L194-L205 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/utils/tensorboard/_caffe2_graph.py | python | protos_to_graph_def | (net_defs, shapes=None, **kwargs) | return _operators_to_graph_def(shapes, ops, **kwargs) | Convert a set of Caffe2 net definitions to a Tensorflow graph.
Args:
net_defs: List of caffe2_pb2.NetDef protobufs representing computation
graphs.
shapes: Dictionary mapping blob names to their shapes/dimensions.
Returns:
Call to _operators_to_graph_def() with the extracte... | Convert a set of Caffe2 net definitions to a Tensorflow graph. | [
"Convert",
"a",
"set",
"of",
"Caffe2",
"net",
"definitions",
"to",
"a",
"Tensorflow",
"graph",
"."
] | def protos_to_graph_def(net_defs, shapes=None, **kwargs):
'''
Convert a set of Caffe2 net definitions to a Tensorflow graph.
Args:
net_defs: List of caffe2_pb2.NetDef protobufs representing computation
graphs.
shapes: Dictionary mapping blob names to their shapes/dimensions.
... | [
"def",
"protos_to_graph_def",
"(",
"net_defs",
",",
"shapes",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"net",
"in",
"net_defs",
":",
"_propagate_device_option",
"(",
"net",
")",
"shapes",
"=",
"copy",
".",
"deepcopy",
"(",
"shapes",
"or",
"... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/utils/tensorboard/_caffe2_graph.py#L797-L815 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py2/numpy/polynomial/legendre.py | python | legder | (c, m=1, scl=1, axis=0) | return c | Differentiate a Legendre series.
Returns the Legendre series coefficients `c` differentiated `m` times
along `axis`. At each iteration the result is multiplied by `scl` (the
scaling factor is for use in a linear change of variable). The argument
`c` is an array of coefficients from low to high degree ... | Differentiate a Legendre series. | [
"Differentiate",
"a",
"Legendre",
"series",
"."
] | def legder(c, m=1, scl=1, axis=0):
"""
Differentiate a Legendre series.
Returns the Legendre series coefficients `c` differentiated `m` times
along `axis`. At each iteration the result is multiplied by `scl` (the
scaling factor is for use in a linear change of variable). The argument
`c` is an... | [
"def",
"legder",
"(",
"c",
",",
"m",
"=",
"1",
",",
"scl",
"=",
"1",
",",
"axis",
"=",
"0",
")",
":",
"c",
"=",
"np",
".",
"array",
"(",
"c",
",",
"ndmin",
"=",
"1",
",",
"copy",
"=",
"1",
")",
"if",
"c",
".",
"dtype",
".",
"char",
"in"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py2/numpy/polynomial/legendre.py#L679-L772 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/pubsub/core/topicobj.py | python | Topic.validate | (self, listener) | return self.__validator.validate(listener) | Checks whether listener could be subscribed to this topic:
if yes, just returns; if not, raises ListenerMismatchError.
Note that method raises TopicDefnError if self not
hasMDS(). | Checks whether listener could be subscribed to this topic:
if yes, just returns; if not, raises ListenerMismatchError.
Note that method raises TopicDefnError if self not
hasMDS(). | [
"Checks",
"whether",
"listener",
"could",
"be",
"subscribed",
"to",
"this",
"topic",
":",
"if",
"yes",
"just",
"returns",
";",
"if",
"not",
"raises",
"ListenerMismatchError",
".",
"Note",
"that",
"method",
"raises",
"TopicDefnError",
"if",
"self",
"not",
"hasM... | def validate(self, listener):
"""Checks whether listener could be subscribed to this topic:
if yes, just returns; if not, raises ListenerMismatchError.
Note that method raises TopicDefnError if self not
hasMDS()."""
if not self.hasMDS():
raise TopicDefnError(self.__tu... | [
"def",
"validate",
"(",
"self",
",",
"listener",
")",
":",
"if",
"not",
"self",
".",
"hasMDS",
"(",
")",
":",
"raise",
"TopicDefnError",
"(",
"self",
".",
"__tupleName",
")",
"return",
"self",
".",
"__validator",
".",
"validate",
"(",
"listener",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/pubsub/core/topicobj.py#L272-L279 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/idlelib/searchengine.py | python | SearchEngine.search_text | (self, text, prog=None, ok=0) | return res | Return (lineno, matchobj) or None for forward/backward search.
This function calls the right function with the right arguments.
It directly return the result of that call.
Text is a text widget. Prog is a precompiled pattern.
The ok parameter is a bit complicated as it has two effects.... | Return (lineno, matchobj) or None for forward/backward search. | [
"Return",
"(",
"lineno",
"matchobj",
")",
"or",
"None",
"for",
"forward",
"/",
"backward",
"search",
"."
] | def search_text(self, text, prog=None, ok=0):
'''Return (lineno, matchobj) or None for forward/backward search.
This function calls the right function with the right arguments.
It directly return the result of that call.
Text is a text widget. Prog is a precompiled pattern.
The... | [
"def",
"search_text",
"(",
"self",
",",
"text",
",",
"prog",
"=",
"None",
",",
"ok",
"=",
"0",
")",
":",
"if",
"not",
"prog",
":",
"prog",
"=",
"self",
".",
"getprog",
"(",
")",
"if",
"not",
"prog",
":",
"return",
"None",
"# Compilation failed -- sto... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/idlelib/searchengine.py#L105-L143 | |
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/lldb/scripts/prepare_bindings.py | python | prepare_all_bindings | (options) | Prepares bindings for each of the languages supported.
@param options the parsed arguments from the command line
@return the exit value for the program. 0 is success, all othes
indicate some kind of failure. | Prepares bindings for each of the languages supported. | [
"Prepares",
"bindings",
"for",
"each",
"of",
"the",
"languages",
"supported",
"."
] | def prepare_all_bindings(options):
"""Prepares bindings for each of the languages supported.
@param options the parsed arguments from the command line
@return the exit value for the program. 0 is success, all othes
indicate some kind of failure.
"""
# Check for the existence of the SWIG script... | [
"def",
"prepare_all_bindings",
"(",
"options",
")",
":",
"# Check for the existence of the SWIG scripts folder",
"scripts_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"options",
".",
"src_root",
",",
"\"scripts\"",
")",
"if",
"not",
"os",
".",
"path",
".",
"e... | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/prepare_bindings.py#L60-L79 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/framework/ops.py | python | Operation._get_control_flow_context | (self) | return self._control_flow_context | Returns the control flow context of this op.
Returns:
A context object. | Returns the control flow context of this op. | [
"Returns",
"the",
"control",
"flow",
"context",
"of",
"this",
"op",
"."
] | def _get_control_flow_context(self):
"""Returns the control flow context of this op.
Returns:
A context object.
"""
return self._control_flow_context | [
"def",
"_get_control_flow_context",
"(",
"self",
")",
":",
"return",
"self",
".",
"_control_flow_context"
] | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/framework/ops.py#L1630-L1636 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Parser/asdl.py | python | ASDLParser.p_definition_1 | (self, (definitions, definition)) | return definitions + definition | definitions ::= definition definitions | definitions ::= definition definitions | [
"definitions",
"::",
"=",
"definition",
"definitions"
] | def p_definition_1(self, (definitions, definition)):
" definitions ::= definition definitions "
return definitions + definition | [
"def",
"p_definition_1",
"(",
"self",
",",
"(",
"definitions",
",",
"definition",
")",
")",
":",
"return",
"definitions",
"+",
"definition"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Parser/asdl.py#L136-L138 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/dataset/text/transforms.py | python | JiebaTokenizer.__add_dict_py_file | (self, file_path) | Add user defined word by file | Add user defined word by file | [
"Add",
"user",
"defined",
"word",
"by",
"file"
] | def __add_dict_py_file(self, file_path):
"""Add user defined word by file"""
words_list = self.__parser_file(file_path)
for data in words_list:
if data[1] is None:
freq = 0
else:
freq = int(data[1])
self.add_word(data[0], freq) | [
"def",
"__add_dict_py_file",
"(",
"self",
",",
"file_path",
")",
":",
"words_list",
"=",
"self",
".",
"__parser_file",
"(",
"file_path",
")",
"for",
"data",
"in",
"words_list",
":",
"if",
"data",
"[",
"1",
"]",
"is",
"None",
":",
"freq",
"=",
"0",
"els... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/dataset/text/transforms.py#L210-L218 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/stringold.py | python | expandtabs | (s, tabsize=8) | return res + line | expandtabs(s [,tabsize]) -> string
Return a copy of the string s with all tab characters replaced
by the appropriate number of spaces, depending on the current
column, and the tabsize (default 8). | expandtabs(s [,tabsize]) -> string | [
"expandtabs",
"(",
"s",
"[",
"tabsize",
"]",
")",
"-",
">",
"string"
] | def expandtabs(s, tabsize=8):
"""expandtabs(s [,tabsize]) -> string
Return a copy of the string s with all tab characters replaced
by the appropriate number of spaces, depending on the current
column, and the tabsize (default 8).
"""
res = line = ''
for c in s:
if c == '\t':
... | [
"def",
"expandtabs",
"(",
"s",
",",
"tabsize",
"=",
"8",
")",
":",
"res",
"=",
"line",
"=",
"''",
"for",
"c",
"in",
"s",
":",
"if",
"c",
"==",
"'\\t'",
":",
"c",
"=",
"' '",
"*",
"(",
"tabsize",
"-",
"len",
"(",
"line",
")",
"%",
"tabsize",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/stringold.py#L328-L344 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/onnx/mx2onnx/_op_translations/_op_translations_opset13.py | python | convert_contrib_roialign | (node, **kwargs) | return nodes | Map MXNet's _contrib_ROIAlign | Map MXNet's _contrib_ROIAlign | [
"Map",
"MXNet",
"s",
"_contrib_ROIAlign"
] | def convert_contrib_roialign(node, **kwargs):
"""Map MXNet's _contrib_ROIAlign
"""
from onnx.helper import make_node
from onnx import TensorProto
name, input_nodes, attrs = get_inputs(node, kwargs)
pooled_size = convert_string_to_list(str(attrs.get('pooled_size')))
spatial_scale = float(att... | [
"def",
"convert_contrib_roialign",
"(",
"node",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"onnx",
".",
"helper",
"import",
"make_node",
"from",
"onnx",
"import",
"TensorProto",
"name",
",",
"input_nodes",
",",
"attrs",
"=",
"get_inputs",
"(",
"node",
",",
... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/onnx/mx2onnx/_op_translations/_op_translations_opset13.py#L909-L949 | |
google/mozc | 7329757e1ad30e327c1ae823a8302c79482d6b9c | src/build_tools/versioning_files.py | python | VersioningFiles | (version_string, is_debug, file_paths) | Creates versioned files and information files of the files. | Creates versioned files and information files of the files. | [
"Creates",
"versioned",
"files",
"and",
"information",
"files",
"of",
"the",
"files",
"."
] | def VersioningFiles(version_string, is_debug, file_paths):
"""Creates versioned files and information files of the files."""
for file_path in file_paths:
_VersioningFile(version_string, is_debug, file_path) | [
"def",
"VersioningFiles",
"(",
"version_string",
",",
"is_debug",
",",
"file_paths",
")",
":",
"for",
"file_path",
"in",
"file_paths",
":",
"_VersioningFile",
"(",
"version_string",
",",
"is_debug",
",",
"file_path",
")"
] | https://github.com/google/mozc/blob/7329757e1ad30e327c1ae823a8302c79482d6b9c/src/build_tools/versioning_files.py#L108-L111 | ||
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | media/webrtc/trunk/tools/gyp/pylib/gyp/xcode_emulation.py | python | XcodeSettings.GetMachOType | (self) | return {
'executable': 'mh_execute',
'static_library': 'staticlib',
'shared_library': 'mh_dylib',
'loadable_module': 'mh_bundle',
}[self.spec['type']] | Returns the MACH_O_TYPE of this target. | Returns the MACH_O_TYPE of this target. | [
"Returns",
"the",
"MACH_O_TYPE",
"of",
"this",
"target",
"."
] | def GetMachOType(self):
"""Returns the MACH_O_TYPE of this target."""
# Weird, but matches Xcode.
if not self._IsBundle() and self.spec['type'] == 'executable':
return ''
return {
'executable': 'mh_execute',
'static_library': 'staticlib',
'shared_library': 'mh_dylib',
'load... | [
"def",
"GetMachOType",
"(",
"self",
")",
":",
"# Weird, but matches Xcode.",
"if",
"not",
"self",
".",
"_IsBundle",
"(",
")",
"and",
"self",
".",
"spec",
"[",
"'type'",
"]",
"==",
"'executable'",
":",
"return",
"''",
"return",
"{",
"'executable'",
":",
"'m... | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/media/webrtc/trunk/tools/gyp/pylib/gyp/xcode_emulation.py#L144-L154 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/protorpc/protorpc/webapp/forms.py | python | FormsHandler.new_factory | (cls, registry_path=DEFAULT_REGISTRY_PATH) | return forms_factory | Construct a factory for use with WSGIApplication.
This method is called automatically with the correct registry path when
services are configured via service_handlers.service_mapping.
Args:
registry_path: Absolute path on server where the ProtoRPC RegsitryService
is located.
Returns:
... | Construct a factory for use with WSGIApplication. | [
"Construct",
"a",
"factory",
"for",
"use",
"with",
"WSGIApplication",
"."
] | def new_factory(cls, registry_path=DEFAULT_REGISTRY_PATH):
"""Construct a factory for use with WSGIApplication.
This method is called automatically with the correct registry path when
services are configured via service_handlers.service_mapping.
Args:
registry_path: Absolute path on server where... | [
"def",
"new_factory",
"(",
"cls",
",",
"registry_path",
"=",
"DEFAULT_REGISTRY_PATH",
")",
":",
"def",
"forms_factory",
"(",
")",
":",
"return",
"cls",
"(",
"registry_path",
")",
"return",
"forms_factory"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/protorpc/protorpc/webapp/forms.py#L148-L163 | |
domino-team/openwrt-cc | 8b181297c34d14d3ca521cc9f31430d561dbc688 | package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/tools/gyp/pylib/gyp/generator/make.py | python | MakefileWriter.WriteList | (self, value_list, variable=None, prefix='',
quoter=QuoteIfNecessary) | Write a variable definition that is a list of values.
E.g. WriteList(['a','b'], 'foo', prefix='blah') writes out
foo = blaha blahb
but in a pretty-printed style. | Write a variable definition that is a list of values. | [
"Write",
"a",
"variable",
"definition",
"that",
"is",
"a",
"list",
"of",
"values",
"."
] | def WriteList(self, value_list, variable=None, prefix='',
quoter=QuoteIfNecessary):
"""Write a variable definition that is a list of values.
E.g. WriteList(['a','b'], 'foo', prefix='blah') writes out
foo = blaha blahb
but in a pretty-printed style.
"""
values = ''
if va... | [
"def",
"WriteList",
"(",
"self",
",",
"value_list",
",",
"variable",
"=",
"None",
",",
"prefix",
"=",
"''",
",",
"quoter",
"=",
"QuoteIfNecessary",
")",
":",
"values",
"=",
"''",
"if",
"value_list",
":",
"value_list",
"=",
"[",
"quoter",
"(",
"prefix",
... | https://github.com/domino-team/openwrt-cc/blob/8b181297c34d14d3ca521cc9f31430d561dbc688/package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/tools/gyp/pylib/gyp/generator/make.py#L1719-L1731 | ||
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/closest-binary-search-tree-value-ii.py | python | Solution2.closestKValues | (self, root, target, k) | return result | :type root: TreeNode
:type target: float
:type k: int
:rtype: List[int] | :type root: TreeNode
:type target: float
:type k: int
:rtype: List[int] | [
":",
"type",
"root",
":",
"TreeNode",
":",
"type",
"target",
":",
"float",
":",
"type",
"k",
":",
"int",
":",
"rtype",
":",
"List",
"[",
"int",
"]"
] | def closestKValues(self, root, target, k):
"""
:type root: TreeNode
:type target: float
:type k: int
:rtype: List[int]
"""
# Helper class to make a stack to the next node.
class BSTIterator:
# @param root, a binary search tree's root node
... | [
"def",
"closestKValues",
"(",
"self",
",",
"root",
",",
"target",
",",
"k",
")",
":",
"# Helper class to make a stack to the next node.",
"class",
"BSTIterator",
":",
"# @param root, a binary search tree's root node",
"def",
"__init__",
"(",
"self",
",",
"stack",
",",
... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/closest-binary-search-tree-value-ii.py#L55-L115 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/symbol/numpy/_symbol.py | python | greater | (x1, x2, out=None) | return _ufunc_helper(x1, x2, _npi.greater, _np.greater, _npi.greater_scalar,
_npi.less_scalar, out) | Return the truth value of (x1 > x2) element-wise.
Parameters
----------
x1, x2 : _Symbol or scalars
Input arrays. If ``x1.shape != x2.shape``, they must be broadcastable to
a common shape (which becomes the shape of the output).
out : Dummy parameter, optional
A location into whi... | Return the truth value of (x1 > x2) element-wise.
Parameters
----------
x1, x2 : _Symbol or scalars
Input arrays. If ``x1.shape != x2.shape``, they must be broadcastable to
a common shape (which becomes the shape of the output).
out : Dummy parameter, optional
A location into whi... | [
"Return",
"the",
"truth",
"value",
"of",
"(",
"x1",
">",
"x2",
")",
"element",
"-",
"wise",
".",
"Parameters",
"----------",
"x1",
"x2",
":",
"_Symbol",
"or",
"scalars",
"Input",
"arrays",
".",
"If",
"x1",
".",
"shape",
"!",
"=",
"x2",
".",
"shape",
... | def greater(x1, x2, out=None):
"""
Return the truth value of (x1 > x2) element-wise.
Parameters
----------
x1, x2 : _Symbol or scalars
Input arrays. If ``x1.shape != x2.shape``, they must be broadcastable to
a common shape (which becomes the shape of the output).
out : Dummy para... | [
"def",
"greater",
"(",
"x1",
",",
"x2",
",",
"out",
"=",
"None",
")",
":",
"return",
"_ufunc_helper",
"(",
"x1",
",",
"x2",
",",
"_npi",
".",
"greater",
",",
"_np",
".",
"greater",
",",
"_npi",
".",
"greater_scalar",
",",
"_npi",
".",
"less_scalar",
... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/symbol/numpy/_symbol.py#L6405-L6434 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/protobuf/py2/google/protobuf/descriptor.py | python | Descriptor.fields_by_camelcase_name | (self) | return self._fields_by_camelcase_name | Same FieldDescriptor objects as in :attr:`fields`, but indexed by
:attr:`FieldDescriptor.camelcase_name`. | Same FieldDescriptor objects as in :attr:`fields`, but indexed by
:attr:`FieldDescriptor.camelcase_name`. | [
"Same",
"FieldDescriptor",
"objects",
"as",
"in",
":",
"attr",
":",
"fields",
"but",
"indexed",
"by",
":",
"attr",
":",
"FieldDescriptor",
".",
"camelcase_name",
"."
] | def fields_by_camelcase_name(self):
"""Same FieldDescriptor objects as in :attr:`fields`, but indexed by
:attr:`FieldDescriptor.camelcase_name`.
"""
if self._fields_by_camelcase_name is None:
self._fields_by_camelcase_name = dict(
(f.camelcase_name, f) for f in self.fields)
return se... | [
"def",
"fields_by_camelcase_name",
"(",
"self",
")",
":",
"if",
"self",
".",
"_fields_by_camelcase_name",
"is",
"None",
":",
"self",
".",
"_fields_by_camelcase_name",
"=",
"dict",
"(",
"(",
"f",
".",
"camelcase_name",
",",
"f",
")",
"for",
"f",
"in",
"self",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/protobuf/py2/google/protobuf/descriptor.py#L373-L380 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/setuptools/_vendor/pyparsing.py | python | ParserElement.setDebugActions | ( self, startAction, successAction, exceptionAction ) | return self | Enable display of debugging messages while doing pattern matching. | Enable display of debugging messages while doing pattern matching. | [
"Enable",
"display",
"of",
"debugging",
"messages",
"while",
"doing",
"pattern",
"matching",
"."
] | def setDebugActions( self, startAction, successAction, exceptionAction ):
"""
Enable display of debugging messages while doing pattern matching.
"""
self.debugActions = (startAction or _defaultStartDebugAction,
successAction or _defaultSuccessDebugAction,
... | [
"def",
"setDebugActions",
"(",
"self",
",",
"startAction",
",",
"successAction",
",",
"exceptionAction",
")",
":",
"self",
".",
"debugActions",
"=",
"(",
"startAction",
"or",
"_defaultStartDebugAction",
",",
"successAction",
"or",
"_defaultSuccessDebugAction",
",",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/setuptools/_vendor/pyparsing.py#L2102-L2110 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/training/saver.py | python | Saver.set_last_checkpoints_with_time | (self, last_checkpoints_with_time) | Sets the list of old checkpoint filenames and timestamps.
Args:
last_checkpoints_with_time: A list of tuples of checkpoint filenames and
timestamps.
Raises:
AssertionError: If last_checkpoints_with_time is not a list. | Sets the list of old checkpoint filenames and timestamps. | [
"Sets",
"the",
"list",
"of",
"old",
"checkpoint",
"filenames",
"and",
"timestamps",
"."
] | def set_last_checkpoints_with_time(self, last_checkpoints_with_time):
"""Sets the list of old checkpoint filenames and timestamps.
Args:
last_checkpoints_with_time: A list of tuples of checkpoint filenames and
timestamps.
Raises:
AssertionError: If last_checkpoints_with_time is not a l... | [
"def",
"set_last_checkpoints_with_time",
"(",
"self",
",",
"last_checkpoints_with_time",
")",
":",
"assert",
"isinstance",
"(",
"last_checkpoints_with_time",
",",
"list",
")",
"self",
".",
"_last_checkpoints",
"=",
"last_checkpoints_with_time"
] | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/training/saver.py#L1360-L1371 | ||
Kitware/VTK | 5b4df4d90a4f31194d97d3c639dd38ea8f81e8b8 | Wrapping/Python/vtkmodules/numpy_interface/dataset_adapter.py | python | CompositeDataSet.GetCellData | (self) | return self._CellData() | Returns the cell data as a DataSetAttributes instance. | Returns the cell data as a DataSetAttributes instance. | [
"Returns",
"the",
"cell",
"data",
"as",
"a",
"DataSetAttributes",
"instance",
"."
] | def GetCellData(self):
"Returns the cell data as a DataSetAttributes instance."
if self._CellData is None or self._CellData() is None:
cdata = self.GetAttributes(ArrayAssociation.CELL)
self._CellData = weakref.ref(cdata)
return self._CellData() | [
"def",
"GetCellData",
"(",
"self",
")",
":",
"if",
"self",
".",
"_CellData",
"is",
"None",
"or",
"self",
".",
"_CellData",
"(",
")",
"is",
"None",
":",
"cdata",
"=",
"self",
".",
"GetAttributes",
"(",
"ArrayAssociation",
".",
"CELL",
")",
"self",
".",
... | https://github.com/Kitware/VTK/blob/5b4df4d90a4f31194d97d3c639dd38ea8f81e8b8/Wrapping/Python/vtkmodules/numpy_interface/dataset_adapter.py#L975-L980 | |
deepmind/open_spiel | 4ca53bea32bb2875c7385d215424048ae92f78c8 | open_spiel/python/algorithms/jpsro.py | python | _min_epsilon_mgce | (meta_game, per_player_repeats, ignore_repeats=False) | return dist, dict() | Min Epsilon Maximum Gini CE. | Min Epsilon Maximum Gini CE. | [
"Min",
"Epsilon",
"Maximum",
"Gini",
"CE",
"."
] | def _min_epsilon_mgce(meta_game, per_player_repeats, ignore_repeats=False):
"""Min Epsilon Maximum Gini CE."""
a_mat, e_vec, meta = _ace_constraints(
meta_game, [0.0] * len(per_player_repeats), remove_null=True,
zero_tolerance=1e-8)
a_mats = _partition_by_player(
a_mat, meta["p_vec"], len(per_pl... | [
"def",
"_min_epsilon_mgce",
"(",
"meta_game",
",",
"per_player_repeats",
",",
"ignore_repeats",
"=",
"False",
")",
":",
"a_mat",
",",
"e_vec",
",",
"meta",
"=",
"_ace_constraints",
"(",
"meta_game",
",",
"[",
"0.0",
"]",
"*",
"len",
"(",
"per_player_repeats",
... | https://github.com/deepmind/open_spiel/blob/4ca53bea32bb2875c7385d215424048ae92f78c8/open_spiel/python/algorithms/jpsro.py#L820-L834 | |
vmtk/vmtk | 927331ad752265199390eabbbf2e07cdc2b4bcc6 | PypeS/pype.py | python | Pype.PrintLog | (self,logMessage,indent=0) | Prints log messages from pypescript members to the console.
All vmtkscripts subclassing from pypes.Pype use the PrintLog method in order
to write their output to the console.
Args:
logMessage (str): the message to be logged
indent (int): number of spaces to intent the m... | Prints log messages from pypescript members to the console. | [
"Prints",
"log",
"messages",
"from",
"pypescript",
"members",
"to",
"the",
"console",
"."
] | def PrintLog(self,logMessage,indent=0):
'''Prints log messages from pypescript members to the console.
All vmtkscripts subclassing from pypes.Pype use the PrintLog method in order
to write their output to the console.
Args:
logMessage (str): the message to be logged
... | [
"def",
"PrintLog",
"(",
"self",
",",
"logMessage",
",",
"indent",
"=",
"0",
")",
":",
"if",
"not",
"self",
".",
"LogOn",
":",
"return",
"indentUnit",
"=",
"' '",
"indentation",
"=",
"''",
"for",
"i",
"in",
"range",
"(",
"indent",
")",
":",
"indent... | https://github.com/vmtk/vmtk/blob/927331ad752265199390eabbbf2e07cdc2b4bcc6/PypeS/pype.py#L77-L93 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/urllib/request.py | python | build_opener | (*handlers) | return opener | Create an opener object from a list of handlers.
The opener will use several default handlers, including support
for HTTP, FTP and when applicable HTTPS.
If any of the handlers passed as arguments are subclasses of the
default handlers, the default handlers will not be used. | Create an opener object from a list of handlers. | [
"Create",
"an",
"opener",
"object",
"from",
"a",
"list",
"of",
"handlers",
"."
] | def build_opener(*handlers):
"""Create an opener object from a list of handlers.
The opener will use several default handlers, including support
for HTTP, FTP and when applicable HTTPS.
If any of the handlers passed as arguments are subclasses of the
default handlers, the default handlers will not... | [
"def",
"build_opener",
"(",
"*",
"handlers",
")",
":",
"opener",
"=",
"OpenerDirector",
"(",
")",
"default_classes",
"=",
"[",
"ProxyHandler",
",",
"UnknownHandler",
",",
"HTTPHandler",
",",
"HTTPDefaultErrorHandler",
",",
"HTTPRedirectHandler",
",",
"FTPHandler",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/urllib/request.py#L575-L609 | |
manutdzou/KITTI_SSD | 5b620c2f291d36a0fe14489214f22a992f173f44 | scripts/cpp_lint.py | python | CheckForNonStandardConstructs | (filename, clean_lines, linenum,
nesting_state, error) | r"""Logs an error if we see certain non-ANSI constructs ignored by gcc-2.
Complain about several constructs which gcc-2 accepts, but which are
not standard C++. Warning about these in lint is one way to ease the
transition to new compilers.
- put storage class first (e.g. "static const" instead of "const stat... | r"""Logs an error if we see certain non-ANSI constructs ignored by gcc-2. | [
"r",
"Logs",
"an",
"error",
"if",
"we",
"see",
"certain",
"non",
"-",
"ANSI",
"constructs",
"ignored",
"by",
"gcc",
"-",
"2",
"."
] | def CheckForNonStandardConstructs(filename, clean_lines, linenum,
nesting_state, error):
r"""Logs an error if we see certain non-ANSI constructs ignored by gcc-2.
Complain about several constructs which gcc-2 accepts, but which are
not standard C++. Warning about these in lint ... | [
"def",
"CheckForNonStandardConstructs",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"nesting_state",
",",
"error",
")",
":",
"# Remove comments from the line, but leave in strings for now.",
"line",
"=",
"clean_lines",
".",
"lines",
"[",
"linenum",
"]",
"i... | https://github.com/manutdzou/KITTI_SSD/blob/5b620c2f291d36a0fe14489214f22a992f173f44/scripts/cpp_lint.py#L2198-L2302 | ||
apiaryio/snowcrash | b5b39faa85f88ee17459edf39fdc6fe4fc70d2e3 | tools/gyp/pylib/gyp/generator/make.py | python | CalculateGeneratorInputInfo | (params) | Calculate the generator specific info that gets fed to input (called by
gyp). | Calculate the generator specific info that gets fed to input (called by
gyp). | [
"Calculate",
"the",
"generator",
"specific",
"info",
"that",
"gets",
"fed",
"to",
"input",
"(",
"called",
"by",
"gyp",
")",
"."
] | def CalculateGeneratorInputInfo(params):
"""Calculate the generator specific info that gets fed to input (called by
gyp)."""
generator_flags = params.get('generator_flags', {})
android_ndk_version = generator_flags.get('android_ndk_version', None)
# Android NDK requires a strict link order.
if android_ndk_v... | [
"def",
"CalculateGeneratorInputInfo",
"(",
"params",
")",
":",
"generator_flags",
"=",
"params",
".",
"get",
"(",
"'generator_flags'",
",",
"{",
"}",
")",
"android_ndk_version",
"=",
"generator_flags",
".",
"get",
"(",
"'android_ndk_version'",
",",
"None",
")",
... | https://github.com/apiaryio/snowcrash/blob/b5b39faa85f88ee17459edf39fdc6fe4fc70d2e3/tools/gyp/pylib/gyp/generator/make.py#L98-L118 | ||
kushview/Element | 1cc16380caa2ab79461246ba758b9de1f46db2a5 | waflib/Options.py | python | OptionsContext.parse_args | (self, _args=None) | Parses arguments from a list which is not necessarily the command-line.
Initializes the module variables options, commands and envvars
If help is requested, prints it and exit the application
:param _args: arguments
:type _args: list of strings | Parses arguments from a list which is not necessarily the command-line.
Initializes the module variables options, commands and envvars
If help is requested, prints it and exit the application | [
"Parses",
"arguments",
"from",
"a",
"list",
"which",
"is",
"not",
"necessarily",
"the",
"command",
"-",
"line",
".",
"Initializes",
"the",
"module",
"variables",
"options",
"commands",
"and",
"envvars",
"If",
"help",
"is",
"requested",
"prints",
"it",
"and",
... | def parse_args(self, _args=None):
"""
Parses arguments from a list which is not necessarily the command-line.
Initializes the module variables options, commands and envvars
If help is requested, prints it and exit the application
:param _args: arguments
:type _args: list of strings
"""
options, command... | [
"def",
"parse_args",
"(",
"self",
",",
"_args",
"=",
"None",
")",
":",
"options",
",",
"commands",
",",
"envvars",
"=",
"self",
".",
"parse_cmd_args",
"(",
")",
"self",
".",
"init_logs",
"(",
"options",
",",
"commands",
",",
"envvars",
")",
"self",
"."... | https://github.com/kushview/Element/blob/1cc16380caa2ab79461246ba758b9de1f46db2a5/waflib/Options.py#L339-L350 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/flatnotebook.py | python | FNBRendererRibbonTabs.DrawTab | (self, pageContainer, dc, posx, tabIdx, tabWidth, tabHeight, btnStatus) | Draws a tab using the `Ribbon Tabs` style.
:param `pageContainer`: an instance of :class:`FlatNotebook`;
:param `dc`: an instance of :class:`DC`;
:param `posx`: the x position of the tab;
:param `tabIdx`: the index of the tab;
:param `tabWidth`: the tab's width;
:param `... | Draws a tab using the `Ribbon Tabs` style. | [
"Draws",
"a",
"tab",
"using",
"the",
"Ribbon",
"Tabs",
"style",
"."
] | def DrawTab(self, pageContainer, dc, posx, tabIdx, tabWidth, tabHeight, btnStatus):
"""
Draws a tab using the `Ribbon Tabs` style.
:param `pageContainer`: an instance of :class:`FlatNotebook`;
:param `dc`: an instance of :class:`DC`;
:param `posx`: the x position of the tab;
... | [
"def",
"DrawTab",
"(",
"self",
",",
"pageContainer",
",",
"dc",
",",
"posx",
",",
"tabIdx",
",",
"tabWidth",
",",
"tabHeight",
",",
"btnStatus",
")",
":",
"pc",
"=",
"pageContainer",
"gc",
"=",
"wx",
".",
"GraphicsContext",
".",
"Create",
"(",
"dc",
")... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/flatnotebook.py#L3674-L3751 | ||
FEniCS/dolfinx | 3dfdf038cccdb70962865b58a63bf29c2e55ec6e | python/dolfinx/fem/function.py | python | FunctionSpace.dofmap | (self) | return dofmap.DofMap(self._cpp_object.dofmap) | Degree-of-freedom map associated with the function space. | Degree-of-freedom map associated with the function space. | [
"Degree",
"-",
"of",
"-",
"freedom",
"map",
"associated",
"with",
"the",
"function",
"space",
"."
] | def dofmap(self) -> dofmap.DofMap:
"""Degree-of-freedom map associated with the function space."""
return dofmap.DofMap(self._cpp_object.dofmap) | [
"def",
"dofmap",
"(",
"self",
")",
"->",
"dofmap",
".",
"DofMap",
":",
"return",
"dofmap",
".",
"DofMap",
"(",
"self",
".",
"_cpp_object",
".",
"dofmap",
")"
] | https://github.com/FEniCS/dolfinx/blob/3dfdf038cccdb70962865b58a63bf29c2e55ec6e/python/dolfinx/fem/function.py#L548-L550 | |
apiaryio/drafter | 4634ebd07f6c6f257cc656598ccd535492fdfb55 | tools/gyp/pylib/gyp/msvs_emulation.py | python | MsvsSettings.GetLdflags | (self, config, gyp_to_build_path, expand_special,
manifest_base_name, output_name, is_executable, build_dir) | return ldflags, intermediate_manifest, manifest_files | Returns the flags that need to be added to link commands, and the
manifest files. | Returns the flags that need to be added to link commands, and the
manifest files. | [
"Returns",
"the",
"flags",
"that",
"need",
"to",
"be",
"added",
"to",
"link",
"commands",
"and",
"the",
"manifest",
"files",
"."
] | def GetLdflags(self, config, gyp_to_build_path, expand_special,
manifest_base_name, output_name, is_executable, build_dir):
"""Returns the flags that need to be added to link commands, and the
manifest files."""
config = self._TargetConfig(config)
ldflags = []
ld = self._GetWrapper(... | [
"def",
"GetLdflags",
"(",
"self",
",",
"config",
",",
"gyp_to_build_path",
",",
"expand_special",
",",
"manifest_base_name",
",",
"output_name",
",",
"is_executable",
",",
"build_dir",
")",
":",
"config",
"=",
"self",
".",
"_TargetConfig",
"(",
"config",
")",
... | https://github.com/apiaryio/drafter/blob/4634ebd07f6c6f257cc656598ccd535492fdfb55/tools/gyp/pylib/gyp/msvs_emulation.py#L556-L657 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/training/python/training/sequence_queueing_state_saver.py | python | _padding | (sequences, num_unroll) | return length, padded_sequences | For a dictionary of sequences, pads tensors to a multiple of `num_unroll`.
Args:
sequences: dictionary with `Tensor` values.
num_unroll: int specifying to what multiple to pad sequences to.
Returns:
length: Scalar `Tensor` of dimension 0 of all the values in sequences.
padded_sequence: Dictionary o... | For a dictionary of sequences, pads tensors to a multiple of `num_unroll`. | [
"For",
"a",
"dictionary",
"of",
"sequences",
"pads",
"tensors",
"to",
"a",
"multiple",
"of",
"num_unroll",
"."
] | def _padding(sequences, num_unroll):
"""For a dictionary of sequences, pads tensors to a multiple of `num_unroll`.
Args:
sequences: dictionary with `Tensor` values.
num_unroll: int specifying to what multiple to pad sequences to.
Returns:
length: Scalar `Tensor` of dimension 0 of all the values in se... | [
"def",
"_padding",
"(",
"sequences",
",",
"num_unroll",
")",
":",
"if",
"not",
"isinstance",
"(",
"num_unroll",
",",
"numbers",
".",
"Integral",
")",
":",
"raise",
"ValueError",
"(",
"\"Unsupported num_unroll expected int, got: %s\"",
"%",
"str",
"(",
"num_unroll"... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/training/python/training/sequence_queueing_state_saver.py#L1550-L1628 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/byteflow.py | python | TraceRunner.op_DELETE_SLICE_1 | (self, state, inst) | del TOS1[TOS:] | del TOS1[TOS:] | [
"del",
"TOS1",
"[",
"TOS",
":",
"]"
] | def op_DELETE_SLICE_1(self, state, inst):
"""
del TOS1[TOS:]
"""
tos = state.pop()
tos1 = state.pop()
slicevar = state.make_temp()
indexvar = state.make_temp()
nonevar = state.make_temp()
state.append(
inst,
base=tos1,
... | [
"def",
"op_DELETE_SLICE_1",
"(",
"self",
",",
"state",
",",
"inst",
")",
":",
"tos",
"=",
"state",
".",
"pop",
"(",
")",
"tos1",
"=",
"state",
".",
"pop",
"(",
")",
"slicevar",
"=",
"state",
".",
"make_temp",
"(",
")",
"indexvar",
"=",
"state",
"."... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/byteflow.py#L478-L494 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/flatmenu.py | python | FlatMenu.CloseSubMenu | (self, itemIdx, alwaysClose=False) | Closes a child sub-menu.
:param integer `itemIdx`: the index of the item for which we want to close the submenu;
:param bool `alwaysClose`: if ``True``, always close the submenu irrespectively of
other conditions. | Closes a child sub-menu. | [
"Closes",
"a",
"child",
"sub",
"-",
"menu",
"."
] | def CloseSubMenu(self, itemIdx, alwaysClose=False):
"""
Closes a child sub-menu.
:param integer `itemIdx`: the index of the item for which we want to close the submenu;
:param bool `alwaysClose`: if ``True``, always close the submenu irrespectively of
other conditions.
... | [
"def",
"CloseSubMenu",
"(",
"self",
",",
"itemIdx",
",",
"alwaysClose",
"=",
"False",
")",
":",
"item",
"=",
"None",
"subMenu",
"=",
"None",
"if",
"itemIdx",
">=",
"0",
"and",
"itemIdx",
"<",
"len",
"(",
"self",
".",
"_itemsArr",
")",
":",
"item",
"=... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/flatmenu.py#L6490-L6513 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | gpu/command_buffer/build_gles2_cmd_buffer.py | python | CreateHandler.WriteGLES2Implementation | (self, func, file) | Overrriden from TypeHandler. | Overrriden from TypeHandler. | [
"Overrriden",
"from",
"TypeHandler",
"."
] | def WriteGLES2Implementation(self, func, file):
"""Overrriden from TypeHandler."""
file.Write("%s GLES2Implementation::%s(%s) {\n" %
(func.return_type, func.original_name,
func.MakeTypedOriginalArgString("")))
file.Write(" GPU_CLIENT_SINGLE_THREAD_CHECK();\n")
func.WriteD... | [
"def",
"WriteGLES2Implementation",
"(",
"self",
",",
"func",
",",
"file",
")",
":",
"file",
".",
"Write",
"(",
"\"%s GLES2Implementation::%s(%s) {\\n\"",
"%",
"(",
"func",
".",
"return_type",
",",
"func",
".",
"original_name",
",",
"func",
".",
"MakeTypedOrigina... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/gpu/command_buffer/build_gles2_cmd_buffer.py#L4198-L4218 | ||
cmu-db/bustub | fe1b9e984bd2967997b52df872c873d80f71cf7d | build_support/cpplint.py | python | CheckComment | (line, filename, linenum, next_line_start, error) | Checks for common mistakes in comments.
Args:
line: The line in question.
filename: The name of the current file.
linenum: The number of the line to check.
next_line_start: The first non-whitespace column of the next line.
error: The function to call with any errors found. | Checks for common mistakes in comments. | [
"Checks",
"for",
"common",
"mistakes",
"in",
"comments",
"."
] | def CheckComment(line, filename, linenum, next_line_start, error):
"""Checks for common mistakes in comments.
Args:
line: The line in question.
filename: The name of the current file.
linenum: The number of the line to check.
next_line_start: The first non-whitespace column of the next line.
er... | [
"def",
"CheckComment",
"(",
"line",
",",
"filename",
",",
"linenum",
",",
"next_line_start",
",",
"error",
")",
":",
"commentpos",
"=",
"line",
".",
"find",
"(",
"'//'",
")",
"if",
"commentpos",
"!=",
"-",
"1",
":",
"# Check if the // may be in quotes. If so,... | https://github.com/cmu-db/bustub/blob/fe1b9e984bd2967997b52df872c873d80f71cf7d/build_support/cpplint.py#L3353-L3404 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/control_flow_util.py | python | IsCondSwitch | (op) | return is_cond_switch | Return true if `op` is the Switch for a conditional. | Return true if `op` is the Switch for a conditional. | [
"Return",
"true",
"if",
"op",
"is",
"the",
"Switch",
"for",
"a",
"conditional",
"."
] | def IsCondSwitch(op):
"""Return true if `op` is the Switch for a conditional."""
if not IsSwitch(op):
return False
if not op.outputs:
return False
# Switch nodes are not part of the cond control flow context that they
# represent, so consider the consumers of its outputs to determine if it is
# cond... | [
"def",
"IsCondSwitch",
"(",
"op",
")",
":",
"if",
"not",
"IsSwitch",
"(",
"op",
")",
":",
"return",
"False",
"if",
"not",
"op",
".",
"outputs",
":",
"return",
"False",
"# Switch nodes are not part of the cond control flow context that they",
"# represent, so consider ... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/control_flow_util.py#L112-L130 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/ebmlib/clipboard.py | python | Clipboard.Switch | (cls, reg) | Switch to register
@param reg: char | Switch to register
@param reg: char | [
"Switch",
"to",
"register",
"@param",
"reg",
":",
"char"
] | def Switch(cls, reg):
"""Switch to register
@param reg: char
"""
if reg in cls.NAMES or reg == u'"':
cls.current = reg
else:
raise ClipboardException(u"Switched to invalid register name") | [
"def",
"Switch",
"(",
"cls",
",",
"reg",
")",
":",
"if",
"reg",
"in",
"cls",
".",
"NAMES",
"or",
"reg",
"==",
"u'\"'",
":",
"cls",
".",
"current",
"=",
"reg",
"else",
":",
"raise",
"ClipboardException",
"(",
"u\"Switched to invalid register name\"",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/ebmlib/clipboard.py#L59-L67 | ||
livecode/livecode | 4606a10ea10b16d5071d0f9f263ccdd7ede8b31d | gyp/pylib/gyp/MSVSUtil.py | python | _SuffixName | (name, suffix) | return '#'.join(parts) | Add a suffix to the end of a target.
Arguments:
name: name of the target (foo#target)
suffix: the suffix to be added
Returns:
Target name with suffix added (foo_suffix#target) | Add a suffix to the end of a target. | [
"Add",
"a",
"suffix",
"to",
"the",
"end",
"of",
"a",
"target",
"."
] | def _SuffixName(name, suffix):
"""Add a suffix to the end of a target.
Arguments:
name: name of the target (foo#target)
suffix: the suffix to be added
Returns:
Target name with suffix added (foo_suffix#target)
"""
parts = name.rsplit('#', 1)
parts[0] = '%s_%s' % (parts[0], suffix)
return '#'.... | [
"def",
"_SuffixName",
"(",
"name",
",",
"suffix",
")",
":",
"parts",
"=",
"name",
".",
"rsplit",
"(",
"'#'",
",",
"1",
")",
"parts",
"[",
"0",
"]",
"=",
"'%s_%s'",
"%",
"(",
"parts",
"[",
"0",
"]",
",",
"suffix",
")",
"return",
"'#'",
".",
"joi... | https://github.com/livecode/livecode/blob/4606a10ea10b16d5071d0f9f263ccdd7ede8b31d/gyp/pylib/gyp/MSVSUtil.py#L47-L58 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/generic.py | python | NDFrame.add_prefix | (self, prefix) | return self.rename(**mapper) | Prefix labels with string `prefix`.
For Series, the row labels are prefixed.
For DataFrame, the column labels are prefixed.
Parameters
----------
prefix : str
The string to add before each label.
Returns
-------
Series or DataFrame
... | Prefix labels with string `prefix`. | [
"Prefix",
"labels",
"with",
"string",
"prefix",
"."
] | def add_prefix(self, prefix):
"""
Prefix labels with string `prefix`.
For Series, the row labels are prefixed.
For DataFrame, the column labels are prefixed.
Parameters
----------
prefix : str
The string to add before each label.
Returns
... | [
"def",
"add_prefix",
"(",
"self",
",",
"prefix",
")",
":",
"f",
"=",
"functools",
".",
"partial",
"(",
"'{prefix}{}'",
".",
"format",
",",
"prefix",
"=",
"prefix",
")",
"mapper",
"=",
"{",
"self",
".",
"_info_axis_name",
":",
"f",
"}",
"return",
"self"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/generic.py#L3858-L3915 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py3/sklearn/pipeline.py | python | make_pipeline | (*steps, **kwargs) | return Pipeline(_name_estimators(steps), memory=memory, verbose=verbose) | Construct a Pipeline from the given estimators.
This is a shorthand for the Pipeline constructor; it does not require, and
does not permit, naming the estimators. Instead, their names will be set
to the lowercase of their types automatically.
Parameters
----------
*steps : list of estimators.
... | Construct a Pipeline from the given estimators. | [
"Construct",
"a",
"Pipeline",
"from",
"the",
"given",
"estimators",
"."
] | def make_pipeline(*steps, **kwargs):
"""Construct a Pipeline from the given estimators.
This is a shorthand for the Pipeline constructor; it does not require, and
does not permit, naming the estimators. Instead, their names will be set
to the lowercase of their types automatically.
Parameters
... | [
"def",
"make_pipeline",
"(",
"*",
"steps",
",",
"*",
"*",
"kwargs",
")",
":",
"memory",
"=",
"kwargs",
".",
"pop",
"(",
"'memory'",
",",
"None",
")",
"verbose",
"=",
"kwargs",
".",
"pop",
"(",
"'verbose'",
",",
"False",
")",
"if",
"kwargs",
":",
"r... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/pipeline.py#L656-L703 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/graph_editor/transform.py | python | Transformer._connect_ops | (self, info) | Connect the previously copied ops. | Connect the previously copied ops. | [
"Connect",
"the",
"previously",
"copied",
"ops",
"."
] | def _connect_ops(self, info):
"""Connect the previously copied ops."""
for op in info.sgv.ops:
logging.debug("Finalizing op: %s", op.name)
op_ = info.transformed_ops[op]
# pylint: disable=protected-access
if op_.inputs:
raise ValueError("The newly transformed op should not have ... | [
"def",
"_connect_ops",
"(",
"self",
",",
"info",
")",
":",
"for",
"op",
"in",
"info",
".",
"sgv",
".",
"ops",
":",
"logging",
".",
"debug",
"(",
"\"Finalizing op: %s\"",
",",
"op",
".",
"name",
")",
"op_",
"=",
"info",
".",
"transformed_ops",
"[",
"o... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/graph_editor/transform.py#L459-L485 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_misc.py | python | TimeSpan.Hours | (*args, **kwargs) | return _misc_.TimeSpan_Hours(*args, **kwargs) | Hours(long hours) -> TimeSpan | Hours(long hours) -> TimeSpan | [
"Hours",
"(",
"long",
"hours",
")",
"-",
">",
"TimeSpan"
] | def Hours(*args, **kwargs):
"""Hours(long hours) -> TimeSpan"""
return _misc_.TimeSpan_Hours(*args, **kwargs) | [
"def",
"Hours",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"TimeSpan_Hours",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_misc.py#L4379-L4381 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/fsspec/implementations/webhdfs.py | python | WebHDFS._open | (
self,
path,
mode="rb",
block_size=None,
autocommit=True,
replication=None,
permissions=None,
**kwargs
) | return WebHDFile(
self,
path,
mode=mode,
block_size=block_size,
tempdir=self.tempdir,
autocommit=autocommit,
replication=replication,
permissions=permissions,
) | Parameters
----------
path: str
File location
mode: str
'rb', 'wb', etc.
block_size: int
Client buffer size for read-ahead or write buffer
autocommit: bool
If False, writes to temporary file that only gets put in final
l... | [] | def _open(
self,
path,
mode="rb",
block_size=None,
autocommit=True,
replication=None,
permissions=None,
**kwargs
):
"""
Parameters
----------
path: str
File location
mode: str
'rb', 'wb',... | [
"def",
"_open",
"(",
"self",
",",
"path",
",",
"mode",
"=",
"\"rb\"",
",",
"block_size",
"=",
"None",
",",
"autocommit",
"=",
"True",
",",
"replication",
"=",
"None",
",",
"permissions",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"block_size",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/fsspec/implementations/webhdfs.py#L140-L183 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_gdi.py | python | DC.DrawIcon | (*args, **kwargs) | return _gdi_.DC_DrawIcon(*args, **kwargs) | DrawIcon(self, Icon icon, int x, int y)
Draw an icon on the display (does nothing if the device context is
PostScript). This can be the simplest way of drawing bitmaps on a
window. | DrawIcon(self, Icon icon, int x, int y) | [
"DrawIcon",
"(",
"self",
"Icon",
"icon",
"int",
"x",
"int",
"y",
")"
] | def DrawIcon(*args, **kwargs):
"""
DrawIcon(self, Icon icon, int x, int y)
Draw an icon on the display (does nothing if the device context is
PostScript). This can be the simplest way of drawing bitmaps on a
window.
"""
return _gdi_.DC_DrawIcon(*args, **kwargs) | [
"def",
"DrawIcon",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"DC_DrawIcon",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_gdi.py#L3677-L3685 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.