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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
microsoft/CNTK | e9396480025b9ca457d26b6f33dd07c474c6aa04 | bindings/python/cntk/logging/progress_print.py | python | ProgressPrinter.log | (self, message) | Prints any message the user wishes to place in the log.
Args:
msg (`string`): message to print. | Prints any message the user wishes to place in the log. | [
"Prints",
"any",
"message",
"the",
"user",
"wishes",
"to",
"place",
"in",
"the",
"log",
"."
] | def log(self, message):
'''
Prints any message the user wishes to place in the log.
Args:
msg (`string`): message to print.
'''
self.___logprint(message) | [
"def",
"log",
"(",
"self",
",",
"message",
")",
":",
"self",
".",
"___logprint",
"(",
"message",
")"
] | https://github.com/microsoft/CNTK/blob/e9396480025b9ca457d26b6f33dd07c474c6aa04/bindings/python/cntk/logging/progress_print.py#L138-L145 | ||
BitMEX/api-connectors | 37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812 | auto-generated/python/swagger_client/models/wallet.py | python | Wallet.account | (self, account) | Sets the account of this Wallet.
:param account: The account of this Wallet. # noqa: E501
:type: float | Sets the account of this Wallet. | [
"Sets",
"the",
"account",
"of",
"this",
"Wallet",
"."
] | def account(self, account):
"""Sets the account of this Wallet.
:param account: The account of this Wallet. # noqa: E501
:type: float
"""
if account is None:
raise ValueError("Invalid value for `account`, must not be `None`") # noqa: E501
self._account = ... | [
"def",
"account",
"(",
"self",
",",
"account",
")",
":",
"if",
"account",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"Invalid value for `account`, must not be `None`\"",
")",
"# noqa: E501",
"self",
".",
"_account",
"=",
"account"
] | https://github.com/BitMEX/api-connectors/blob/37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812/auto-generated/python/swagger_client/models/wallet.py#L179-L189 | ||
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/media/webrtc/trunk/tools/gyp/pylib/gyp/generator/make.py | python | EscapeShellArgument | (s) | return "'" + s.replace("'", "'\\''") + "'" | Quotes an argument so that it will be interpreted literally by a POSIX
shell. Taken from
http://stackoverflow.com/questions/35817/whats-the-best-way-to-escape-ossystem-calls-in-python | Quotes an argument so that it will be interpreted literally by a POSIX
shell. Taken from
http://stackoverflow.com/questions/35817/whats-the-best-way-to-escape-ossystem-calls-in-python | [
"Quotes",
"an",
"argument",
"so",
"that",
"it",
"will",
"be",
"interpreted",
"literally",
"by",
"a",
"POSIX",
"shell",
".",
"Taken",
"from",
"http",
":",
"//",
"stackoverflow",
".",
"com",
"/",
"questions",
"/",
"35817",
"/",
"whats",
"-",
"the",
"-",
... | def EscapeShellArgument(s):
"""Quotes an argument so that it will be interpreted literally by a POSIX
shell. Taken from
http://stackoverflow.com/questions/35817/whats-the-best-way-to-escape-ossystem-calls-in-python
"""
return "'" + s.replace("'", "'\\''") + "'" | [
"def",
"EscapeShellArgument",
"(",
"s",
")",
":",
"return",
"\"'\"",
"+",
"s",
".",
"replace",
"(",
"\"'\"",
",",
"\"'\\\\''\"",
")",
"+",
"\"'\""
] | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/media/webrtc/trunk/tools/gyp/pylib/gyp/generator/make.py#L572-L577 | |
weolar/miniblink49 | 1c4678db0594a4abde23d3ebbcc7cd13c3170777 | third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/wpt/wpt/tools/wptserve/wptserve/request.py | python | CookieValue.__eq__ | (self, other) | return self.value == other | Equality comparison for cookies. Compares to other cookies
based on value alone and on non-cookies based on the equality
of self.value with the other object so that a cookie with value
"ham" compares equal to the string "ham" | Equality comparison for cookies. Compares to other cookies
based on value alone and on non-cookies based on the equality
of self.value with the other object so that a cookie with value
"ham" compares equal to the string "ham" | [
"Equality",
"comparison",
"for",
"cookies",
".",
"Compares",
"to",
"other",
"cookies",
"based",
"on",
"value",
"alone",
"and",
"on",
"non",
"-",
"cookies",
"based",
"on",
"the",
"equality",
"of",
"self",
".",
"value",
"with",
"the",
"other",
"object",
"so"... | def __eq__(self, other):
"""Equality comparison for cookies. Compares to other cookies
based on value alone and on non-cookies based on the equality
of self.value with the other object so that a cookie with value
"ham" compares equal to the string "ham"
"""
if hasattr(oth... | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"if",
"hasattr",
"(",
"other",
",",
"\"value\"",
")",
":",
"return",
"self",
".",
"value",
"==",
"other",
".",
"value",
"return",
"self",
".",
"value",
"==",
"other"
] | https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/wpt/wpt/tools/wptserve/wptserve/request.py#L452-L460 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | third_party/python_gflags/gflags.py | python | _GetThisModuleObjectAndName | () | return _GetModuleObjectAndName(globals()) | Returns: (module object, module name) for this module. | Returns: (module object, module name) for this module. | [
"Returns",
":",
"(",
"module",
"object",
"module",
"name",
")",
"for",
"this",
"module",
"."
] | def _GetThisModuleObjectAndName():
"""Returns: (module object, module name) for this module."""
return _GetModuleObjectAndName(globals()) | [
"def",
"_GetThisModuleObjectAndName",
"(",
")",
":",
"return",
"_GetModuleObjectAndName",
"(",
"globals",
"(",
")",
")"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/third_party/python_gflags/gflags.py#L437-L439 | |
google/earthenterprise | 0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9 | earth_enterprise/src/server/wsgi/search/plugin/custom_POI_search_handler.py | python | CustomPOISearch.GetOutputType | (self, response_type) | return "json" | Provide the output type for the Google places search. | Provide the output type for the Google places search. | [
"Provide",
"the",
"output",
"type",
"for",
"the",
"Google",
"places",
"search",
"."
] | def GetOutputType(self, response_type):
"""Provide the output type for the Google places search."""
if response_type == "KML":
return "xml"
return "json" | [
"def",
"GetOutputType",
"(",
"self",
",",
"response_type",
")",
":",
"if",
"response_type",
"==",
"\"KML\"",
":",
"return",
"\"xml\"",
"return",
"\"json\""
] | https://github.com/google/earthenterprise/blob/0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9/earth_enterprise/src/server/wsgi/search/plugin/custom_POI_search_handler.py#L285-L289 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/lib/shape_base.py | python | get_array_wrap | (*args) | return None | Find the wrapper for the array with the highest priority.
In case of ties, leftmost wins. If no wrapper is found, return None | Find the wrapper for the array with the highest priority. | [
"Find",
"the",
"wrapper",
"for",
"the",
"array",
"with",
"the",
"highest",
"priority",
"."
] | def get_array_wrap(*args):
"""Find the wrapper for the array with the highest priority.
In case of ties, leftmost wins. If no wrapper is found, return None
"""
wrappers = sorted((getattr(x, '__array_priority__', 0), -i,
x.__array_wrap__) for i, x in enumerate(args)
... | [
"def",
"get_array_wrap",
"(",
"*",
"args",
")",
":",
"wrappers",
"=",
"sorted",
"(",
"(",
"getattr",
"(",
"x",
",",
"'__array_priority__'",
",",
"0",
")",
",",
"-",
"i",
",",
"x",
".",
"__array_wrap__",
")",
"for",
"i",
",",
"x",
"in",
"enumerate",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/lib/shape_base.py#L1048-L1058 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/extern/pubsub.py | python | PublisherClass.isValid | (self, listener) | Return true only if listener will be able to subscribe to
Publisher. | Return true only if listener will be able to subscribe to
Publisher. | [
"Return",
"true",
"only",
"if",
"listener",
"will",
"be",
"able",
"to",
"subscribe",
"to",
"Publisher",
"."
] | def isValid(self, listener):
"""Return true only if listener will be able to subscribe to
Publisher."""
try:
self.validate(listener)
return True
except TypeError:
return False | [
"def",
"isValid",
"(",
"self",
",",
"listener",
")",
":",
"try",
":",
"self",
".",
"validate",
"(",
"listener",
")",
"return",
"True",
"except",
"TypeError",
":",
"return",
"False"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/pubsub.py#L713-L720 | ||
baoboa/pyqt5 | 11d5f43bc6f213d9d60272f3954a0048569cfc7c | configure.py | python | run_command | (cmd, verbose) | Run a command and display the output if requested. cmd is the command
to run. verbose is set if the output is to be displayed. | Run a command and display the output if requested. cmd is the command
to run. verbose is set if the output is to be displayed. | [
"Run",
"a",
"command",
"and",
"display",
"the",
"output",
"if",
"requested",
".",
"cmd",
"is",
"the",
"command",
"to",
"run",
".",
"verbose",
"is",
"set",
"if",
"the",
"output",
"is",
"to",
"be",
"displayed",
"."
] | def run_command(cmd, verbose):
""" Run a command and display the output if requested. cmd is the command
to run. verbose is set if the output is to be displayed.
"""
if verbose:
sys.stdout.write(cmd + "\n")
fout = get_command_output(cmd, and_stderr=True)
# Read stdout and stderr unt... | [
"def",
"run_command",
"(",
"cmd",
",",
"verbose",
")",
":",
"if",
"verbose",
":",
"sys",
".",
"stdout",
".",
"write",
"(",
"cmd",
"+",
"\"\\n\"",
")",
"fout",
"=",
"get_command_output",
"(",
"cmd",
",",
"and_stderr",
"=",
"True",
")",
"# Read stdout and ... | https://github.com/baoboa/pyqt5/blob/11d5f43bc6f213d9d60272f3954a0048569cfc7c/configure.py#L2034-L2060 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/_pyio.py | python | FileIO.__init__ | (self, file, mode='r', closefd=True, opener=None) | Open a file. The mode can be 'r' (default), 'w', 'x' or 'a' for reading,
writing, exclusive creation or appending. The file will be created if it
doesn't exist when opened for writing or appending; it will be truncated
when opened for writing. A FileExistsError will be raised if it already
... | Open a file. The mode can be 'r' (default), 'w', 'x' or 'a' for reading,
writing, exclusive creation or appending. The file will be created if it
doesn't exist when opened for writing or appending; it will be truncated
when opened for writing. A FileExistsError will be raised if it already
... | [
"Open",
"a",
"file",
".",
"The",
"mode",
"can",
"be",
"r",
"(",
"default",
")",
"w",
"x",
"or",
"a",
"for",
"reading",
"writing",
"exclusive",
"creation",
"or",
"appending",
".",
"The",
"file",
"will",
"be",
"created",
"if",
"it",
"doesn",
"t",
"exis... | def __init__(self, file, mode='r', closefd=True, opener=None):
"""Open a file. The mode can be 'r' (default), 'w', 'x' or 'a' for reading,
writing, exclusive creation or appending. The file will be created if it
doesn't exist when opened for writing or appending; it will be truncated
w... | [
"def",
"__init__",
"(",
"self",
",",
"file",
",",
"mode",
"=",
"'r'",
",",
"closefd",
"=",
"True",
",",
"opener",
"=",
"None",
")",
":",
"if",
"self",
".",
"_fd",
">=",
"0",
":",
"# Have to close the existing file first.",
"try",
":",
"if",
"self",
"."... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/_pyio.py#L1436-L1555 | ||
OGRECave/ogre-next | 287307980e6de8910f04f3cc0994451b075071fd | Tools/BlenderExport/ogrepkg/armatureexport.py | python | SkeletonAnimationTrack.optimizeKeyframes | (self) | return | Reduce number of keyframes.
Note that you can't reduce keyframes locally when using
Catmull-Rom spline interpolation. Doing so would result in
wrong tangents. | Reduce number of keyframes.
Note that you can't reduce keyframes locally when using
Catmull-Rom spline interpolation. Doing so would result in
wrong tangents. | [
"Reduce",
"number",
"of",
"keyframes",
".",
"Note",
"that",
"you",
"can",
"t",
"reduce",
"keyframes",
"locally",
"when",
"using",
"Catmull",
"-",
"Rom",
"spline",
"interpolation",
".",
"Doing",
"so",
"would",
"result",
"in",
"wrong",
"tangents",
"."
] | def optimizeKeyframes(self):
"""Reduce number of keyframes.
Note that you can't reduce keyframes locally when using
Catmull-Rom spline interpolation. Doing so would result in
wrong tangents.
"""
return | [
"def",
"optimizeKeyframes",
"(",
"self",
")",
":",
"return"
] | https://github.com/OGRECave/ogre-next/blob/287307980e6de8910f04f3cc0994451b075071fd/Tools/BlenderExport/ogrepkg/armatureexport.py#L433-L440 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/signal/window_ops.py | python | hamming_window | (window_length, periodic=True, dtype=dtypes.float32,
name=None) | return _raised_cosine_window(name, 'hamming_window', window_length, periodic,
dtype, 0.54, 0.46) | Generate a [Hamming][hamming] window.
Args:
window_length: A scalar `Tensor` indicating the window length to generate.
periodic: A bool `Tensor` indicating whether to generate a periodic or
symmetric window. Periodic windows are typically used for spectral
analysis while symmetric windows are typ... | Generate a [Hamming][hamming] window. | [
"Generate",
"a",
"[",
"Hamming",
"]",
"[",
"hamming",
"]",
"window",
"."
] | def hamming_window(window_length, periodic=True, dtype=dtypes.float32,
name=None):
"""Generate a [Hamming][hamming] window.
Args:
window_length: A scalar `Tensor` indicating the window length to generate.
periodic: A bool `Tensor` indicating whether to generate a periodic or
symmet... | [
"def",
"hamming_window",
"(",
"window_length",
",",
"periodic",
"=",
"True",
",",
"dtype",
"=",
"dtypes",
".",
"float32",
",",
"name",
"=",
"None",
")",
":",
"return",
"_raised_cosine_window",
"(",
"name",
",",
"'hamming_window'",
",",
"window_length",
",",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/signal/window_ops.py#L59-L81 | |
devpack/android-python27 | d42dd67565e104cf7b0b50eb473f615db3e69901 | python-build-with-qt/sip-4.11.2/siputils.py | python | Makefile.generate_target_clean | (self, mfile) | The default implementation of the clean target.
mfile is the file object. | The default implementation of the clean target. | [
"The",
"default",
"implementation",
"of",
"the",
"clean",
"target",
"."
] | def generate_target_clean(self, mfile):
"""The default implementation of the clean target.
mfile is the file object.
"""
mfile.write("\nclean:\n") | [
"def",
"generate_target_clean",
"(",
"self",
",",
"mfile",
")",
":",
"mfile",
".",
"write",
"(",
"\"\\nclean:\\n\"",
")"
] | https://github.com/devpack/android-python27/blob/d42dd67565e104cf7b0b50eb473f615db3e69901/python-build-with-qt/sip-4.11.2/siputils.py#L1156-L1161 | ||
google/earthenterprise | 0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9 | earth_enterprise/src/server/wsgi/serve/push/stream/stream_push_app.py | python | StreamPushApp.__call__ | (self, environ, start_response) | Executes an application.
Parses HTTP requests into internal request object and delegates
processing to StreamPushServlet.
Args:
environ: WSGI environment.
start_response: callable that starts response.
Returns:
response body. | Executes an application. | [
"Executes",
"an",
"application",
"."
] | def __call__(self, environ, start_response):
"""Executes an application.
Parses HTTP requests into internal request object and delegates
processing to StreamPushServlet.
Args:
environ: WSGI environment.
start_response: callable that starts response.
Returns:
response body.
""... | [
"def",
"__call__",
"(",
"self",
",",
"environ",
",",
"start_response",
")",
":",
"form",
"=",
"cgi",
".",
"FieldStorage",
"(",
"fp",
"=",
"environ",
"[",
"\"wsgi.input\"",
"]",
",",
"environ",
"=",
"environ",
")",
"# Get parameters from HTTP request.",
"reques... | https://github.com/google/earthenterprise/blob/0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9/earth_enterprise/src/server/wsgi/serve/push/stream/stream_push_app.py#L52-L90 | ||
CaoWGG/TensorRT-CenterNet | f949252e37b51e60f873808f46d3683f15735e79 | onnx-tensorrt/third_party/onnx/third_party/pybind11/tools/clang/cindex.py | python | Cursor.kind | (self) | return CursorKind.from_id(self._kind_id) | Return the kind of this cursor. | Return the kind of this cursor. | [
"Return",
"the",
"kind",
"of",
"this",
"cursor",
"."
] | def kind(self):
"""Return the kind of this cursor."""
return CursorKind.from_id(self._kind_id) | [
"def",
"kind",
"(",
"self",
")",
":",
"return",
"CursorKind",
".",
"from_id",
"(",
"self",
".",
"_kind_id",
")"
] | https://github.com/CaoWGG/TensorRT-CenterNet/blob/f949252e37b51e60f873808f46d3683f15735e79/onnx-tensorrt/third_party/onnx/third_party/pybind11/tools/clang/cindex.py#L1393-L1395 | |
cvxpy/cvxpy | 5165b4fb750dfd237de8659383ef24b4b2e33aaf | cvxpy/atoms/elementwise/kl_div.py | python | kl_div._domain | (self) | return [self.args[0] >= 0, self.args[1] >= 0] | Returns constraints describing the domain of the node. | Returns constraints describing the domain of the node. | [
"Returns",
"constraints",
"describing",
"the",
"domain",
"of",
"the",
"node",
"."
] | def _domain(self) -> List[Constraint]:
"""Returns constraints describing the domain of the node.
"""
return [self.args[0] >= 0, self.args[1] >= 0] | [
"def",
"_domain",
"(",
"self",
")",
"->",
"List",
"[",
"Constraint",
"]",
":",
"return",
"[",
"self",
".",
"args",
"[",
"0",
"]",
">=",
"0",
",",
"self",
".",
"args",
"[",
"1",
"]",
">=",
"0",
"]"
] | https://github.com/cvxpy/cvxpy/blob/5165b4fb750dfd237de8659383ef24b4b2e33aaf/cvxpy/atoms/elementwise/kl_div.py#L95-L98 | |
crosslife/OpenBird | 9e0198a1a2295f03fa1e8676e216e22c9c7d380b | cocos2d/build/android-build.py | python | caculate_built_samples | (args) | return list(targets) | Compute the sampels to be built
'cpp' for short of all cpp samples
'lua' for short of all lua smpleas
'jsb' for short of all javascript samples | Compute the sampels to be built
'cpp' for short of all cpp samples
'lua' for short of all lua smpleas
'jsb' for short of all javascript samples | [
"Compute",
"the",
"sampels",
"to",
"be",
"built",
"cpp",
"for",
"short",
"of",
"all",
"cpp",
"samples",
"lua",
"for",
"short",
"of",
"all",
"lua",
"smpleas",
"jsb",
"for",
"short",
"of",
"all",
"javascript",
"samples"
] | def caculate_built_samples(args):
''' Compute the sampels to be built
'cpp' for short of all cpp samples
'lua' for short of all lua smpleas
'jsb' for short of all javascript samples
'''
if 'all' in args:
return ALL_SAMPLES
targets = []
if 'cpp' in args:
targets += CPP_S... | [
"def",
"caculate_built_samples",
"(",
"args",
")",
":",
"if",
"'all'",
"in",
"args",
":",
"return",
"ALL_SAMPLES",
"targets",
"=",
"[",
"]",
"if",
"'cpp'",
"in",
"args",
":",
"targets",
"+=",
"CPP_SAMPLES",
"args",
".",
"remove",
"(",
"'cpp'",
")",
"if",... | https://github.com/crosslife/OpenBird/blob/9e0198a1a2295f03fa1e8676e216e22c9c7d380b/cocos2d/build/android-build.py#L75-L101 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/cuda/intrinsic_wrapper.py | python | any_sync | (mask, predicate) | return numba.cuda.vote_sync_intrinsic(mask, 1, predicate)[1] | If for any thread in the masked warp the predicate is true, then
a non-zero value is returned, otherwise 0 is returned. | If for any thread in the masked warp the predicate is true, then
a non-zero value is returned, otherwise 0 is returned. | [
"If",
"for",
"any",
"thread",
"in",
"the",
"masked",
"warp",
"the",
"predicate",
"is",
"true",
"then",
"a",
"non",
"-",
"zero",
"value",
"is",
"returned",
"otherwise",
"0",
"is",
"returned",
"."
] | def any_sync(mask, predicate):
"""
If for any thread in the masked warp the predicate is true, then
a non-zero value is returned, otherwise 0 is returned.
"""
return numba.cuda.vote_sync_intrinsic(mask, 1, predicate)[1] | [
"def",
"any_sync",
"(",
"mask",
",",
"predicate",
")",
":",
"return",
"numba",
".",
"cuda",
".",
"vote_sync_intrinsic",
"(",
"mask",
",",
"1",
",",
"predicate",
")",
"[",
"1",
"]"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/cuda/intrinsic_wrapper.py#L16-L21 | |
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | scripts/Python/static-binding/lldb.py | python | SBHostOS.ThreadCreate | (name, arg2, thread_arg, err) | return _lldb.SBHostOS_ThreadCreate(name, arg2, thread_arg, err) | ThreadCreate(char const * name, lldb::thread_func_t arg2, void * thread_arg, SBError err) -> lldb::thread_t | ThreadCreate(char const * name, lldb::thread_func_t arg2, void * thread_arg, SBError err) -> lldb::thread_t | [
"ThreadCreate",
"(",
"char",
"const",
"*",
"name",
"lldb",
"::",
"thread_func_t",
"arg2",
"void",
"*",
"thread_arg",
"SBError",
"err",
")",
"-",
">",
"lldb",
"::",
"thread_t"
] | def ThreadCreate(name, arg2, thread_arg, err):
"""ThreadCreate(char const * name, lldb::thread_func_t arg2, void * thread_arg, SBError err) -> lldb::thread_t"""
return _lldb.SBHostOS_ThreadCreate(name, arg2, thread_arg, err) | [
"def",
"ThreadCreate",
"(",
"name",
",",
"arg2",
",",
"thread_arg",
",",
"err",
")",
":",
"return",
"_lldb",
".",
"SBHostOS_ThreadCreate",
"(",
"name",
",",
"arg2",
",",
"thread_arg",
",",
"err",
")"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L6068-L6070 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py3/sklearn/utils/extmath.py | python | make_nonnegative | (X, min_value=0) | return X | Ensure `X.min()` >= `min_value`.
Parameters
----------
X : array_like
The matrix to make non-negative
min_value : float
The threshold value
Returns
-------
array_like
The thresholded array
Raises
------
ValueError
When X is sparse | Ensure `X.min()` >= `min_value`. | [
"Ensure",
"X",
".",
"min",
"()",
">",
"=",
"min_value",
"."
] | def make_nonnegative(X, min_value=0):
"""Ensure `X.min()` >= `min_value`.
Parameters
----------
X : array_like
The matrix to make non-negative
min_value : float
The threshold value
Returns
-------
array_like
The thresholded array
Raises
------
Value... | [
"def",
"make_nonnegative",
"(",
"X",
",",
"min_value",
"=",
"0",
")",
":",
"min_",
"=",
"X",
".",
"min",
"(",
")",
"if",
"min_",
"<",
"min_value",
":",
"if",
"sparse",
".",
"issparse",
"(",
"X",
")",
":",
"raise",
"ValueError",
"(",
"\"Cannot make th... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/utils/extmath.py#L647-L675 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/lib2to3/fixes/fix_metaclass.py | python | has_metaclass | (parent) | return False | we have to check the cls_node without changing it.
There are two possibilities:
1) clsdef => suite => simple_stmt => expr_stmt => Leaf('__meta')
2) clsdef => simple_stmt => expr_stmt => Leaf('__meta') | we have to check the cls_node without changing it.
There are two possibilities:
1) clsdef => suite => simple_stmt => expr_stmt => Leaf('__meta')
2) clsdef => simple_stmt => expr_stmt => Leaf('__meta') | [
"we",
"have",
"to",
"check",
"the",
"cls_node",
"without",
"changing",
"it",
".",
"There",
"are",
"two",
"possibilities",
":",
"1",
")",
"clsdef",
"=",
">",
"suite",
"=",
">",
"simple_stmt",
"=",
">",
"expr_stmt",
"=",
">",
"Leaf",
"(",
"__meta",
")",
... | def has_metaclass(parent):
""" we have to check the cls_node without changing it.
There are two possibilities:
1) clsdef => suite => simple_stmt => expr_stmt => Leaf('__meta')
2) clsdef => simple_stmt => expr_stmt => Leaf('__meta')
"""
for node in parent.children:
if no... | [
"def",
"has_metaclass",
"(",
"parent",
")",
":",
"for",
"node",
"in",
"parent",
".",
"children",
":",
"if",
"node",
".",
"type",
"==",
"syms",
".",
"suite",
":",
"return",
"has_metaclass",
"(",
"node",
")",
"elif",
"node",
".",
"type",
"==",
"syms",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/lib2to3/fixes/fix_metaclass.py#L26-L42 | |
nyuwireless-unipd/ns3-mmwave | 4ff9e87e8079764e04cbeccd8e85bff15ae16fb3 | waf-tools/misc.py | python | copy_attrs | (orig, dest, names, only_if_set=False) | copy class attributes from an object to another | copy class attributes from an object to another | [
"copy",
"class",
"attributes",
"from",
"an",
"object",
"to",
"another"
] | def copy_attrs(orig, dest, names, only_if_set=False):
"""
copy class attributes from an object to another
"""
for a in Utils.to_list(names):
u = getattr(orig, a, ())
if u or not only_if_set:
setattr(dest, a, u) | [
"def",
"copy_attrs",
"(",
"orig",
",",
"dest",
",",
"names",
",",
"only_if_set",
"=",
"False",
")",
":",
"for",
"a",
"in",
"Utils",
".",
"to_list",
"(",
"names",
")",
":",
"u",
"=",
"getattr",
"(",
"orig",
",",
"a",
",",
"(",
")",
")",
"if",
"u... | https://github.com/nyuwireless-unipd/ns3-mmwave/blob/4ff9e87e8079764e04cbeccd8e85bff15ae16fb3/waf-tools/misc.py#L19-L26 | ||
nvdla/sw | 79538ba1b52b040a4a4645f630e457fa01839e90 | regression/scripts/dla_client.py | python | validateTestExecution | (msg) | return | Helper API to validate the Test Execution output. | Helper API to validate the Test Execution output. | [
"Helper",
"API",
"to",
"validate",
"the",
"Test",
"Execution",
"output",
"."
] | def validateTestExecution(msg):
"""
Helper API to validate the Test Execution output.
"""
if "PASSED" not in msg:
passed = "FAIL"
else:
passed = "PASS"
if passed == "FAIL":
sys.exit(1)
return | [
"def",
"validateTestExecution",
"(",
"msg",
")",
":",
"if",
"\"PASSED\"",
"not",
"in",
"msg",
":",
"passed",
"=",
"\"FAIL\"",
"else",
":",
"passed",
"=",
"\"PASS\"",
"if",
"passed",
"==",
"\"FAIL\"",
":",
"sys",
".",
"exit",
"(",
"1",
")",
"return"
] | https://github.com/nvdla/sw/blob/79538ba1b52b040a4a4645f630e457fa01839e90/regression/scripts/dla_client.py#L117-L129 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/urllib3/filepost.py | python | iter_fields | (fields) | return ((k, v) for k, v in fields) | .. deprecated:: 1.6
Iterate over fields.
The addition of :class:`~urllib3.fields.RequestField` makes this function
obsolete. Instead, use :func:`iter_field_objects`, which returns
:class:`~urllib3.fields.RequestField` objects.
Supports list of (k, v) tuples and dicts. | .. deprecated:: 1.6 | [
"..",
"deprecated",
"::",
"1",
".",
"6"
] | def iter_fields(fields):
"""
.. deprecated:: 1.6
Iterate over fields.
The addition of :class:`~urllib3.fields.RequestField` makes this function
obsolete. Instead, use :func:`iter_field_objects`, which returns
:class:`~urllib3.fields.RequestField` objects.
Supports list of (k, v) tuples an... | [
"def",
"iter_fields",
"(",
"fields",
")",
":",
"if",
"isinstance",
"(",
"fields",
",",
"dict",
")",
":",
"return",
"(",
"(",
"k",
",",
"v",
")",
"for",
"k",
",",
"v",
"in",
"six",
".",
"iteritems",
"(",
"fields",
")",
")",
"return",
"(",
"(",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/urllib3/filepost.py#L45-L60 | |
google/angle | d5df233189cad620b8e0de653fe5e6cb778e209d | third_party/logdog/logdog/streamname.py | python | StreamPath.parse | (cls, path) | return cls.make(*parts) | Returns (StreamPath): The parsed StreamPath instance.
Args:
path (str): the full stream path to parse.
Raises:
ValueError: If path is not a full, valid stream path string. | Returns (StreamPath): The parsed StreamPath instance. | [
"Returns",
"(",
"StreamPath",
")",
":",
"The",
"parsed",
"StreamPath",
"instance",
"."
] | def parse(cls, path):
"""Returns (StreamPath): The parsed StreamPath instance.
Args:
path (str): the full stream path to parse.
Raises:
ValueError: If path is not a full, valid stream path string.
"""
parts = path.split('/+/', 1)
if len(parts) != 2:
raise Va... | [
"def",
"parse",
"(",
"cls",
",",
"path",
")",
":",
"parts",
"=",
"path",
".",
"split",
"(",
"'/+/'",
",",
"1",
")",
"if",
"len",
"(",
"parts",
")",
"!=",
"2",
":",
"raise",
"ValueError",
"(",
"'Not a full stream path: [%s]'",
"%",
"(",
"path",
",",
... | https://github.com/google/angle/blob/d5df233189cad620b8e0de653fe5e6cb778e209d/third_party/logdog/logdog/streamname.py#L141-L153 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/control/motion_generation.py | python | AccelerationBoundedMotionGeneration.trajectory | (self) | return suffix | Returns the future trajectory as a HermiteTrajectory. | Returns the future trajectory as a HermiteTrajectory. | [
"Returns",
"the",
"future",
"trajectory",
"as",
"a",
"HermiteTrajectory",
"."
] | def trajectory(self):
"""Returns the future trajectory as a HermiteTrajectory.
"""
self._checkValid()
times,milestones,dmilestones = combine_nd_cubic(self.times,self.milestones,self.dmilestones)
prefix,suffix = HermiteTrajectory(times,milestones,dmilestones).split(self.trajTime)
... | [
"def",
"trajectory",
"(",
"self",
")",
":",
"self",
".",
"_checkValid",
"(",
")",
"times",
",",
"milestones",
",",
"dmilestones",
"=",
"combine_nd_cubic",
"(",
"self",
".",
"times",
",",
"self",
".",
"milestones",
",",
"self",
".",
"dmilestones",
")",
"p... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/control/motion_generation.py#L408-L415 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | SizerItem.CalcMin | (*args, **kwargs) | return _core_.SizerItem_CalcMin(*args, **kwargs) | CalcMin(self) -> Size
Calculates the minimum desired size for the item, including any space
needed by borders. | CalcMin(self) -> Size | [
"CalcMin",
"(",
"self",
")",
"-",
">",
"Size"
] | def CalcMin(*args, **kwargs):
"""
CalcMin(self) -> Size
Calculates the minimum desired size for the item, including any space
needed by borders.
"""
return _core_.SizerItem_CalcMin(*args, **kwargs) | [
"def",
"CalcMin",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"SizerItem_CalcMin",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L14068-L14075 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/contrib/sparsity/asp.py | python | set_excluded_layers | (main_program, param_names) | r"""
Set parameter name of layers which would not be pruned as sparse weights.
Args:
main_program (Program, optional): Program with model definition and its parameters.
param_names (list): A list contains names of parameters.
Examples:
.. code-block:: python
import padd... | r"""
Set parameter name of layers which would not be pruned as sparse weights. | [
"r",
"Set",
"parameter",
"name",
"of",
"layers",
"which",
"would",
"not",
"be",
"pruned",
"as",
"sparse",
"weights",
"."
] | def set_excluded_layers(main_program, param_names):
r"""
Set parameter name of layers which would not be pruned as sparse weights.
Args:
main_program (Program, optional): Program with model definition and its parameters.
param_names (list): A list contains names of parameters.
Examples:... | [
"def",
"set_excluded_layers",
"(",
"main_program",
",",
"param_names",
")",
":",
"ASPHelper",
".",
"set_excluded_layers",
"(",
"main_program",
"=",
"main_program",
",",
"param_names",
"=",
"param_names",
")"
] | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/contrib/sparsity/asp.py#L36-L74 | ||
qgis/QGIS | 15a77662d4bb712184f6aa60d0bd663010a76a75 | python/plugins/db_manager/db_plugins/plugin.py | python | Table.crs | (self) | return QgsCoordinateReferenceSystem() | Returns the CRS of this table or an invalid CRS if this is not a spatial table
This should be overwritten by any additional db plugins | Returns the CRS of this table or an invalid CRS if this is not a spatial table
This should be overwritten by any additional db plugins | [
"Returns",
"the",
"CRS",
"of",
"this",
"table",
"or",
"an",
"invalid",
"CRS",
"if",
"this",
"is",
"not",
"a",
"spatial",
"table",
"This",
"should",
"be",
"overwritten",
"by",
"any",
"additional",
"db",
"plugins"
] | def crs(self):
"""Returns the CRS of this table or an invalid CRS if this is not a spatial table
This should be overwritten by any additional db plugins"""
return QgsCoordinateReferenceSystem() | [
"def",
"crs",
"(",
"self",
")",
":",
"return",
"QgsCoordinateReferenceSystem",
"(",
")"
] | https://github.com/qgis/QGIS/blob/15a77662d4bb712184f6aa60d0bd663010a76a75/python/plugins/db_manager/db_plugins/plugin.py#L756-L759 | |
Tencent/Pebble | 68315f176d9e328a233ace29b7579a829f89879f | tools/blade/src/blade/console.py | python | warning | (msg) | dump warning message but continue. | dump warning message but continue. | [
"dump",
"warning",
"message",
"but",
"continue",
"."
] | def warning(msg):
"""dump warning message but continue. """
msg = 'Blade(warning): ' + msg
if color_enabled:
msg = _colors['yellow'] + msg + _colors['end']
print >>sys.stderr, msg | [
"def",
"warning",
"(",
"msg",
")",
":",
"msg",
"=",
"'Blade(warning): '",
"+",
"msg",
"if",
"color_enabled",
":",
"msg",
"=",
"_colors",
"[",
"'yellow'",
"]",
"+",
"msg",
"+",
"_colors",
"[",
"'end'",
"]",
"print",
">>",
"sys",
".",
"stderr",
",",
"m... | https://github.com/Tencent/Pebble/blob/68315f176d9e328a233ace29b7579a829f89879f/tools/blade/src/blade/console.py#L50-L55 | ||
liuheng92/tensorflow_PSENet | e2cd908f301b762150aa36893677c1c51c98ff9e | nets/model.py | python | mean_image_subtraction | (images, means=[123.68, 116.78, 103.94]) | return tf.concat(axis=3, values=channels) | image normalization
:param images:
:param means:
:return: | image normalization
:param images:
:param means:
:return: | [
"image",
"normalization",
":",
"param",
"images",
":",
":",
"param",
"means",
":",
":",
"return",
":"
] | def mean_image_subtraction(images, means=[123.68, 116.78, 103.94]):
'''
image normalization
:param images:
:param means:
:return:
'''
num_channels = images.get_shape().as_list()[-1]
if len(means) != num_channels:
raise ValueError('len(means) must match the number of channels')
... | [
"def",
"mean_image_subtraction",
"(",
"images",
",",
"means",
"=",
"[",
"123.68",
",",
"116.78",
",",
"103.94",
"]",
")",
":",
"num_channels",
"=",
"images",
".",
"get_shape",
"(",
")",
".",
"as_list",
"(",
")",
"[",
"-",
"1",
"]",
"if",
"len",
"(",
... | https://github.com/liuheng92/tensorflow_PSENet/blob/e2cd908f301b762150aa36893677c1c51c98ff9e/nets/model.py#L17-L30 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py3/sklearn/mixture/_bayesian_mixture.py | python | BayesianGaussianMixture._check_precision_parameters | (self, X) | Check the prior parameters of the precision distribution.
Parameters
----------
X : array-like, shape (n_samples, n_features) | Check the prior parameters of the precision distribution. | [
"Check",
"the",
"prior",
"parameters",
"of",
"the",
"precision",
"distribution",
"."
] | def _check_precision_parameters(self, X):
"""Check the prior parameters of the precision distribution.
Parameters
----------
X : array-like, shape (n_samples, n_features)
"""
_, n_features = X.shape
if self.degrees_of_freedom_prior is None:
self.degr... | [
"def",
"_check_precision_parameters",
"(",
"self",
",",
"X",
")",
":",
"_",
",",
"n_features",
"=",
"X",
".",
"shape",
"if",
"self",
".",
"degrees_of_freedom_prior",
"is",
"None",
":",
"self",
".",
"degrees_of_freedom_prior_",
"=",
"n_features",
"elif",
"self"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/mixture/_bayesian_mixture.py#L396-L412 | ||
gem5/gem5 | 141cc37c2d4b93959d4c249b8f7e6a8b2ef75338 | src/arch/micro_asm.py | python | p_rom_or_macro_0 | (t) | rom_or_macro : rom_block
| macroop_def | rom_or_macro : rom_block
| macroop_def | [
"rom_or_macro",
":",
"rom_block",
"|",
"macroop_def"
] | def p_rom_or_macro_0(t):
'''rom_or_macro : rom_block
| macroop_def''' | [
"def",
"p_rom_or_macro_0",
"(",
"t",
")",
":"
] | https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/src/arch/micro_asm.py#L325-L327 | ||
vmtk/vmtk | 927331ad752265199390eabbbf2e07cdc2b4bcc6 | vtkVmtk/Utilities/Stellar_1.0/meshconvert.py | python | readVmesh | (meshFileName) | return points, tets, boundFaces | Read in .vmesh file... again, I can't recall who uses this format | Read in .vmesh file... again, I can't recall who uses this format | [
"Read",
"in",
".",
"vmesh",
"file",
"...",
"again",
"I",
"can",
"t",
"recall",
"who",
"uses",
"this",
"format"
] | def readVmesh(meshFileName):
"""Read in .vmesh file... again, I can't recall who uses this format"""
# append .vmesh to file stem
meshFileName += '.vmesh'
# open input .vmesh file
infile = open(meshFileName)
# first line: #tets #faces #boundFaces #verts
firstLine = map(int,infile.readline... | [
"def",
"readVmesh",
"(",
"meshFileName",
")",
":",
"# append .vmesh to file stem",
"meshFileName",
"+=",
"'.vmesh'",
"# open input .vmesh file",
"infile",
"=",
"open",
"(",
"meshFileName",
")",
"# first line: #tets #faces #boundFaces #verts",
"firstLine",
"=",
"map",
"(",
... | https://github.com/vmtk/vmtk/blob/927331ad752265199390eabbbf2e07cdc2b4bcc6/vtkVmtk/Utilities/Stellar_1.0/meshconvert.py#L247-L313 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/richtext.py | python | RichTextCtrl.GetValue | (*args, **kwargs) | return _richtext.RichTextCtrl_GetValue(*args, **kwargs) | GetValue(self) -> String | GetValue(self) -> String | [
"GetValue",
"(",
"self",
")",
"-",
">",
"String"
] | def GetValue(*args, **kwargs):
"""GetValue(self) -> String"""
return _richtext.RichTextCtrl_GetValue(*args, **kwargs) | [
"def",
"GetValue",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextCtrl_GetValue",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/richtext.py#L2923-L2925 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_core.py | python | CallLater.Stop | (self) | Stop and destroy the timer. | Stop and destroy the timer. | [
"Stop",
"and",
"destroy",
"the",
"timer",
"."
] | def Stop(self):
"""
Stop and destroy the timer.
"""
if self.timer is not None:
self.timer.Stop()
self.timer = None
self.__RUNNING.discard(self) | [
"def",
"Stop",
"(",
"self",
")",
":",
"if",
"self",
".",
"timer",
"is",
"not",
"None",
":",
"self",
".",
"timer",
".",
"Stop",
"(",
")",
"self",
".",
"timer",
"=",
"None",
"self",
".",
"__RUNNING",
".",
"discard",
"(",
"self",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L16826-L16833 | ||
LisaAnne/lisa-caffe-public | 49b8643ddef23a4f6120017968de30c45e693f59 | scripts/cpp_lint.py | python | ReverseCloseExpression | (clean_lines, linenum, pos) | return (line, 0, -1) | If input points to ) or } or ] or >, finds the position that opens it.
If lines[linenum][pos] points to a ')' or '}' or ']' or '>', finds the
linenum/pos that correspond to the opening of the expression.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to ... | If input points to ) or } or ] or >, finds the position that opens it. | [
"If",
"input",
"points",
"to",
")",
"or",
"}",
"or",
"]",
"or",
">",
"finds",
"the",
"position",
"that",
"opens",
"it",
"."
] | def ReverseCloseExpression(clean_lines, linenum, pos):
"""If input points to ) or } or ] or >, finds the position that opens it.
If lines[linenum][pos] points to a ')' or '}' or ']' or '>', finds the
linenum/pos that correspond to the opening of the expression.
Args:
clean_lines: A CleansedLines instance ... | [
"def",
"ReverseCloseExpression",
"(",
"clean_lines",
",",
"linenum",
",",
"pos",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"endchar",
"=",
"line",
"[",
"pos",
"]",
"if",
"endchar",
"not",
"in",
"')}]>'",
":",
"return",
"("... | https://github.com/LisaAnne/lisa-caffe-public/blob/49b8643ddef23a4f6120017968de30c45e693f59/scripts/cpp_lint.py#L1327-L1369 | |
xbmc/xbmc | 091211a754589fc40a2a1f239b0ce9f4ee138268 | tools/EventClients/lib/python/xbmcclient.py | python | XBMCClient.send_remote_button | (self, button=None) | Send a remote control event to XBMC
Keyword Arguments:
button -- name of the remote control button to send (same as in Keymap.xml) | Send a remote control event to XBMC
Keyword Arguments:
button -- name of the remote control button to send (same as in Keymap.xml) | [
"Send",
"a",
"remote",
"control",
"event",
"to",
"XBMC",
"Keyword",
"Arguments",
":",
"button",
"--",
"name",
"of",
"the",
"remote",
"control",
"button",
"to",
"send",
"(",
"same",
"as",
"in",
"Keymap",
".",
"xml",
")"
] | def send_remote_button(self, button=None):
"""Send a remote control event to XBMC
Keyword Arguments:
button -- name of the remote control button to send (same as in Keymap.xml)
"""
if not button:
return
self.send_button(map="R1", button=button) | [
"def",
"send_remote_button",
"(",
"self",
",",
"button",
"=",
"None",
")",
":",
"if",
"not",
"button",
":",
"return",
"self",
".",
"send_button",
"(",
"map",
"=",
"\"R1\"",
",",
"button",
"=",
"button",
")"
] | https://github.com/xbmc/xbmc/blob/091211a754589fc40a2a1f239b0ce9f4ee138268/tools/EventClients/lib/python/xbmcclient.py#L541-L548 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | deps/src/libxml2-2.9.1/python/libxml2class.py | python | addEncodingAlias | (name, alias) | return ret | Registers an alias @alias for an encoding named @name.
Existing alias will be overwritten. | Registers an alias | [
"Registers",
"an",
"alias"
] | def addEncodingAlias(name, alias):
"""Registers an alias @alias for an encoding named @name.
Existing alias will be overwritten. """
ret = libxml2mod.xmlAddEncodingAlias(name, alias)
return ret | [
"def",
"addEncodingAlias",
"(",
"name",
",",
"alias",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlAddEncodingAlias",
"(",
"name",
",",
"alias",
")",
"return",
"ret"
] | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2class.py#L322-L326 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Arch/ArchWall.py | python | _CommandMergeWalls.Activated | (self) | Executed when Arch MergeWalls is called.
Call ArchWall.joinWalls() on walls selected by the user, with the
delete option enabled. If the user has selected a single wall, check to
see if the wall has any Additions that are walls. If so, merges these
additions to the wall, deleting the ad... | Executed when Arch MergeWalls is called. | [
"Executed",
"when",
"Arch",
"MergeWalls",
"is",
"called",
"."
] | def Activated(self):
"""Executed when Arch MergeWalls is called.
Call ArchWall.joinWalls() on walls selected by the user, with the
delete option enabled. If the user has selected a single wall, check to
see if the wall has any Additions that are walls. If so, merges these
additi... | [
"def",
"Activated",
"(",
"self",
")",
":",
"walls",
"=",
"FreeCADGui",
".",
"Selection",
".",
"getSelection",
"(",
")",
"if",
"len",
"(",
"walls",
")",
"==",
"1",
":",
"if",
"Draft",
".",
"getType",
"(",
"walls",
"[",
"0",
"]",
")",
"==",
"\"Wall\"... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Arch/ArchWall.py#L643-L680 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/lite/examples/transfer_learning/model/effnet.py | python | DepthwiseSeparableConv.construct | (self, x) | return x | construct | construct | [
"construct"
] | def construct(self, x):
"""
construct
"""
residual = x
x = self.conv_dw(x)
x = self.bn1(x)
x = self.act1(x)
x = self.se(x)
x = self.conv_pw(x)
x = self.bn2(x)
if self.has_residual:
x += residual
return x | [
"def",
"construct",
"(",
"self",
",",
"x",
")",
":",
"residual",
"=",
"x",
"x",
"=",
"self",
".",
"conv_dw",
"(",
"x",
")",
"x",
"=",
"self",
".",
"bn1",
"(",
"x",
")",
"x",
"=",
"self",
".",
"act1",
"(",
"x",
")",
"x",
"=",
"self",
".",
... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/lite/examples/transfer_learning/model/effnet.py#L110-L123 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/python/ops/io_ops.py | python | TFRecordReader.__init__ | (self, name=None, options=None) | Create a TFRecordReader.
Args:
name: A name for the operation (optional).
options: A TFRecordOptions object (optional). | Create a TFRecordReader. | [
"Create",
"a",
"TFRecordReader",
"."
] | def __init__(self, name=None, options=None):
"""Create a TFRecordReader.
Args:
name: A name for the operation (optional).
options: A TFRecordOptions object (optional).
"""
compression_type_string = ""
if (options and
options.compression_type == python_io.TFRecordCompressionType.... | [
"def",
"__init__",
"(",
"self",
",",
"name",
"=",
"None",
",",
"options",
"=",
"None",
")",
":",
"compression_type_string",
"=",
"\"\"",
"if",
"(",
"options",
"and",
"options",
".",
"compression_type",
"==",
"python_io",
".",
"TFRecordCompressionType",
".",
... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/ops/io_ops.py#L527-L541 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/extern/flatnotebook.py | python | FlatNotebook.GetImageList | (self) | return self._pages.GetImageList() | Returns the associated image list. | Returns the associated image list. | [
"Returns",
"the",
"associated",
"image",
"list",
"."
] | def GetImageList(self):
""" Returns the associated image list. """
return self._pages.GetImageList() | [
"def",
"GetImageList",
"(",
"self",
")",
":",
"return",
"self",
".",
"_pages",
".",
"GetImageList",
"(",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/flatnotebook.py#L3190-L3193 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/common/seed.py | python | _get_graph_seed | (op_seed, kernel_name) | return seeds | Get the graph-level seed.
Graph-level seed is used as a global variable, that can be used in different ops in case op-level seed is not set.
If op-level seed is 0, use graph-level seed; if graph-level seed is also 0, the system would generate a
random seed.
Note:
For each seed, either op-seed o... | Get the graph-level seed.
Graph-level seed is used as a global variable, that can be used in different ops in case op-level seed is not set.
If op-level seed is 0, use graph-level seed; if graph-level seed is also 0, the system would generate a
random seed. | [
"Get",
"the",
"graph",
"-",
"level",
"seed",
".",
"Graph",
"-",
"level",
"seed",
"is",
"used",
"as",
"a",
"global",
"variable",
"that",
"can",
"be",
"used",
"in",
"different",
"ops",
"in",
"case",
"op",
"-",
"level",
"seed",
"is",
"not",
"set",
".",
... | def _get_graph_seed(op_seed, kernel_name):
"""
Get the graph-level seed.
Graph-level seed is used as a global variable, that can be used in different ops in case op-level seed is not set.
If op-level seed is 0, use graph-level seed; if graph-level seed is also 0, the system would generate a
random s... | [
"def",
"_get_graph_seed",
"(",
"op_seed",
",",
"kernel_name",
")",
":",
"global_seed",
"=",
"get_seed",
"(",
")",
"if",
"global_seed",
"==",
"0",
":",
"global_seed",
"=",
"DEFAULT_GRAPH_SEED",
"elif",
"global_seed",
"is",
"None",
":",
"global_seed",
"=",
"0",
... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/common/seed.py#L222-L264 | |
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | third_party/Python/module/six/six.py | python | _SixMetaPathImporter.get_code | (self, fullname) | return None | Return None
Required, if is_package is implemented | Return None | [
"Return",
"None"
] | def get_code(self, fullname):
"""Return None
Required, if is_package is implemented"""
self.__get_module(fullname) # eventually raises ImportError
return None | [
"def",
"get_code",
"(",
"self",
",",
"fullname",
")",
":",
"self",
".",
"__get_module",
"(",
"fullname",
")",
"# eventually raises ImportError",
"return",
"None"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/third_party/Python/module/six/six.py#L218-L223 | |
gnuradio/gnuradio | 09c3c4fa4bfb1a02caac74cb5334dfe065391e3b | grc/gui/Utils.py | python | num_to_str | (num) | Display logic for numbers | Display logic for numbers | [
"Display",
"logic",
"for",
"numbers"
] | def num_to_str(num):
""" Display logic for numbers """
def eng_notation(value, fmt='g'):
"""Convert a number to a string in engineering notation. E.g., 5e-9 -> 5n"""
template = '{:' + fmt + '}{}'
magnitude = abs(value)
for exp, symbol in zip(range(9, -15 - 1, -3), 'GMk munpf'):
... | [
"def",
"num_to_str",
"(",
"num",
")",
":",
"def",
"eng_notation",
"(",
"value",
",",
"fmt",
"=",
"'g'",
")",
":",
"\"\"\"Convert a number to a string in engineering notation. E.g., 5e-9 -> 5n\"\"\"",
"template",
"=",
"'{:'",
"+",
"fmt",
"+",
"'}{}'",
"magnitude",
"... | https://github.com/gnuradio/gnuradio/blob/09c3c4fa4bfb1a02caac74cb5334dfe065391e3b/grc/gui/Utils.py#L73-L94 | ||
BitMEX/api-connectors | 37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812 | auto-generated/python/swagger_client/models/position.py | python | Position.unrealised_gross_pnl | (self) | return self._unrealised_gross_pnl | Gets the unrealised_gross_pnl of this Position. # noqa: E501
:return: The unrealised_gross_pnl of this Position. # noqa: E501
:rtype: float | Gets the unrealised_gross_pnl of this Position. # noqa: E501 | [
"Gets",
"the",
"unrealised_gross_pnl",
"of",
"this",
"Position",
".",
"#",
"noqa",
":",
"E501"
] | def unrealised_gross_pnl(self):
"""Gets the unrealised_gross_pnl of this Position. # noqa: E501
:return: The unrealised_gross_pnl of this Position. # noqa: E501
:rtype: float
"""
return self._unrealised_gross_pnl | [
"def",
"unrealised_gross_pnl",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unrealised_gross_pnl"
] | https://github.com/BitMEX/api-connectors/blob/37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812/auto-generated/python/swagger_client/models/position.py#L1911-L1918 | |
scribusproject/scribus | 41ec7c775a060912cf251682a8b1437f753f80f4 | scribus/plugins/scriptplugin_py2x/scripts/ColorChart.py | python | rgbhex | (r,g,b) | return rgbstring | convert rgb values in 0-255 style to hex string in #000000 to #ffffff style | convert rgb values in 0-255 style to hex string in #000000 to #ffffff style | [
"convert",
"rgb",
"values",
"in",
"0",
"-",
"255",
"style",
"to",
"hex",
"string",
"in",
"#000000",
"to",
"#ffffff",
"style"
] | def rgbhex(r,g,b):
'''convert rgb values in 0-255 style to hex string in #000000 to #ffffff style'''
hr=hex(r)
hr = hr.replace("0x", "")
if len(hr)== 0:
hr = "00"
elif len(hr)==1:
hr = "0"+hr
else:
pass
hg=hex(g)
hg = hg.replace("0x", "")
if len(hg)== 0:
... | [
"def",
"rgbhex",
"(",
"r",
",",
"g",
",",
"b",
")",
":",
"hr",
"=",
"hex",
"(",
"r",
")",
"hr",
"=",
"hr",
".",
"replace",
"(",
"\"0x\"",
",",
"\"\"",
")",
"if",
"len",
"(",
"hr",
")",
"==",
"0",
":",
"hr",
"=",
"\"00\"",
"elif",
"len",
"... | https://github.com/scribusproject/scribus/blob/41ec7c775a060912cf251682a8b1437f753f80f4/scribus/plugins/scriptplugin_py2x/scripts/ColorChart.py#L186-L214 | |
tensorflow/minigo | 6d89c202cdceaf449aefc3149ab2110d44f1a6a4 | mcts.py | python | MCTSNode.is_done | (self) | return self.position.is_game_over() or self.position.n >= FLAGS.max_game_length | True if the last two moves were Pass or if the position is at a move
greater than the max depth. | True if the last two moves were Pass or if the position is at a move
greater than the max depth. | [
"True",
"if",
"the",
"last",
"two",
"moves",
"were",
"Pass",
"or",
"if",
"the",
"position",
"is",
"at",
"a",
"move",
"greater",
"than",
"the",
"max",
"depth",
"."
] | def is_done(self):
"""True if the last two moves were Pass or if the position is at a move
greater than the max depth."""
return self.position.is_game_over() or self.position.n >= FLAGS.max_game_length | [
"def",
"is_done",
"(",
"self",
")",
":",
"return",
"self",
".",
"position",
".",
"is_game_over",
"(",
")",
"or",
"self",
".",
"position",
".",
"n",
">=",
"FLAGS",
".",
"max_game_length"
] | https://github.com/tensorflow/minigo/blob/6d89c202cdceaf449aefc3149ab2110d44f1a6a4/mcts.py#L235-L238 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/optparse.py | python | OptionParser._match_long_opt | (self, opt) | return _match_abbrev(opt, self._long_opt) | _match_long_opt(opt : string) -> string
Determine which long option string 'opt' matches, ie. which one
it is an unambiguous abbreviation for. Raises BadOptionError if
'opt' doesn't unambiguously match any long option string. | _match_long_opt(opt : string) -> string | [
"_match_long_opt",
"(",
"opt",
":",
"string",
")",
"-",
">",
"string"
] | def _match_long_opt(self, opt):
"""_match_long_opt(opt : string) -> string
Determine which long option string 'opt' matches, ie. which one
it is an unambiguous abbreviation for. Raises BadOptionError if
'opt' doesn't unambiguously match any long option string.
"""
retur... | [
"def",
"_match_long_opt",
"(",
"self",
",",
"opt",
")",
":",
"return",
"_match_abbrev",
"(",
"opt",
",",
"self",
".",
"_long_opt",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/optparse.py#L1471-L1478 | |
grpc/grpc | 27bc6fe7797e43298dc931b96dc57322d0852a9f | tools/interop_matrix/create_matrix_images.py | python | build_image_jobspec | (runtime, env, gcr_tag, stack_base) | return build_job | Build interop docker image for a language with runtime.
runtime: a <lang><version> string, for example go1.8.
env: dictionary of env to passed to the build script.
gcr_tag: the tag for the docker image (i.e. v1.3.0).
stack_base: the local gRPC repo path. | Build interop docker image for a language with runtime. | [
"Build",
"interop",
"docker",
"image",
"for",
"a",
"language",
"with",
"runtime",
"."
] | def build_image_jobspec(runtime, env, gcr_tag, stack_base):
"""Build interop docker image for a language with runtime.
runtime: a <lang><version> string, for example go1.8.
env: dictionary of env to passed to the build script.
gcr_tag: the tag for the docker image (i.e. v1.3.0).
stack_base: the local g... | [
"def",
"build_image_jobspec",
"(",
"runtime",
",",
"env",
",",
"gcr_tag",
",",
"stack_base",
")",
":",
"basename",
"=",
"'grpc_interop_%s'",
"%",
"runtime",
"tag",
"=",
"'%s/%s:%s'",
"%",
"(",
"args",
".",
"gcr_path",
",",
"basename",
",",
"gcr_tag",
")",
... | https://github.com/grpc/grpc/blob/27bc6fe7797e43298dc931b96dc57322d0852a9f/tools/interop_matrix/create_matrix_images.py#L140-L160 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/idlelib/config.py | python | IdleConf.GetExtensionBindings | (self, extensionName) | return extBinds | Return dict {extensionName event : active or defined keybinding}.
Augment self.GetExtensionKeys(extensionName) with mapping of non-
configurable events (from default config) to GetOption splits,
as in self.__GetRawExtensionKeys. | Return dict {extensionName event : active or defined keybinding}. | [
"Return",
"dict",
"{",
"extensionName",
"event",
":",
"active",
"or",
"defined",
"keybinding",
"}",
"."
] | def GetExtensionBindings(self, extensionName):
"""Return dict {extensionName event : active or defined keybinding}.
Augment self.GetExtensionKeys(extensionName) with mapping of non-
configurable events (from default config) to GetOption splits,
as in self.__GetRawExtensionKeys.
... | [
"def",
"GetExtensionBindings",
"(",
"self",
",",
"extensionName",
")",
":",
"bindsName",
"=",
"extensionName",
"+",
"'_bindings'",
"extBinds",
"=",
"self",
".",
"GetExtensionKeys",
"(",
"extensionName",
")",
"#add the non-configurable bindings",
"if",
"self",
".",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/idlelib/config.py#L507-L525 | |
bh107/bohrium | 5b83e7117285fefc7779ed0e9acb0f8e74c7e068 | bridge/npbackend/bohrium/array_create.py | python | zeros_like | (a, dtype=None, bohrium=None) | return b | Return an array of zeros with the same shape and type as a given array.
With default parameters, is equivalent to ``a.copy().fill(0)``.
Parameters
----------
a : array_like
The shape and data-type of `a` define these same attributes of
the returned array.
dtype : data-type, optiona... | Return an array of zeros with the same shape and type as a given array. | [
"Return",
"an",
"array",
"of",
"zeros",
"with",
"the",
"same",
"shape",
"and",
"type",
"as",
"a",
"given",
"array",
"."
] | def zeros_like(a, dtype=None, bohrium=None):
"""
Return an array of zeros with the same shape and type as a given array.
With default parameters, is equivalent to ``a.copy().fill(0)``.
Parameters
----------
a : array_like
The shape and data-type of `a` define these same attributes of
... | [
"def",
"zeros_like",
"(",
"a",
",",
"dtype",
"=",
"None",
",",
"bohrium",
"=",
"None",
")",
":",
"if",
"dtype",
"is",
"None",
":",
"dtype",
"=",
"a",
".",
"dtype",
"if",
"bohrium",
"is",
"None",
":",
"bohrium",
"=",
"bhary",
".",
"check",
"(",
"a... | https://github.com/bh107/bohrium/blob/5b83e7117285fefc7779ed0e9acb0f8e74c7e068/bridge/npbackend/bohrium/array_create.py#L382-L446 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/plugins/algorithms/NormaliseSpectra.py | python | NormaliseSpectra._setup | (self) | Gets properties. | Gets properties. | [
"Gets",
"properties",
"."
] | def _setup(self):
"""
Gets properties.
"""
self._input_ws_name = self.getPropertyValue('InputWorkspace')
self._input_ws = mtd[self._input_ws_name]
self._output_ws_name = self.getPropertyValue('OutputWorkspace') | [
"def",
"_setup",
"(",
"self",
")",
":",
"self",
".",
"_input_ws_name",
"=",
"self",
".",
"getPropertyValue",
"(",
"'InputWorkspace'",
")",
"self",
".",
"_input_ws",
"=",
"mtd",
"[",
"self",
".",
"_input_ws_name",
"]",
"self",
".",
"_output_ws_name",
"=",
"... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/NormaliseSpectra.py#L65-L72 | ||
protocolbuffers/protobuf | b5ab0b7a18b7336c60130f4ddb2d97c51792f896 | python/google/protobuf/message.py | python | Message.WhichOneof | (self, oneof_group) | Returns the name of the field that is set inside a oneof group.
If no field is set, returns None.
Args:
oneof_group (str): the name of the oneof group to check.
Returns:
str or None: The name of the group that is set, or None.
Raises:
ValueError: no group with the given name exists | Returns the name of the field that is set inside a oneof group. | [
"Returns",
"the",
"name",
"of",
"the",
"field",
"that",
"is",
"set",
"inside",
"a",
"oneof",
"group",
"."
] | def WhichOneof(self, oneof_group):
"""Returns the name of the field that is set inside a oneof group.
If no field is set, returns None.
Args:
oneof_group (str): the name of the oneof group to check.
Returns:
str or None: The name of the group that is set, or None.
Raises:
Value... | [
"def",
"WhichOneof",
"(",
"self",
",",
"oneof_group",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/protocolbuffers/protobuf/blob/b5ab0b7a18b7336c60130f4ddb2d97c51792f896/python/google/protobuf/message.py#L295-L309 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/email/_policybase.py | python | Policy.register_defect | (self, obj, defect) | Record 'defect' on 'obj'.
Called by handle_defect if raise_on_defect is False. This method is
part of the Policy API so that Policy subclasses can implement custom
defect handling. The default implementation calls the append method of
the defects attribute of obj. The objects used by... | Record 'defect' on 'obj'. | [
"Record",
"defect",
"on",
"obj",
"."
] | def register_defect(self, obj, defect):
"""Record 'defect' on 'obj'.
Called by handle_defect if raise_on_defect is False. This method is
part of the Policy API so that Policy subclasses can implement custom
defect handling. The default implementation calls the append method of
... | [
"def",
"register_defect",
"(",
"self",
",",
"obj",
",",
"defect",
")",
":",
"obj",
".",
"defects",
".",
"append",
"(",
"defect",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/email/_policybase.py#L188-L199 | ||
devsisters/libquic | 8954789a056d8e7d5fcb6452fd1572ca57eb5c4e | src/third_party/protobuf/python/google/protobuf/internal/python_message.py | python | _AddHasFieldMethod | (message_descriptor, cls) | Helper for _AddMessageMethods(). | Helper for _AddMessageMethods(). | [
"Helper",
"for",
"_AddMessageMethods",
"()",
"."
] | def _AddHasFieldMethod(message_descriptor, cls):
"""Helper for _AddMessageMethods()."""
is_proto3 = (message_descriptor.syntax == "proto3")
error_msg = _Proto3HasError if is_proto3 else _Proto2HasError
hassable_fields = {}
for field in message_descriptor.fields:
if field.label == _FieldDescriptor.LABEL_... | [
"def",
"_AddHasFieldMethod",
"(",
"message_descriptor",
",",
"cls",
")",
":",
"is_proto3",
"=",
"(",
"message_descriptor",
".",
"syntax",
"==",
"\"proto3\"",
")",
"error_msg",
"=",
"_Proto3HasError",
"if",
"is_proto3",
"else",
"_Proto2HasError",
"hassable_fields",
"... | https://github.com/devsisters/libquic/blob/8954789a056d8e7d5fcb6452fd1572ca57eb5c4e/src/third_party/protobuf/python/google/protobuf/internal/python_message.py#L810-L849 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/pubsub/setupkwargs.py | python | transitionFromArg1 | (commonName) | Utility function to assist migrating an application from using
the arg1 messaging protocol to using the kwargs protocol. Call this
after having run and debugged your application with ``setuparg1.enforceArgName(commonName)``. See the migration docs
for more detais. | Utility function to assist migrating an application from using
the arg1 messaging protocol to using the kwargs protocol. Call this
after having run and debugged your application with ``setuparg1.enforceArgName(commonName)``. See the migration docs
for more detais. | [
"Utility",
"function",
"to",
"assist",
"migrating",
"an",
"application",
"from",
"using",
"the",
"arg1",
"messaging",
"protocol",
"to",
"using",
"the",
"kwargs",
"protocol",
".",
"Call",
"this",
"after",
"having",
"run",
"and",
"debugged",
"your",
"application",... | def transitionFromArg1(commonName):
"""Utility function to assist migrating an application from using
the arg1 messaging protocol to using the kwargs protocol. Call this
after having run and debugged your application with ``setuparg1.enforceArgName(commonName)``. See the migration docs
for more detais... | [
"def",
"transitionFromArg1",
"(",
"commonName",
")",
":",
"policies",
".",
"setMsgDataArgName",
"(",
"2",
",",
"commonName",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/pubsub/setupkwargs.py#L23-L29 | ||
PyMesh/PyMesh | 384ba882b7558ba6e8653ed263c419226c22bddf | python/pymesh/wires/wires_io.py | python | load_wires | (wire_file) | return WireNetwork.create_from_file(wire_file) | Create a WireNetwork object from file. | Create a WireNetwork object from file. | [
"Create",
"a",
"WireNetwork",
"object",
"from",
"file",
"."
] | def load_wires(wire_file):
""" Create a WireNetwork object from file.
"""
return WireNetwork.create_from_file(wire_file) | [
"def",
"load_wires",
"(",
"wire_file",
")",
":",
"return",
"WireNetwork",
".",
"create_from_file",
"(",
"wire_file",
")"
] | https://github.com/PyMesh/PyMesh/blob/384ba882b7558ba6e8653ed263c419226c22bddf/python/pymesh/wires/wires_io.py#L3-L6 | |
isl-org/Open3D | 79aec3ddde6a571ce2f28e4096477e52ec465244 | python/open3d/visualization/tensorboard_plugin/util.py | python | LRUCache.clear | (self) | Invalidate cache. | Invalidate cache. | [
"Invalidate",
"cache",
"."
] | def clear(self):
"""Invalidate cache."""
self.rwlock.acquire_write()
self.cache.clear()
self.rwlock.release_write() | [
"def",
"clear",
"(",
"self",
")",
":",
"self",
".",
"rwlock",
".",
"acquire_write",
"(",
")",
"self",
".",
"cache",
".",
"clear",
"(",
")",
"self",
".",
"rwlock",
".",
"release_write",
"(",
")"
] | https://github.com/isl-org/Open3D/blob/79aec3ddde6a571ce2f28e4096477e52ec465244/python/open3d/visualization/tensorboard_plugin/util.py#L161-L165 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/SCD_Reduction/ICCFitTools.py | python | integrateSample | (run, MDdata, peaks_ws, paramList, UBMatrix, dQ, qMask, padeCoefficients,
figsFormat=None, dtSpread=0.02, fracHKL=0.5, minFracPixels=0.0000, fracStop=0.01,
dQPixel=0.005, p=None, neigh_length_m=0, zBG=-1.0, bgPolyOrder=1,
doIterativeBackgroundFitting=False, q_... | return peaks_ws, paramList, fitDict | integrateSample contains the loop that integrates over all of the peaks in a run and saves the results. Importantly, it also handles
errors (mostly by passing and recording special values for failed fits.)
Input:
run - int; the run number to process
MDdata - MDWorkspace; the MDWorkspace from th... | integrateSample contains the loop that integrates over all of the peaks in a run and saves the results. Importantly, it also handles
errors (mostly by passing and recording special values for failed fits.)
Input:
run - int; the run number to process
MDdata - MDWorkspace; the MDWorkspace from th... | [
"integrateSample",
"contains",
"the",
"loop",
"that",
"integrates",
"over",
"all",
"of",
"the",
"peaks",
"in",
"a",
"run",
"and",
"saves",
"the",
"results",
".",
"Importantly",
"it",
"also",
"handles",
"errors",
"(",
"mostly",
"by",
"passing",
"and",
"record... | def integrateSample(run, MDdata, peaks_ws, paramList, UBMatrix, dQ, qMask, padeCoefficients,
figsFormat=None, dtSpread=0.02, fracHKL=0.5, minFracPixels=0.0000, fracStop=0.01,
dQPixel=0.005, p=None, neigh_length_m=0, zBG=-1.0, bgPolyOrder=1,
doIterativeBackgrou... | [
"def",
"integrateSample",
"(",
"run",
",",
"MDdata",
",",
"peaks_ws",
",",
"paramList",
",",
"UBMatrix",
",",
"dQ",
",",
"qMask",
",",
"padeCoefficients",
",",
"figsFormat",
"=",
"None",
",",
"dtSpread",
"=",
"0.02",
",",
"fracHKL",
"=",
"0.5",
",",
"min... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/SCD_Reduction/ICCFitTools.py#L911-L1052 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/stc.py | python | StyledTextCtrl.SetMarginSensitive | (*args, **kwargs) | return _stc.StyledTextCtrl_SetMarginSensitive(*args, **kwargs) | SetMarginSensitive(self, int margin, bool sensitive)
Make a margin sensitive or insensitive to mouse clicks. | SetMarginSensitive(self, int margin, bool sensitive) | [
"SetMarginSensitive",
"(",
"self",
"int",
"margin",
"bool",
"sensitive",
")"
] | def SetMarginSensitive(*args, **kwargs):
"""
SetMarginSensitive(self, int margin, bool sensitive)
Make a margin sensitive or insensitive to mouse clicks.
"""
return _stc.StyledTextCtrl_SetMarginSensitive(*args, **kwargs) | [
"def",
"SetMarginSensitive",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_SetMarginSensitive",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/stc.py#L2482-L2488 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/httplib2/upload-diffs.py | python | MercurialVCS.GetUnknownFiles | (self) | return unknown_files | Return a list of files unknown to the VCS. | Return a list of files unknown to the VCS. | [
"Return",
"a",
"list",
"of",
"files",
"unknown",
"to",
"the",
"VCS",
"."
] | def GetUnknownFiles(self):
"""Return a list of files unknown to the VCS."""
args = []
status = RunShell(["hg", "status", "--rev", self.base_rev, "-u", "."],
silent_ok=True)
unknown_files = []
for line in status.splitlines():
st, fn = line.split(" ", 1)
if st == "?":
unkno... | [
"def",
"GetUnknownFiles",
"(",
"self",
")",
":",
"args",
"=",
"[",
"]",
"status",
"=",
"RunShell",
"(",
"[",
"\"hg\"",
",",
"\"status\"",
",",
"\"--rev\"",
",",
"self",
".",
"base_rev",
",",
"\"-u\"",
",",
"\".\"",
"]",
",",
"silent_ok",
"=",
"True",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/httplib2/upload-diffs.py#L1525-L1535 | |
pybox2d/pybox2d | 09643321fd363f0850087d1bde8af3f4afd82163 | library/Box2D/examples/backends/pyqt4_framework.py | python | Pyqt4Draw.DrawShape | (self, shape, transform, color, selected=False) | Draw any type of shape | Draw any type of shape | [
"Draw",
"any",
"type",
"of",
"shape"
] | def DrawShape(self, shape, transform, color, selected=False):
"""
Draw any type of shape
"""
cache_hit = False
if hash(shape) in self.item_cache:
cache_hit = True
items = self.item_cache[hash(shape)]
items[0].setRotation(transform.angle * 180.0... | [
"def",
"DrawShape",
"(",
"self",
",",
"shape",
",",
"transform",
",",
"color",
",",
"selected",
"=",
"False",
")",
":",
"cache_hit",
"=",
"False",
"if",
"hash",
"(",
"shape",
")",
"in",
"self",
".",
"item_cache",
":",
"cache_hit",
"=",
"True",
"items",... | https://github.com/pybox2d/pybox2d/blob/09643321fd363f0850087d1bde8af3f4afd82163/library/Box2D/examples/backends/pyqt4_framework.py#L268-L316 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/core/series.py | python | Series.map | (self, arg, na_action=None) | return self._constructor(new_values, index=self.index).__finalize__(
self, method="map"
) | Map values of Series according to input correspondence.
Used for substituting each value in a Series with another value,
that may be derived from a function, a ``dict`` or
a :class:`Series`.
Parameters
----------
arg : function, collections.abc.Mapping subclass or Serie... | Map values of Series according to input correspondence. | [
"Map",
"values",
"of",
"Series",
"according",
"to",
"input",
"correspondence",
"."
] | def map(self, arg, na_action=None) -> Series:
"""
Map values of Series according to input correspondence.
Used for substituting each value in a Series with another value,
that may be derived from a function, a ``dict`` or
a :class:`Series`.
Parameters
----------... | [
"def",
"map",
"(",
"self",
",",
"arg",
",",
"na_action",
"=",
"None",
")",
"->",
"Series",
":",
"new_values",
"=",
"super",
"(",
")",
".",
"_map_values",
"(",
"arg",
",",
"na_action",
"=",
"na_action",
")",
"return",
"self",
".",
"_constructor",
"(",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/series.py#L4086-L4164 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/roslisp/rosbuild/scripts/genmsg_lisp.py | python | write_class_exports | (s, pkg) | Write the _package.lisp file | Write the _package.lisp file | [
"Write",
"the",
"_package",
".",
"lisp",
"file"
] | def write_class_exports(s, pkg):
"Write the _package.lisp file"
s.write('(cl:defpackage %s-msg'%pkg, False)
with Indent(s):
s.write('(:use )')
s.write('(:export')
with Indent(s, inc=1):
for spec in roslib.msgs.get_pkg_msg_specs(pkg)[0]:
(p, msg_type) = spe... | [
"def",
"write_class_exports",
"(",
"s",
",",
"pkg",
")",
":",
"s",
".",
"write",
"(",
"'(cl:defpackage %s-msg'",
"%",
"pkg",
",",
"False",
")",
"with",
"Indent",
"(",
"s",
")",
":",
"s",
".",
"write",
"(",
"'(:use )'",
")",
"s",
".",
"write",
"(",
... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/roslisp/rosbuild/scripts/genmsg_lisp.py#L478-L490 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/keras/engine/compile_utils.py | python | LossesContainer.__call__ | (self,
y_true,
y_pred,
sample_weight=None,
regularization_losses=None) | Computes the overall loss.
Args:
y_true: An arbitrary structure of Tensors representing the ground truth.
y_pred: An arbitrary structure of Tensors representing a Model's outputs.
sample_weight: An arbitrary structure of Tensors representing the
per-sample loss weights. If one Tensor is p... | Computes the overall loss. | [
"Computes",
"the",
"overall",
"loss",
"."
] | def __call__(self,
y_true,
y_pred,
sample_weight=None,
regularization_losses=None):
"""Computes the overall loss.
Args:
y_true: An arbitrary structure of Tensors representing the ground truth.
y_pred: An arbitrary structure of Tensors repr... | [
"def",
"__call__",
"(",
"self",
",",
"y_true",
",",
"y_pred",
",",
"sample_weight",
"=",
"None",
",",
"regularization_losses",
"=",
"None",
")",
":",
"y_true",
"=",
"self",
".",
"_conform_to_outputs",
"(",
"y_pred",
",",
"y_true",
")",
"sample_weight",
"=",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/keras/engine/compile_utils.py#L164-L250 | ||
rsocket/rsocket-cpp | 45ed594ebd6701f40795c31ec922d784ec7fc921 | build/fbcode_builder/getdeps/fetcher.py | python | Fetcher.clean | (self) | Reverts any changes that might have been made to
the src dir | Reverts any changes that might have been made to
the src dir | [
"Reverts",
"any",
"changes",
"that",
"might",
"have",
"been",
"made",
"to",
"the",
"src",
"dir"
] | def clean(self):
"""Reverts any changes that might have been made to
the src dir"""
pass | [
"def",
"clean",
"(",
"self",
")",
":",
"pass"
] | https://github.com/rsocket/rsocket-cpp/blob/45ed594ebd6701f40795c31ec922d784ec7fc921/build/fbcode_builder/getdeps/fetcher.py#L121-L124 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_core.py | python | FileSystemHandler.GetMimeTypeFromExt | (*args, **kwargs) | return _core_.FileSystemHandler_GetMimeTypeFromExt(*args, **kwargs) | GetMimeTypeFromExt(String location) -> String | GetMimeTypeFromExt(String location) -> String | [
"GetMimeTypeFromExt",
"(",
"String",
"location",
")",
"-",
">",
"String"
] | def GetMimeTypeFromExt(*args, **kwargs):
"""GetMimeTypeFromExt(String location) -> String"""
return _core_.FileSystemHandler_GetMimeTypeFromExt(*args, **kwargs) | [
"def",
"GetMimeTypeFromExt",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"FileSystemHandler_GetMimeTypeFromExt",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_core.py#L2380-L2382 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py3/numpy/lib/function_base.py | python | place | (arr, mask, vals) | return _insert(arr, mask, vals) | Change elements of an array based on conditional and input values.
Similar to ``np.copyto(arr, vals, where=mask)``, the difference is that
`place` uses the first N elements of `vals`, where N is the number of
True values in `mask`, while `copyto` uses the elements where `mask`
is True.
Note that `... | Change elements of an array based on conditional and input values. | [
"Change",
"elements",
"of",
"an",
"array",
"based",
"on",
"conditional",
"and",
"input",
"values",
"."
] | def place(arr, mask, vals):
"""
Change elements of an array based on conditional and input values.
Similar to ``np.copyto(arr, vals, where=mask)``, the difference is that
`place` uses the first N elements of `vals`, where N is the number of
True values in `mask`, while `copyto` uses the elements wh... | [
"def",
"place",
"(",
"arr",
",",
"mask",
",",
"vals",
")",
":",
"if",
"not",
"isinstance",
"(",
"arr",
",",
"np",
".",
"ndarray",
")",
":",
"raise",
"TypeError",
"(",
"\"argument 1 must be numpy.ndarray, \"",
"\"not {name}\"",
".",
"format",
"(",
"name",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py3/numpy/lib/function_base.py#L1758-L1798 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/stc.py | python | StyledTextCtrl.GetAnchor | (*args, **kwargs) | return _stc.StyledTextCtrl_GetAnchor(*args, **kwargs) | GetAnchor(self) -> int
Returns the position of the opposite end of the selection to the caret. | GetAnchor(self) -> int | [
"GetAnchor",
"(",
"self",
")",
"-",
">",
"int"
] | def GetAnchor(*args, **kwargs):
"""
GetAnchor(self) -> int
Returns the position of the opposite end of the selection to the caret.
"""
return _stc.StyledTextCtrl_GetAnchor(*args, **kwargs) | [
"def",
"GetAnchor",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_GetAnchor",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/stc.py#L2103-L2109 | |
deepmind/open_spiel | 4ca53bea32bb2875c7385d215424048ae92f78c8 | open_spiel/python/games/dynamic_routing.py | python | DynamicRoutingGameState.get_location_as_int | (self, vehicle: int) | return self.get_game().network.get_action_id_from_movement(
origin, destination) | Get the vehicle location. | Get the vehicle location. | [
"Get",
"the",
"vehicle",
"location",
"."
] | def get_location_as_int(self, vehicle: int) -> int:
"""Get the vehicle location."""
origin, destination = dynamic_routing_utils._road_section_to_nodes( # pylint:disable=protected-access
self._vehicle_locations[vehicle])
return self.get_game().network.get_action_id_from_movement(
origin, des... | [
"def",
"get_location_as_int",
"(",
"self",
",",
"vehicle",
":",
"int",
")",
"->",
"int",
":",
"origin",
",",
"destination",
"=",
"dynamic_routing_utils",
".",
"_road_section_to_nodes",
"(",
"# pylint:disable=protected-access",
"self",
".",
"_vehicle_locations",
"[",
... | https://github.com/deepmind/open_spiel/blob/4ca53bea32bb2875c7385d215424048ae92f78c8/open_spiel/python/games/dynamic_routing.py#L397-L402 | |
swift/swift | 12d031cf8177fdec0137f9aa7e2912fa23c4416b | 3rdParty/SCons/scons-3.0.1/engine/SCons/Node/FS.py | python | File.get_content_hash | (self) | return cs | Compute and return the MD5 hash for this file. | Compute and return the MD5 hash for this file. | [
"Compute",
"and",
"return",
"the",
"MD5",
"hash",
"for",
"this",
"file",
"."
] | def get_content_hash(self):
"""
Compute and return the MD5 hash for this file.
"""
if not self.rexists():
return SCons.Util.MD5signature('')
fname = self.rfile().get_abspath()
try:
cs = SCons.Util.MD5filesignature(fname,
chunksize=S... | [
"def",
"get_content_hash",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"rexists",
"(",
")",
":",
"return",
"SCons",
".",
"Util",
".",
"MD5signature",
"(",
"''",
")",
"fname",
"=",
"self",
".",
"rfile",
"(",
")",
".",
"get_abspath",
"(",
")",
"... | https://github.com/swift/swift/blob/12d031cf8177fdec0137f9aa7e2912fa23c4416b/3rdParty/SCons/scons-3.0.1/engine/SCons/Node/FS.py#L2664-L2678 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/aui/auibook.py | python | TabTextCtrl.OnChar | (self, event) | Handles the ``wx.EVT_CHAR`` event for :class:`TabTextCtrl`.
:param `event`: a :class:`KeyEvent` event to be processed. | Handles the ``wx.EVT_CHAR`` event for :class:`TabTextCtrl`. | [
"Handles",
"the",
"wx",
".",
"EVT_CHAR",
"event",
"for",
":",
"class",
":",
"TabTextCtrl",
"."
] | def OnChar(self, event):
"""
Handles the ``wx.EVT_CHAR`` event for :class:`TabTextCtrl`.
:param `event`: a :class:`KeyEvent` event to be processed.
"""
keycode = event.GetKeyCode()
shiftDown = event.ShiftDown()
if keycode == wx.WXK_RETURN:
if shiftD... | [
"def",
"OnChar",
"(",
"self",
",",
"event",
")",
":",
"keycode",
"=",
"event",
".",
"GetKeyCode",
"(",
")",
"shiftDown",
"=",
"event",
".",
"ShiftDown",
"(",
")",
"if",
"keycode",
"==",
"wx",
".",
"WXK_RETURN",
":",
"if",
"shiftDown",
"and",
"self",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/aui/auibook.py#L227-L252 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/plugins/algorithms/SaveYDA.py | python | SaveYDA.PyInit | (self) | Declare properties | Declare properties | [
"Declare",
"properties"
] | def PyInit(self):
"""Declare properties
"""
wsValidators = CompositeValidator()
# X axis must be a NumericAxis in energy transfer units.
wsValidators.add(WorkspaceUnitValidator("DeltaE"))
# Workspace must have an Instrument
wsValidators.add(InstrumentValidator())
... | [
"def",
"PyInit",
"(",
"self",
")",
":",
"wsValidators",
"=",
"CompositeValidator",
"(",
")",
"# X axis must be a NumericAxis in energy transfer units.",
"wsValidators",
".",
"add",
"(",
"WorkspaceUnitValidator",
"(",
"\"DeltaE\"",
")",
")",
"# Workspace must have an Instrum... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/SaveYDA.py#L39-L51 | ||
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/media/webrtc/trunk/tools/gyp/pylib/gyp/MSVSVersion.py | python | VisualStudioVersion.SetupScript | (self, target_arch) | Returns a command (with arguments) to be used to set up the
environment. | Returns a command (with arguments) to be used to set up the
environment. | [
"Returns",
"a",
"command",
"(",
"with",
"arguments",
")",
"to",
"be",
"used",
"to",
"set",
"up",
"the",
"environment",
"."
] | def SetupScript(self, target_arch):
"""Returns a command (with arguments) to be used to set up the
environment."""
# Check if we are running in the SDK command line environment and use
# the setup script from the SDK if so. |target_arch| should be either
# 'x86' or 'x64'.
assert target_arch in (... | [
"def",
"SetupScript",
"(",
"self",
",",
"target_arch",
")",
":",
"# Check if we are running in the SDK command line environment and use",
"# the setup script from the SDK if so. |target_arch| should be either",
"# 'x86' or 'x64'.",
"assert",
"target_arch",
"in",
"(",
"'x86'",
",",
... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/media/webrtc/trunk/tools/gyp/pylib/gyp/MSVSVersion.py#L70-L96 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/pycollapsiblepane.py | python | PyCollapsiblePane.GetButtonFont | (self) | return self._pButton.GetFont() | Returns the button font. | Returns the button font. | [
"Returns",
"the",
"button",
"font",
"."
] | def GetButtonFont(self):
""" Returns the button font. """
return self._pButton.GetFont() | [
"def",
"GetButtonFont",
"(",
"self",
")",
":",
"return",
"self",
".",
"_pButton",
".",
"GetFont",
"(",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/pycollapsiblepane.py#L632-L635 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/ntpath.py | python | splitunc | (p) | return '', p | Split a pathname into UNC mount point and relative path specifiers.
Return a 2-tuple (unc, rest); either part may be empty.
If unc is not empty, it has the form '//host/mount' (or similar
using backslashes). unc+rest is always the input path.
Paths containing drive letters never have a UNC part. | Split a pathname into UNC mount point and relative path specifiers. | [
"Split",
"a",
"pathname",
"into",
"UNC",
"mount",
"point",
"and",
"relative",
"path",
"specifiers",
"."
] | def splitunc(p):
"""Split a pathname into UNC mount point and relative path specifiers.
Return a 2-tuple (unc, rest); either part may be empty.
If unc is not empty, it has the form '//host/mount' (or similar
using backslashes). unc+rest is always the input path.
Paths containing drive letters neve... | [
"def",
"splitunc",
"(",
"p",
")",
":",
"if",
"p",
"[",
"1",
":",
"2",
"]",
"==",
"':'",
":",
"return",
"''",
",",
"p",
"# Drive letter present",
"firstTwo",
"=",
"p",
"[",
"0",
":",
"2",
"]",
"if",
"firstTwo",
"==",
"'//'",
"or",
"firstTwo",
"=="... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/ntpath.py#L138-L166 | |
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/buildscripts/resmokelib/utils/__init__.py | python | is_js_file | (filename) | return os.path.splitext(filename)[1] == ".js" | Returns true if 'filename' ends in .js, and false otherwise. | Returns true if 'filename' ends in .js, and false otherwise. | [
"Returns",
"true",
"if",
"filename",
"ends",
"in",
".",
"js",
"and",
"false",
"otherwise",
"."
] | def is_js_file(filename):
"""
Returns true if 'filename' ends in .js, and false otherwise.
"""
return os.path.splitext(filename)[1] == ".js" | [
"def",
"is_js_file",
"(",
"filename",
")",
":",
"return",
"os",
".",
"path",
".",
"splitext",
"(",
"filename",
")",
"[",
"1",
"]",
"==",
"\".js\""
] | https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/buildscripts/resmokelib/utils/__init__.py#L56-L60 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | current/tools/gyp/pylib/gyp/generator/msvs.py | python | GenerateOutput | (target_list, target_dicts, data, params) | Generate .sln and .vcproj files.
This is the entry point for this generator.
Arguments:
target_list: List of target pairs: 'base/base.gyp:base'.
target_dicts: Dict of target properties keyed on target pair.
data: Dictionary containing per .gyp data. | Generate .sln and .vcproj files. | [
"Generate",
".",
"sln",
"and",
".",
"vcproj",
"files",
"."
] | def GenerateOutput(target_list, target_dicts, data, params):
"""Generate .sln and .vcproj files.
This is the entry point for this generator.
Arguments:
target_list: List of target pairs: 'base/base.gyp:base'.
target_dicts: Dict of target properties keyed on target pair.
data: Dictionary containing pe... | [
"def",
"GenerateOutput",
"(",
"target_list",
",",
"target_dicts",
",",
"data",
",",
"params",
")",
":",
"global",
"fixpath_prefix",
"options",
"=",
"params",
"[",
"'options'",
"]",
"# Get the project file format version back out of where we stashed it in",
"# GeneratorCalcu... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/current/tools/gyp/pylib/gyp/generator/msvs.py#L2015-L2099 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py2/setuptools/msvc.py | python | RegistryInfo.microsoft | (self, key, x86=False) | return join('Software', node64, 'Microsoft', key) | Return key in Microsoft software registry.
Parameters
----------
key: str
Registry key path where look.
x86: str
Force x86 software registry.
Return
------
str
Registry key | Return key in Microsoft software registry. | [
"Return",
"key",
"in",
"Microsoft",
"software",
"registry",
"."
] | def microsoft(self, key, x86=False):
"""
Return key in Microsoft software registry.
Parameters
----------
key: str
Registry key path where look.
x86: str
Force x86 software registry.
Return
------
str
Registry ... | [
"def",
"microsoft",
"(",
"self",
",",
"key",
",",
"x86",
"=",
"False",
")",
":",
"node64",
"=",
"''",
"if",
"self",
".",
"pi",
".",
"current_is_x86",
"(",
")",
"or",
"x86",
"else",
"'Wow6432Node'",
"return",
"join",
"(",
"'Software'",
",",
"node64",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py2/setuptools/msvc.py#L466-L483 | |
husixu1/HUST-Homeworks | fbf6ed749eacab6e14bffea83703aadaf9324828 | JOS/jos/gradelib.py | python | call_on_line | (regexp, callback) | return setup_call_on_line | Returns a monitor that calls 'callback' when QEMU prints a line
matching 'regexp'. | Returns a monitor that calls 'callback' when QEMU prints a line
matching 'regexp'. | [
"Returns",
"a",
"monitor",
"that",
"calls",
"callback",
"when",
"QEMU",
"prints",
"a",
"line",
"matching",
"regexp",
"."
] | def call_on_line(regexp, callback):
"""Returns a monitor that calls 'callback' when QEMU prints a line
matching 'regexp'."""
def setup_call_on_line(runner):
buf = bytearray()
def handle_output(output):
buf.extend(output)
while b"\n" in buf:
line, buf[... | [
"def",
"call_on_line",
"(",
"regexp",
",",
"callback",
")",
":",
"def",
"setup_call_on_line",
"(",
"runner",
")",
":",
"buf",
"=",
"bytearray",
"(",
")",
"def",
"handle_output",
"(",
"output",
")",
":",
"buf",
".",
"extend",
"(",
"output",
")",
"while",
... | https://github.com/husixu1/HUST-Homeworks/blob/fbf6ed749eacab6e14bffea83703aadaf9324828/JOS/jos/gradelib.py#L525-L539 | |
netket/netket | 0d534e54ecbf25b677ea72af6b85947979420652 | netket/graph/common_lattices.py | python | Diamond | (
extent: Sequence[int], *, pbc: Union[bool, Sequence[bool]] = True, **kwargs
) | return Lattice(
basis_vectors=basis,
site_offsets=sites,
extent=extent,
pbc=pbc,
point_group=point_group,
**kwargs,
) | Constructs a diamond lattice of a given spatial extent.
Periodic boundary conditions can also be imposed.
Sites are returned at the 8a Wyckoff positions of the FCC lattice
([000], [1/4,1/4,1/4], and translations thereof).
Arguments:
extent: Number of primitive unit cells along each direction, ... | Constructs a diamond lattice of a given spatial extent.
Periodic boundary conditions can also be imposed. | [
"Constructs",
"a",
"diamond",
"lattice",
"of",
"a",
"given",
"spatial",
"extent",
".",
"Periodic",
"boundary",
"conditions",
"can",
"also",
"be",
"imposed",
"."
] | def Diamond(
extent: Sequence[int], *, pbc: Union[bool, Sequence[bool]] = True, **kwargs
) -> Lattice:
"""Constructs a diamond lattice of a given spatial extent.
Periodic boundary conditions can also be imposed.
Sites are returned at the 8a Wyckoff positions of the FCC lattice
([000], [1/4,1/4,1/4]... | [
"def",
"Diamond",
"(",
"extent",
":",
"Sequence",
"[",
"int",
"]",
",",
"*",
",",
"pbc",
":",
"Union",
"[",
"bool",
",",
"Sequence",
"[",
"bool",
"]",
"]",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
"->",
"Lattice",
":",
"basis",
"=",
"[",
"[",... | https://github.com/netket/netket/blob/0d534e54ecbf25b677ea72af6b85947979420652/netket/graph/common_lattices.py#L307-L347 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/tf_asymmetry_fitting/tf_asymmetry_fitting_presenter.py | python | TFAsymmetryFittingPresenter._switch_to_normal_fitting | (self) | Activates normal fitting by turning off TF Asymmetry fitting. | Activates normal fitting by turning off TF Asymmetry fitting. | [
"Activates",
"normal",
"fitting",
"by",
"turning",
"off",
"TF",
"Asymmetry",
"fitting",
"."
] | def _switch_to_normal_fitting(self):
"""Activates normal fitting by turning off TF Asymmetry fitting."""
self.view.tf_asymmetry_mode, self.model.tf_asymmetry_mode = False, False
self.automatically_update_function_name() | [
"def",
"_switch_to_normal_fitting",
"(",
"self",
")",
":",
"self",
".",
"view",
".",
"tf_asymmetry_mode",
",",
"self",
".",
"model",
".",
"tf_asymmetry_mode",
"=",
"False",
",",
"False",
"self",
".",
"automatically_update_function_name",
"(",
")"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/tf_asymmetry_fitting/tf_asymmetry_fitting_presenter.py#L126-L129 | ||
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/media/webrtc/trunk/tools/gyp/pylib/gyp/msvs_emulation.py | python | MsvsSettings.HasExplicitIdlRules | (self, spec) | return False | Determine if there's an explicit rule for idl files. When there isn't we
need to generate implicit rules to build MIDL .idl files. | Determine if there's an explicit rule for idl files. When there isn't we
need to generate implicit rules to build MIDL .idl files. | [
"Determine",
"if",
"there",
"s",
"an",
"explicit",
"rule",
"for",
"idl",
"files",
".",
"When",
"there",
"isn",
"t",
"we",
"need",
"to",
"generate",
"implicit",
"rules",
"to",
"build",
"MIDL",
".",
"idl",
"files",
"."
] | def HasExplicitIdlRules(self, spec):
"""Determine if there's an explicit rule for idl files. When there isn't we
need to generate implicit rules to build MIDL .idl files."""
for rule in spec.get('rules', []):
if rule['extension'] == 'idl' and int(rule.get('msvs_external_rule', 0)):
return True... | [
"def",
"HasExplicitIdlRules",
"(",
"self",
",",
"spec",
")",
":",
"for",
"rule",
"in",
"spec",
".",
"get",
"(",
"'rules'",
",",
"[",
"]",
")",
":",
"if",
"rule",
"[",
"'extension'",
"]",
"==",
"'idl'",
"and",
"int",
"(",
"rule",
".",
"get",
"(",
... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/media/webrtc/trunk/tools/gyp/pylib/gyp/msvs_emulation.py#L513-L519 | |
SFTtech/openage | d6a08c53c48dc1e157807471df92197f6ca9e04d | openage/convert/service/init/mount_asset_dirs.py | python | mount_asset_dirs | (srcdir, game_version) | return result | Returns a Union path where srcdir is mounted at /,
and all the asset files are mounted in subfolders. | Returns a Union path where srcdir is mounted at /,
and all the asset files are mounted in subfolders. | [
"Returns",
"a",
"Union",
"path",
"where",
"srcdir",
"is",
"mounted",
"at",
"/",
"and",
"all",
"the",
"asset",
"files",
"are",
"mounted",
"in",
"subfolders",
"."
] | def mount_asset_dirs(srcdir, game_version):
"""
Returns a Union path where srcdir is mounted at /,
and all the asset files are mounted in subfolders.
"""
result = Union().root
result.mount(srcdir)
def mount_drs(filename, target):
"""
Mounts the DRS file from srcdir's filena... | [
"def",
"mount_asset_dirs",
"(",
"srcdir",
",",
"game_version",
")",
":",
"result",
"=",
"Union",
"(",
")",
".",
"root",
"result",
".",
"mount",
"(",
"srcdir",
")",
"def",
"mount_drs",
"(",
"filename",
",",
"target",
")",
":",
"\"\"\"\n Mounts the DRS ... | https://github.com/SFTtech/openage/blob/d6a08c53c48dc1e157807471df92197f6ca9e04d/openage/convert/service/init/mount_asset_dirs.py#L12-L62 | |
NVIDIA/MDL-SDK | aa9642b2546ad7b6236b5627385d882c2ed83c5d | examples/mdl_python/modules/example_modules.py | python | get_db_module_name | (neuray, module_mdl_name) | Return the db name of the given module. | Return the db name of the given module. | [
"Return",
"the",
"db",
"name",
"of",
"the",
"given",
"module",
"."
] | def get_db_module_name(neuray, module_mdl_name):
"""Return the db name of the given module."""
# When the module is loaded we can access it and all its definitions by accessing the DB
# for that we need to get a the database name of the module using the factory
with neuray.get_api_component(pymdlsdk.IM... | [
"def",
"get_db_module_name",
"(",
"neuray",
",",
"module_mdl_name",
")",
":",
"# When the module is loaded we can access it and all its definitions by accessing the DB",
"# for that we need to get a the database name of the module using the factory",
"with",
"neuray",
".",
"get_api_compone... | https://github.com/NVIDIA/MDL-SDK/blob/aa9642b2546ad7b6236b5627385d882c2ed83c5d/examples/mdl_python/modules/example_modules.py#L251-L271 | ||
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/python/ops/array_ops.py | python | placeholder | (dtype, shape=None, name=None) | return ret | Inserts a placeholder for a tensor that will be always fed.
**Important**: This tensor will produce an error if evaluated. Its value must
be fed using the `feed_dict` optional argument to `Session.run()`,
`Tensor.eval()`, or `Operation.run()`.
For example:
```python
x = tf.placeholder(tf.float32, shape=(... | Inserts a placeholder for a tensor that will be always fed. | [
"Inserts",
"a",
"placeholder",
"for",
"a",
"tensor",
"that",
"will",
"be",
"always",
"fed",
"."
] | def placeholder(dtype, shape=None, name=None):
"""Inserts a placeholder for a tensor that will be always fed.
**Important**: This tensor will produce an error if evaluated. Its value must
be fed using the `feed_dict` optional argument to `Session.run()`,
`Tensor.eval()`, or `Operation.run()`.
For example:
... | [
"def",
"placeholder",
"(",
"dtype",
",",
"shape",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"shape",
"=",
"tensor_shape",
".",
"as_shape",
"(",
"shape",
")",
"if",
"shape",
".",
"is_fully_defined",
"(",
")",
":",
"dim_list",
"=",
"shape",
".",
... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/python/ops/array_ops.py#L1174-L1214 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/requests/cookies.py | python | RequestsCookieJar.list_paths | (self) | return paths | Utility method to list all the paths in the jar. | Utility method to list all the paths in the jar. | [
"Utility",
"method",
"to",
"list",
"all",
"the",
"paths",
"in",
"the",
"jar",
"."
] | def list_paths(self):
"""Utility method to list all the paths in the jar."""
paths = []
for cookie in iter(self):
if cookie.path not in paths:
paths.append(cookie.path)
return paths | [
"def",
"list_paths",
"(",
"self",
")",
":",
"paths",
"=",
"[",
"]",
"for",
"cookie",
"in",
"iter",
"(",
"self",
")",
":",
"if",
"cookie",
".",
"path",
"not",
"in",
"paths",
":",
"paths",
".",
"append",
"(",
"cookie",
".",
"path",
")",
"return",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/requests/cookies.py#L278-L284 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/control-examples/MotionModel.py | python | MotionModel.getInverse | (self) | return DefaultInverseMotionModel(self) | Returns the inverted motion model for which evaluation produces
the inputs u that would produce output v: u = f^-1(q,dq,v). | Returns the inverted motion model for which evaluation produces
the inputs u that would produce output v: u = f^-1(q,dq,v). | [
"Returns",
"the",
"inverted",
"motion",
"model",
"for",
"which",
"evaluation",
"produces",
"the",
"inputs",
"u",
"that",
"would",
"produce",
"output",
"v",
":",
"u",
"=",
"f^",
"-",
"1",
"(",
"q",
"dq",
"v",
")",
"."
] | def getInverse(self):
"""Returns the inverted motion model for which evaluation produces
the inputs u that would produce output v: u = f^-1(q,dq,v). """
return DefaultInverseMotionModel(self) | [
"def",
"getInverse",
"(",
"self",
")",
":",
"return",
"DefaultInverseMotionModel",
"(",
"self",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/control-examples/MotionModel.py#L28-L31 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/emscripten/1.37.19/emscripten.py | python | asmjs_mangle | (name) | return '_' + ''.join(['_' if not c.isalnum() else c for c in name]) | Mangle a name the way asm.js/JSBackend globals are mangled.
Prepends '_' and replaces non-alphanumerics with '_'.
Used by wasm backend for JS library consistency with asm.js. | Mangle a name the way asm.js/JSBackend globals are mangled. | [
"Mangle",
"a",
"name",
"the",
"way",
"asm",
".",
"js",
"/",
"JSBackend",
"globals",
"are",
"mangled",
"."
] | def asmjs_mangle(name):
"""Mangle a name the way asm.js/JSBackend globals are mangled.
Prepends '_' and replaces non-alphanumerics with '_'.
Used by wasm backend for JS library consistency with asm.js.
"""
library_functions_in_module = ('setThrew', 'setTempRet0', 'getTempRet0')
if name.startswith('dynCall_... | [
"def",
"asmjs_mangle",
"(",
"name",
")",
":",
"library_functions_in_module",
"=",
"(",
"'setThrew'",
",",
"'setTempRet0'",
",",
"'getTempRet0'",
")",
"if",
"name",
".",
"startswith",
"(",
"'dynCall_'",
")",
":",
"return",
"name",
"if",
"name",
"in",
"library_f... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/emscripten/1.37.19/emscripten.py#L2068-L2077 | |
ApolloAuto/apollo | 463fb82f9e979d02dcb25044e60931293ab2dba0 | modules/tools/mapshow/libs/map.py | python | Map._draw_lane_boundary | (lane, ax, color_val) | draw boundary | draw boundary | [
"draw",
"boundary"
] | def _draw_lane_boundary(lane, ax, color_val):
"""draw boundary"""
for curve in lane.left_boundary.curve.segment:
if curve.HasField('line_segment'):
px = []
py = []
for p in curve.line_segment.point:
px.append(float(p.x))
... | [
"def",
"_draw_lane_boundary",
"(",
"lane",
",",
"ax",
",",
"color_val",
")",
":",
"for",
"curve",
"in",
"lane",
".",
"left_boundary",
".",
"curve",
".",
"segment",
":",
"if",
"curve",
".",
"HasField",
"(",
"'line_segment'",
")",
":",
"px",
"=",
"[",
"]... | https://github.com/ApolloAuto/apollo/blob/463fb82f9e979d02dcb25044e60931293ab2dba0/modules/tools/mapshow/libs/map.py#L210-L227 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_gdi.py | python | DC.GetHDC | (*args, **kwargs) | return _gdi_.DC_GetHDC(*args, **kwargs) | GetHDC(self) -> long | GetHDC(self) -> long | [
"GetHDC",
"(",
"self",
")",
"-",
">",
"long"
] | def GetHDC(*args, **kwargs):
"""GetHDC(self) -> long"""
return _gdi_.DC_GetHDC(*args, **kwargs) | [
"def",
"GetHDC",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"DC_GetHDC",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_gdi.py#L4644-L4646 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/binhex.py | python | hexbin | (inp, out) | hexbin(infilename, outfilename) - Decode binhexed file | hexbin(infilename, outfilename) - Decode binhexed file | [
"hexbin",
"(",
"infilename",
"outfilename",
")",
"-",
"Decode",
"binhexed",
"file"
] | def hexbin(inp, out):
"""hexbin(infilename, outfilename) - Decode binhexed file"""
ifp = HexBin(inp)
finfo = ifp.FInfo
if not out:
out = ifp.FName
with io.open(out, 'wb') as ofp:
# XXXX Do translation on non-mac systems
while True:
d = ifp.read(128000)
... | [
"def",
"hexbin",
"(",
"inp",
",",
"out",
")",
":",
"ifp",
"=",
"HexBin",
"(",
"inp",
")",
"finfo",
"=",
"ifp",
".",
"FInfo",
"if",
"not",
"out",
":",
"out",
"=",
"ifp",
".",
"FName",
"with",
"io",
".",
"open",
"(",
"out",
",",
"'wb'",
")",
"a... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/binhex.py#L454-L479 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/joblib/joblib/_parallel_backends.py | python | ParallelBackendBase._prepare_worker_env | (self, n_jobs) | return env | Return environment variables limiting threadpools in external libs.
This function return a dict containing environment variables to pass
when creating a pool of process. These environment variables limit the
number of threads to `n_threads` for OpenMP, MKL, Accelerated and
OpenBLAS libr... | Return environment variables limiting threadpools in external libs. | [
"Return",
"environment",
"variables",
"limiting",
"threadpools",
"in",
"external",
"libs",
"."
] | def _prepare_worker_env(self, n_jobs):
"""Return environment variables limiting threadpools in external libs.
This function return a dict containing environment variables to pass
when creating a pool of process. These environment variables limit the
number of threads to `n_threads` for ... | [
"def",
"_prepare_worker_env",
"(",
"self",
",",
"n_jobs",
")",
":",
"explicit_n_threads",
"=",
"self",
".",
"inner_max_num_threads",
"default_n_threads",
"=",
"str",
"(",
"max",
"(",
"cpu_count",
"(",
")",
"//",
"n_jobs",
",",
"1",
")",
")",
"# Set the inner e... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/joblib/joblib/_parallel_backends.py#L154-L183 | |
charlesnicholson/nanoprintf | f6fcbb9f750a800b8538ae3207dd49cd3bc183b7 | build.py | python | get_ninja | (download, verbose) | return ninja_local_exe | Return the path to system Ninja, or download and unpack a local copy. | Return the path to system Ninja, or download and unpack a local copy. | [
"Return",
"the",
"path",
"to",
"system",
"Ninja",
"or",
"download",
"and",
"unpack",
"a",
"local",
"copy",
"."
] | def get_ninja(download, verbose):
"""Return the path to system Ninja, or download and unpack a local copy."""
if not download:
ninja = shutil.which('ninja')
if ninja:
if verbose:
print(f'Found ninja at {ninja}')
return ninja
ninja_local_dir = SCRIPT_P... | [
"def",
"get_ninja",
"(",
"download",
",",
"verbose",
")",
":",
"if",
"not",
"download",
":",
"ninja",
"=",
"shutil",
".",
"which",
"(",
"'ninja'",
")",
"if",
"ninja",
":",
"if",
"verbose",
":",
"print",
"(",
"f'Found ninja at {ninja}'",
")",
"return",
"n... | https://github.com/charlesnicholson/nanoprintf/blob/f6fcbb9f750a800b8538ae3207dd49cd3bc183b7/build.py#L91-L118 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/build/waf-1.7.13/waflib/extras/msvs.py | python | vsnode_target.__init__ | (self, ctx, tg) | A project is more or less equivalent to a file/folder | A project is more or less equivalent to a file/folder | [
"A",
"project",
"is",
"more",
"or",
"less",
"equivalent",
"to",
"a",
"file",
"/",
"folder"
] | def __init__(self, ctx, tg):
"""
A project is more or less equivalent to a file/folder
"""
base = getattr(ctx, 'projects_dir', None) or tg.path
node = base.make_node(quote(tg.name) + ctx.project_extension) # the project file as a Node
vsnode_project.__init__(self, ctx, node)
self.name = quote(tg.name)
s... | [
"def",
"__init__",
"(",
"self",
",",
"ctx",
",",
"tg",
")",
":",
"base",
"=",
"getattr",
"(",
"ctx",
",",
"'projects_dir'",
",",
"None",
")",
"or",
"tg",
".",
"path",
"node",
"=",
"base",
".",
"make_node",
"(",
"quote",
"(",
"tg",
".",
"name",
")... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/build/waf-1.7.13/waflib/extras/msvs.py#L637-L645 | ||
KDE/krita | 10ea63984e00366865769c193ab298de73a59c5c | plugins/python/scripter/ui_scripter/actions/runaction/runaction.py | python | RunAction.run_py2_document | (self, document) | return user_module | Loads and executes an external script using Python 2 specific operations
and returns the loaded module for further execution if needed. | Loads and executes an external script using Python 2 specific operations
and returns the loaded module for further execution if needed. | [
"Loads",
"and",
"executes",
"an",
"external",
"script",
"using",
"Python",
"2",
"specific",
"operations",
"and",
"returns",
"the",
"loaded",
"module",
"for",
"further",
"execution",
"if",
"needed",
"."
] | def run_py2_document(self, document):
""" Loads and executes an external script using Python 2 specific operations
and returns the loaded module for further execution if needed.
"""
try:
user_module = imp.load_source(EXEC_NAMESPACE, document.filePath)
except Exception... | [
"def",
"run_py2_document",
"(",
"self",
",",
"document",
")",
":",
"try",
":",
"user_module",
"=",
"imp",
".",
"load_source",
"(",
"EXEC_NAMESPACE",
",",
"document",
".",
"filePath",
")",
"except",
"Exception",
"as",
"e",
":",
"raise",
"e",
"return",
"user... | https://github.com/KDE/krita/blob/10ea63984e00366865769c193ab298de73a59c5c/plugins/python/scripter/ui_scripter/actions/runaction/runaction.py#L120-L129 | |
deepmind/streetlearn | ccf1d60b9c45154894d45a897748aee85d7eb69b | streetlearn/python/environment/streetlearn.py | python | StreetLearn.observation_spec | (self) | return {observation.name: observation.observation_spec
for observation in self._observations} | Returns the observation spec, dependent on the observation format. | Returns the observation spec, dependent on the observation format. | [
"Returns",
"the",
"observation",
"spec",
"dependent",
"on",
"the",
"observation",
"format",
"."
] | def observation_spec(self):
"""Returns the observation spec, dependent on the observation format."""
return {observation.name: observation.observation_spec
for observation in self._observations} | [
"def",
"observation_spec",
"(",
"self",
")",
":",
"return",
"{",
"observation",
".",
"name",
":",
"observation",
".",
"observation_spec",
"for",
"observation",
"in",
"self",
".",
"_observations",
"}"
] | https://github.com/deepmind/streetlearn/blob/ccf1d60b9c45154894d45a897748aee85d7eb69b/streetlearn/python/environment/streetlearn.py#L261-L264 | |
gem5/gem5 | 141cc37c2d4b93959d4c249b8f7e6a8b2ef75338 | ext/ply/example/BASIC/basparse.py | python | p_dimlist | (p) | dimlist : dimlist COMMA dimitem
| dimitem | dimlist : dimlist COMMA dimitem
| dimitem | [
"dimlist",
":",
"dimlist",
"COMMA",
"dimitem",
"|",
"dimitem"
] | def p_dimlist(p):
'''dimlist : dimlist COMMA dimitem
| dimitem'''
if len(p) == 4:
p[0] = p[1]
p[0].append(p[3])
else:
p[0] = [p[1]] | [
"def",
"p_dimlist",
"(",
"p",
")",
":",
"if",
"len",
"(",
"p",
")",
"==",
"4",
":",
"p",
"[",
"0",
"]",
"=",
"p",
"[",
"1",
"]",
"p",
"[",
"0",
"]",
".",
"append",
"(",
"p",
"[",
"3",
"]",
")",
"else",
":",
"p",
"[",
"0",
"]",
"=",
... | https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/ext/ply/example/BASIC/basparse.py#L261-L268 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.