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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/setuptools/command/easy_install.py | python | easy_install.expand_dirs | (self) | Calls `os.path.expanduser` on install dirs. | Calls `os.path.expanduser` on install dirs. | [
"Calls",
"os",
".",
"path",
".",
"expanduser",
"on",
"install",
"dirs",
"."
] | def expand_dirs(self):
"""Calls `os.path.expanduser` on install dirs."""
dirs = [
'install_purelib',
'install_platlib',
'install_lib',
'install_headers',
'install_scripts',
'install_data',
]
self._expand_attrs(dirs) | [
"def",
"expand_dirs",
"(",
"self",
")",
":",
"dirs",
"=",
"[",
"'install_purelib'",
",",
"'install_platlib'",
",",
"'install_lib'",
",",
"'install_headers'",
",",
"'install_scripts'",
",",
"'install_data'",
",",
"]",
"self",
".",
"_expand_attrs",
"(",
"dirs",
")... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/setuptools/command/easy_install.py#L401-L411 | ||
Tencent/CMONGO | c40380caa14e05509f46993aa8b8da966b09b0b5 | src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Node/__init__.py | python | Node.get_binfo | (self) | return binfo | Fetch a node's build information.
node - the node whose sources will be collected
cache - alternate node to use for the signature cache
returns - the build signature
This no longer handles the recursive descent of the
node's children's signatures. We expect that they're
... | Fetch a node's build information. | [
"Fetch",
"a",
"node",
"s",
"build",
"information",
"."
] | def get_binfo(self):
"""
Fetch a node's build information.
node - the node whose sources will be collected
cache - alternate node to use for the signature cache
returns - the build signature
This no longer handles the recursive descent of the
node's children's s... | [
"def",
"get_binfo",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"binfo",
"except",
"AttributeError",
":",
"pass",
"binfo",
"=",
"self",
".",
"new_binfo",
"(",
")",
"self",
".",
"binfo",
"=",
"binfo",
"executor",
"=",
"self",
".",
"get_exe... | https://github.com/Tencent/CMONGO/blob/c40380caa14e05509f46993aa8b8da966b09b0b5/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Node/__init__.py#L1097-L1159 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py | python | XCObject.EnsureNoIDCollisions | (self) | Verifies that no two objects have the same ID. Checks all descendants. | Verifies that no two objects have the same ID. Checks all descendants. | [
"Verifies",
"that",
"no",
"two",
"objects",
"have",
"the",
"same",
"ID",
".",
"Checks",
"all",
"descendants",
"."
] | def EnsureNoIDCollisions(self):
"""Verifies that no two objects have the same ID. Checks all descendants.
"""
ids = {}
descendants = self.Descendants()
for descendant in descendants:
if descendant.id in ids:
other = ids[descendant.id]
raise KeyError(
'Duplicate ... | [
"def",
"EnsureNoIDCollisions",
"(",
"self",
")",
":",
"ids",
"=",
"{",
"}",
"descendants",
"=",
"self",
".",
"Descendants",
"(",
")",
"for",
"descendant",
"in",
"descendants",
":",
"if",
"descendant",
".",
"id",
"in",
"ids",
":",
"other",
"=",
"ids",
"... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py#L455-L468 | ||
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/patch_builds/change_data.py | python | find_changed_files | (repo: Repo, revision_map: Optional[RevisionMap] = None) | return {
os.path.relpath(f"{repo.working_dir}/{os.path.normpath(path)}", os.getcwd())
for path in paths
} | Find files that were new or added to the repository between commits.
:param repo: Git repository.
:param revision_map: Map of revisions to compare against for repos.
:return: Set of changed files. | Find files that were new or added to the repository between commits. | [
"Find",
"files",
"that",
"were",
"new",
"or",
"added",
"to",
"the",
"repository",
"between",
"commits",
"."
] | def find_changed_files(repo: Repo, revision_map: Optional[RevisionMap] = None) -> Set[str]:
"""
Find files that were new or added to the repository between commits.
:param repo: Git repository.
:param revision_map: Map of revisions to compare against for repos.
:return: Set of changed files.
"... | [
"def",
"find_changed_files",
"(",
"repo",
":",
"Repo",
",",
"revision_map",
":",
"Optional",
"[",
"RevisionMap",
"]",
"=",
"None",
")",
"->",
"Set",
"[",
"str",
"]",
":",
"LOGGER",
".",
"info",
"(",
"\"Getting diff for repo\"",
",",
"repo",
"=",
"repo",
... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/patch_builds/change_data.py#L74-L101 | |
envoyproxy/envoy-wasm | ab5d9381fdf92a1efa0b87cff80036b5b3e81198 | tools/envoy_headersplit/replace_includes.py | python | to_bazelname | (filename: str, mockname: str) | return bazelname | maps divided mock class file name to bazel target name
e.g. map "test/mocks/server/admin_stream.h" to "//test/mocks/server:admin_stream_mocks"
Args:
filename: string, mock class header file name (might be the whole path instead of the base name)
mockname: string, mock directory name
Returns:
c... | maps divided mock class file name to bazel target name
e.g. map "test/mocks/server/admin_stream.h" to "//test/mocks/server:admin_stream_mocks" | [
"maps",
"divided",
"mock",
"class",
"file",
"name",
"to",
"bazel",
"target",
"name",
"e",
".",
"g",
".",
"map",
"test",
"/",
"mocks",
"/",
"server",
"/",
"admin_stream",
".",
"h",
"to",
"//",
"test",
"/",
"mocks",
"/",
"server",
":",
"admin_stream_mock... | def to_bazelname(filename: str, mockname: str) -> str:
"""
maps divided mock class file name to bazel target name
e.g. map "test/mocks/server/admin_stream.h" to "//test/mocks/server:admin_stream_mocks"
Args:
filename: string, mock class header file name (might be the whole path instead of the base name)
... | [
"def",
"to_bazelname",
"(",
"filename",
":",
"str",
",",
"mockname",
":",
"str",
")",
"->",
"str",
":",
"bazelname",
"=",
"\"//test/mocks/{}:\"",
".",
"format",
"(",
"mockname",
")",
"bazelname",
"+=",
"filename",
".",
"split",
"(",
"'/'",
")",
"[",
"-",... | https://github.com/envoyproxy/envoy-wasm/blob/ab5d9381fdf92a1efa0b87cff80036b5b3e81198/tools/envoy_headersplit/replace_includes.py#L38-L52 | |
p4lang/behavioral-model | 81ce0163f0770c6b9d6056a28ce2e0cc035bb6e9 | tools/runtime_CLI.py | python | RuntimeAPI.do_mc_node_update | (self, line) | Update multicast node: mc_node_update <node handle> <space-separated port list> [ | <space-separated lag list> ] | Update multicast node: mc_node_update <node handle> <space-separated port list> [ | <space-separated lag list> ] | [
"Update",
"multicast",
"node",
":",
"mc_node_update",
"<node",
"handle",
">",
"<space",
"-",
"separated",
"port",
"list",
">",
"[",
"|",
"<space",
"-",
"separated",
"lag",
"list",
">",
"]"
] | def do_mc_node_update(self, line):
"Update multicast node: mc_node_update <node handle> <space-separated port list> [ | <space-separated lag list> ]"
self.check_has_pre()
args = line.split()
self.at_least_n_args(args, 2)
l1_hdl = self.get_node_handle(args[0])
port_map_str... | [
"def",
"do_mc_node_update",
"(",
"self",
",",
"line",
")",
":",
"self",
".",
"check_has_pre",
"(",
")",
"args",
"=",
"line",
".",
"split",
"(",
")",
"self",
".",
"at_least_n_args",
"(",
"args",
",",
"2",
")",
"l1_hdl",
"=",
"self",
".",
"get_node_handl... | https://github.com/p4lang/behavioral-model/blob/81ce0163f0770c6b9d6056a28ce2e0cc035bb6e9/tools/runtime_CLI.py#L1794-L1808 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_misc.py | python | Joystick.GetButtonState | (*args, **kwargs) | return _misc_.Joystick_GetButtonState(*args, **kwargs) | GetButtonState(self) -> int | GetButtonState(self) -> int | [
"GetButtonState",
"(",
"self",
")",
"-",
">",
"int"
] | def GetButtonState(*args, **kwargs):
"""GetButtonState(self) -> int"""
return _misc_.Joystick_GetButtonState(*args, **kwargs) | [
"def",
"GetButtonState",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"Joystick_GetButtonState",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_misc.py#L2134-L2136 | |
H-uru/Plasma | c2140ea046e82e9c199e257a7f2e7edb42602871 | Scripts/Python/plasma/pch.py | python | showinst | () | show details of the instance of the ptModifier class in the selected module | show details of the instance of the ptModifier class in the selected module | [
"show",
"details",
"of",
"the",
"instance",
"of",
"the",
"ptModifier",
"class",
"in",
"the",
"selected",
"module"
] | def showinst():
"show details of the instance of the ptModifier class in the selected module"
global __pmods
global __sel
for name in __pmods[__sel][1].__dict__.keys():
ist = __pmods[__sel][1].__dict__[name]
if isinstance(ist,PlasmaTypes.ptModifier):
print("Instance of %s in ... | [
"def",
"showinst",
"(",
")",
":",
"global",
"__pmods",
"global",
"__sel",
"for",
"name",
"in",
"__pmods",
"[",
"__sel",
"]",
"[",
"1",
"]",
".",
"__dict__",
".",
"keys",
"(",
")",
":",
"ist",
"=",
"__pmods",
"[",
"__sel",
"]",
"[",
"1",
"]",
".",... | https://github.com/H-uru/Plasma/blob/c2140ea046e82e9c199e257a7f2e7edb42602871/Scripts/Python/plasma/pch.py#L225-L235 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/cgutils.py | python | pack_array | (builder, values, ty=None) | return ary | Pack a sequence of values in a LLVM array. *ty* should be given
if the array may be empty, in which case the type can't be inferred
from the values. | Pack a sequence of values in a LLVM array. *ty* should be given
if the array may be empty, in which case the type can't be inferred
from the values. | [
"Pack",
"a",
"sequence",
"of",
"values",
"in",
"a",
"LLVM",
"array",
".",
"*",
"ty",
"*",
"should",
"be",
"given",
"if",
"the",
"array",
"may",
"be",
"empty",
"in",
"which",
"case",
"the",
"type",
"can",
"t",
"be",
"inferred",
"from",
"the",
"values"... | def pack_array(builder, values, ty=None):
"""
Pack a sequence of values in a LLVM array. *ty* should be given
if the array may be empty, in which case the type can't be inferred
from the values.
"""
n = len(values)
if ty is None:
ty = values[0].type
ary = ir.ArrayType(ty, n)(ir.... | [
"def",
"pack_array",
"(",
"builder",
",",
"values",
",",
"ty",
"=",
"None",
")",
":",
"n",
"=",
"len",
"(",
"values",
")",
"if",
"ty",
"is",
"None",
":",
"ty",
"=",
"values",
"[",
"0",
"]",
".",
"type",
"ary",
"=",
"ir",
".",
"ArrayType",
"(",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/cgutils.py#L622-L634 | |
Tencent/Pebble | 68315f176d9e328a233ace29b7579a829f89879f | tools/blade/src/blade/rules_generator.py | python | SconsFileHeaderGenerator._append_prefix_to_building_var | (
self,
prefix='',
building_var='',
condition=False) | A helper method: append prefix to building var if condition is True. | A helper method: append prefix to building var if condition is True. | [
"A",
"helper",
"method",
":",
"append",
"prefix",
"to",
"building",
"var",
"if",
"condition",
"is",
"True",
"."
] | def _append_prefix_to_building_var(
self,
prefix='',
building_var='',
condition=False):
"""A helper method: append prefix to building var if condition is True."""
if condition:
return '%s %s' % (prefix, building_var)
els... | [
"def",
"_append_prefix_to_building_var",
"(",
"self",
",",
"prefix",
"=",
"''",
",",
"building_var",
"=",
"''",
",",
"condition",
"=",
"False",
")",
":",
"if",
"condition",
":",
"return",
"'%s %s'",
"%",
"(",
"prefix",
",",
"building_var",
")",
"else",
":"... | https://github.com/Tencent/Pebble/blob/68315f176d9e328a233ace29b7579a829f89879f/tools/blade/src/blade/rules_generator.py#L61-L70 | ||
OGRECave/ogre-next | 287307980e6de8910f04f3cc0994451b075071fd | Tools/BlenderExport/ogrepkg/gui.py | python | ToggleGroup.setValue | (self, value) | return | Sets a toggle to <code>True</code>.
@param value Key of ToggleModel. | Sets a toggle to <code>True</code>. | [
"Sets",
"a",
"toggle",
"to",
"<code",
">",
"True<",
"/",
"code",
">",
"."
] | def setValue(self, value):
"""Sets a toggle to <code>True</code>.
@param value Key of ToggleModel.
"""
# set value as current active
if (value in self.toggleDict.keys()):
self.value = value
self._notify()
elif value is None:
pass
else:
raise KeyError
return | [
"def",
"setValue",
"(",
"self",
",",
"value",
")",
":",
"# set value as current active",
"if",
"(",
"value",
"in",
"self",
".",
"toggleDict",
".",
"keys",
"(",
")",
")",
":",
"self",
".",
"value",
"=",
"value",
"self",
".",
"_notify",
"(",
")",
"elif",... | https://github.com/OGRECave/ogre-next/blob/287307980e6de8910f04f3cc0994451b075071fd/Tools/BlenderExport/ogrepkg/gui.py#L514-L527 | |
deepmind/open_spiel | 4ca53bea32bb2875c7385d215424048ae92f78c8 | open_spiel/python/games/iterated_prisoners_dilemma.py | python | IteratedPrisonersDilemmaState.is_terminal | (self) | return self._game_over | Returns True if the game is over. | Returns True if the game is over. | [
"Returns",
"True",
"if",
"the",
"game",
"is",
"over",
"."
] | def is_terminal(self):
"""Returns True if the game is over."""
return self._game_over | [
"def",
"is_terminal",
"(",
"self",
")",
":",
"return",
"self",
".",
"_game_over"
] | https://github.com/deepmind/open_spiel/blob/4ca53bea32bb2875c7385d215424048ae92f78c8/open_spiel/python/games/iterated_prisoners_dilemma.py#L148-L150 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py3/sklearn/metrics/cluster/_supervised.py | python | mutual_info_score | (labels_true, labels_pred, contingency=None) | return mi.sum() | Mutual Information between two clusterings.
The Mutual Information is a measure of the similarity between two labels of
the same data. Where :math:`|U_i|` is the number of the samples
in cluster :math:`U_i` and :math:`|V_j|` is the number of the
samples in cluster :math:`V_j`, the Mutual Information
... | Mutual Information between two clusterings. | [
"Mutual",
"Information",
"between",
"two",
"clusterings",
"."
] | def mutual_info_score(labels_true, labels_pred, contingency=None):
"""Mutual Information between two clusterings.
The Mutual Information is a measure of the similarity between two labels of
the same data. Where :math:`|U_i|` is the number of the samples
in cluster :math:`U_i` and :math:`|V_j|` is the n... | [
"def",
"mutual_info_score",
"(",
"labels_true",
",",
"labels_pred",
",",
"contingency",
"=",
"None",
")",
":",
"if",
"contingency",
"is",
"None",
":",
"labels_true",
",",
"labels_pred",
"=",
"check_clusterings",
"(",
"labels_true",
",",
"labels_pred",
")",
"cont... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/metrics/cluster/_supervised.py#L565-L648 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/boto3/resources/response.py | python | build_identifiers | (identifiers, parent, params=None, raw_response=None) | return results | Builds a mapping of identifier names to values based on the
identifier source location, type, and target. Identifier
values may be scalars or lists depending on the source type
and location.
:type identifiers: list
:param identifiers: List of :py:class:`~boto3.resources.model.Parameter`
... | Builds a mapping of identifier names to values based on the
identifier source location, type, and target. Identifier
values may be scalars or lists depending on the source type
and location. | [
"Builds",
"a",
"mapping",
"of",
"identifier",
"names",
"to",
"values",
"based",
"on",
"the",
"identifier",
"source",
"location",
"type",
"and",
"target",
".",
"Identifier",
"values",
"may",
"be",
"scalars",
"or",
"lists",
"depending",
"on",
"the",
"source",
... | def build_identifiers(identifiers, parent, params=None, raw_response=None):
"""
Builds a mapping of identifier names to values based on the
identifier source location, type, and target. Identifier
values may be scalars or lists depending on the source type
and location.
:type identifiers: list
... | [
"def",
"build_identifiers",
"(",
"identifiers",
",",
"parent",
",",
"params",
"=",
"None",
",",
"raw_response",
"=",
"None",
")",
":",
"results",
"=",
"[",
"]",
"for",
"identifier",
"in",
"identifiers",
":",
"source",
"=",
"identifier",
".",
"source",
"tar... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/boto3/resources/response.py#L32-L76 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/plan/motionplanning.py | python | CSpaceInterface.setDistance | (self, pyDist: object) | return _motionplanning.CSpaceInterface_setDistance(self, pyDist) | r"""
Args:
pyDist (:obj:`object`) | r"""
Args:
pyDist (:obj:`object`) | [
"r",
"Args",
":",
"pyDist",
"(",
":",
"obj",
":",
"object",
")"
] | def setDistance(self, pyDist: object) ->None:
r"""
Args:
pyDist (:obj:`object`)
"""
return _motionplanning.CSpaceInterface_setDistance(self, pyDist) | [
"def",
"setDistance",
"(",
"self",
",",
"pyDist",
":",
"object",
")",
"->",
"None",
":",
"return",
"_motionplanning",
".",
"CSpaceInterface_setDistance",
"(",
"self",
",",
"pyDist",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/plan/motionplanning.py#L552-L557 | |
bareos/bareos | 56a10bb368b0a81e977bb51304033fe49d59efb0 | restapi/bareos_restapi/__init__.py | python | read_client_by_name | (
*,
response: Response,
current_user: User = Depends(get_current_user),
profiles_name: str = Path(..., title="Client name to look for"),
verbose: Optional[bareosBool] = Query("yes", title="Verbose output"),
) | return show_configuration_items(
response=response,
current_user=current_user,
itemType="profiles",
byName=profiles_name,
verbose=verbose,
) | Read all jobdef resources. Built on console command _show profiles_.
Needs at least Bareos Version >= 20.0.0 | Read all jobdef resources. Built on console command _show profiles_. | [
"Read",
"all",
"jobdef",
"resources",
".",
"Built",
"on",
"console",
"command",
"_show",
"profiles_",
"."
] | def read_client_by_name(
*,
response: Response,
current_user: User = Depends(get_current_user),
profiles_name: str = Path(..., title="Client name to look for"),
verbose: Optional[bareosBool] = Query("yes", title="Verbose output"),
):
"""
Read all jobdef resources. Built on console command _s... | [
"def",
"read_client_by_name",
"(",
"*",
",",
"response",
":",
"Response",
",",
"current_user",
":",
"User",
"=",
"Depends",
"(",
"get_current_user",
")",
",",
"profiles_name",
":",
"str",
"=",
"Path",
"(",
"...",
",",
"title",
"=",
"\"Client name to look for\"... | https://github.com/bareos/bareos/blob/56a10bb368b0a81e977bb51304033fe49d59efb0/restapi/bareos_restapi/__init__.py#L1838-L1856 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/external/bazel_tools/third_party/py/concurrent/futures/thread.py | python | _remove_dead_thread_references | () | Remove inactive threads from _thread_references.
Should be called periodically to prevent memory leaks in scenarios such as:
>>> while True:
... t = ThreadPoolExecutor(max_workers=5)
... t.map(int, ['1', '2', '3', '4', '5']) | Remove inactive threads from _thread_references. | [
"Remove",
"inactive",
"threads",
"from",
"_thread_references",
"."
] | def _remove_dead_thread_references():
"""Remove inactive threads from _thread_references.
Should be called periodically to prevent memory leaks in scenarios such as:
>>> while True:
... t = ThreadPoolExecutor(max_workers=5)
... t.map(int, ['1', '2', '3', '4', '5'])
"""
for thread_refe... | [
"def",
"_remove_dead_thread_references",
"(",
")",
":",
"for",
"thread_reference",
"in",
"set",
"(",
"_thread_references",
")",
":",
"if",
"thread_reference",
"(",
")",
"is",
"None",
":",
"_thread_references",
".",
"discard",
"(",
"thread_reference",
")"
] | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/external/bazel_tools/third_party/py/concurrent/futures/thread.py#L46-L56 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/SANS/sans/algorithm_detail/xml_shapes.py | python | add_xml_shape | (xml, complete_xml_element) | Add an arbitrary shape to region to be masked
:param xml: a list of shapes to which we append here
:param complete_xml_element: description of the shape to add | Add an arbitrary shape to region to be masked
:param xml: a list of shapes to which we append here
:param complete_xml_element: description of the shape to add | [
"Add",
"an",
"arbitrary",
"shape",
"to",
"region",
"to",
"be",
"masked",
":",
"param",
"xml",
":",
"a",
"list",
"of",
"shapes",
"to",
"which",
"we",
"append",
"here",
":",
"param",
"complete_xml_element",
":",
"description",
"of",
"the",
"shape",
"to",
"... | def add_xml_shape(xml, complete_xml_element):
"""
Add an arbitrary shape to region to be masked
:param xml: a list of shapes to which we append here
:param complete_xml_element: description of the shape to add
"""
if not complete_xml_element.startswith('<'):
raise ValueError(... | [
"def",
"add_xml_shape",
"(",
"xml",
",",
"complete_xml_element",
")",
":",
"if",
"not",
"complete_xml_element",
".",
"startswith",
"(",
"'<'",
")",
":",
"raise",
"ValueError",
"(",
"'Excepted xml string but found: '",
"+",
"str",
"(",
"complete_xml_element",
")",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/SANS/sans/algorithm_detail/xml_shapes.py#L11-L19 | ||
InsightSoftwareConsortium/ITK | 87acfce9a93d928311c38bc371b666b515b9f19d | Modules/ThirdParty/pygccxml/src/pygccxml/declarations/declaration.py | python | declaration_t.name | (self) | return self._get_name_impl() | Declaration name
@type: str | Declaration name
@type: str | [
"Declaration",
"name",
"@type",
":",
"str"
] | def name(self):
"""
Declaration name
@type: str
"""
return self._get_name_impl() | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_get_name_impl",
"(",
")"
] | https://github.com/InsightSoftwareConsortium/ITK/blob/87acfce9a93d928311c38bc371b666b515b9f19d/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/declaration.py#L152-L159 | |
danxuhk/ContinuousCRF-CNN | 2b6dcaf179620f118b225ed12c890414ca828e21 | scripts/cpp_lint.py | python | CheckAltTokens | (filename, clean_lines, linenum, error) | Check alternative keywords being used in boolean expressions.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found. | Check alternative keywords being used in boolean expressions. | [
"Check",
"alternative",
"keywords",
"being",
"used",
"in",
"boolean",
"expressions",
"."
] | def CheckAltTokens(filename, clean_lines, linenum, error):
"""Check alternative keywords being used in boolean expressions.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call ... | [
"def",
"CheckAltTokens",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"# Avoid preprocessor lines",
"if",
"Match",
"(",
"r'^\\s*#'",
",",
"line",
")",
":",
"retur... | https://github.com/danxuhk/ContinuousCRF-CNN/blob/2b6dcaf179620f118b225ed12c890414ca828e21/scripts/cpp_lint.py#L3409-L3438 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/HFIR_4Circle_Reduction/fourcircle_utility.py | python | get_single_pt_md_name | (exp_number, scan_number, pt_number) | return ws_name | Form the name of the MDEvnetWorkspace for a single Pt. measurement
:param exp_number:
:param scan_number:
:param pt_number:
:return: | Form the name of the MDEvnetWorkspace for a single Pt. measurement
:param exp_number:
:param scan_number:
:param pt_number:
:return: | [
"Form",
"the",
"name",
"of",
"the",
"MDEvnetWorkspace",
"for",
"a",
"single",
"Pt",
".",
"measurement",
":",
"param",
"exp_number",
":",
":",
"param",
"scan_number",
":",
":",
"param",
"pt_number",
":",
":",
"return",
":"
] | def get_single_pt_md_name(exp_number, scan_number, pt_number):
""" Form the name of the MDEvnetWorkspace for a single Pt. measurement
:param exp_number:
:param scan_number:
:param pt_number:
:return:
"""
ws_name = 'HB3A_Exp%d_Scan%d_Pt%d_MD' % (exp_number, scan_number, pt_number)
return... | [
"def",
"get_single_pt_md_name",
"(",
"exp_number",
",",
"scan_number",
",",
"pt_number",
")",
":",
"ws_name",
"=",
"'HB3A_Exp%d_Scan%d_Pt%d_MD'",
"%",
"(",
"exp_number",
",",
"scan_number",
",",
"pt_number",
")",
"return",
"ws_name"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/HFIR_4Circle_Reduction/fourcircle_utility.py#L637-L646 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/multiprocessing/managers.py | python | dispatch | (c, id, methodname, args=(), kwds={}) | Send a message to manager using connection `c` and return response | Send a message to manager using connection `c` and return response | [
"Send",
"a",
"message",
"to",
"manager",
"using",
"connection",
"c",
"and",
"return",
"response"
] | def dispatch(c, id, methodname, args=(), kwds={}):
'''
Send a message to manager using connection `c` and return response
'''
c.send((id, methodname, args, kwds))
kind, result = c.recv()
if kind == '#RETURN':
return result
raise convert_to_error(kind, result) | [
"def",
"dispatch",
"(",
"c",
",",
"id",
",",
"methodname",
",",
"args",
"=",
"(",
")",
",",
"kwds",
"=",
"{",
"}",
")",
":",
"c",
".",
"send",
"(",
"(",
"id",
",",
"methodname",
",",
"args",
",",
"kwds",
")",
")",
"kind",
",",
"result",
"=",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/multiprocessing/managers.py#L74-L82 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_misc.py | python | TimeSpan.IsEqualTo | (*args, **kwargs) | return _misc_.TimeSpan_IsEqualTo(*args, **kwargs) | IsEqualTo(self, TimeSpan ts) -> bool | IsEqualTo(self, TimeSpan ts) -> bool | [
"IsEqualTo",
"(",
"self",
"TimeSpan",
"ts",
")",
"-",
">",
"bool"
] | def IsEqualTo(*args, **kwargs):
"""IsEqualTo(self, TimeSpan ts) -> bool"""
return _misc_.TimeSpan_IsEqualTo(*args, **kwargs) | [
"def",
"IsEqualTo",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"TimeSpan_IsEqualTo",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_misc.py#L4502-L4504 | |
PX4/PX4-Autopilot | 0b9f60a0370be53d683352c63fd92db3d6586e18 | Tools/mavlink_px4.py | python | MAVLink.safety_allowed_area_send | (self, frame, p1x, p1y, p1z, p2x, p2y, p2z) | return self.send(self.safety_allowed_area_encode(frame, p1x, p1y, p1z, p2x, p2y, p2z)) | Read out the safety zone the MAV currently assumes.
frame : Coordinate frame, as defined by MAV_FRAME enum in mavlink_types.h. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down. (uint8_t)
p1x : x position... | Read out the safety zone the MAV currently assumes. | [
"Read",
"out",
"the",
"safety",
"zone",
"the",
"MAV",
"currently",
"assumes",
"."
] | def safety_allowed_area_send(self, frame, p1x, p1y, p1z, p2x, p2y, p2z):
'''
Read out the safety zone the MAV currently assumes.
frame : Coordinate frame, as defined by MAV_FRAME enum in mavlink_types.h. Can be either global, GPS, right-handed with Z ... | [
"def",
"safety_allowed_area_send",
"(",
"self",
",",
"frame",
",",
"p1x",
",",
"p1y",
",",
"p1z",
",",
"p2x",
",",
"p2y",
",",
"p2z",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"safety_allowed_area_encode",
"(",
"frame",
",",
"p1x",
","... | https://github.com/PX4/PX4-Autopilot/blob/0b9f60a0370be53d683352c63fd92db3d6586e18/Tools/mavlink_px4.py#L3914-L3927 | |
macchina-io/macchina.io | ef24ba0e18379c3dd48fb84e6dbf991101cb8db0 | platform/JS/V8/tools/gyp/pylib/gyp/MSVSProject.py | python | Writer.__init__ | (self, project_path, version, name, guid=None, platforms=None) | Initializes the project.
Args:
project_path: Path to the project file.
version: Format version to emit.
name: Name of the project.
guid: GUID to use for project, if not None.
platforms: Array of string, the supported platforms. If null, ['Win32'] | Initializes the project. | [
"Initializes",
"the",
"project",
"."
] | def __init__(self, project_path, version, name, guid=None, platforms=None):
"""Initializes the project.
Args:
project_path: Path to the project file.
version: Format version to emit.
name: Name of the project.
guid: GUID to use for project, if not None.
platforms: Array of string,... | [
"def",
"__init__",
"(",
"self",
",",
"project_path",
",",
"version",
",",
"name",
",",
"guid",
"=",
"None",
",",
"platforms",
"=",
"None",
")",
":",
"self",
".",
"project_path",
"=",
"project_path",
"self",
".",
"version",
"=",
"version",
"self",
".",
... | https://github.com/macchina-io/macchina.io/blob/ef24ba0e18379c3dd48fb84e6dbf991101cb8db0/platform/JS/V8/tools/gyp/pylib/gyp/MSVSProject.py#L54-L82 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/timeseries/python/timeseries/state_space_models/structural_ensemble.py | python | MultiResolutionStructuralEnsemble.__init__ | (self,
cycle_num_latent_values,
moving_average_order,
autoregressive_order,
periodicities,
use_level_noise=True,
configuration=state_space_model.StateSpaceModelConfiguration()) | Initialize the multi-resolution structural ensemble.
Args:
cycle_num_latent_values: Controls the model size and the number of latent
values cycled between (but not the periods over which they cycle).
Reducing this parameter can save significant amounts of memory, but
the tradeof... | Initialize the multi-resolution structural ensemble. | [
"Initialize",
"the",
"multi",
"-",
"resolution",
"structural",
"ensemble",
"."
] | def __init__(self,
cycle_num_latent_values,
moving_average_order,
autoregressive_order,
periodicities,
use_level_noise=True,
configuration=state_space_model.StateSpaceModelConfiguration()):
"""Initialize the multi-resolution s... | [
"def",
"__init__",
"(",
"self",
",",
"cycle_num_latent_values",
",",
"moving_average_order",
",",
"autoregressive_order",
",",
"periodicities",
",",
"use_level_noise",
"=",
"True",
",",
"configuration",
"=",
"state_space_model",
".",
"StateSpaceModelConfiguration",
"(",
... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/timeseries/python/timeseries/state_space_models/structural_ensemble.py#L182-L266 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/slim/python/slim/summaries.py | python | _get_summary_name | (tensor, name=None, prefix=None, postfix=None) | return name | Produces the summary name given.
Args:
tensor: A variable or op `Tensor`.
name: The optional name for the summary.
prefix: An optional prefix for the summary name.
postfix: An optional postfix for the summary name.
Returns:
a summary name. | Produces the summary name given. | [
"Produces",
"the",
"summary",
"name",
"given",
"."
] | def _get_summary_name(tensor, name=None, prefix=None, postfix=None):
"""Produces the summary name given.
Args:
tensor: A variable or op `Tensor`.
name: The optional name for the summary.
prefix: An optional prefix for the summary name.
postfix: An optional postfix for the summary name.
Returns:
... | [
"def",
"_get_summary_name",
"(",
"tensor",
",",
"name",
"=",
"None",
",",
"prefix",
"=",
"None",
",",
"postfix",
"=",
"None",
")",
":",
"if",
"not",
"name",
":",
"name",
"=",
"tensor",
".",
"op",
".",
"name",
"if",
"prefix",
":",
"name",
"=",
"pref... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/slim/python/slim/summaries.py#L42-L60 | |
infinisql/infinisql | 6e858e142196e20b6779e1ee84c4a501e246c1f8 | manager/infinisqlmgr/engine/state.py | python | ConfigurationState.on_get_topology_mgr_mbox_ptr | (self, sock) | Handles a GET_TOPOLOGY_MANAGER_MAILBOX_POINTER response.
:param sock: The socket to read from.
:return: None | Handles a GET_TOPOLOGY_MANAGER_MAILBOX_POINTER response.
:param sock: The socket to read from.
:return: None | [
"Handles",
"a",
"GET_TOPOLOGY_MANAGER_MAILBOX_POINTER",
"response",
".",
":",
"param",
"sock",
":",
"The",
"socket",
"to",
"read",
"from",
".",
":",
"return",
":",
"None"
] | def on_get_topology_mgr_mbox_ptr(self, sock):
"""
Handles a GET_TOPOLOGY_MANAGER_MAILBOX_POINTER response.
:param sock: The socket to read from.
:return: None
"""
stream = self._recv(sock)
result = next(stream)
if result != cfg.CMD_OK:
logging.... | [
"def",
"on_get_topology_mgr_mbox_ptr",
"(",
"self",
",",
"sock",
")",
":",
"stream",
"=",
"self",
".",
"_recv",
"(",
"sock",
")",
"result",
"=",
"next",
"(",
"stream",
")",
"if",
"result",
"!=",
"cfg",
".",
"CMD_OK",
":",
"logging",
".",
"error",
"(",
... | https://github.com/infinisql/infinisql/blob/6e858e142196e20b6779e1ee84c4a501e246c1f8/manager/infinisqlmgr/engine/state.py#L88-L101 | ||
infinit/elle | a8154593c42743f45b9df09daf62b44630c24a02 | drake/src/drake/cxx/__init__.py | python | GccToolkit.basename | (self) | return self.__split()[1] | The compiler basename, e.g., `clang++`. | The compiler basename, e.g., `clang++`. | [
"The",
"compiler",
"basename",
"e",
".",
"g",
".",
"clang",
"++",
"."
] | def basename(self):
'''The compiler basename, e.g., `clang++`.'''
return self.__split()[1] | [
"def",
"basename",
"(",
"self",
")",
":",
"return",
"self",
".",
"__split",
"(",
")",
"[",
"1",
"]"
] | https://github.com/infinit/elle/blob/a8154593c42743f45b9df09daf62b44630c24a02/drake/src/drake/cxx/__init__.py#L1116-L1118 | |
lballabio/quantlib-old | 136336947ed4fea9ecc1da6edad188700e821739 | gensrc/gensrc/addins/excel.py | python | ExcelAddin.generateRegisterFunction | (self, func, categoryName, register = True) | return self.bufferRegisterFunction_.set({
'category' : categoryName,
'categoryLen' : self.checkLen(categoryName),
'delim' : delim,
'funcDesc' : funcDesc,
'funcDescLen' : self.checkLen(funcDesc),
'functionName' : func.name(),
'functionNa... | Generate code to register/unregister given function. | Generate code to register/unregister given function. | [
"Generate",
"code",
"to",
"register",
"/",
"unregister",
"given",
"function",
"."
] | def generateRegisterFunction(self, func, categoryName, register = True):
"""Generate code to register/unregister given function."""
paramStr = self.xlRegisterReturn_.apply(func.returnValue()) \
+ func.parameterList().generate(self.xlRegisterParam_)
if func.xlMacro():
par... | [
"def",
"generateRegisterFunction",
"(",
"self",
",",
"func",
",",
"categoryName",
",",
"register",
"=",
"True",
")",
":",
"paramStr",
"=",
"self",
".",
"xlRegisterReturn_",
".",
"apply",
"(",
"func",
".",
"returnValue",
"(",
")",
")",
"+",
"func",
".",
"... | https://github.com/lballabio/quantlib-old/blob/136336947ed4fea9ecc1da6edad188700e821739/gensrc/gensrc/addins/excel.py#L175-L233 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/ResourceManager/lib/Crypto/Hash/SHA1.py | python | _pbkdf2_hmac_assist | (inner, outer, first_digest, iterations) | return get_raw_buffer(bfr) | Compute the expensive inner loop in PBKDF-HMAC. | Compute the expensive inner loop in PBKDF-HMAC. | [
"Compute",
"the",
"expensive",
"inner",
"loop",
"in",
"PBKDF",
"-",
"HMAC",
"."
] | def _pbkdf2_hmac_assist(inner, outer, first_digest, iterations):
"""Compute the expensive inner loop in PBKDF-HMAC."""
assert len(first_digest) == digest_size
assert iterations > 0
bfr = create_string_buffer(digest_size);
result = _raw_sha1_lib.SHA1_pbkdf2_hmac_assist(
inner._s... | [
"def",
"_pbkdf2_hmac_assist",
"(",
"inner",
",",
"outer",
",",
"first_digest",
",",
"iterations",
")",
":",
"assert",
"len",
"(",
"first_digest",
")",
"==",
"digest_size",
"assert",
"iterations",
">",
"0",
"bfr",
"=",
"create_string_buffer",
"(",
"digest_size",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/ResourceManager/lib/Crypto/Hash/SHA1.py#L168-L185 | |
rrwick/Porechop | 109e437280436d1ec27e5a5b7a34ffb752176390 | porechop/nanopore_read.py | python | NanoporeRead.formatted_start_seq | (self, end_size, extra_trim_size) | return formatted_str | Returns the start of the read sequence, with any found adapters highlighted in red. | Returns the start of the read sequence, with any found adapters highlighted in red. | [
"Returns",
"the",
"start",
"of",
"the",
"read",
"sequence",
"with",
"any",
"found",
"adapters",
"highlighted",
"in",
"red",
"."
] | def formatted_start_seq(self, end_size, extra_trim_size):
"""
Returns the start of the read sequence, with any found adapters highlighted in red.
"""
start_seq = self.seq[:end_size]
if not self.start_trim_amount:
return start_seq
red_bases = self.start_trim_am... | [
"def",
"formatted_start_seq",
"(",
"self",
",",
"end_size",
",",
"extra_trim_size",
")",
":",
"start_seq",
"=",
"self",
".",
"seq",
"[",
":",
"end_size",
"]",
"if",
"not",
"self",
".",
"start_trim_amount",
":",
"return",
"start_seq",
"red_bases",
"=",
"self"... | https://github.com/rrwick/Porechop/blob/109e437280436d1ec27e5a5b7a34ffb752176390/porechop/nanopore_read.py#L245-L258 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_windows.py | python | ScrollHelper.AdjustScrollbars | (*args, **kwargs) | return _windows_.ScrollHelper_AdjustScrollbars(*args, **kwargs) | AdjustScrollbars(self) | AdjustScrollbars(self) | [
"AdjustScrollbars",
"(",
"self",
")"
] | def AdjustScrollbars(*args, **kwargs):
"""AdjustScrollbars(self)"""
return _windows_.ScrollHelper_AdjustScrollbars(*args, **kwargs) | [
"def",
"AdjustScrollbars",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"ScrollHelper_AdjustScrollbars",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_windows.py#L233-L235 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/solvers/python/ops/linear_equations.py | python | conjugate_gradient | (operator,
rhs,
tol=1e-4,
max_iter=20,
name="conjugate_gradient") | r"""Conjugate gradient solver.
Solves a linear system of equations `A*x = rhs` for selfadjoint, positive
definite matrix `A` and righ-hand side vector `rhs`, using an iterative,
matrix-free algorithm where the action of the matrix A is represented by
`operator`. The iteration terminates when either the number ... | r"""Conjugate gradient solver. | [
"r",
"Conjugate",
"gradient",
"solver",
"."
] | def conjugate_gradient(operator,
rhs,
tol=1e-4,
max_iter=20,
name="conjugate_gradient"):
r"""Conjugate gradient solver.
Solves a linear system of equations `A*x = rhs` for selfadjoint, positive
definite matrix `A` and rig... | [
"def",
"conjugate_gradient",
"(",
"operator",
",",
"rhs",
",",
"tol",
"=",
"1e-4",
",",
"max_iter",
"=",
"20",
",",
"name",
"=",
"\"conjugate_gradient\"",
")",
":",
"# ephemeral class holding CG state.",
"cg_state",
"=",
"collections",
".",
"namedtuple",
"(",
"\... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/solvers/python/ops/linear_equations.py#L32-L104 | ||
ArmageddonGames/ZeldaClassic | c244ae6c1d361d24a5529b1c0394e656f1f5d965 | allegro/addons/allegrogl/misc/zipup.py | python | get_files | () | return [f.path for f in files if f.is_versioned and f.entry and
f.entry.kind == pysvn.node_kind.file] | Find all SVN files to include in the release. | Find all SVN files to include in the release. | [
"Find",
"all",
"SVN",
"files",
"to",
"include",
"in",
"the",
"release",
"."
] | def get_files():
"""Find all SVN files to include in the release."""
client = pysvn.Client()
files = client.status(".", recurse = True, get_all = True)
return [f.path for f in files if f.is_versioned and f.entry and
f.entry.kind == pysvn.node_kind.file] | [
"def",
"get_files",
"(",
")",
":",
"client",
"=",
"pysvn",
".",
"Client",
"(",
")",
"files",
"=",
"client",
".",
"status",
"(",
"\".\"",
",",
"recurse",
"=",
"True",
",",
"get_all",
"=",
"True",
")",
"return",
"[",
"f",
".",
"path",
"for",
"f",
"... | https://github.com/ArmageddonGames/ZeldaClassic/blob/c244ae6c1d361d24a5529b1c0394e656f1f5d965/allegro/addons/allegrogl/misc/zipup.py#L12-L19 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_misc.py | python | DateTime.ToGMT | (*args, **kwargs) | return _misc_.DateTime_ToGMT(*args, **kwargs) | ToGMT(self, bool noDST=False) -> DateTime | ToGMT(self, bool noDST=False) -> DateTime | [
"ToGMT",
"(",
"self",
"bool",
"noDST",
"=",
"False",
")",
"-",
">",
"DateTime"
] | def ToGMT(*args, **kwargs):
"""ToGMT(self, bool noDST=False) -> DateTime"""
return _misc_.DateTime_ToGMT(*args, **kwargs) | [
"def",
"ToGMT",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"DateTime_ToGMT",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_misc.py#L3946-L3948 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/dataview.py | python | DataViewIndexListModel.GetAttrByRow | (*args, **kwargs) | return _dataview.DataViewIndexListModel_GetAttrByRow(*args, **kwargs) | GetAttrByRow(self, unsigned int row, unsigned int col, DataViewItemAttr attr) -> bool
Override this to indicate that the item has special font
attributes. This only affects the `DataViewTextRenderer` renderer.
Return ``False`` if the default attributes should be used. | GetAttrByRow(self, unsigned int row, unsigned int col, DataViewItemAttr attr) -> bool | [
"GetAttrByRow",
"(",
"self",
"unsigned",
"int",
"row",
"unsigned",
"int",
"col",
"DataViewItemAttr",
"attr",
")",
"-",
">",
"bool"
] | def GetAttrByRow(*args, **kwargs):
"""
GetAttrByRow(self, unsigned int row, unsigned int col, DataViewItemAttr attr) -> bool
Override this to indicate that the item has special font
attributes. This only affects the `DataViewTextRenderer` renderer.
Return ``False`` if the defaul... | [
"def",
"GetAttrByRow",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_dataview",
".",
"DataViewIndexListModel_GetAttrByRow",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/dataview.py#L828-L836 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/threading.py | python | Semaphore | (*args, **kwargs) | return _Semaphore(*args, **kwargs) | A factory function that returns a new semaphore.
Semaphores manage a counter representing the number of release() calls minus
the number of acquire() calls, plus an initial value. The acquire() method
blocks if necessary until it can return without making the counter
negative. If not given, value defau... | A factory function that returns a new semaphore. | [
"A",
"factory",
"function",
"that",
"returns",
"a",
"new",
"semaphore",
"."
] | def Semaphore(*args, **kwargs):
"""A factory function that returns a new semaphore.
Semaphores manage a counter representing the number of release() calls minus
the number of acquire() calls, plus an initial value. The acquire() method
blocks if necessary until it can return without making the counter
... | [
"def",
"Semaphore",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_Semaphore",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/threading.py#L411-L420 | |
stellar-deprecated/stellard | 67eabb2217bdfa9a6ea317f62338fb6bca458c90 | src/protobuf/python/google/protobuf/internal/encoder.py | python | _VarintBytes | (value) | return "".join(pieces) | Encode the given integer as a varint and return the bytes. This is only
called at startup time so it doesn't need to be fast. | Encode the given integer as a varint and return the bytes. This is only
called at startup time so it doesn't need to be fast. | [
"Encode",
"the",
"given",
"integer",
"as",
"a",
"varint",
"and",
"return",
"the",
"bytes",
".",
"This",
"is",
"only",
"called",
"at",
"startup",
"time",
"so",
"it",
"doesn",
"t",
"need",
"to",
"be",
"fast",
"."
] | def _VarintBytes(value):
"""Encode the given integer as a varint and return the bytes. This is only
called at startup time so it doesn't need to be fast."""
pieces = []
_EncodeVarint(pieces.append, value)
return "".join(pieces) | [
"def",
"_VarintBytes",
"(",
"value",
")",
":",
"pieces",
"=",
"[",
"]",
"_EncodeVarint",
"(",
"pieces",
".",
"append",
",",
"value",
")",
"return",
"\"\"",
".",
"join",
"(",
"pieces",
")"
] | https://github.com/stellar-deprecated/stellard/blob/67eabb2217bdfa9a6ea317f62338fb6bca458c90/src/protobuf/python/google/protobuf/internal/encoder.py#L379-L385 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py | python | MergeGlobalXcodeSettingsToSpec | (global_dict, spec) | Merges the global xcode_settings dictionary into each configuration of the
target represented by spec. For keys that are both in the global and the local
xcode_settings dict, the local key gets precedence. | Merges the global xcode_settings dictionary into each configuration of the
target represented by spec. For keys that are both in the global and the local
xcode_settings dict, the local key gets precedence. | [
"Merges",
"the",
"global",
"xcode_settings",
"dictionary",
"into",
"each",
"configuration",
"of",
"the",
"target",
"represented",
"by",
"spec",
".",
"For",
"keys",
"that",
"are",
"both",
"in",
"the",
"global",
"and",
"the",
"local",
"xcode_settings",
"dict",
"... | def MergeGlobalXcodeSettingsToSpec(global_dict, spec):
"""Merges the global xcode_settings dictionary into each configuration of the
target represented by spec. For keys that are both in the global and the local
xcode_settings dict, the local key gets precedence.
"""
# The xcode generator special-cases global... | [
"def",
"MergeGlobalXcodeSettingsToSpec",
"(",
"global_dict",
",",
"spec",
")",
":",
"# The xcode generator special-cases global xcode_settings and does something",
"# that amounts to merging in the global xcode_settings into each local",
"# xcode_settings dict.",
"global_xcode_settings",
"="... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py#L1345-L1358 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_core.py | python | Sizer.InsertStretchSpacer | (self, index, prop=1) | return self.Insert(index, (0,0), prop) | InsertStretchSpacer(int index, int prop=1) --> SizerItem
Insert a stretchable spacer. | InsertStretchSpacer(int index, int prop=1) --> SizerItem | [
"InsertStretchSpacer",
"(",
"int",
"index",
"int",
"prop",
"=",
"1",
")",
"--",
">",
"SizerItem"
] | def InsertStretchSpacer(self, index, prop=1):
"""InsertStretchSpacer(int index, int prop=1) --> SizerItem
Insert a stretchable spacer."""
return self.Insert(index, (0,0), prop) | [
"def",
"InsertStretchSpacer",
"(",
"self",
",",
"index",
",",
"prop",
"=",
"1",
")",
":",
"return",
"self",
".",
"Insert",
"(",
"index",
",",
"(",
"0",
",",
"0",
")",
",",
"prop",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_core.py#L14705-L14709 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/locale.py | python | _parse_localename | (localename) | Parses the locale code for localename and returns the
result as tuple (language code, encoding).
The localename is normalized and passed through the locale
alias engine. A ValueError is raised in case the locale name
cannot be parsed.
The language code corresponds to RFC 1766. ... | Parses the locale code for localename and returns the
result as tuple (language code, encoding). | [
"Parses",
"the",
"locale",
"code",
"for",
"localename",
"and",
"returns",
"the",
"result",
"as",
"tuple",
"(",
"language",
"code",
"encoding",
")",
"."
] | def _parse_localename(localename):
""" Parses the locale code for localename and returns the
result as tuple (language code, encoding).
The localename is normalized and passed through the locale
alias engine. A ValueError is raised in case the locale name
cannot be parsed.
... | [
"def",
"_parse_localename",
"(",
"localename",
")",
":",
"code",
"=",
"normalize",
"(",
"localename",
")",
"if",
"'@'",
"in",
"code",
":",
"# Deal with locale modifiers",
"code",
",",
"modifier",
"=",
"code",
".",
"split",
"(",
"'@'",
",",
"1",
")",
"if",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/locale.py#L467-L499 | ||
trilinos/Trilinos | 6168be6dd51e35e1cd681e9c4b24433e709df140 | packages/seacas/scripts/exodus2.in.py | python | exodus.put_elem_blk_name | (self, id, name) | exo.put_elem_blk_name(elem_blk_id, elem_blk_name)
-> store the element block name
input value(s):
<int> elem_blk_id element block *ID* (not *INDEX*)
<string> elem_blk_name | exo.put_elem_blk_name(elem_blk_id, elem_blk_name) | [
"exo",
".",
"put_elem_blk_name",
"(",
"elem_blk_id",
"elem_blk_name",
")"
] | def put_elem_blk_name(self, id, name):
"""
exo.put_elem_blk_name(elem_blk_id, elem_blk_name)
-> store the element block name
input value(s):
<int> elem_blk_id element block *ID* (not *INDEX*)
<string> elem_blk_name
"""
objType = ex_en... | [
"def",
"put_elem_blk_name",
"(",
"self",
",",
"id",
",",
"name",
")",
":",
"objType",
"=",
"ex_entity_type",
"(",
"\"EX_ELEM_BLOCK\"",
")",
"self",
".",
"__ex_put_name",
"(",
"objType",
",",
"id",
",",
"name",
")"
] | https://github.com/trilinos/Trilinos/blob/6168be6dd51e35e1cd681e9c4b24433e709df140/packages/seacas/scripts/exodus2.in.py#L1245-L1256 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/robotsim.py | python | SimBody.setTransform | (self, R, t) | return _robotsim.SimBody_setTransform(self, R, t) | setTransform(SimBody self, double const [9] R, double const [3] t)
Sets the body's transformation at the current simulation time step (in center-
of-mass centered coordinates). | setTransform(SimBody self, double const [9] R, double const [3] t) | [
"setTransform",
"(",
"SimBody",
"self",
"double",
"const",
"[",
"9",
"]",
"R",
"double",
"const",
"[",
"3",
"]",
"t",
")"
] | def setTransform(self, R, t):
"""
setTransform(SimBody self, double const [9] R, double const [3] t)
Sets the body's transformation at the current simulation time step (in center-
of-mass centered coordinates).
"""
return _robotsim.SimBody_setTransform(self, R, t) | [
"def",
"setTransform",
"(",
"self",
",",
"R",
",",
"t",
")",
":",
"return",
"_robotsim",
".",
"SimBody_setTransform",
"(",
"self",
",",
"R",
",",
"t",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/robotsim.py#L7943-L7953 | |
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Editor/Python/windows/Lib/site-packages/pkg_resources/__init__.py | python | yield_lines | (strs) | Yield non-empty/non-comment lines of a string or sequence | Yield non-empty/non-comment lines of a string or sequence | [
"Yield",
"non",
"-",
"empty",
"/",
"non",
"-",
"comment",
"lines",
"of",
"a",
"string",
"or",
"sequence"
] | def yield_lines(strs):
"""Yield non-empty/non-comment lines of a string or sequence"""
if isinstance(strs, six.string_types):
for s in strs.splitlines():
s = s.strip()
# skip blank lines/comments
if s and not s.startswith('#'):
yield s
else:
... | [
"def",
"yield_lines",
"(",
"strs",
")",
":",
"if",
"isinstance",
"(",
"strs",
",",
"six",
".",
"string_types",
")",
":",
"for",
"s",
"in",
"strs",
".",
"splitlines",
"(",
")",
":",
"s",
"=",
"s",
".",
"strip",
"(",
")",
"# skip blank lines/comments",
... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Editor/Python/windows/Lib/site-packages/pkg_resources/__init__.py#L2369-L2380 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_misc.py | python | ConfigBase.Get | (*args, **kwargs) | return _misc_.ConfigBase_Get(*args, **kwargs) | Get(bool createOnDemand=True) -> ConfigBase
Returns the current global config object, creating one if neccessary. | Get(bool createOnDemand=True) -> ConfigBase | [
"Get",
"(",
"bool",
"createOnDemand",
"=",
"True",
")",
"-",
">",
"ConfigBase"
] | def Get(*args, **kwargs):
"""
Get(bool createOnDemand=True) -> ConfigBase
Returns the current global config object, creating one if neccessary.
"""
return _misc_.ConfigBase_Get(*args, **kwargs) | [
"def",
"Get",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"ConfigBase_Get",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_misc.py#L3113-L3119 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/pydocview.py | python | DocTabbedChildFrame.OnTitleIsModified | (self) | Add/remove to the frame's title an indication that the document is dirty.
If the document is dirty, an '*' is appended to the title | Add/remove to the frame's title an indication that the document is dirty.
If the document is dirty, an '*' is appended to the title | [
"Add",
"/",
"remove",
"to",
"the",
"frame",
"s",
"title",
"an",
"indication",
"that",
"the",
"document",
"is",
"dirty",
".",
"If",
"the",
"document",
"is",
"dirty",
"an",
"*",
"is",
"appended",
"to",
"the",
"title"
] | def OnTitleIsModified(self):
"""
Add/remove to the frame's title an indication that the document is dirty.
If the document is dirty, an '*' is appended to the title
"""
title = self.GetTitle()
if title:
if self.GetDocument().IsModified():
if no... | [
"def",
"OnTitleIsModified",
"(",
"self",
")",
":",
"title",
"=",
"self",
".",
"GetTitle",
"(",
")",
"if",
"title",
":",
"if",
"self",
".",
"GetDocument",
"(",
")",
".",
"IsModified",
"(",
")",
":",
"if",
"not",
"title",
".",
"endswith",
"(",
"\"*\"",... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/pydocview.py#L666-L680 | ||
gnuradio/gnuradio | 09c3c4fa4bfb1a02caac74cb5334dfe065391e3b | grc/gui/Dialogs.py | python | show_keyboard_shortcuts | (parent) | Display keyboard shortcut-keys. | Display keyboard shortcut-keys. | [
"Display",
"keyboard",
"shortcut",
"-",
"keys",
"."
] | def show_keyboard_shortcuts(parent):
""" Display keyboard shortcut-keys. """
markup = textwrap.dedent("""\
<b>Keyboard Shortcuts</b>
\n\
<u>Ctrl+N</u>: Create a new flowgraph.
<u>Ctrl+O</u>: Open an existing flowgraph.
<u>Ctrl+S</u>: Save the current flowgraph or save as for new.
<u>Ctrl... | [
"def",
"show_keyboard_shortcuts",
"(",
"parent",
")",
":",
"markup",
"=",
"textwrap",
".",
"dedent",
"(",
"\"\"\"\\\n <b>Keyboard Shortcuts</b>\n \\n\\\n <u>Ctrl+N</u>: Create a new flowgraph.\n <u>Ctrl+O</u>: Open an existing flowgraph.\n <u>Ctrl+S</u>: Save the current flowg... | https://github.com/gnuradio/gnuradio/blob/09c3c4fa4bfb1a02caac74cb5334dfe065391e3b/grc/gui/Dialogs.py#L316-L355 | ||
google/or-tools | 2cb85b4eead4c38e1c54b48044f92087cf165bce | ortools/constraint_solver/doc/routing_svg.py | python | SVGPrinter.draw_demands | (self) | Draws all the demands. | Draws all the demands. | [
"Draws",
"all",
"the",
"demands",
"."
] | def draw_demands(self):
"""Draws all the demands."""
print(r'<!-- Print demands -->')
for idx, loc in enumerate(self._data.locations):
if idx == self._data.depot:
continue
demand = self._data.demands[idx]
position = [
x + y
... | [
"def",
"draw_demands",
"(",
"self",
")",
":",
"print",
"(",
"r'<!-- Print demands -->'",
")",
"for",
"idx",
",",
"loc",
"in",
"enumerate",
"(",
"self",
".",
"_data",
".",
"locations",
")",
":",
"if",
"idx",
"==",
"self",
".",
"_data",
".",
"depot",
":"... | https://github.com/google/or-tools/blob/2cb85b4eead4c38e1c54b48044f92087cf165bce/ortools/constraint_solver/doc/routing_svg.py#L486-L499 | ||
physercoe/starquant | c00cad64d1de2da05081b3dc320ef264c6295e08 | source/engine/strategy_engine.py | python | StrategyEngine._init_strategy | (self) | Init strategies in queue. | Init strategies in queue. | [
"Init",
"strategies",
"in",
"queue",
"."
] | def _init_strategy(self):
"""
Init strategies in queue.
"""
while not self.init_queue.empty():
strategy_name = self.init_queue.get()
strategy = self.strategies[strategy_name]
if strategy.inited:
self.write_log(f"{strategy_name}已经完成初始化,... | [
"def",
"_init_strategy",
"(",
"self",
")",
":",
"while",
"not",
"self",
".",
"init_queue",
".",
"empty",
"(",
")",
":",
"strategy_name",
"=",
"self",
".",
"init_queue",
".",
"get",
"(",
")",
"strategy",
"=",
"self",
".",
"strategies",
"[",
"strategy_name... | https://github.com/physercoe/starquant/blob/c00cad64d1de2da05081b3dc320ef264c6295e08/source/engine/strategy_engine.py#L452-L509 | ||
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | addon-sdk/source/python-lib/mozrunner/killableprocess.py | python | check_call | (*args, **kwargs) | Call a program with an optional timeout. If the program has a non-zero
exit status, raises a CalledProcessError. | Call a program with an optional timeout. If the program has a non-zero
exit status, raises a CalledProcessError. | [
"Call",
"a",
"program",
"with",
"an",
"optional",
"timeout",
".",
"If",
"the",
"program",
"has",
"a",
"non",
"-",
"zero",
"exit",
"status",
"raises",
"a",
"CalledProcessError",
"."
] | def check_call(*args, **kwargs):
"""Call a program with an optional timeout. If the program has a non-zero
exit status, raises a CalledProcessError."""
retcode = call(*args, **kwargs)
if retcode:
cmd = kwargs.get("args")
if cmd is None:
cmd = args[0]
raise CalledProc... | [
"def",
"check_call",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"retcode",
"=",
"call",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"if",
"retcode",
":",
"cmd",
"=",
"kwargs",
".",
"get",
"(",
"\"args\"",
")",
"if",
"cmd",
"is",
"... | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/addon-sdk/source/python-lib/mozrunner/killableprocess.py#L91-L100 | ||
smilehao/xlua-framework | a03801538be2b0e92d39332d445b22caca1ef61f | ConfigData/trunk/tools/protobuf-2.5.0/protobuf-2.5.0/python/google/protobuf/text_format.py | python | _Tokenizer.TryConsume | (self, token) | return False | Tries to consume a given piece of text.
Args:
token: Text to consume.
Returns:
True iff the text was consumed. | Tries to consume a given piece of text. | [
"Tries",
"to",
"consume",
"a",
"given",
"piece",
"of",
"text",
"."
] | def TryConsume(self, token):
"""Tries to consume a given piece of text.
Args:
token: Text to consume.
Returns:
True iff the text was consumed.
"""
if self.token == token:
self.NextToken()
return True
return False | [
"def",
"TryConsume",
"(",
"self",
",",
"token",
")",
":",
"if",
"self",
".",
"token",
"==",
"token",
":",
"self",
".",
"NextToken",
"(",
")",
"return",
"True",
"return",
"False"
] | https://github.com/smilehao/xlua-framework/blob/a03801538be2b0e92d39332d445b22caca1ef61f/ConfigData/trunk/tools/protobuf-2.5.0/protobuf-2.5.0/python/google/protobuf/text_format.py#L354-L366 | |
facebookincubator/BOLT | 88c70afe9d388ad430cc150cc158641701397f70 | clang/tools/scan-build-py/lib/libscanbuild/report.py | python | read_bugs | (output_dir, html) | Generate a unique sequence of bugs from given output directory.
Duplicates can be in a project if the same module was compiled multiple
times with different compiler options. These would be better to show in
the final report (cover) only once. | Generate a unique sequence of bugs from given output directory. | [
"Generate",
"a",
"unique",
"sequence",
"of",
"bugs",
"from",
"given",
"output",
"directory",
"."
] | def read_bugs(output_dir, html):
# type: (str, bool) -> Generator[Dict[str, Any], None, None]
""" Generate a unique sequence of bugs from given output directory.
Duplicates can be in a project if the same module was compiled multiple
times with different compiler options. These would be better to show ... | [
"def",
"read_bugs",
"(",
"output_dir",
",",
"html",
")",
":",
"# type: (str, bool) -> Generator[Dict[str, Any], None, None]",
"def",
"empty",
"(",
"file_name",
")",
":",
"return",
"os",
".",
"stat",
"(",
"file_name",
")",
".",
"st_size",
"==",
"0",
"duplicate",
... | https://github.com/facebookincubator/BOLT/blob/88c70afe9d388ad430cc150cc158641701397f70/clang/tools/scan-build-py/lib/libscanbuild/report.py#L261-L284 | ||
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/PathList.py | python | _PathList.__init__ | (self, pathlist) | Initializes a PathList object, canonicalizing the input and
pre-processing it for quicker substitution later.
The stored representation of the PathList is a list of tuples
containing (type, value), where the "type" is one of the TYPE_*
variables defined above. We distinguish between:
... | Initializes a PathList object, canonicalizing the input and
pre-processing it for quicker substitution later. | [
"Initializes",
"a",
"PathList",
"object",
"canonicalizing",
"the",
"input",
"and",
"pre",
"-",
"processing",
"it",
"for",
"quicker",
"substitution",
"later",
"."
] | def __init__(self, pathlist):
"""
Initializes a PathList object, canonicalizing the input and
pre-processing it for quicker substitution later.
The stored representation of the PathList is a list of tuples
containing (type, value), where the "type" is one of the TYPE_*
v... | [
"def",
"__init__",
"(",
"self",
",",
"pathlist",
")",
":",
"if",
"SCons",
".",
"Util",
".",
"is_String",
"(",
"pathlist",
")",
":",
"pathlist",
"=",
"pathlist",
".",
"split",
"(",
"os",
".",
"pathsep",
")",
"elif",
"not",
"SCons",
".",
"Util",
".",
... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/PathList.py#L73-L117 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/imghdr.py | python | test_pgm | (h, f) | PGM (portable graymap) | PGM (portable graymap) | [
"PGM",
"(",
"portable",
"graymap",
")"
] | def test_pgm(h, f):
"""PGM (portable graymap)"""
if len(h) >= 3 and \
h[0] == ord(b'P') and h[1] in b'25' and h[2] in b' \t\n\r':
return 'pgm' | [
"def",
"test_pgm",
"(",
"h",
",",
"f",
")",
":",
"if",
"len",
"(",
"h",
")",
">=",
"3",
"and",
"h",
"[",
"0",
"]",
"==",
"ord",
"(",
"b'P'",
")",
"and",
"h",
"[",
"1",
"]",
"in",
"b'25'",
"and",
"h",
"[",
"2",
"]",
"in",
"b' \\t\\n\\r'",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/imghdr.py#L79-L83 | ||
Lavender105/DFF | 152397cec4a3dac2aa86e92a65cc27e6c8016ab9 | exps/models/dff.py | python | get_dff | (dataset='cityscapes', backbone='resnet50', pretrained=False,
root='./pretrain_models', **kwargs) | return model | r"""DFF model from the paper "Dynamic Feature Fusion for Semantic Edge Detection" | r"""DFF model from the paper "Dynamic Feature Fusion for Semantic Edge Detection" | [
"r",
"DFF",
"model",
"from",
"the",
"paper",
"Dynamic",
"Feature",
"Fusion",
"for",
"Semantic",
"Edge",
"Detection"
] | def get_dff(dataset='cityscapes', backbone='resnet50', pretrained=False,
root='./pretrain_models', **kwargs):
r"""DFF model from the paper "Dynamic Feature Fusion for Semantic Edge Detection"
"""
acronyms = {
'cityscapes': 'cityscapes',
'sbd': 'sbd',
}
# infer number of c... | [
"def",
"get_dff",
"(",
"dataset",
"=",
"'cityscapes'",
",",
"backbone",
"=",
"'resnet50'",
",",
"pretrained",
"=",
"False",
",",
"root",
"=",
"'./pretrain_models'",
",",
"*",
"*",
"kwargs",
")",
":",
"acronyms",
"=",
"{",
"'cityscapes'",
":",
"'cityscapes'",... | https://github.com/Lavender105/DFF/blob/152397cec4a3dac2aa86e92a65cc27e6c8016ab9/exps/models/dff.py#L108-L124 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py2/numpy/lib/mixins.py | python | _numeric_methods | (ufunc, name) | return (_binary_method(ufunc, name),
_reflected_binary_method(ufunc, name),
_inplace_binary_method(ufunc, name)) | Implement forward, reflected and inplace binary methods with a ufunc. | Implement forward, reflected and inplace binary methods with a ufunc. | [
"Implement",
"forward",
"reflected",
"and",
"inplace",
"binary",
"methods",
"with",
"a",
"ufunc",
"."
] | def _numeric_methods(ufunc, name):
"""Implement forward, reflected and inplace binary methods with a ufunc."""
return (_binary_method(ufunc, name),
_reflected_binary_method(ufunc, name),
_inplace_binary_method(ufunc, name)) | [
"def",
"_numeric_methods",
"(",
"ufunc",
",",
"name",
")",
":",
"return",
"(",
"_binary_method",
"(",
"ufunc",
",",
"name",
")",
",",
"_reflected_binary_method",
"(",
"ufunc",
",",
"name",
")",
",",
"_inplace_binary_method",
"(",
"ufunc",
",",
"name",
")",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py2/numpy/lib/mixins.py#L48-L52 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/SANS/isis_reduction_steps.py | python | DarkRunSubtraction._execute_dark_run_subtraction_monitors | (self, monitor_workspace, setting, workspace_was_event) | return out_ws | Apply one dark run setting to a monitor workspace
@param monitor_workspace: the monitor data set associated with the scatter data
@param setting: a dark run settings tuple
@param workspace_was_event: flag if the original workspace was derived from histo or event
@returns a monitor for t... | Apply one dark run setting to a monitor workspace | [
"Apply",
"one",
"dark",
"run",
"setting",
"to",
"a",
"monitor",
"workspace"
] | def _execute_dark_run_subtraction_monitors(self, monitor_workspace, setting, workspace_was_event):
'''
Apply one dark run setting to a monitor workspace
@param monitor_workspace: the monitor data set associated with the scatter data
@param setting: a dark run settings tuple
@para... | [
"def",
"_execute_dark_run_subtraction_monitors",
"(",
"self",
",",
"monitor_workspace",
",",
"setting",
",",
"workspace_was_event",
")",
":",
"# Get the dark run name and path for the monitor",
"dark_run_name",
",",
"dark_run_file_path",
"=",
"self",
".",
"_get_dark_run_name_an... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/SANS/isis_reduction_steps.py#L1440-L1465 | |
shoaibrayeen/Programmers-Community | 1d352fb3e6ac5e2e7d9472d90527bdcc8d5ec355 | Basic/Reverse A String/SolutionByTanmay.py | python | rev_string | (strng) | return rev_str | Objective : To Reverse A Given String
Input : A String - Str Object
Return Value : A Reversed String - Str Object | Objective : To Reverse A Given String
Input : A String - Str Object
Return Value : A Reversed String - Str Object | [
"Objective",
":",
"To",
"Reverse",
"A",
"Given",
"String",
"Input",
":",
"A",
"String",
"-",
"Str",
"Object",
"Return",
"Value",
":",
"A",
"Reversed",
"String",
"-",
"Str",
"Object"
] | def rev_string(strng):
'''
Objective : To Reverse A Given String
Input : A String - Str Object
Return Value : A Reversed String - Str Object
'''
rev_str = ''
for i in range(len(strng)-1,-1,-1):
rev_str+=strng[i]
return rev_str | [
"def",
"rev_string",
"(",
"strng",
")",
":",
"rev_str",
"=",
"''",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"strng",
")",
"-",
"1",
",",
"-",
"1",
",",
"-",
"1",
")",
":",
"rev_str",
"+=",
"strng",
"[",
"i",
"]",
"return",
"rev_str"
] | https://github.com/shoaibrayeen/Programmers-Community/blob/1d352fb3e6ac5e2e7d9472d90527bdcc8d5ec355/Basic/Reverse A String/SolutionByTanmay.py#L1-L15 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/memory_inspector/memory_inspector/core/backends.py | python | Device.IsMmapTracingEnabled | (self) | Check if the device is ready to capture memory map traces. | Check if the device is ready to capture memory map traces. | [
"Check",
"if",
"the",
"device",
"is",
"ready",
"to",
"capture",
"memory",
"map",
"traces",
"."
] | def IsMmapTracingEnabled(self):
"""Check if the device is ready to capture memory map traces."""
raise NotImplementedError() | [
"def",
"IsMmapTracingEnabled",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/memory_inspector/memory_inspector/core/backends.py#L83-L85 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AzCodeGenerator/bin/linux/az_code_gen/clang_cpp.py | python | format_cpp_annotations | (json_object) | Does a pass over the entire JSON output from clang and organizes it into:
{
"objects": [
{
"fields": [
{
"annotations": {
"AzProperty": {}
}
... | Does a pass over the entire JSON output from clang and organizes it into:
{
"objects": [
{
"fields": [
{
"annotations": {
"AzProperty": {}
}
... | [
"Does",
"a",
"pass",
"over",
"the",
"entire",
"JSON",
"output",
"from",
"clang",
"and",
"organizes",
"it",
"into",
":",
"{",
"objects",
":",
"[",
"{",
"fields",
":",
"[",
"{",
"annotations",
":",
"{",
"AzProperty",
":",
"{}",
"}",
"}",
"]",
"methods"... | def format_cpp_annotations(json_object):
""" Does a pass over the entire JSON output from clang and organizes it into:
{
"objects": [
{
"fields": [
{
"annotations": {
"AzProper... | [
"def",
"format_cpp_annotations",
"(",
"json_object",
")",
":",
"promote_field_tags_to_class",
"(",
"json_object",
")",
"format_enums",
"(",
"json_object",
")",
"format_globals",
"(",
"json_object",
")",
"for",
"object",
"in",
"json_object",
".",
"get",
"(",
"'object... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AzCodeGenerator/bin/linux/az_code_gen/clang_cpp.py#L67-L111 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/richtext.py | python | RichTextParagraph.GetContiguousPlainText | (*args, **kwargs) | return _richtext.RichTextParagraph_GetContiguousPlainText(*args, **kwargs) | GetContiguousPlainText(self, String text, RichTextRange range, bool fromStart=True) -> bool | GetContiguousPlainText(self, String text, RichTextRange range, bool fromStart=True) -> bool | [
"GetContiguousPlainText",
"(",
"self",
"String",
"text",
"RichTextRange",
"range",
"bool",
"fromStart",
"=",
"True",
")",
"-",
">",
"bool"
] | def GetContiguousPlainText(*args, **kwargs):
"""GetContiguousPlainText(self, String text, RichTextRange range, bool fromStart=True) -> bool"""
return _richtext.RichTextParagraph_GetContiguousPlainText(*args, **kwargs) | [
"def",
"GetContiguousPlainText",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextParagraph_GetContiguousPlainText",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/richtext.py#L2015-L2017 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/ops/control_flow_ops.py | python | CondContext.__init__ | (self, pred=None, pivot=None, branch=None,
name="cond_text", context_def=None, import_scope=None) | Creates a `CondContext`.
Args:
pred: The `boolean` tensor for the conditional predicate.
pivot: The predicate tensor in this branch.
branch: 0 or 1 representing this branch.
name: Name of the `CondContext` python object.
context_def: Optional `ContextDef` protocol buffer to initialize... | Creates a `CondContext`. | [
"Creates",
"a",
"CondContext",
"."
] | def __init__(self, pred=None, pivot=None, branch=None,
name="cond_text", context_def=None, import_scope=None):
"""Creates a `CondContext`.
Args:
pred: The `boolean` tensor for the conditional predicate.
pivot: The predicate tensor in this branch.
branch: 0 or 1 representing thi... | [
"def",
"__init__",
"(",
"self",
",",
"pred",
"=",
"None",
",",
"pivot",
"=",
"None",
",",
"branch",
"=",
"None",
",",
"name",
"=",
"\"cond_text\"",
",",
"context_def",
"=",
"None",
",",
"import_scope",
"=",
"None",
")",
":",
"self",
".",
"_name",
"="... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/control_flow_ops.py#L1515-L1542 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/share/doc/python3.7/examples/Tools/gdb/libpython.py | python | move_in_stack | (move_up) | Move up or down the stack (for the py-up/py-down command) | Move up or down the stack (for the py-up/py-down command) | [
"Move",
"up",
"or",
"down",
"the",
"stack",
"(",
"for",
"the",
"py",
"-",
"up",
"/",
"py",
"-",
"down",
"command",
")"
] | def move_in_stack(move_up):
'''Move up or down the stack (for the py-up/py-down command)'''
frame = Frame.get_selected_python_frame()
if not frame:
print('Unable to locate python frame')
return
while frame:
if move_up:
iter_frame = frame.older()
else:
... | [
"def",
"move_in_stack",
"(",
"move_up",
")",
":",
"frame",
"=",
"Frame",
".",
"get_selected_python_frame",
"(",
")",
"if",
"not",
"frame",
":",
"print",
"(",
"'Unable to locate python frame'",
")",
"return",
"while",
"frame",
":",
"if",
"move_up",
":",
"iter_f... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/share/doc/python3.7/examples/Tools/gdb/libpython.py#L1787-L1814 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/sets_impl.py | python | _set_operation | (a, b, set_operation, validate_indices=True) | return sparse_tensor.SparseTensor(indices, values, shape) | Compute set operation of elements in last dimension of `a` and `b`.
All but the last dimension of `a` and `b` must match.
Args:
a: `Tensor` or `SparseTensor` of the same type as `b`. If sparse, indices
must be sorted in row-major order.
b: `Tensor` or `SparseTensor` of the same type as `a`. Must b... | Compute set operation of elements in last dimension of `a` and `b`. | [
"Compute",
"set",
"operation",
"of",
"elements",
"in",
"last",
"dimension",
"of",
"a",
"and",
"b",
"."
] | def _set_operation(a, b, set_operation, validate_indices=True):
"""Compute set operation of elements in last dimension of `a` and `b`.
All but the last dimension of `a` and `b` must match.
Args:
a: `Tensor` or `SparseTensor` of the same type as `b`. If sparse, indices
must be sorted in row-major ord... | [
"def",
"_set_operation",
"(",
"a",
",",
"b",
",",
"set_operation",
",",
"validate_indices",
"=",
"True",
")",
":",
"if",
"isinstance",
"(",
"a",
",",
"sparse_tensor",
".",
"SparseTensor",
")",
":",
"if",
"isinstance",
"(",
"b",
",",
"sparse_tensor",
".",
... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/sets_impl.py#L91-L131 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/data_flow_ops.py | python | Barrier.barrier_ref | (self) | return self._barrier_ref | Get the underlying barrier reference. | Get the underlying barrier reference. | [
"Get",
"the",
"underlying",
"barrier",
"reference",
"."
] | def barrier_ref(self):
"""Get the underlying barrier reference."""
return self._barrier_ref | [
"def",
"barrier_ref",
"(",
"self",
")",
":",
"return",
"self",
".",
"_barrier_ref"
] | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/data_flow_ops.py#L902-L904 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_misc.py | python | GetActiveWindow | (*args) | return _misc_.GetActiveWindow(*args) | GetActiveWindow() -> Window
Get the currently active window of this application, or None | GetActiveWindow() -> Window | [
"GetActiveWindow",
"()",
"-",
">",
"Window"
] | def GetActiveWindow(*args):
"""
GetActiveWindow() -> Window
Get the currently active window of this application, or None
"""
return _misc_.GetActiveWindow(*args) | [
"def",
"GetActiveWindow",
"(",
"*",
"args",
")",
":",
"return",
"_misc_",
".",
"GetActiveWindow",
"(",
"*",
"args",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_misc.py#L575-L581 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/dataview.py | python | DataViewVirtualListModel.GetCount | (*args, **kwargs) | return _dataview.DataViewVirtualListModel_GetCount(*args, **kwargs) | GetCount(self) -> unsigned int
returns the number of rows | GetCount(self) -> unsigned int | [
"GetCount",
"(",
"self",
")",
"-",
">",
"unsigned",
"int"
] | def GetCount(*args, **kwargs):
"""
GetCount(self) -> unsigned int
returns the number of rows
"""
return _dataview.DataViewVirtualListModel_GetCount(*args, **kwargs) | [
"def",
"GetCount",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_dataview",
".",
"DataViewVirtualListModel_GetCount",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/dataview.py#L1064-L1070 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/calendar.py | python | Calendar.monthdayscalendar | (self, year, month) | return [ days[i:i+7] for i in range(0, len(days), 7) ] | Return a matrix representing a month's calendar.
Each row represents a week; days outside this month are zero. | Return a matrix representing a month's calendar.
Each row represents a week; days outside this month are zero. | [
"Return",
"a",
"matrix",
"representing",
"a",
"month",
"s",
"calendar",
".",
"Each",
"row",
"represents",
"a",
"week",
";",
"days",
"outside",
"this",
"month",
"are",
"zero",
"."
] | def monthdayscalendar(self, year, month):
"""
Return a matrix representing a month's calendar.
Each row represents a week; days outside this month are zero.
"""
days = list(self.itermonthdays(year, month))
return [ days[i:i+7] for i in range(0, len(days), 7) ] | [
"def",
"monthdayscalendar",
"(",
"self",
",",
"year",
",",
"month",
")",
":",
"days",
"=",
"list",
"(",
"self",
".",
"itermonthdays",
"(",
"year",
",",
"month",
")",
")",
"return",
"[",
"days",
"[",
"i",
":",
"i",
"+",
"7",
"]",
"for",
"i",
"in",... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/calendar.py#L212-L218 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/legacy_seq2seq/python/ops/seq2seq.py | python | embedding_tied_rnn_seq2seq | (encoder_inputs,
decoder_inputs,
cell,
num_symbols,
embedding_size,
num_decoder_symbols=None,
output_projection=None,
... | Embedding RNN sequence-to-sequence model with tied (shared) parameters.
This model first embeds encoder_inputs by a newly created embedding (of shape
[num_symbols x input_size]). Then it runs an RNN to encode embedded
encoder_inputs into a state vector. Next, it embeds decoder_inputs using
the same embedding. ... | Embedding RNN sequence-to-sequence model with tied (shared) parameters. | [
"Embedding",
"RNN",
"sequence",
"-",
"to",
"-",
"sequence",
"model",
"with",
"tied",
"(",
"shared",
")",
"parameters",
"."
] | def embedding_tied_rnn_seq2seq(encoder_inputs,
decoder_inputs,
cell,
num_symbols,
embedding_size,
num_decoder_symbols=None,
output_pro... | [
"def",
"embedding_tied_rnn_seq2seq",
"(",
"encoder_inputs",
",",
"decoder_inputs",
",",
"cell",
",",
"num_symbols",
",",
"embedding_size",
",",
"num_decoder_symbols",
"=",
"None",
",",
"output_projection",
"=",
"None",
",",
"feed_previous",
"=",
"False",
",",
"dtype... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/legacy_seq2seq/python/ops/seq2seq.py#L409-L534 | ||
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/logging/handlers.py | python | SMTPHandler.date_time | (self) | return s | Return the current date and time formatted for a MIME header.
Needed for Python 1.5.2 (no email package available) | Return the current date and time formatted for a MIME header.
Needed for Python 1.5.2 (no email package available) | [
"Return",
"the",
"current",
"date",
"and",
"time",
"formatted",
"for",
"a",
"MIME",
"header",
".",
"Needed",
"for",
"Python",
"1",
".",
"5",
".",
"2",
"(",
"no",
"email",
"package",
"available",
")"
] | def date_time(self):
"""
Return the current date and time formatted for a MIME header.
Needed for Python 1.5.2 (no email package available)
"""
year, month, day, hh, mm, ss, wd, y, z = time.gmtime(time.time())
s = "%s, %02d %3s %4d %02d:%02d:%02d GMT" % (
... | [
"def",
"date_time",
"(",
"self",
")",
":",
"year",
",",
"month",
",",
"day",
",",
"hh",
",",
"mm",
",",
"ss",
",",
"wd",
",",
"y",
",",
"z",
"=",
"time",
".",
"gmtime",
"(",
"time",
".",
"time",
"(",
")",
")",
"s",
"=",
"\"%s, %02d %3s %4d %02d... | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/logging/handlers.py#L838-L848 | |
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | third_party/numpy/files/numpy/ma/mrecords.py | python | MaskedRecords.view | (self, dtype=None, type=None) | return output | Returns a view of the mrecarray. | Returns a view of the mrecarray. | [
"Returns",
"a",
"view",
"of",
"the",
"mrecarray",
"."
] | def view(self, dtype=None, type=None):
"""Returns a view of the mrecarray."""
# OK, basic copy-paste from MaskedArray.view...
if dtype is None:
if type is None:
output = ndarray.view(self)
else:
output = ndarray.view(self, type)
# H... | [
"def",
"view",
"(",
"self",
",",
"dtype",
"=",
"None",
",",
"type",
"=",
"None",
")",
":",
"# OK, basic copy-paste from MaskedArray.view...",
"if",
"dtype",
"is",
"None",
":",
"if",
"type",
"is",
"None",
":",
"output",
"=",
"ndarray",
".",
"view",
"(",
"... | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/ma/mrecords.py#L345-L381 | |
google-coral/edgetpu | 5020de9386ff370dcc1f63291a2d0f98eeb98adb | edgetpu/utils/dataset_utils.py | python | read_label_file | (file_path) | return ret | Reads labels from text file and store it in a dict.
This function supports following formats:
1. Each line contains id and description separated by colon or space.
Example: '0:cat' or '0 cat'.
2. Each line contains description only. Label's id equals to row number.
Args:
file_path: String, path to t... | Reads labels from text file and store it in a dict. | [
"Reads",
"labels",
"from",
"text",
"file",
"and",
"store",
"it",
"in",
"a",
"dict",
"."
] | def read_label_file(file_path):
"""Reads labels from text file and store it in a dict.
This function supports following formats:
1. Each line contains id and description separated by colon or space.
Example: '0:cat' or '0 cat'.
2. Each line contains description only. Label's id equals to row number.
A... | [
"def",
"read_label_file",
"(",
"file_path",
")",
":",
"with",
"open",
"(",
"file_path",
",",
"'r'",
",",
"encoding",
"=",
"'utf-8'",
")",
"as",
"f",
":",
"lines",
"=",
"f",
".",
"readlines",
"(",
")",
"ret",
"=",
"{",
"}",
"for",
"row_number",
",",
... | https://github.com/google-coral/edgetpu/blob/5020de9386ff370dcc1f63291a2d0f98eeb98adb/edgetpu/utils/dataset_utils.py#L19-L43 | |
cmu-db/noisepage | 79276e68fe83322f1249e8a8be96bd63c583ae56 | build-support/cpplint.py | python | CheckIncludeLine | (filename, clean_lines, linenum, include_state, error) | Check rules that are applicable to #include lines.
Strings on #include lines are NOT removed from elided line, to make
certain tasks easier. However, to prevent false positives, checks
applicable to #include lines in CheckLanguage must be put here.
Args:
filename: The name of the current file.
clean_l... | Check rules that are applicable to #include lines. | [
"Check",
"rules",
"that",
"are",
"applicable",
"to",
"#include",
"lines",
"."
] | def CheckIncludeLine(filename, clean_lines, linenum, include_state, error):
"""Check rules that are applicable to #include lines.
Strings on #include lines are NOT removed from elided line, to make
certain tasks easier. However, to prevent false positives, checks
applicable to #include lines in CheckLanguage... | [
"def",
"CheckIncludeLine",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"include_state",
",",
"error",
")",
":",
"fileinfo",
"=",
"FileInfo",
"(",
"filename",
")",
"line",
"=",
"clean_lines",
".",
"lines",
"[",
"linenum",
"]",
"# \"include\" shoul... | https://github.com/cmu-db/noisepage/blob/79276e68fe83322f1249e8a8be96bd63c583ae56/build-support/cpplint.py#L4777-L4864 | ||
toggl-open-source/toggldesktop | 91865205885531cc8fd9e8d613dad49d625d56e7 | third_party/cpplint/cpplint.py | python | FilesBelongToSameModule | (filename_cc, filename_h) | return files_belong_to_same_module, common_path | Check if these two filenames belong to the same module.
The concept of a 'module' here is a as follows:
foo.h, foo-inl.h, foo.cc, foo_test.cc and foo_unittest.cc belong to the
same 'module' if they are in the same directory.
some/path/public/xyzzy and some/path/internal/xyzzy are also considered
to belong to... | Check if these two filenames belong to the same module. | [
"Check",
"if",
"these",
"two",
"filenames",
"belong",
"to",
"the",
"same",
"module",
"."
] | def FilesBelongToSameModule(filename_cc, filename_h):
"""Check if these two filenames belong to the same module.
The concept of a 'module' here is a as follows:
foo.h, foo-inl.h, foo.cc, foo_test.cc and foo_unittest.cc belong to the
same 'module' if they are in the same directory.
some/path/public/xyzzy and ... | [
"def",
"FilesBelongToSameModule",
"(",
"filename_cc",
",",
"filename_h",
")",
":",
"if",
"not",
"filename_cc",
".",
"endswith",
"(",
"'.cc'",
")",
":",
"return",
"(",
"False",
",",
"''",
")",
"filename_cc",
"=",
"filename_cc",
"[",
":",
"-",
"len",
"(",
... | https://github.com/toggl-open-source/toggldesktop/blob/91865205885531cc8fd9e8d613dad49d625d56e7/third_party/cpplint/cpplint.py#L5522-L5574 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/idlelib/autocomplete_w.py | python | AutoCompleteWindow._selection_changed | (self) | Call when the selection of the Listbox has changed.
Updates the Listbox display and calls _change_start. | Call when the selection of the Listbox has changed. | [
"Call",
"when",
"the",
"selection",
"of",
"the",
"Listbox",
"has",
"changed",
"."
] | def _selection_changed(self):
"""Call when the selection of the Listbox has changed.
Updates the Listbox display and calls _change_start.
"""
cursel = int(self.listbox.curselection()[0])
self.listbox.see(cursel)
lts = self.lasttypedstart
selstart = self.complet... | [
"def",
"_selection_changed",
"(",
"self",
")",
":",
"cursel",
"=",
"int",
"(",
"self",
".",
"listbox",
".",
"curselection",
"(",
")",
"[",
"0",
"]",
")",
"self",
".",
"listbox",
".",
"see",
"(",
"cursel",
")",
"lts",
"=",
"self",
".",
"lasttypedstart... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/idlelib/autocomplete_w.py#L120-L156 | ||
rodeofx/OpenWalter | 6116fbe3f04f1146c854afbfbdbe944feaee647e | walter/maya/scripts/AEwalterOverrideTemplate.py | python | AEwalterOverrideTemplate.renameAttr | (self, node, old, new, nameLayout, attrLayout, buttonLayout) | Rename the given attribute to the name given in the "new" argument.
Update the UI layout. | Rename the given attribute to the name given in the "new" argument.
Update the UI layout. | [
"Rename",
"the",
"given",
"attribute",
"to",
"the",
"name",
"given",
"in",
"the",
"new",
"argument",
".",
"Update",
"the",
"UI",
"layout",
"."
] | def renameAttr(self, node, old, new, nameLayout, attrLayout, buttonLayout):
"""
Rename the given attribute to the name given in the "new" argument.
Update the UI layout.
"""
# Rename Maya attribute
plug = '.'.join([node, old])
cmds.renameAttr(plug, new)
#... | [
"def",
"renameAttr",
"(",
"self",
",",
"node",
",",
"old",
",",
"new",
",",
"nameLayout",
",",
"attrLayout",
",",
"buttonLayout",
")",
":",
"# Rename Maya attribute",
"plug",
"=",
"'.'",
".",
"join",
"(",
"[",
"node",
",",
"old",
"]",
")",
"cmds",
".",... | https://github.com/rodeofx/OpenWalter/blob/6116fbe3f04f1146c854afbfbdbe944feaee647e/walter/maya/scripts/AEwalterOverrideTemplate.py#L615-L647 | ||
google/or-tools | 2cb85b4eead4c38e1c54b48044f92087cf165bce | ortools/sat/python/cp_model.py | python | CpModel.AddBoolXOr | (self, literals) | return ct | Adds `XOr(literals) == true`.
In contrast to AddBoolOr and AddBoolAnd, it does not support
.OnlyEnforceIf().
Args:
literals: the list of literals in the constraint.
Returns:
An `Constraint` object. | Adds `XOr(literals) == true`. | [
"Adds",
"XOr",
"(",
"literals",
")",
"==",
"true",
"."
] | def AddBoolXOr(self, literals):
"""Adds `XOr(literals) == true`.
In contrast to AddBoolOr and AddBoolAnd, it does not support
.OnlyEnforceIf().
Args:
literals: the list of literals in the constraint.
Returns:
An `Constraint` object.
"""
ct = Constraint(self.__model... | [
"def",
"AddBoolXOr",
"(",
"self",
",",
"literals",
")",
":",
"ct",
"=",
"Constraint",
"(",
"self",
".",
"__model",
".",
"constraints",
")",
"model_ct",
"=",
"self",
".",
"__model",
".",
"constraints",
"[",
"ct",
".",
"Index",
"(",
")",
"]",
"model_ct",... | https://github.com/google/or-tools/blob/2cb85b4eead4c38e1c54b48044f92087cf165bce/ortools/sat/python/cp_model.py#L1477-L1493 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/ros_comm/rospy/src/rospy/impl/registration.py | python | RegistrationListener.reg_added | (self, resolved_name, data_type_or_uri, reg_type) | New pub/sub/service declared.
@param resolved_name: resolved topic/service name
@param data_type_or_uri: topic type or service uri
@type data_type_or_uri: str
@param reg_type: Valid values are L{Registration.PUB}, L{Registration.SUB}, L{Registration.SRV}
@type reg_type: str | New pub/sub/service declared. | [
"New",
"pub",
"/",
"sub",
"/",
"service",
"declared",
"."
] | def reg_added(self, resolved_name, data_type_or_uri, reg_type):
"""
New pub/sub/service declared.
@param resolved_name: resolved topic/service name
@param data_type_or_uri: topic type or service uri
@type data_type_or_uri: str
@param reg_type: Valid values are L{Registr... | [
"def",
"reg_added",
"(",
"self",
",",
"resolved_name",
",",
"data_type_or_uri",
",",
"reg_type",
")",
":",
"pass"
] | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros_comm/rospy/src/rospy/impl/registration.py#L100-L109 | ||
flexflow/FlexFlow | 581fad8ba8d10a16a3102ee2b406b0319586df24 | python/flexflow/keras/datasets/mnist.py | python | load_data | (path='mnist.npz') | return (x_train, y_train), (x_test, y_test) | Loads the MNIST dataset.
# Arguments
path: path where to cache the dataset locally
(relative to ~/.keras/datasets).
# Returns
Tuple of Numpy arrays: `(x_train, y_train), (x_test, y_test)`. | Loads the MNIST dataset. | [
"Loads",
"the",
"MNIST",
"dataset",
"."
] | def load_data(path='mnist.npz'):
"""Loads the MNIST dataset.
# Arguments
path: path where to cache the dataset locally
(relative to ~/.keras/datasets).
# Returns
Tuple of Numpy arrays: `(x_train, y_train), (x_test, y_test)`.
"""
path = get_file(path,
... | [
"def",
"load_data",
"(",
"path",
"=",
"'mnist.npz'",
")",
":",
"path",
"=",
"get_file",
"(",
"path",
",",
"origin",
"=",
"'https://s3.amazonaws.com/img-datasets/mnist.npz'",
",",
"file_hash",
"=",
"'8a61469f7ea1b51cbae51d4f78837e45'",
")",
"with",
"np",
".",
"load",... | https://github.com/flexflow/FlexFlow/blob/581fad8ba8d10a16a3102ee2b406b0319586df24/python/flexflow/keras/datasets/mnist.py#L11-L27 | |
google/or-tools | 2cb85b4eead4c38e1c54b48044f92087cf165bce | examples/python/transit_time.py | python | Vehicle.speed | (self) | return self._speed | Gets the average travel speed of a vehicle | Gets the average travel speed of a vehicle | [
"Gets",
"the",
"average",
"travel",
"speed",
"of",
"a",
"vehicle"
] | def speed(self):
"""Gets the average travel speed of a vehicle"""
return self._speed | [
"def",
"speed",
"(",
"self",
")",
":",
"return",
"self",
".",
"_speed"
] | https://github.com/google/or-tools/blob/2cb85b4eead4c38e1c54b48044f92087cf165bce/examples/python/transit_time.py#L41-L43 | |
intel-iot-devkit/how-to-code-samples | b4ea616f36bbfa2e042beb1698f968cfd651d79f | watering-system/python/iot_watering_system/log.py | python | increment | () | Publish timestamp to MQTT server and data store. | Publish timestamp to MQTT server and data store. | [
"Publish",
"timestamp",
"to",
"MQTT",
"server",
"and",
"data",
"store",
"."
] | def increment():
"""
Publish timestamp to MQTT server and data store.
"""
payload = {"counter": datetime.utcnow().isoformat()}
send(payload) | [
"def",
"increment",
"(",
")",
":",
"payload",
"=",
"{",
"\"counter\"",
":",
"datetime",
".",
"utcnow",
"(",
")",
".",
"isoformat",
"(",
")",
"}",
"send",
"(",
"payload",
")"
] | https://github.com/intel-iot-devkit/how-to-code-samples/blob/b4ea616f36bbfa2e042beb1698f968cfd651d79f/watering-system/python/iot_watering_system/log.py#L36-L43 | ||
bigartm/bigartm | 47e37f982de87aa67bfd475ff1f39da696b181b3 | utils/cpplint.py | python | _IsTestFilename | (filename) | Determines if the given filename has a suffix that identifies it as a test.
Args:
filename: The input filename.
Returns:
True if 'filename' looks like a test, False otherwise. | Determines if the given filename has a suffix that identifies it as a test. | [
"Determines",
"if",
"the",
"given",
"filename",
"has",
"a",
"suffix",
"that",
"identifies",
"it",
"as",
"a",
"test",
"."
] | def _IsTestFilename(filename):
"""Determines if the given filename has a suffix that identifies it as a test.
Args:
filename: The input filename.
Returns:
True if 'filename' looks like a test, False otherwise.
"""
if (filename.endswith('_test.cc') or
filename.endswith('_unittest.cc') or
... | [
"def",
"_IsTestFilename",
"(",
"filename",
")",
":",
"if",
"(",
"filename",
".",
"endswith",
"(",
"'_test.cc'",
")",
"or",
"filename",
".",
"endswith",
"(",
"'_unittest.cc'",
")",
"or",
"filename",
".",
"endswith",
"(",
"'_regtest.cc'",
")",
")",
":",
"ret... | https://github.com/bigartm/bigartm/blob/47e37f982de87aa67bfd475ff1f39da696b181b3/utils/cpplint.py#L4532-L4546 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | third_party/pexpect/pexpect.py | python | spawn.readlines | (self, sizehint=-1) | return lines | This reads until EOF using readline() and returns a list containing
the lines thus read. The optional 'sizehint' argument is ignored. | This reads until EOF using readline() and returns a list containing
the lines thus read. The optional 'sizehint' argument is ignored. | [
"This",
"reads",
"until",
"EOF",
"using",
"readline",
"()",
"and",
"returns",
"a",
"list",
"containing",
"the",
"lines",
"thus",
"read",
".",
"The",
"optional",
"sizehint",
"argument",
"is",
"ignored",
"."
] | def readlines(self, sizehint=-1):
"""This reads until EOF using readline() and returns a list containing
the lines thus read. The optional 'sizehint' argument is ignored. """
lines = []
while True:
line = self.readline()
if not line:
break
... | [
"def",
"readlines",
"(",
"self",
",",
"sizehint",
"=",
"-",
"1",
")",
":",
"lines",
"=",
"[",
"]",
"while",
"True",
":",
"line",
"=",
"self",
".",
"readline",
"(",
")",
"if",
"not",
"line",
":",
"break",
"lines",
".",
"append",
"(",
"line",
")",
... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/third_party/pexpect/pexpect.py#L963-L974 | |
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/benchmarks/analyze.py | python | get_baseline_task_id | (evg_api_config: str, current_task_id: str) | return "" | Get the most recent successful task prior to the current task. | Get the most recent successful task prior to the current task. | [
"Get",
"the",
"most",
"recent",
"successful",
"task",
"prior",
"to",
"the",
"current",
"task",
"."
] | def get_baseline_task_id(evg_api_config: str, current_task_id: str) -> str:
"""Get the most recent successful task prior to the current task."""
evg_api = RetryingEvergreenApi.get_api(config_file=evg_api_config)
current_task = evg_api.task_by_id(current_task_id)
base_version = evg_api.version_by_id(
... | [
"def",
"get_baseline_task_id",
"(",
"evg_api_config",
":",
"str",
",",
"current_task_id",
":",
"str",
")",
"->",
"str",
":",
"evg_api",
"=",
"RetryingEvergreenApi",
".",
"get_api",
"(",
"config_file",
"=",
"evg_api_config",
")",
"current_task",
"=",
"evg_api",
"... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/benchmarks/analyze.py#L18-L41 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/abins/input/casteploader.py | python | CASTEPLoader._parse_phonon_eigenvectors | (self, f_handle) | return np.asarray(vectors) | :param f_handle: file object to read
:returns: eigenvectors (atomic displacements) for all k-points | [] | def _parse_phonon_eigenvectors(self, f_handle):
"""
:param f_handle: file object to read
:returns: eigenvectors (atomic displacements) for all k-points
"""
dim = 3 # we have 3D space
# in general case eigenvectors are complex
vectors = np.zeros((self._num_atoms... | [
"def",
"_parse_phonon_eigenvectors",
"(",
"self",
",",
"f_handle",
")",
":",
"dim",
"=",
"3",
"# we have 3D space",
"# in general case eigenvectors are complex",
"vectors",
"=",
"np",
".",
"zeros",
"(",
"(",
"self",
".",
"_num_atoms",
",",
"self",
".",
"_num_phono... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/abins/input/casteploader.py#L144-L169 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_core.py | python | Window.SetEventHandler | (*args, **kwargs) | return _core_.Window_SetEventHandler(*args, **kwargs) | SetEventHandler(self, EvtHandler handler)
Sets the event handler for this window. An event handler is an object
that is capable of processing the events sent to a window. (In other
words, is able to dispatch the events to handler function.) By
default, the window is its own event han... | SetEventHandler(self, EvtHandler handler) | [
"SetEventHandler",
"(",
"self",
"EvtHandler",
"handler",
")"
] | def SetEventHandler(*args, **kwargs):
"""
SetEventHandler(self, EvtHandler handler)
Sets the event handler for this window. An event handler is an object
that is capable of processing the events sent to a window. (In other
words, is able to dispatch the events to handler funct... | [
"def",
"SetEventHandler",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Window_SetEventHandler",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_core.py#L10364-L10380 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py3/sklearn/base.py | python | RegressorMixin.score | (self, X, y, sample_weight=None) | return r2_score(y, y_pred, sample_weight=sample_weight,
multioutput='variance_weighted') | Return the coefficient of determination R^2 of the prediction.
The coefficient R^2 is defined as (1 - u/v), where u is the residual
sum of squares ((y_true - y_pred) ** 2).sum() and v is the total
sum of squares ((y_true - y_true.mean()) ** 2).sum().
The best possible score is 1.0 and i... | Return the coefficient of determination R^2 of the prediction. | [
"Return",
"the",
"coefficient",
"of",
"determination",
"R^2",
"of",
"the",
"prediction",
"."
] | def score(self, X, y, sample_weight=None):
"""Return the coefficient of determination R^2 of the prediction.
The coefficient R^2 is defined as (1 - u/v), where u is the residual
sum of squares ((y_true - y_pred) ** 2).sum() and v is the total
sum of squares ((y_true - y_true.mean()) ** ... | [
"def",
"score",
"(",
"self",
",",
"X",
",",
"y",
",",
"sample_weight",
"=",
"None",
")",
":",
"from",
".",
"metrics",
"import",
"r2_score",
"from",
".",
"metrics",
".",
"_regression",
"import",
"_check_reg_targets",
"y_pred",
"=",
"self",
".",
"predict",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/base.py#L376-L436 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/nn/layer/container.py | python | SequentialCell.__init__ | (self, *args) | Initialize SequentialCell. | Initialize SequentialCell. | [
"Initialize",
"SequentialCell",
"."
] | def __init__(self, *args):
"""Initialize SequentialCell."""
super(SequentialCell, self).__init__()
self._is_dynamic_name = []
if len(args) == 1:
cells = args[0]
if isinstance(cells, list):
for index, cell in enumerate(cells):
se... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
")",
":",
"super",
"(",
"SequentialCell",
",",
"self",
")",
".",
"__init__",
"(",
")",
"self",
".",
"_is_dynamic_name",
"=",
"[",
"]",
"if",
"len",
"(",
"args",
")",
"==",
"1",
":",
"cells",
"=",
... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/nn/layer/container.py#L140-L164 | ||
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_aarch64/python2.7/dist-packages/rospkg/rospack.py | python | ManifestManager.get_manifest | (self, name) | :raises: :exc:`InvalidManifest` | :raises: :exc:`InvalidManifest` | [
":",
"raises",
":",
":",
"exc",
":",
"InvalidManifest"
] | def get_manifest(self, name):
"""
:raises: :exc:`InvalidManifest`
"""
if name in self._manifests:
return self._manifests[name]
else:
return self._load_manifest(name) | [
"def",
"get_manifest",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
"in",
"self",
".",
"_manifests",
":",
"return",
"self",
".",
"_manifests",
"[",
"name",
"]",
"else",
":",
"return",
"self",
".",
"_load_manifest",
"(",
"name",
")"
] | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_aarch64/python2.7/dist-packages/rospkg/rospack.py#L157-L164 | ||
google-ar/WebARonTango | e86965d2cbc652156b480e0fcf77c716745578cd | chromium/src/gpu/command_buffer/build_gles2_cmd_buffer.py | python | CustomHandler.WriteImmediateServiceUnitTest | (self, func, f, *extras) | Overrriden from TypeHandler. | Overrriden from TypeHandler. | [
"Overrriden",
"from",
"TypeHandler",
"."
] | def WriteImmediateServiceUnitTest(self, func, f, *extras):
"""Overrriden from TypeHandler."""
pass | [
"def",
"WriteImmediateServiceUnitTest",
"(",
"self",
",",
"func",
",",
"f",
",",
"*",
"extras",
")",
":",
"pass"
] | https://github.com/google-ar/WebARonTango/blob/e86965d2cbc652156b480e0fcf77c716745578cd/chromium/src/gpu/command_buffer/build_gles2_cmd_buffer.py#L5702-L5704 | ||
mapnik/mapnik | f3da900c355e1d15059c4a91b00203dcc9d9f0ef | scons/scons-local-4.1.0/SCons/Util.py | python | make_path_relative | (path) | return path | makes an absolute path name to a relative pathname. | makes an absolute path name to a relative pathname. | [
"makes",
"an",
"absolute",
"path",
"name",
"to",
"a",
"relative",
"pathname",
"."
] | def make_path_relative(path):
""" makes an absolute path name to a relative pathname.
"""
if os.path.isabs(path):
drive_s,path = os.path.splitdrive(path)
import re
if not drive_s:
path=re.compile("/*(.*)").findall(path)[0]
else:
path=path[1:]
ass... | [
"def",
"make_path_relative",
"(",
"path",
")",
":",
"if",
"os",
".",
"path",
".",
"isabs",
"(",
"path",
")",
":",
"drive_s",
",",
"path",
"=",
"os",
".",
"path",
".",
"splitdrive",
"(",
"path",
")",
"import",
"re",
"if",
"not",
"drive_s",
":",
"pat... | https://github.com/mapnik/mapnik/blob/f3da900c355e1d15059c4a91b00203dcc9d9f0ef/scons/scons-local-4.1.0/SCons/Util.py#L1393-L1406 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/distutils/ccompiler.py | python | get_default_compiler | (osname=None, platform=None) | return 'unix' | Determine the default compiler to use for the given platform.
osname should be one of the standard Python OS names (i.e. the
ones returned by os.name) and platform the common value
returned by sys.platform for the platform in question.
The default values are os.name and sys.platform in... | Determine the default compiler to use for the given platform. | [
"Determine",
"the",
"default",
"compiler",
"to",
"use",
"for",
"the",
"given",
"platform",
"."
] | def get_default_compiler(osname=None, platform=None):
""" Determine the default compiler to use for the given platform.
osname should be one of the standard Python OS names (i.e. the
ones returned by os.name) and platform the common value
returned by sys.platform for the platform in questio... | [
"def",
"get_default_compiler",
"(",
"osname",
"=",
"None",
",",
"platform",
"=",
"None",
")",
":",
"if",
"osname",
"is",
"None",
":",
"osname",
"=",
"os",
".",
"name",
"if",
"platform",
"is",
"None",
":",
"platform",
"=",
"sys",
".",
"platform",
"for",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/distutils/ccompiler.py#L913-L933 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/lib/mixins.py | python | _numeric_methods | (ufunc, name) | return (_binary_method(ufunc, name),
_reflected_binary_method(ufunc, name),
_inplace_binary_method(ufunc, name)) | Implement forward, reflected and inplace binary methods with a ufunc. | Implement forward, reflected and inplace binary methods with a ufunc. | [
"Implement",
"forward",
"reflected",
"and",
"inplace",
"binary",
"methods",
"with",
"a",
"ufunc",
"."
] | def _numeric_methods(ufunc, name):
"""Implement forward, reflected and inplace binary methods with a ufunc."""
return (_binary_method(ufunc, name),
_reflected_binary_method(ufunc, name),
_inplace_binary_method(ufunc, name)) | [
"def",
"_numeric_methods",
"(",
"ufunc",
",",
"name",
")",
":",
"return",
"(",
"_binary_method",
"(",
"ufunc",
",",
"name",
")",
",",
"_reflected_binary_method",
"(",
"ufunc",
",",
"name",
")",
",",
"_inplace_binary_method",
"(",
"ufunc",
",",
"name",
")",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/lib/mixins.py#L48-L52 | |
bumptop/BumpTop | 466d23597a07ae738f4265262fa01087fc6e257c | trunk/win/Source/bin/jinja2/filters.py | python | do_urlize | (environment, value, trim_url_limit=None, nofollow=False) | return rv | Converts URLs in plain text into clickable links.
If you pass the filter an additional integer it will shorten the urls
to that number. Also a third argument exists that makes the urls
"nofollow":
.. sourcecode:: jinja
{{ mytext|urlize(40, true) }}
links are shortened to 40 chars ... | Converts URLs in plain text into clickable links. | [
"Converts",
"URLs",
"in",
"plain",
"text",
"into",
"clickable",
"links",
"."
] | def do_urlize(environment, value, trim_url_limit=None, nofollow=False):
"""Converts URLs in plain text into clickable links.
If you pass the filter an additional integer it will shorten the urls
to that number. Also a third argument exists that makes the urls
"nofollow":
.. sourcecode:: jinja
... | [
"def",
"do_urlize",
"(",
"environment",
",",
"value",
",",
"trim_url_limit",
"=",
"None",
",",
"nofollow",
"=",
"False",
")",
":",
"rv",
"=",
"urlize",
"(",
"value",
",",
"trim_url_limit",
",",
"nofollow",
")",
"if",
"environment",
".",
"autoescape",
":",
... | https://github.com/bumptop/BumpTop/blob/466d23597a07ae738f4265262fa01087fc6e257c/trunk/win/Source/bin/jinja2/filters.py#L313-L328 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/Diffraction/isis_powder/abstract_inst.py | python | AbstractInst._apply_absorb_corrections | (self, run_details, ws_to_correct) | Generates absorption corrections to compensate for the container. The overriding instrument
should handle the difference between a vanadium workspace and regular workspace
:param ws_to_correct: A reference vanadium workspace to match the binning of or correct
:return: A w... | Generates absorption corrections to compensate for the container. The overriding instrument
should handle the difference between a vanadium workspace and regular workspace
:param ws_to_correct: A reference vanadium workspace to match the binning of or correct
:return: A w... | [
"Generates",
"absorption",
"corrections",
"to",
"compensate",
"for",
"the",
"container",
".",
"The",
"overriding",
"instrument",
"should",
"handle",
"the",
"difference",
"between",
"a",
"vanadium",
"workspace",
"and",
"regular",
"workspace",
":",
"param",
"ws_to_cor... | def _apply_absorb_corrections(self, run_details, ws_to_correct):
"""
Generates absorption corrections to compensate for the container. The overriding instrument
should handle the difference between a vanadium workspace and regular workspace
:param ws_to_correct: A... | [
"def",
"_apply_absorb_corrections",
"(",
"self",
",",
"run_details",
",",
"ws_to_correct",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"apply_absorb_corrections Not implemented for this instrument yet\"",
")"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/Diffraction/isis_powder/abstract_inst.py#L134-L142 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/core/function_base.py | python | linspace | (start, stop, num=50, endpoint=True, retstep=False, dtype=None,
axis=0) | Return evenly spaced numbers over a specified interval.
Returns `num` evenly spaced samples, calculated over the
interval [`start`, `stop`].
The endpoint of the interval can optionally be excluded.
.. versionchanged:: 1.16.0
Non-scalar `start` and `stop` are now supported.
Parameters
... | Return evenly spaced numbers over a specified interval. | [
"Return",
"evenly",
"spaced",
"numbers",
"over",
"a",
"specified",
"interval",
"."
] | def linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None,
axis=0):
"""
Return evenly spaced numbers over a specified interval.
Returns `num` evenly spaced samples, calculated over the
interval [`start`, `stop`].
The endpoint of the interval can optionally be excluded... | [
"def",
"linspace",
"(",
"start",
",",
"stop",
",",
"num",
"=",
"50",
",",
"endpoint",
"=",
"True",
",",
"retstep",
"=",
"False",
",",
"dtype",
"=",
"None",
",",
"axis",
"=",
"0",
")",
":",
"try",
":",
"num",
"=",
"operator",
".",
"index",
"(",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/core/function_base.py#L27-L174 | ||
zhuli19901106/leetcode-zhuli | 0f8fc29ccb8c33ea91149ecb2d4e961024c11db7 | algorithms/0501-1000/0702_search-in-a-sorted-array-of-unknown-size_1_AC.py | python | Solution.search | (self, reader, target) | return -1 | :type reader: ArrayReader
:type target: int
:rtype: int | :type reader: ArrayReader
:type target: int
:rtype: int | [
":",
"type",
"reader",
":",
"ArrayReader",
":",
"type",
"target",
":",
"int",
":",
"rtype",
":",
"int"
] | def search(self, reader, target):
"""
:type reader: ArrayReader
:type target: int
:rtype: int
"""
low = 0
high = 2 ** 31 - 1
while high - low > 1:
mid = low + (high - low) // 2
val = reader.get(mid)
if val == Solution.I... | [
"def",
"search",
"(",
"self",
",",
"reader",
",",
"target",
")",
":",
"low",
"=",
"0",
"high",
"=",
"2",
"**",
"31",
"-",
"1",
"while",
"high",
"-",
"low",
">",
"1",
":",
"mid",
"=",
"low",
"+",
"(",
"high",
"-",
"low",
")",
"//",
"2",
"val... | https://github.com/zhuli19901106/leetcode-zhuli/blob/0f8fc29ccb8c33ea91149ecb2d4e961024c11db7/algorithms/0501-1000/0702_search-in-a-sorted-array-of-unknown-size_1_AC.py#L13-L42 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/numpy/multiarray.py | python | tile | (A, reps) | return _mx_nd_np.tile(A, reps) | r"""
Construct an array by repeating A the number of times given by reps.
If `reps` has length ``d``, the result will have dimension of
``max(d, A.ndim)``.
If ``A.ndim < d``, `A` is promoted to be d-dimensional by prepending new
axes. So a shape (3,) array is promoted to (1, 3) for 2-D replication... | r"""
Construct an array by repeating A the number of times given by reps. | [
"r",
"Construct",
"an",
"array",
"by",
"repeating",
"A",
"the",
"number",
"of",
"times",
"given",
"by",
"reps",
"."
] | def tile(A, reps):
r"""
Construct an array by repeating A the number of times given by reps.
If `reps` has length ``d``, the result will have dimension of
``max(d, A.ndim)``.
If ``A.ndim < d``, `A` is promoted to be d-dimensional by prepending new
axes. So a shape (3,) array is promoted to (1,... | [
"def",
"tile",
"(",
"A",
",",
"reps",
")",
":",
"return",
"_mx_nd_np",
".",
"tile",
"(",
"A",
",",
"reps",
")"
] | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/numpy/multiarray.py#L6476-L6540 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/python/turicreate/data_structures/gframe.py | python | GFrame.add_columns | (self, data, column_names=None, inplace=False) | Adds columns to the SFrame. The number of elements in all columns must
match every other column of the SFrame.
If inplace == False (default) this operation does not modify the
current SFrame, returning a new SFrame.
If inplace == True, this operation modifies the current
SFram... | Adds columns to the SFrame. The number of elements in all columns must
match every other column of the SFrame. | [
"Adds",
"columns",
"to",
"the",
"SFrame",
".",
"The",
"number",
"of",
"elements",
"in",
"all",
"columns",
"must",
"match",
"every",
"other",
"column",
"of",
"the",
"SFrame",
"."
] | def add_columns(self, data, column_names=None, inplace=False):
"""
Adds columns to the SFrame. The number of elements in all columns must
match every other column of the SFrame.
If inplace == False (default) this operation does not modify the
current SFrame, returning a new SFr... | [
"def",
"add_columns",
"(",
"self",
",",
"data",
",",
"column_names",
"=",
"None",
",",
"inplace",
"=",
"False",
")",
":",
"datalist",
"=",
"data",
"if",
"isinstance",
"(",
"data",
",",
"SFrame",
")",
":",
"other",
"=",
"data",
"datalist",
"=",
"[",
"... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/python/turicreate/data_structures/gframe.py#L108-L162 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.