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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
giuspen/cherrytree | 84712f206478fcf9acf30174009ad28c648c6344 | pygtk2/modules/core.py | python | CherryTree.links_entries_reset | (self) | Reset Global Links Variables | Reset Global Links Variables | [
"Reset",
"Global",
"Links",
"Variables"
] | def links_entries_reset(self):
"""Reset Global Links Variables"""
self.link_node_id = None
self.links_entries['webs'] = ""
self.links_entries['file'] = ""
self.links_entries['fold'] = ""
self.links_entries['anch'] = "" | [
"def",
"links_entries_reset",
"(",
"self",
")",
":",
"self",
".",
"link_node_id",
"=",
"None",
"self",
".",
"links_entries",
"[",
"'webs'",
"]",
"=",
"\"\"",
"self",
".",
"links_entries",
"[",
"'file'",
"]",
"=",
"\"\"",
"self",
".",
"links_entries",
"[",
... | https://github.com/giuspen/cherrytree/blob/84712f206478fcf9acf30174009ad28c648c6344/pygtk2/modules/core.py#L4601-L4607 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_gdi.py | python | Locale.GetLanguage | (*args, **kwargs) | return _gdi_.Locale_GetLanguage(*args, **kwargs) | GetLanguage(self) -> int | GetLanguage(self) -> int | [
"GetLanguage",
"(",
"self",
")",
"-",
">",
"int"
] | def GetLanguage(*args, **kwargs):
"""GetLanguage(self) -> int"""
return _gdi_.Locale_GetLanguage(*args, **kwargs) | [
"def",
"GetLanguage",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"Locale_GetLanguage",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_gdi.py#L3029-L3031 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/OpenSSL/crypto.py | python | NetscapeSPKI.get_pubkey | (self) | return pkey | Get the public key of this certificate.
:return: The public key.
:rtype: :py:class:`PKey` | Get the public key of this certificate. | [
"Get",
"the",
"public",
"key",
"of",
"this",
"certificate",
"."
] | def get_pubkey(self):
"""
Get the public key of this certificate.
:return: The public key.
:rtype: :py:class:`PKey`
"""
pkey = PKey.__new__(PKey)
pkey._pkey = _lib.NETSCAPE_SPKI_get_pubkey(self._spki)
_openssl_assert(pkey._pkey != _ffi.NULL)
pkey.... | [
"def",
"get_pubkey",
"(",
"self",
")",
":",
"pkey",
"=",
"PKey",
".",
"__new__",
"(",
"PKey",
")",
"pkey",
".",
"_pkey",
"=",
"_lib",
".",
"NETSCAPE_SPKI_get_pubkey",
"(",
"self",
".",
"_spki",
")",
"_openssl_assert",
"(",
"pkey",
".",
"_pkey",
"!=",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/OpenSSL/crypto.py#L2581-L2593 | |
xhzdeng/crpn | a5aef0f80dbe486103123f740c634fb01e6cc9a1 | lib/datasets/imdb.py | python | imdb.evaluate_recall | (self, candidate_boxes=None, thresholds=None,
area='all', limit=None) | return {'ar': ar, 'recalls': recalls, 'thresholds': thresholds,
'gt_overlaps': gt_overlaps} | Evaluate detection proposal recall metrics.
Returns:
results: dictionary of results with keys
'ar': average recall
'recalls': vector recalls at each IoU overlap threshold
'thresholds': vector of IoU overlap thresholds
'gt_overlaps': ve... | Evaluate detection proposal recall metrics. | [
"Evaluate",
"detection",
"proposal",
"recall",
"metrics",
"."
] | def evaluate_recall(self, candidate_boxes=None, thresholds=None,
area='all', limit=None):
"""Evaluate detection proposal recall metrics.
Returns:
results: dictionary of results with keys
'ar': average recall
'recalls': vector recalls a... | [
"def",
"evaluate_recall",
"(",
"self",
",",
"candidate_boxes",
"=",
"None",
",",
"thresholds",
"=",
"None",
",",
"area",
"=",
"'all'",
",",
"limit",
"=",
"None",
")",
":",
"# Record max overlap value for each gt box",
"# Return vector of overlap values",
"areas",
"=... | https://github.com/xhzdeng/crpn/blob/a5aef0f80dbe486103123f740c634fb01e6cc9a1/lib/datasets/imdb.py#L126-L214 | |
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/resmokelib/hang_analyzer/dumper.py | python | LLDBDumper._find_debugger | (debugger) | return find_program(debugger, ['/usr/bin']) | Find the installed debugger. | Find the installed debugger. | [
"Find",
"the",
"installed",
"debugger",
"."
] | def _find_debugger(debugger):
"""Find the installed debugger."""
return find_program(debugger, ['/usr/bin']) | [
"def",
"_find_debugger",
"(",
"debugger",
")",
":",
"return",
"find_program",
"(",
"debugger",
",",
"[",
"'/usr/bin'",
"]",
")"
] | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/resmokelib/hang_analyzer/dumper.py#L211-L213 | |
intel/llvm | e6d0547e9d99b5a56430c4749f6c7e328bf221ab | lldb/third_party/Python/module/pexpect-4.6/pexpect/screen.py | python | constrain | (n, min, max) | return n | This returns a number, n constrained to the min and max bounds. | This returns a number, n constrained to the min and max bounds. | [
"This",
"returns",
"a",
"number",
"n",
"constrained",
"to",
"the",
"min",
"and",
"max",
"bounds",
"."
] | def constrain (n, min, max):
'''This returns a number, n constrained to the min and max bounds. '''
if n < min:
return min
if n > max:
return max
return n | [
"def",
"constrain",
"(",
"n",
",",
"min",
",",
"max",
")",
":",
"if",
"n",
"<",
"min",
":",
"return",
"min",
"if",
"n",
">",
"max",
":",
"return",
"max",
"return",
"n"
] | https://github.com/intel/llvm/blob/e6d0547e9d99b5a56430c4749f6c7e328bf221ab/lldb/third_party/Python/module/pexpect-4.6/pexpect/screen.py#L60-L68 | |
rapidsai/cudf | d5b2448fc69f17509304d594f029d0df56984962 | python/cudf/cudf/core/column/column.py | python | to_arrow | (self) | return libcudf.interop.to_arrow(
cudf.core.frame.Frame(
cudf.core.column_accessor.ColumnAccessor({"None": self})
),
[["None"]],
keep_index=False,
)["None"].chunk(0) | Convert to PyArrow Array
Examples
--------
>>> import cudf
>>> col = cudf.core.column.as_column([1, 2, 3, 4])
>>> col.to_arrow()
<pyarrow.lib.Int64Array object at 0x7f886547f830>
[
1,
2,
3,
4
] | Convert to PyArrow Array | [
"Convert",
"to",
"PyArrow",
"Array"
] | def to_arrow(self) -> pa.Array:
"""Convert to PyArrow Array
Examples
--------
>>> import cudf
>>> col = cudf.core.column.as_column([1, 2, 3, 4])
>>> col.to_arrow()
<pyarrow.lib.Int64Array object at 0x7f886547f830>
[
1,
2,
3,
... | [
"def",
"to_arrow",
"(",
"self",
")",
"->",
"pa",
".",
"Array",
":",
"return",
"libcudf",
".",
"interop",
".",
"to_arrow",
"(",
"cudf",
".",
"core",
".",
"frame",
".",
"Frame",
"(",
"cudf",
".",
"core",
".",
"column_accessor",
".",
"ColumnAccessor",
"("... | https://github.com/rapidsai/cudf/blob/d5b2448fc69f17509304d594f029d0df56984962/python/cudf/cudf/core/column/column.py#L209-L231 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/utils/data/_typing.py | python | issubtype | (left, right, recursive=True) | return all(_issubtype_with_constraints(variant, constraints, recursive) for variant in variants) | r"""
Check if the left-side type is a subtype of the right-side type.
If any of type is a composite type like `Union` and `TypeVar` with
bounds, it would be expanded into a list of types and check all
of left-side types are subtypes of either one from right-side types. | r"""
Check if the left-side type is a subtype of the right-side type.
If any of type is a composite type like `Union` and `TypeVar` with
bounds, it would be expanded into a list of types and check all
of left-side types are subtypes of either one from right-side types. | [
"r",
"Check",
"if",
"the",
"left",
"-",
"side",
"type",
"is",
"a",
"subtype",
"of",
"the",
"right",
"-",
"side",
"type",
".",
"If",
"any",
"of",
"type",
"is",
"a",
"composite",
"type",
"like",
"Union",
"and",
"TypeVar",
"with",
"bounds",
"it",
"would... | def issubtype(left, right, recursive=True):
r"""
Check if the left-side type is a subtype of the right-side type.
If any of type is a composite type like `Union` and `TypeVar` with
bounds, it would be expanded into a list of types and check all
of left-side types are subtypes of either one from righ... | [
"def",
"issubtype",
"(",
"left",
",",
"right",
",",
"recursive",
"=",
"True",
")",
":",
"left",
"=",
"TYPE2ABC",
".",
"get",
"(",
"left",
",",
"left",
")",
"right",
"=",
"TYPE2ABC",
".",
"get",
"(",
"right",
",",
"right",
")",
"if",
"right",
"is",
... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/utils/data/_typing.py#L51-L87 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/boto3/resources/factory.py | python | ResourceFactory._create_waiter | (factory_self, resource_waiter_model, resource_name,
service_context) | return do_waiter | Creates a new wait method for each resource where both a waiter and
resource model is defined. | Creates a new wait method for each resource where both a waiter and
resource model is defined. | [
"Creates",
"a",
"new",
"wait",
"method",
"for",
"each",
"resource",
"where",
"both",
"a",
"waiter",
"and",
"resource",
"model",
"is",
"defined",
"."
] | def _create_waiter(factory_self, resource_waiter_model, resource_name,
service_context):
"""
Creates a new wait method for each resource where both a waiter and
resource model is defined.
"""
waiter = WaiterAction(resource_waiter_model,
... | [
"def",
"_create_waiter",
"(",
"factory_self",
",",
"resource_waiter_model",
",",
"resource_name",
",",
"service_context",
")",
":",
"waiter",
"=",
"WaiterAction",
"(",
"resource_waiter_model",
",",
"waiter_resource_name",
"=",
"resource_waiter_model",
".",
"name",
")",
... | 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/factory.py#L359-L380 | |
google/earthenterprise | 0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9 | earth_enterprise/src/fusion/portableglobe/servers/postgres_search.py | python | PostgresDatabase.KmlSearch | (self, search_term) | return self.Search(search_term, kml_start_template,
kml_end_template, self.kml_placemark_) | Search all tables and return resuls as kml. | Search all tables and return resuls as kml. | [
"Search",
"all",
"tables",
"and",
"return",
"resuls",
"as",
"kml",
"."
] | def KmlSearch(self, search_term):
"""Search all tables and return resuls as kml."""
return self.Search(search_term, kml_start_template,
kml_end_template, self.kml_placemark_) | [
"def",
"KmlSearch",
"(",
"self",
",",
"search_term",
")",
":",
"return",
"self",
".",
"Search",
"(",
"search_term",
",",
"kml_start_template",
",",
"kml_end_template",
",",
"self",
".",
"kml_placemark_",
")"
] | https://github.com/google/earthenterprise/blob/0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9/earth_enterprise/src/fusion/portableglobe/servers/postgres_search.py#L222-L225 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_windows.py | python | VarScrollHelperBase.GetNonOrientationTargetSize | (*args, **kwargs) | return _windows_.VarScrollHelperBase_GetNonOrientationTargetSize(*args, **kwargs) | GetNonOrientationTargetSize(self) -> int | GetNonOrientationTargetSize(self) -> int | [
"GetNonOrientationTargetSize",
"(",
"self",
")",
"-",
">",
"int"
] | def GetNonOrientationTargetSize(*args, **kwargs):
"""GetNonOrientationTargetSize(self) -> int"""
return _windows_.VarScrollHelperBase_GetNonOrientationTargetSize(*args, **kwargs) | [
"def",
"GetNonOrientationTargetSize",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"VarScrollHelperBase_GetNonOrientationTargetSize",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_windows.py#L2258-L2260 | |
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | tools/playback_benchmark/playback_driver.py | python | PlaybackRequestHandler._GetBenchmarkResource | (self, resource, handler) | Sends requested resource to browser. | Sends requested resource to browser. | [
"Sends",
"requested",
"resource",
"to",
"browser",
"."
] | def _GetBenchmarkResource(self, resource, handler):
"Sends requested resource to browser."
if resource in self.benchmark_resources:
resource = self.benchmark_resources[resource]
handler.send_response(200)
handler.send_header('content-length', len(resource['data']))
handler.send_header('... | [
"def",
"_GetBenchmarkResource",
"(",
"self",
",",
"resource",
",",
"handler",
")",
":",
"if",
"resource",
"in",
"self",
".",
"benchmark_resources",
":",
"resource",
"=",
"self",
".",
"benchmark_resources",
"[",
"resource",
"]",
"handler",
".",
"send_response",
... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/tools/playback_benchmark/playback_driver.py#L159-L171 | ||
balloonwj/TeamTalk | dc79c40687e4c9d7bec07ff5c9782be586fd9b41 | win-client/3rdParty/src/json/devtools/tarball.py | python | decompress | ( tarball_path, base_dir ) | Decompress the gzipped tarball into directory base_dir. | Decompress the gzipped tarball into directory base_dir. | [
"Decompress",
"the",
"gzipped",
"tarball",
"into",
"directory",
"base_dir",
"."
] | def decompress( tarball_path, base_dir ):
"""Decompress the gzipped tarball into directory base_dir.
"""
# !!! This class method is not documented in the online doc
# nor is bz2open!
tar = tarfile.TarFile.gzopen(tarball_path, mode='r')
try:
tar.extractall( base_dir )
finally:
... | [
"def",
"decompress",
"(",
"tarball_path",
",",
"base_dir",
")",
":",
"# !!! This class method is not documented in the online doc",
"# nor is bz2open!",
"tar",
"=",
"tarfile",
".",
"TarFile",
".",
"gzopen",
"(",
"tarball_path",
",",
"mode",
"=",
"'r'",
")",
"try",
"... | https://github.com/balloonwj/TeamTalk/blob/dc79c40687e4c9d7bec07ff5c9782be586fd9b41/win-client/3rdParty/src/json/devtools/tarball.py#L44-L53 | ||
gem5/gem5 | 141cc37c2d4b93959d4c249b8f7e6a8b2ef75338 | util/gerrit-bot/gerrit.py | python | GerritRestAPI.get_account | (self, account_id="self") | return self._get(f"/accounts/{account_id}") | get an account detail from an account_id | get an account detail from an account_id | [
"get",
"an",
"account",
"detail",
"from",
"an",
"account_id"
] | def get_account(self, account_id="self"):
""" get an account detail from an account_id """
return self._get(f"/accounts/{account_id}") | [
"def",
"get_account",
"(",
"self",
",",
"account_id",
"=",
"\"self\"",
")",
":",
"return",
"self",
".",
"_get",
"(",
"f\"/accounts/{account_id}\"",
")"
] | https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/util/gerrit-bot/gerrit.py#L83-L85 | |
citizenfx/fivem | 88276d40cc7baf8285d02754cc5ae42ec7a8563f | vendor/chromium/mojo/public/tools/bindings/pylib/mojom/parse/parser.py | python | Parser.p_attribute_2 | (self, p) | attribute : NAME | attribute : NAME | [
"attribute",
":",
"NAME"
] | def p_attribute_2(self, p):
"""attribute : NAME"""
p[0] = ast.Attribute(p[1], True, filename=self.filename, lineno=p.lineno(1)) | [
"def",
"p_attribute_2",
"(",
"self",
",",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"ast",
".",
"Attribute",
"(",
"p",
"[",
"1",
"]",
",",
"True",
",",
"filename",
"=",
"self",
".",
"filename",
",",
"lineno",
"=",
"p",
".",
"lineno",
"(",
"1",
... | https://github.com/citizenfx/fivem/blob/88276d40cc7baf8285d02754cc5ae42ec7a8563f/vendor/chromium/mojo/public/tools/bindings/pylib/mojom/parse/parser.py#L142-L144 | ||
apache/mesos | 97d9a4063332aae3825d78de71611657e05cf5e2 | support/cpplint.py | python | CleansedLines._CollapseStrings | (elided) | return collapsed | Collapses strings and chars on a line to simple "" or '' blocks.
We nix strings first so we're not fooled by text like '"http://"'
Args:
elided: The line being processed.
Returns:
The line with collapsed strings. | Collapses strings and chars on a line to simple "" or '' blocks. | [
"Collapses",
"strings",
"and",
"chars",
"on",
"a",
"line",
"to",
"simple",
"or",
"blocks",
"."
] | def _CollapseStrings(elided):
"""Collapses strings and chars on a line to simple "" or '' blocks.
We nix strings first so we're not fooled by text like '"http://"'
Args:
elided: The line being processed.
Returns:
The line with collapsed strings.
"""
if _RE_PATTERN_INCLUDE.match(el... | [
"def",
"_CollapseStrings",
"(",
"elided",
")",
":",
"if",
"_RE_PATTERN_INCLUDE",
".",
"match",
"(",
"elided",
")",
":",
"return",
"elided",
"# Remove escaped characters first to make quote/single quote collapsing",
"# basic. Things that look like escaped characters shouldn't occur... | https://github.com/apache/mesos/blob/97d9a4063332aae3825d78de71611657e05cf5e2/support/cpplint.py#L1457-L1521 | |
cocos2d/cocos2d-js | f0a7d4fa454de7076c054b677a36c5968a160901 | build/android-build.py | python | check_environment_variables_sdk | () | return SDK_ROOT | Checking the environment ANDROID_SDK_ROOT, which will be used for building | Checking the environment ANDROID_SDK_ROOT, which will be used for building | [
"Checking",
"the",
"environment",
"ANDROID_SDK_ROOT",
"which",
"will",
"be",
"used",
"for",
"building"
] | def check_environment_variables_sdk():
''' Checking the environment ANDROID_SDK_ROOT, which will be used for building
'''
try:
SDK_ROOT = os.environ['ANDROID_SDK_ROOT']
except Exception:
print "ANDROID_SDK_ROOT not defined. Please define ANDROID_SDK_ROOT in your environment"
sys... | [
"def",
"check_environment_variables_sdk",
"(",
")",
":",
"try",
":",
"SDK_ROOT",
"=",
"os",
".",
"environ",
"[",
"'ANDROID_SDK_ROOT'",
"]",
"except",
"Exception",
":",
"print",
"\"ANDROID_SDK_ROOT not defined. Please define ANDROID_SDK_ROOT in your environment\"",
"sys",
".... | https://github.com/cocos2d/cocos2d-js/blob/f0a7d4fa454de7076c054b677a36c5968a160901/build/android-build.py#L40-L50 | |
gem5/gem5 | 141cc37c2d4b93959d4c249b8f7e6a8b2ef75338 | configs/example/arm/ruby_fs.py | python | create | (args) | return system | Create and configure the system object. | Create and configure the system object. | [
"Create",
"and",
"configure",
"the",
"system",
"object",
"."
] | def create(args):
''' Create and configure the system object. '''
if args.script and not os.path.isfile(args.script):
print("Error: Bootscript %s does not exist" % args.script)
sys.exit(1)
cpu_class = cpu_types[args.cpu][0]
mem_mode = cpu_class.memory_mode()
system = devices.ArmRu... | [
"def",
"create",
"(",
"args",
")",
":",
"if",
"args",
".",
"script",
"and",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"args",
".",
"script",
")",
":",
"print",
"(",
"\"Error: Bootscript %s does not exist\"",
"%",
"args",
".",
"script",
")",
"sys",
... | https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/configs/example/arm/ruby_fs.py#L96-L172 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/internals/blocks.py | python | Block.coerce_to_target_dtype | (self, other) | coerce the current block to a dtype compat for other
we will return a block, possibly object, and not raise
we can also safely try to coerce to the same dtype
and will receive the same block | coerce the current block to a dtype compat for other
we will return a block, possibly object, and not raise | [
"coerce",
"the",
"current",
"block",
"to",
"a",
"dtype",
"compat",
"for",
"other",
"we",
"will",
"return",
"a",
"block",
"possibly",
"object",
"and",
"not",
"raise"
] | def coerce_to_target_dtype(self, other):
"""
coerce the current block to a dtype compat for other
we will return a block, possibly object, and not raise
we can also safely try to coerce to the same dtype
and will receive the same block
"""
# if we cannot then co... | [
"def",
"coerce_to_target_dtype",
"(",
"self",
",",
"other",
")",
":",
"# if we cannot then coerce to object",
"dtype",
",",
"_",
"=",
"infer_dtype_from",
"(",
"other",
",",
"pandas_dtype",
"=",
"True",
")",
"if",
"is_dtype_equal",
"(",
"self",
".",
"dtype",
",",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/internals/blocks.py#L1043-L1105 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/framework/python/framework/tensor_util.py | python | with_shape | (expected_shape, tensor) | return tensor | Asserts tensor has expected shape.
If tensor shape and expected_shape, are fully defined, assert they match.
Otherwise, add assert op that will validate the shape when tensor is
evaluated, and set shape on tensor.
Args:
expected_shape: Expected shape to assert, as a 1D array of ints, or tensor
of ... | Asserts tensor has expected shape. | [
"Asserts",
"tensor",
"has",
"expected",
"shape",
"."
] | def with_shape(expected_shape, tensor):
"""Asserts tensor has expected shape.
If tensor shape and expected_shape, are fully defined, assert they match.
Otherwise, add assert op that will validate the shape when tensor is
evaluated, and set shape on tensor.
Args:
expected_shape: Expected shape to assert,... | [
"def",
"with_shape",
"(",
"expected_shape",
",",
"tensor",
")",
":",
"if",
"isinstance",
"(",
"tensor",
",",
"sparse_tensor",
".",
"SparseTensor",
")",
":",
"raise",
"ValueError",
"(",
"'SparseTensor not supported.'",
")",
"# Shape type must be 1D int32.",
"if",
"te... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/framework/python/framework/tensor_util.py#L205-L272 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/grid.py | python | PyGridCellAttrProvider._setCallbackInfo | (*args, **kwargs) | return _grid.PyGridCellAttrProvider__setCallbackInfo(*args, **kwargs) | _setCallbackInfo(self, PyObject self, PyObject _class) | _setCallbackInfo(self, PyObject self, PyObject _class) | [
"_setCallbackInfo",
"(",
"self",
"PyObject",
"self",
"PyObject",
"_class",
")"
] | def _setCallbackInfo(*args, **kwargs):
"""_setCallbackInfo(self, PyObject self, PyObject _class)"""
return _grid.PyGridCellAttrProvider__setCallbackInfo(*args, **kwargs) | [
"def",
"_setCallbackInfo",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_grid",
".",
"PyGridCellAttrProvider__setCallbackInfo",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/grid.py#L721-L723 | |
OSGeo/gdal | 3748fc4ba4fba727492774b2b908a2130c864a83 | swig/python/osgeo/ogr.py | python | FieldDomain.SetSplitPolicy | (self, *args) | return _ogr.FieldDomain_SetSplitPolicy(self, *args) | r"""SetSplitPolicy(FieldDomain self, OGRFieldDomainSplitPolicy policy) | r"""SetSplitPolicy(FieldDomain self, OGRFieldDomainSplitPolicy policy) | [
"r",
"SetSplitPolicy",
"(",
"FieldDomain",
"self",
"OGRFieldDomainSplitPolicy",
"policy",
")"
] | def SetSplitPolicy(self, *args):
r"""SetSplitPolicy(FieldDomain self, OGRFieldDomainSplitPolicy policy)"""
return _ogr.FieldDomain_SetSplitPolicy(self, *args) | [
"def",
"SetSplitPolicy",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_ogr",
".",
"FieldDomain_SetSplitPolicy",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/OSGeo/gdal/blob/3748fc4ba4fba727492774b2b908a2130c864a83/swig/python/osgeo/ogr.py#L7584-L7586 | |
cvmfs/cvmfs | 4637bdb5153178eadf885c1acf37bdc5c685bf8a | cpplint.py | python | _OutputFormat | () | return _cpplint_state.output_format | Gets the module's output format. | Gets the module's output format. | [
"Gets",
"the",
"module",
"s",
"output",
"format",
"."
] | def _OutputFormat():
"""Gets the module's output format."""
return _cpplint_state.output_format | [
"def",
"_OutputFormat",
"(",
")",
":",
"return",
"_cpplint_state",
".",
"output_format"
] | https://github.com/cvmfs/cvmfs/blob/4637bdb5153178eadf885c1acf37bdc5c685bf8a/cpplint.py#L851-L853 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/lib2to3/pytree.py | python | WildcardPattern._iterative_matches | (self, nodes) | Helper to iteratively yield the matches. | Helper to iteratively yield the matches. | [
"Helper",
"to",
"iteratively",
"yield",
"the",
"matches",
"."
] | def _iterative_matches(self, nodes):
"""Helper to iteratively yield the matches."""
nodelen = len(nodes)
if 0 >= self.min:
yield 0, {}
results = []
# generate matches that use just one alt from self.content
for alt in self.content:
for c, r in gen... | [
"def",
"_iterative_matches",
"(",
"self",
",",
"nodes",
")",
":",
"nodelen",
"=",
"len",
"(",
"nodes",
")",
"if",
"0",
">=",
"self",
".",
"min",
":",
"yield",
"0",
",",
"{",
"}",
"results",
"=",
"[",
"]",
"# generate matches that use just one alt from self... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/lib2to3/pytree.py#L767-L794 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/platform/tf_logging.py | python | log_if | (level, msg, condition, *args) | Log 'msg % args' at level 'level' only if condition is fulfilled. | Log 'msg % args' at level 'level' only if condition is fulfilled. | [
"Log",
"msg",
"%",
"args",
"at",
"level",
"level",
"only",
"if",
"condition",
"is",
"fulfilled",
"."
] | def log_if(level, msg, condition, *args):
"""Log 'msg % args' at level 'level' only if condition is fulfilled."""
if condition:
vlog(level, msg, *args) | [
"def",
"log_if",
"(",
"level",
",",
"msg",
",",
"condition",
",",
"*",
"args",
")",
":",
"if",
"condition",
":",
"vlog",
"(",
"level",
",",
"msg",
",",
"*",
"args",
")"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/platform/tf_logging.py#L252-L255 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py3/IPython/utils/io.py | python | Tee.close | (self) | Close the file and restore the channel. | Close the file and restore the channel. | [
"Close",
"the",
"file",
"and",
"restore",
"the",
"channel",
"."
] | def close(self):
"""Close the file and restore the channel."""
self.flush()
setattr(sys, self.channel, self.ostream)
self.file.close()
self._closed = True | [
"def",
"close",
"(",
"self",
")",
":",
"self",
".",
"flush",
"(",
")",
"setattr",
"(",
"sys",
",",
"self",
".",
"channel",
",",
"self",
".",
"ostream",
")",
"self",
".",
"file",
".",
"close",
"(",
")",
"self",
".",
"_closed",
"=",
"True"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py3/IPython/utils/io.py#L134-L139 | ||
RoboJackets/robocup-software | bce13ce53ddb2ecb9696266d980722c34617dc15 | rj_gameplay/rj_gameplay/play/restart.py | python | DirectRestartPlay.__init__ | (self) | self.pass_tactic = pass_tactic.Pass(
self.target_point, pass_tactic.PasserCost(self.target_point),
pass_tactic.PassToClosestReceiver(self.target_point))
self.seek_tactic = pass_seek.Seek(
self.target_point, pass_seek.restart_seek,
pass_seek.SeekCost(self.target_po... | self.pass_tactic = pass_tactic.Pass(
self.target_point, pass_tactic.PasserCost(self.target_point),
pass_tactic.PassToClosestReceiver(self.target_point))
self.seek_tactic = pass_seek.Seek(
self.target_point, pass_seek.restart_seek,
pass_seek.SeekCost(self.target_po... | [
"self",
".",
"pass_tactic",
"=",
"pass_tactic",
".",
"Pass",
"(",
"self",
".",
"target_point",
"pass_tactic",
".",
"PasserCost",
"(",
"self",
".",
"target_point",
")",
"pass_tactic",
".",
"PassToClosestReceiver",
"(",
"self",
".",
"target_point",
"))",
"self",
... | def __init__(self):
self.target_point = np.array([1.0, 4.0])
# TODO: simplify tactic with list (see basic_defense.py)
self.goalie_tactic = goalie_tactic.GoalieTactic()
self.clear_tactic = clear_tactic.Clear(
np.array([0.0, 9.0]), chip=False, kick_speed=5.5
)
... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"target_point",
"=",
"np",
".",
"array",
"(",
"[",
"1.0",
",",
"4.0",
"]",
")",
"# TODO: simplify tactic with list (see basic_defense.py)",
"self",
".",
"goalie_tactic",
"=",
"goalie_tactic",
".",
"GoalieTac... | https://github.com/RoboJackets/robocup-software/blob/bce13ce53ddb2ecb9696266d980722c34617dc15/rj_gameplay/rj_gameplay/play/restart.py#L134-L171 | ||
fatih/subvim | 241b6d170597857105da219c9b7d36059e9f11fb | vim/base/YouCompleteMe/third_party/bottle/bottle.py | python | _re_flatten | (p) | return re.sub(r'(\\*)(\(\?P<[^>]+>|\((?!\?))',
lambda m: m.group(0) if len(m.group(1)) % 2 else m.group(1) + '(?:', p) | Turn all capturing groups in a regular expression pattern into
non-capturing groups. | Turn all capturing groups in a regular expression pattern into
non-capturing groups. | [
"Turn",
"all",
"capturing",
"groups",
"in",
"a",
"regular",
"expression",
"pattern",
"into",
"non",
"-",
"capturing",
"groups",
"."
] | def _re_flatten(p):
''' Turn all capturing groups in a regular expression pattern into
non-capturing groups. '''
if '(' not in p: return p
return re.sub(r'(\\*)(\(\?P<[^>]+>|\((?!\?))',
lambda m: m.group(0) if len(m.group(1)) % 2 else m.group(1) + '(?:', p) | [
"def",
"_re_flatten",
"(",
"p",
")",
":",
"if",
"'('",
"not",
"in",
"p",
":",
"return",
"p",
"return",
"re",
".",
"sub",
"(",
"r'(\\\\*)(\\(\\?P<[^>]+>|\\((?!\\?))'",
",",
"lambda",
"m",
":",
"m",
".",
"group",
"(",
"0",
")",
"if",
"len",
"(",
"m",
... | https://github.com/fatih/subvim/blob/241b6d170597857105da219c9b7d36059e9f11fb/vim/base/YouCompleteMe/third_party/bottle/bottle.py#L244-L249 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/pickletools.py | python | genops | (pickle) | return _genops(pickle) | Generate all the opcodes in a pickle.
'pickle' is a file-like object, or string, containing the pickle.
Each opcode in the pickle is generated, from the current pickle position,
stopping after a STOP opcode is delivered. A triple is generated for
each opcode:
opcode, arg, pos
opcode is ... | Generate all the opcodes in a pickle. | [
"Generate",
"all",
"the",
"opcodes",
"in",
"a",
"pickle",
"."
] | def genops(pickle):
"""Generate all the opcodes in a pickle.
'pickle' is a file-like object, or string, containing the pickle.
Each opcode in the pickle is generated, from the current pickle position,
stopping after a STOP opcode is delivered. A triple is generated for
each opcode:
opcod... | [
"def",
"genops",
"(",
"pickle",
")",
":",
"return",
"_genops",
"(",
"pickle",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/pickletools.py#L2222-L2245 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/debug/lib/grpc_debug_server.py | python | EventListenerBaseServicer.SendSourceFiles | (self, request, context) | return debug_service_pb2.EventReply() | Base implementation of the handling of SendSourceFiles calls.
The base implementation does nothing with the incoming request.
Override in an implementation of the server if necessary.
Args:
request: A `DebuggedSourceFiles` proto, containing the path, content, size
and last-modified timestamp... | Base implementation of the handling of SendSourceFiles calls. | [
"Base",
"implementation",
"of",
"the",
"handling",
"of",
"SendSourceFiles",
"calls",
"."
] | def SendSourceFiles(self, request, context):
"""Base implementation of the handling of SendSourceFiles calls.
The base implementation does nothing with the incoming request.
Override in an implementation of the server if necessary.
Args:
request: A `DebuggedSourceFiles` proto, containing the pat... | [
"def",
"SendSourceFiles",
"(",
"self",
",",
"request",
",",
"context",
")",
":",
"return",
"debug_service_pb2",
".",
"EventReply",
"(",
")"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/debug/lib/grpc_debug_server.py#L478-L492 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/core/frame.py | python | DataFrame.assign | (self, **kwargs) | return data | r"""
Assign new columns to a DataFrame.
Returns a new object with all original columns in addition to new ones.
Existing columns that are re-assigned will be overwritten.
Parameters
----------
**kwargs : dict of {str: callable or Series}
The column names are... | r"""
Assign new columns to a DataFrame. | [
"r",
"Assign",
"new",
"columns",
"to",
"a",
"DataFrame",
"."
] | def assign(self, **kwargs) -> DataFrame:
r"""
Assign new columns to a DataFrame.
Returns a new object with all original columns in addition to new ones.
Existing columns that are re-assigned will be overwritten.
Parameters
----------
**kwargs : dict of {str: cal... | [
"def",
"assign",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
"->",
"DataFrame",
":",
"data",
"=",
"self",
".",
"copy",
"(",
")",
"for",
"k",
",",
"v",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"data",
"[",
"k",
"]",
"=",
"com",
".",
"apply_... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/frame.py#L4421-L4487 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/ipc_messages_log.py | python | _ReadLines | (f) | Read from file f and generate right-stripped lines. | Read from file f and generate right-stripped lines. | [
"Read",
"from",
"file",
"f",
"and",
"generate",
"right",
"-",
"stripped",
"lines",
"."
] | def _ReadLines(f):
"""Read from file f and generate right-stripped lines."""
for line in f:
yield line.rstrip() | [
"def",
"_ReadLines",
"(",
"f",
")",
":",
"for",
"line",
"in",
"f",
":",
"yield",
"line",
".",
"rstrip",
"(",
")"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/ipc_messages_log.py#L34-L37 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/boringssl/src/util/bot/go/bootstrap.py | python | get_toolset_url | () | return '%s/%s.%s' % (DOWNLOAD_URL_PREFIX, TOOLSET_VERSION, variant) | URL of a platform specific Go toolset archive. | URL of a platform specific Go toolset archive. | [
"URL",
"of",
"a",
"platform",
"specific",
"Go",
"toolset",
"archive",
"."
] | def get_toolset_url():
"""URL of a platform specific Go toolset archive."""
# TODO(vadimsh): Support toolset for cross-compilation.
arch = {
'amd64': 'x86-64',
'x86_64': 'x86-64',
'i386': 'x86-32',
'x86': 'x86-32',
}.get(platform.machine().lower())
variant = TOOLSET_VARIANTS.get((sys.platform,... | [
"def",
"get_toolset_url",
"(",
")",
":",
"# TODO(vadimsh): Support toolset for cross-compilation.",
"arch",
"=",
"{",
"'amd64'",
":",
"'x86-64'",
",",
"'x86_64'",
":",
"'x86-64'",
",",
"'i386'",
":",
"'x86-32'",
",",
"'x86'",
":",
"'x86-32'",
",",
"}",
".",
"get... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/boringssl/src/util/bot/go/bootstrap.py#L67-L80 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/nn_impl.py | python | batch_norm_with_global_normalization_v2 | (input,
mean,
variance,
beta,
gamma,
variance_epsilon,
s... | return batch_norm_with_global_normalization(t=input,
m=mean,
v=variance,
beta=beta,
gamma=gamma,
... | Batch normalization.
This op is deprecated. See `tf.nn.batch_normalization`.
Args:
input: A 4D input Tensor.
mean: A 1D mean Tensor with size matching the last dimension of t.
This is the first output from tf.nn.moments,
or a saved moving average thereof.
variance: A 1D variance Tensor wit... | Batch normalization. | [
"Batch",
"normalization",
"."
] | def batch_norm_with_global_normalization_v2(input,
mean,
variance,
beta,
gamma,
variance_epsilon,
... | [
"def",
"batch_norm_with_global_normalization_v2",
"(",
"input",
",",
"mean",
",",
"variance",
",",
"beta",
",",
"gamma",
",",
"variance_epsilon",
",",
"scale_after_normalization",
",",
"name",
"=",
"None",
")",
":",
"return",
"batch_norm_with_global_normalization",
"(... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/nn_impl.py#L1759-L1804 | |
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/training/slot_creator.py | python | _create_slot_var | (primary, val, scope) | return slot | Helper function for creating a slot variable. | Helper function for creating a slot variable. | [
"Helper",
"function",
"for",
"creating",
"a",
"slot",
"variable",
"."
] | def _create_slot_var(primary, val, scope):
"""Helper function for creating a slot variable."""
slot = variables.Variable(val, name=scope, trainable=False)
# pylint: disable=protected-access
if isinstance(primary, variables.Variable) and primary._save_slice_info:
# Primary is a partitioned variable, so we n... | [
"def",
"_create_slot_var",
"(",
"primary",
",",
"val",
",",
"scope",
")",
":",
"slot",
"=",
"variables",
".",
"Variable",
"(",
"val",
",",
"name",
"=",
"scope",
",",
"trainable",
"=",
"False",
")",
"# pylint: disable=protected-access",
"if",
"isinstance",
"(... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/training/slot_creator.py#L47-L64 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/eager/function.py | python | defun | (func) | return tf_decorator.make_decorator(func, named_defun(func, func.__name__)) | Decorator to compile func into graph_mode.
`defun` converts a function that constructs a TensorFlow graph into a function
that executes the graph. TensorFlow graphs typically execute faster and with a
lower memory-footprint than executing each of the operations that make up the
function individually as the Ten... | Decorator to compile func into graph_mode. | [
"Decorator",
"to",
"compile",
"func",
"into",
"graph_mode",
"."
] | def defun(func):
"""Decorator to compile func into graph_mode.
`defun` converts a function that constructs a TensorFlow graph into a function
that executes the graph. TensorFlow graphs typically execute faster and with a
lower memory-footprint than executing each of the operations that make up the
function i... | [
"def",
"defun",
"(",
"func",
")",
":",
"# TODO(apassos): deal with captured global state. Deal with control flow.",
"return",
"tf_decorator",
".",
"make_decorator",
"(",
"func",
",",
"named_defun",
"(",
"func",
",",
"func",
".",
"__name__",
")",
")"
] | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/eager/function.py#L520-L571 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/_op_impl/tbe/scatter_nd_update.py | python | _scatter_nd_update_tbe | () | return | ScatterNdUpdate TBE register | ScatterNdUpdate TBE register | [
"ScatterNdUpdate",
"TBE",
"register"
] | def _scatter_nd_update_tbe():
"""ScatterNdUpdate TBE register"""
return | [
"def",
"_scatter_nd_update_tbe",
"(",
")",
":",
"return"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/_op_impl/tbe/scatter_nd_update.py#L40-L42 | |
arangodb/arangodb | 0d658689c7d1b721b314fa3ca27d38303e1570c8 | 3rdParty/V8/v7.9.317/tools/sanitizers/sancov_formatter.py | python | merge | (options) | Implements the 'merge' action of this tool. | Implements the 'merge' action of this tool. | [
"Implements",
"the",
"merge",
"action",
"of",
"this",
"tool",
"."
] | def merge(options):
"""Implements the 'merge' action of this tool."""
# Check if folder with coverage output exists.
assert (os.path.exists(options.coverage_dir) and
os.path.isdir(options.coverage_dir))
# Inputs for multiprocessing. List of tuples of:
# Coverage dir, absoluate path to executable, ... | [
"def",
"merge",
"(",
"options",
")",
":",
"# Check if folder with coverage output exists.",
"assert",
"(",
"os",
".",
"path",
".",
"exists",
"(",
"options",
".",
"coverage_dir",
")",
"and",
"os",
".",
"path",
".",
"isdir",
"(",
"options",
".",
"coverage_dir",
... | https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/V8/v7.9.317/tools/sanitizers/sancov_formatter.py#L338-L380 | ||
tenzir/vast | ff450d61f35c721db1760339869085a89222386f | pyvast/pyvast/vast.py | python | VAST.test_connection | (self) | return proc.returncode == 0 | Checks if the configured endpoint is reachable | Checks if the configured endpoint is reachable | [
"Checks",
"if",
"the",
"configured",
"endpoint",
"is",
"reachable"
] | async def test_connection(self):
"""Checks if the configured endpoint is reachable"""
proc = await self.__spawn("status")
await proc.wait()
return proc.returncode == 0 | [
"async",
"def",
"test_connection",
"(",
"self",
")",
":",
"proc",
"=",
"await",
"self",
".",
"__spawn",
"(",
"\"status\"",
")",
"await",
"proc",
".",
"wait",
"(",
")",
"return",
"proc",
".",
"returncode",
"==",
"0"
] | https://github.com/tenzir/vast/blob/ff450d61f35c721db1760339869085a89222386f/pyvast/pyvast/vast.py#L59-L63 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/abins/input/vasploader.py | python | _to_text | (item: ElementTree.Element) | return item.text | Get an Element.text property, avoiding confusing type errors | Get an Element.text property, avoiding confusing type errors | [
"Get",
"an",
"Element",
".",
"text",
"property",
"avoiding",
"confusing",
"type",
"errors"
] | def _to_text(item: ElementTree.Element) -> str:
"""Get an Element.text property, avoiding confusing type errors"""
if item.text is None:
raise ValueError(f"XML Element {item} didn't contain expected text")
return item.text | [
"def",
"_to_text",
"(",
"item",
":",
"ElementTree",
".",
"Element",
")",
"->",
"str",
":",
"if",
"item",
".",
"text",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"f\"XML Element {item} didn't contain expected text\"",
")",
"return",
"item",
".",
"text"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/abins/input/vasploader.py#L360-L364 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/docutils/utils/math/math2html.py | python | PositionEnding.checkin | (self, pos) | return pos.checkfor(self.ending) | Check for the ending | Check for the ending | [
"Check",
"for",
"the",
"ending"
] | def checkin(self, pos):
"Check for the ending"
return pos.checkfor(self.ending) | [
"def",
"checkin",
"(",
"self",
",",
"pos",
")",
":",
"return",
"pos",
".",
"checkfor",
"(",
"self",
".",
"ending",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/docutils/utils/math/math2html.py#L2007-L2009 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py2/IPython/core/inputtransformer.py | python | _tr_system2 | (line_info) | return '%sget_ipython().getoutput(%r)' % (line_info.pre, cmd) | Translate lines escaped with: !! | Translate lines escaped with: !! | [
"Translate",
"lines",
"escaped",
"with",
":",
"!!"
] | def _tr_system2(line_info):
"Translate lines escaped with: !!"
cmd = line_info.line.lstrip()[2:]
return '%sget_ipython().getoutput(%r)' % (line_info.pre, cmd) | [
"def",
"_tr_system2",
"(",
"line_info",
")",
":",
"cmd",
"=",
"line_info",
".",
"line",
".",
"lstrip",
"(",
")",
"[",
"2",
":",
"]",
"return",
"'%sget_ipython().getoutput(%r)'",
"%",
"(",
"line_info",
".",
"pre",
",",
"cmd",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py2/IPython/core/inputtransformer.py#L220-L223 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/targets/base.py | python | BaseContext.pair_second | (self, builder, val, ty) | return pair.second | Extract the second element of a heterogeneous pair. | Extract the second element of a heterogeneous pair. | [
"Extract",
"the",
"second",
"element",
"of",
"a",
"heterogeneous",
"pair",
"."
] | def pair_second(self, builder, val, ty):
"""
Extract the second element of a heterogeneous pair.
"""
pair = self.make_helper(builder, ty, val)
return pair.second | [
"def",
"pair_second",
"(",
"self",
",",
"builder",
",",
"val",
",",
"ty",
")",
":",
"pair",
"=",
"self",
".",
"make_helper",
"(",
"builder",
",",
"ty",
",",
"val",
")",
"return",
"pair",
".",
"second"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/targets/base.py#L685-L690 | |
su2code/SU2 | 72b2fa977b64b9683a388920f05298a40d39e5c5 | SU2_PY/SU2/eval/gradients.py | python | findiff | ( config, state=None ) | return grads | vals = SU2.eval.findiff(config,state=None)
Evaluates the aerodynamics gradients using
finite differencing with:
SU2.eval.func()
SU2.run.deform()
SU2.run.direct()
Assumptions:
Config is already setup for deformation.
Mesh may or may n... | vals = SU2.eval.findiff(config,state=None) | [
"vals",
"=",
"SU2",
".",
"eval",
".",
"findiff",
"(",
"config",
"state",
"=",
"None",
")"
] | def findiff( config, state=None ):
""" vals = SU2.eval.findiff(config,state=None)
Evaluates the aerodynamics gradients using
finite differencing with:
SU2.eval.func()
SU2.run.deform()
SU2.run.direct()
Assumptions:
Config is already setup for... | [
"def",
"findiff",
"(",
"config",
",",
"state",
"=",
"None",
")",
":",
"# ----------------------------------------------------",
"# Initialize ",
"# ----------------------------------------------------",
"# initialize",
"state",
"=",
"su2io",
".",
"State",
"(",
"state",
... | https://github.com/su2code/SU2/blob/72b2fa977b64b9683a388920f05298a40d39e5c5/SU2_PY/SU2/eval/gradients.py#L720-L928 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py | python | _FixPaths | (paths) | return [_FixPath(i) for i in paths] | Fix each of the paths of the list. | Fix each of the paths of the list. | [
"Fix",
"each",
"of",
"the",
"paths",
"of",
"the",
"list",
"."
] | def _FixPaths(paths):
"""Fix each of the paths of the list."""
return [_FixPath(i) for i in paths] | [
"def",
"_FixPaths",
"(",
"paths",
")",
":",
"return",
"[",
"_FixPath",
"(",
"i",
")",
"for",
"i",
"in",
"paths",
"]"
] | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py#L183-L185 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/contrib/learn/python/learn/learn_io/data_feeder.py | python | _get_in_out_shape | (x_shape, y_shape, n_classes, batch_size=None) | return input_shape, output_shape, batch_size | Returns shape for input and output of the data feeder. | Returns shape for input and output of the data feeder. | [
"Returns",
"shape",
"for",
"input",
"and",
"output",
"of",
"the",
"data",
"feeder",
"."
] | def _get_in_out_shape(x_shape, y_shape, n_classes, batch_size=None):
"""Returns shape for input and output of the data feeder."""
if batch_size is None:
batch_size = x_shape[0]
elif batch_size <= 0:
raise ValueError('Invalid batch_size %d.' % batch_size)
x_shape = list(x_shape[1:]) if len(x_shape) > 1 e... | [
"def",
"_get_in_out_shape",
"(",
"x_shape",
",",
"y_shape",
",",
"n_classes",
",",
"batch_size",
"=",
"None",
")",
":",
"if",
"batch_size",
"is",
"None",
":",
"batch_size",
"=",
"x_shape",
"[",
"0",
"]",
"elif",
"batch_size",
"<=",
"0",
":",
"raise",
"Va... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/learn/python/learn/learn_io/data_feeder.py#L41-L59 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_aarch64/python2.7/dist-packages/rospkg/stack.py | python | parse_stack | (string, filename) | return s | Parse stack.xml string contents.
:param string: stack.xml contents, ``str``
:param filename: full file path for debugging, ``str``
:returns: return parsed :class:`Stack` | Parse stack.xml string contents. | [
"Parse",
"stack",
".",
"xml",
"string",
"contents",
"."
] | def parse_stack(string, filename):
"""
Parse stack.xml string contents.
:param string: stack.xml contents, ``str``
:param filename: full file path for debugging, ``str``
:returns: return parsed :class:`Stack`
"""
# Create some classes to hold some members
new_tuples = {}
for key, me... | [
"def",
"parse_stack",
"(",
"string",
",",
"filename",
")",
":",
"# Create some classes to hold some members",
"new_tuples",
"=",
"{",
"}",
"for",
"key",
",",
"members",
"in",
"LISTED_ATTRIBUTES",
".",
"items",
"(",
")",
":",
"new_tuples",
"[",
"key",
"]",
"=",... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_aarch64/python2.7/dist-packages/rospkg/stack.py#L180-L243 | |
include-what-you-use/include-what-you-use | 208fbfffa5d69364b9f78e427caa443441279283 | iwyu-check-license-header.py | python | format_file_error | (filename, *lines) | return os.linesep.join(lines) | Format an error message from filename and lines | Format an error message from filename and lines | [
"Format",
"an",
"error",
"message",
"from",
"filename",
"and",
"lines"
] | def format_file_error(filename, *lines):
""" Format an error message from filename and lines """
lines = list(lines)
lines[0] = '%s: %s' % (filename, lines[0])
return os.linesep.join(lines) | [
"def",
"format_file_error",
"(",
"filename",
",",
"*",
"lines",
")",
":",
"lines",
"=",
"list",
"(",
"lines",
")",
"lines",
"[",
"0",
"]",
"=",
"'%s: %s'",
"%",
"(",
"filename",
",",
"lines",
"[",
"0",
"]",
")",
"return",
"os",
".",
"linesep",
".",... | https://github.com/include-what-you-use/include-what-you-use/blob/208fbfffa5d69364b9f78e427caa443441279283/iwyu-check-license-header.py#L73-L77 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/io/formats/style_render.py | python | Tooltips._pseudo_css | (self, uuid: str, name: str, row: int, col: int, text: str) | return [
{
"selector": selector_id + f":hover .{name}",
"props": [("visibility", "visible")],
},
{
"selector": selector_id + f" .{name}::after",
"props": [("content", f'"{text}"')],
},
] | For every table data-cell that has a valid tooltip (not None, NaN or
empty string) must create two pseudo CSS entries for the specific
<td> element id which are added to overall table styles:
an on hover visibility change and a content change
dependent upon the user's chosen display stri... | For every table data-cell that has a valid tooltip (not None, NaN or
empty string) must create two pseudo CSS entries for the specific
<td> element id which are added to overall table styles:
an on hover visibility change and a content change
dependent upon the user's chosen display stri... | [
"For",
"every",
"table",
"data",
"-",
"cell",
"that",
"has",
"a",
"valid",
"tooltip",
"(",
"not",
"None",
"NaN",
"or",
"empty",
"string",
")",
"must",
"create",
"two",
"pseudo",
"CSS",
"entries",
"for",
"the",
"specific",
"<td",
">",
"element",
"id",
"... | def _pseudo_css(self, uuid: str, name: str, row: int, col: int, text: str):
"""
For every table data-cell that has a valid tooltip (not None, NaN or
empty string) must create two pseudo CSS entries for the specific
<td> element id which are added to overall table styles:
an on ho... | [
"def",
"_pseudo_css",
"(",
"self",
",",
"uuid",
":",
"str",
",",
"name",
":",
"str",
",",
"row",
":",
"int",
",",
"col",
":",
"int",
",",
"text",
":",
"str",
")",
":",
"selector_id",
"=",
"\"#T_\"",
"+",
"uuid",
"+",
"\"row\"",
"+",
"str",
"(",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/io/formats/style_render.py#L1138-L1179 | |
SoarGroup/Soar | a1c5e249499137a27da60533c72969eef3b8ab6b | scons/scons-local-4.1.0/SCons/Script/Interactive.py | python | SConsInteractiveCmd.do_shell | (self, argv) | \
shell [COMMANDLINE] Execute COMMANDLINE in a subshell. 'sh' and
'!' are synonyms. | \
shell [COMMANDLINE] Execute COMMANDLINE in a subshell. 'sh' and
'!' are synonyms. | [
"\\",
"shell",
"[",
"COMMANDLINE",
"]",
"Execute",
"COMMANDLINE",
"in",
"a",
"subshell",
".",
"sh",
"and",
"!",
"are",
"synonyms",
"."
] | def do_shell(self, argv):
"""\
shell [COMMANDLINE] Execute COMMANDLINE in a subshell. 'sh' and
'!' are synonyms.
"""
import subprocess
argv = argv[1:]
if not argv:
argv = os.environ[self.shell_variable]
try:
... | [
"def",
"do_shell",
"(",
"self",
",",
"argv",
")",
":",
"import",
"subprocess",
"argv",
"=",
"argv",
"[",
"1",
":",
"]",
"if",
"not",
"argv",
":",
"argv",
"=",
"os",
".",
"environ",
"[",
"self",
".",
"shell_variable",
"]",
"try",
":",
"# Per \"[Python... | https://github.com/SoarGroup/Soar/blob/a1c5e249499137a27da60533c72969eef3b8ab6b/scons/scons-local-4.1.0/SCons/Script/Interactive.py#L333-L351 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/optimize/_basinhopping.py | python | Metropolis.accept_reject | (self, energy_new, energy_old) | return w >= rand | If new energy is lower than old, it will always be accepted.
If new is higher than old, there is a chance it will be accepted,
less likely for larger differences. | If new energy is lower than old, it will always be accepted.
If new is higher than old, there is a chance it will be accepted,
less likely for larger differences. | [
"If",
"new",
"energy",
"is",
"lower",
"than",
"old",
"it",
"will",
"always",
"be",
"accepted",
".",
"If",
"new",
"is",
"higher",
"than",
"old",
"there",
"is",
"a",
"chance",
"it",
"will",
"be",
"accepted",
"less",
"likely",
"for",
"larger",
"differences"... | def accept_reject(self, energy_new, energy_old):
"""
If new energy is lower than old, it will always be accepted.
If new is higher than old, there is a chance it will be accepted,
less likely for larger differences.
"""
w = math.exp(min(0, -float(energy_new - energy_old) ... | [
"def",
"accept_reject",
"(",
"self",
",",
"energy_new",
",",
"energy_old",
")",
":",
"w",
"=",
"math",
".",
"exp",
"(",
"min",
"(",
"0",
",",
"-",
"float",
"(",
"energy_new",
"-",
"energy_old",
")",
"*",
"self",
".",
"beta",
")",
")",
"rand",
"=",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/optimize/_basinhopping.py#L307-L315 | |
redpony/cdec | f7c4899b174d86bc70b40b1cae68dcad364615cb | python/cdec/configobj.py | python | ConfigObj.__init__ | (self, infile=None, options=None, configspec=None, encoding=None,
interpolation=True, raise_errors=False, list_values=True,
create_empty=False, file_error=False, stringify=True,
indent_type=None, default_encoding=None, unrepr=False,
write_empty_values=... | Parse a config file or create a config file object.
``ConfigObj(infile=None, configspec=None, encoding=None,
interpolation=True, raise_errors=False, list_values=True,
create_empty=False, file_error=False, stringify=True,
indent_type=None, defa... | Parse a config file or create a config file object.
``ConfigObj(infile=None, configspec=None, encoding=None,
interpolation=True, raise_errors=False, list_values=True,
create_empty=False, file_error=False, stringify=True,
indent_type=None, defa... | [
"Parse",
"a",
"config",
"file",
"or",
"create",
"a",
"config",
"file",
"object",
".",
"ConfigObj",
"(",
"infile",
"=",
"None",
"configspec",
"=",
"None",
"encoding",
"=",
"None",
"interpolation",
"=",
"True",
"raise_errors",
"=",
"False",
"list_values",
"=",... | def __init__(self, infile=None, options=None, configspec=None, encoding=None,
interpolation=True, raise_errors=False, list_values=True,
create_empty=False, file_error=False, stringify=True,
indent_type=None, default_encoding=None, unrepr=False,
write_e... | [
"def",
"__init__",
"(",
"self",
",",
"infile",
"=",
"None",
",",
"options",
"=",
"None",
",",
"configspec",
"=",
"None",
",",
"encoding",
"=",
"None",
",",
"interpolation",
"=",
"True",
",",
"raise_errors",
"=",
"False",
",",
"list_values",
"=",
"True",
... | https://github.com/redpony/cdec/blob/f7c4899b174d86bc70b40b1cae68dcad364615cb/python/cdec/configobj.py#L1187-L1242 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/learn/python/learn/models.py | python | logistic_regression_zero_init | (x, y) | return logistic_regression(x, y, init_mean=0.0, init_stddev=0.0) | Logistic regression subgraph with zero-value initial weights and bias.
Args:
x: tensor or placeholder for input features.
y: tensor or placeholder for labels.
Returns:
Predictions and loss tensors. | Logistic regression subgraph with zero-value initial weights and bias. | [
"Logistic",
"regression",
"subgraph",
"with",
"zero",
"-",
"value",
"initial",
"weights",
"and",
"bias",
"."
] | def logistic_regression_zero_init(x, y):
"""Logistic regression subgraph with zero-value initial weights and bias.
Args:
x: tensor or placeholder for input features.
y: tensor or placeholder for labels.
Returns:
Predictions and loss tensors.
"""
return logistic_regression(x, y, init_mean=0.0, in... | [
"def",
"logistic_regression_zero_init",
"(",
"x",
",",
"y",
")",
":",
"return",
"logistic_regression",
"(",
"x",
",",
"y",
",",
"init_mean",
"=",
"0.0",
",",
"init_stddev",
"=",
"0.0",
")"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/learn/python/learn/models.py#L54-L64 | |
turi-code/SFrame | 796b9bdfb2fa1b881d82080754643c7e68629cd2 | oss_src/unity/python/sframe/util/queue_channel.py | python | QueueListener.dequeue | (self, block) | return self.queue.get(block) | Dequeue a record and return it, optionally blocking.
The base implementation uses :meth:`~queue.Queue.get`. You may want to
override this method if you want to use timeouts or work with custom
queue implementations.
:param block: Whether to block if the queue is empty. If `False` and
... | Dequeue a record and return it, optionally blocking. | [
"Dequeue",
"a",
"record",
"and",
"return",
"it",
"optionally",
"blocking",
"."
] | def dequeue(self, block):
"""
Dequeue a record and return it, optionally blocking.
The base implementation uses :meth:`~queue.Queue.get`. You may want to
override this method if you want to use timeouts or work with custom
queue implementations.
:param block: Whether to... | [
"def",
"dequeue",
"(",
"self",
",",
"block",
")",
":",
"return",
"self",
".",
"queue",
".",
"get",
"(",
"block",
")"
] | https://github.com/turi-code/SFrame/blob/796b9bdfb2fa1b881d82080754643c7e68629cd2/oss_src/unity/python/sframe/util/queue_channel.py#L145-L157 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | example/gluon/lipnet/utils/multi.py | python | test_worker | (from_idx, to_idx, params) | return (succ, fail) | the worker to test multi-process | the worker to test multi-process | [
"the",
"worker",
"to",
"test",
"multi",
"-",
"process"
] | def test_worker(from_idx, to_idx, params):
"""
the worker to test multi-process
"""
params = params
succ = set()
fail = set()
for idx in range(from_idx, to_idx):
try:
succ.add(idx)
except ValueError:
fail.add(idx)
return (succ, fail) | [
"def",
"test_worker",
"(",
"from_idx",
",",
"to_idx",
",",
"params",
")",
":",
"params",
"=",
"params",
"succ",
"=",
"set",
"(",
")",
"fail",
"=",
"set",
"(",
")",
"for",
"idx",
"in",
"range",
"(",
"from_idx",
",",
"to_idx",
")",
":",
"try",
":",
... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/example/gluon/lipnet/utils/multi.py#L87-L99 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/runpy.py | python | _run_module_code | (code, init_globals=None,
mod_name=None, mod_fname=None,
mod_loader=None, pkg_name=None) | return mod_globals.copy() | Helper to run code in new namespace with sys modified | Helper to run code in new namespace with sys modified | [
"Helper",
"to",
"run",
"code",
"in",
"new",
"namespace",
"with",
"sys",
"modified"
] | def _run_module_code(code, init_globals=None,
mod_name=None, mod_fname=None,
mod_loader=None, pkg_name=None):
"""Helper to run code in new namespace with sys modified"""
with _TempModule(mod_name) as temp_module, _ModifiedArgv0(mod_fname):
mod_globals = temp_modul... | [
"def",
"_run_module_code",
"(",
"code",
",",
"init_globals",
"=",
"None",
",",
"mod_name",
"=",
"None",
",",
"mod_fname",
"=",
"None",
",",
"mod_loader",
"=",
"None",
",",
"pkg_name",
"=",
"None",
")",
":",
"with",
"_TempModule",
"(",
"mod_name",
")",
"a... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/runpy.py#L75-L85 | |
echronos/echronos | c996f1d2c8af6c6536205eb319c1bf1d4d84569c | pylib/utils.py | python | top_path | (topdir, *path) | return os.path.join(topdir, *path) | Return a path relative to the directory in which the x tool or wrapper was invoked.
This function is equivalent to base_path(), except when the x tool is invoked in a client repository through a
wrapper.
In that case, the specified path is not appended to the directory containing the core x.py file, but th... | Return a path relative to the directory in which the x tool or wrapper was invoked. | [
"Return",
"a",
"path",
"relative",
"to",
"the",
"directory",
"in",
"which",
"the",
"x",
"tool",
"or",
"wrapper",
"was",
"invoked",
"."
] | def top_path(topdir, *path):
"""Return a path relative to the directory in which the x tool or wrapper was invoked.
This function is equivalent to base_path(), except when the x tool is invoked in a client repository through a
wrapper.
In that case, the specified path is not appended to the directory c... | [
"def",
"top_path",
"(",
"topdir",
",",
"*",
"path",
")",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"topdir",
",",
"*",
"path",
")"
] | https://github.com/echronos/echronos/blob/c996f1d2c8af6c6536205eb319c1bf1d4d84569c/pylib/utils.py#L69-L78 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/psutil/_pswindows.py | python | net_if_addrs | () | return ret | Return the addresses associated to each NIC. | Return the addresses associated to each NIC. | [
"Return",
"the",
"addresses",
"associated",
"to",
"each",
"NIC",
"."
] | def net_if_addrs():
"""Return the addresses associated to each NIC."""
ret = []
for items in cext.net_if_addrs():
items = list(items)
items[0] = py2_strencode(items[0])
ret.append(items)
return ret | [
"def",
"net_if_addrs",
"(",
")",
":",
"ret",
"=",
"[",
"]",
"for",
"items",
"in",
"cext",
".",
"net_if_addrs",
"(",
")",
":",
"items",
"=",
"list",
"(",
"items",
")",
"items",
"[",
"0",
"]",
"=",
"py2_strencode",
"(",
"items",
"[",
"0",
"]",
")",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/psutil/_pswindows.py#L392-L399 | |
JumpingYang001/webrtc | c03d6e965e1f54aeadd670e491eabe5fdb8db968 | tools_webrtc/autoroller/roll_deps.py | python | BuildDepsentryDict | (deps_dict) | return result | Builds a dict of paths to DepsEntry objects from a raw parsed deps dict. | Builds a dict of paths to DepsEntry objects from a raw parsed deps dict. | [
"Builds",
"a",
"dict",
"of",
"paths",
"to",
"DepsEntry",
"objects",
"from",
"a",
"raw",
"parsed",
"deps",
"dict",
"."
] | def BuildDepsentryDict(deps_dict):
"""Builds a dict of paths to DepsEntry objects from a raw parsed deps dict."""
result = {}
def AddDepsEntries(deps_subdict):
for path, dep in deps_subdict.iteritems():
if path in result:
continue
if not isinstance(dep, dict)... | [
"def",
"BuildDepsentryDict",
"(",
"deps_dict",
")",
":",
"result",
"=",
"{",
"}",
"def",
"AddDepsEntries",
"(",
"deps_subdict",
")",
":",
"for",
"path",
",",
"dep",
"in",
"deps_subdict",
".",
"iteritems",
"(",
")",
":",
"if",
"path",
"in",
"result",
":",... | https://github.com/JumpingYang001/webrtc/blob/c03d6e965e1f54aeadd670e491eabe5fdb8db968/tools_webrtc/autoroller/roll_deps.py#L247-L268 | |
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/buildscripts/idl/idl/generator.py | python | _CppSourceFileWriter.gen_op_msg_request_deserializer_methods | (self, struct) | Generate the C++ deserializer method definitions from OpMsgRequest. | Generate the C++ deserializer method definitions from OpMsgRequest. | [
"Generate",
"the",
"C",
"++",
"deserializer",
"method",
"definitions",
"from",
"OpMsgRequest",
"."
] | def gen_op_msg_request_deserializer_methods(self, struct):
# type: (ast.Struct) -> None
"""Generate the C++ deserializer method definitions from OpMsgRequest."""
# pylint: disable=invalid-name
# Commands that have concatentate_with_db namespaces require db name as a parameter
if ... | [
"def",
"gen_op_msg_request_deserializer_methods",
"(",
"self",
",",
"struct",
")",
":",
"# type: (ast.Struct) -> None",
"# pylint: disable=invalid-name",
"# Commands that have concatentate_with_db namespaces require db name as a parameter",
"if",
"not",
"isinstance",
"(",
"struct",
"... | https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/buildscripts/idl/idl/generator.py#L1014-L1075 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py | python | WorkingSet.resolve | (self, requirements, env=None, installer=None,
replace_conflicting=False, extras=None) | return to_activate | List all distributions needed to (recursively) meet `requirements`
`requirements` must be a sequence of ``Requirement`` objects. `env`,
if supplied, should be an ``Environment`` instance. If
not supplied, it defaults to all distributions available within any
entry or distribution in t... | List all distributions needed to (recursively) meet `requirements` | [
"List",
"all",
"distributions",
"needed",
"to",
"(",
"recursively",
")",
"meet",
"requirements"
] | def resolve(self, requirements, env=None, installer=None,
replace_conflicting=False, extras=None):
"""List all distributions needed to (recursively) meet `requirements`
`requirements` must be a sequence of ``Requirement`` objects. `env`,
if supplied, should be an ``Environment`... | [
"def",
"resolve",
"(",
"self",
",",
"requirements",
",",
"env",
"=",
"None",
",",
"installer",
"=",
"None",
",",
"replace_conflicting",
"=",
"False",
",",
"extras",
"=",
"None",
")",
":",
"# set up the stack",
"requirements",
"=",
"list",
"(",
"requirements"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L715-L805 | |
apple/swift | 469f72fdae2ea828b3b6c0d7d62d7e4cf98c4893 | utils/swift_build_support/swift_build_support/products/libdispatch.py | python | LibDispatch.is_before_build_script_impl_product | (cls) | return False | is_before_build_script_impl_product -> bool
Whether this product is built before any build-script-impl products. | is_before_build_script_impl_product -> bool | [
"is_before_build_script_impl_product",
"-",
">",
"bool"
] | def is_before_build_script_impl_product(cls):
"""is_before_build_script_impl_product -> bool
Whether this product is built before any build-script-impl products.
"""
return False | [
"def",
"is_before_build_script_impl_product",
"(",
"cls",
")",
":",
"return",
"False"
] | https://github.com/apple/swift/blob/469f72fdae2ea828b3b6c0d7d62d7e4cf98c4893/utils/swift_build_support/swift_build_support/products/libdispatch.py#L30-L35 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/distutils/util.py | python | split_quoted | (s) | return words | Split a string up according to Unix shell-like rules for quotes and
backslashes. In short: words are delimited by spaces, as long as those
spaces are not escaped by a backslash, or inside a quoted string.
Single and double quotes are equivalent, and the quote characters can
be backslash-escaped. The b... | Split a string up according to Unix shell-like rules for quotes and
backslashes. In short: words are delimited by spaces, as long as those
spaces are not escaped by a backslash, or inside a quoted string.
Single and double quotes are equivalent, and the quote characters can
be backslash-escaped. The b... | [
"Split",
"a",
"string",
"up",
"according",
"to",
"Unix",
"shell",
"-",
"like",
"rules",
"for",
"quotes",
"and",
"backslashes",
".",
"In",
"short",
":",
"words",
"are",
"delimited",
"by",
"spaces",
"as",
"long",
"as",
"those",
"spaces",
"are",
"not",
"esc... | def split_quoted (s):
"""Split a string up according to Unix shell-like rules for quotes and
backslashes. In short: words are delimited by spaces, as long as those
spaces are not escaped by a backslash, or inside a quoted string.
Single and double quotes are equivalent, and the quote characters can
... | [
"def",
"split_quoted",
"(",
"s",
")",
":",
"# This is a nice algorithm for splitting up a single string, since it",
"# doesn't require character-by-character examination. It was a little",
"# bit of a brain-bender to get it working right, though...",
"if",
"_wordchars_re",
"is",
"None",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/distutils/util.py#L235-L293 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/python/platform/gfile.py | python | _GFileBase.read | (self, n=-1) | return self._fp.read(n) | Read n bytes from the underlying file handle.
Args:
n: Number of bytes to read (if negative, read to end of file handle.)
Returns:
A string of the bytes read, up to the end of file. | Read n bytes from the underlying file handle. | [
"Read",
"n",
"bytes",
"from",
"the",
"underlying",
"file",
"handle",
"."
] | def read(self, n=-1):
"""Read n bytes from the underlying file handle.
Args:
n: Number of bytes to read (if negative, read to end of file handle.)
Returns:
A string of the bytes read, up to the end of file.
"""
return self._fp.read(n) | [
"def",
"read",
"(",
"self",
",",
"n",
"=",
"-",
"1",
")",
":",
"return",
"self",
".",
"_fp",
".",
"read",
"(",
"n",
")"
] | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/python/platform/gfile.py#L190-L199 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_gdi.py | python | PseudoDC.SetBrush | (*args, **kwargs) | return _gdi_.PseudoDC_SetBrush(*args, **kwargs) | SetBrush(self, Brush brush)
Sets the current brush for the DC.
If the argument is ``wx.NullBrush``, the current brush is selected out
of the device context, and the original brush restored, allowing the
current brush to be destroyed safely. | SetBrush(self, Brush brush) | [
"SetBrush",
"(",
"self",
"Brush",
"brush",
")"
] | def SetBrush(*args, **kwargs):
"""
SetBrush(self, Brush brush)
Sets the current brush for the DC.
If the argument is ``wx.NullBrush``, the current brush is selected out
of the device context, and the original brush restored, allowing the
current brush to be destroyed sa... | [
"def",
"SetBrush",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"PseudoDC_SetBrush",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_gdi.py#L8236-L8246 | |
mapequation/infomap | 5f56b94fe0f956483f61a03ef07e94d8def2205e | interfaces/python/infomap.py | python | Infomap.names | (self) | return super().getNames() | Get all node names.
Short-hand for ``get_names``.
See Also
--------
get_names
get_name
Returns
-------
dict of string
A dict with node ids as keys and node names as values. | Get all node names. | [
"Get",
"all",
"node",
"names",
"."
] | def names(self):
"""Get all node names.
Short-hand for ``get_names``.
See Also
--------
get_names
get_name
Returns
-------
dict of string
A dict with node ids as keys and node names as values.
"""
return super().getNa... | [
"def",
"names",
"(",
"self",
")",
":",
"return",
"super",
"(",
")",
".",
"getNames",
"(",
")"
] | https://github.com/mapequation/infomap/blob/5f56b94fe0f956483f61a03ef07e94d8def2205e/interfaces/python/infomap.py#L1853-L1868 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/contrib/slim/quantization/quantization_pass.py | python | QuantizationTransformPass._insert_channel_dequant_op | (self, graph, var_node, scale_var_nodes,
quant_bits, quant_axis) | return dequant_var_node | Insert fake_channel_wise_dequantize_max_abs in the graph. | Insert fake_channel_wise_dequantize_max_abs in the graph. | [
"Insert",
"fake_channel_wise_dequantize_max_abs",
"in",
"the",
"graph",
"."
] | def _insert_channel_dequant_op(self, graph, var_node, scale_var_nodes,
quant_bits, quant_axis):
"""
Insert fake_channel_wise_dequantize_max_abs in the graph.
"""
assert var_node.is_var(), '{} is not a var'.format(var_node.name())
dequant_var_no... | [
"def",
"_insert_channel_dequant_op",
"(",
"self",
",",
"graph",
",",
"var_node",
",",
"scale_var_nodes",
",",
"quant_bits",
",",
"quant_axis",
")",
":",
"assert",
"var_node",
".",
"is_var",
"(",
")",
",",
"'{} is not a var'",
".",
"format",
"(",
"var_node",
".... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/contrib/slim/quantization/quantization_pass.py#L870-L896 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/codecs.py | python | StreamReaderWriter.__getattr__ | (self, name,
getattr=getattr) | return getattr(self.stream, name) | Inherit all other methods from the underlying stream. | Inherit all other methods from the underlying stream. | [
"Inherit",
"all",
"other",
"methods",
"from",
"the",
"underlying",
"stream",
"."
] | def __getattr__(self, name,
getattr=getattr):
""" Inherit all other methods from the underlying stream.
"""
return getattr(self.stream, name) | [
"def",
"__getattr__",
"(",
"self",
",",
"name",
",",
"getattr",
"=",
"getattr",
")",
":",
"return",
"getattr",
"(",
"self",
".",
"stream",
",",
"name",
")"
] | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/codecs.py#L697-L702 | |
sfzhang15/RefineDet | 52b6fe23dc1a160fe710b7734576dca509bf4fae | scripts/cpp_lint.py | python | _NestingState.CheckCompletedBlocks | (self, filename, error) | Checks that all classes and namespaces have been completely parsed.
Call this when all lines in a file have been processed.
Args:
filename: The name of the current file.
error: The function to call with any errors found. | Checks that all classes and namespaces have been completely parsed. | [
"Checks",
"that",
"all",
"classes",
"and",
"namespaces",
"have",
"been",
"completely",
"parsed",
"."
] | def CheckCompletedBlocks(self, filename, error):
"""Checks that all classes and namespaces have been completely parsed.
Call this when all lines in a file have been processed.
Args:
filename: The name of the current file.
error: The function to call with any errors found.
"""
# Note: Th... | [
"def",
"CheckCompletedBlocks",
"(",
"self",
",",
"filename",
",",
"error",
")",
":",
"# Note: This test can result in false positives if #ifdef constructs",
"# get in the way of brace matching. See the testBuildClass test in",
"# cpplint_unittest.py for an example of this.",
"for",
"obj"... | https://github.com/sfzhang15/RefineDet/blob/52b6fe23dc1a160fe710b7734576dca509bf4fae/scripts/cpp_lint.py#L2176-L2195 | ||
sdhash/sdhash | b9eff63e4e5867e910f41fd69032bbb1c94a2a5e | sdhash-server/gen-py/sdhashsrv/sdhashsrv.py | python | Iface.displaySet | (self, num1) | Parameters:
- num1 | Parameters:
- num1 | [
"Parameters",
":",
"-",
"num1"
] | def displaySet(self, num1):
"""
Parameters:
- num1
"""
pass | [
"def",
"displaySet",
"(",
"self",
",",
"num1",
")",
":",
"pass"
] | https://github.com/sdhash/sdhash/blob/b9eff63e4e5867e910f41fd69032bbb1c94a2a5e/sdhash-server/gen-py/sdhashsrv/sdhashsrv.py#L34-L39 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/array_analysis.py | python | SymbolicEquivSet.define | (self, var, redefined, func_ir=None, typ=None) | Besides incrementing the definition count of the given variable
name, it will also retrieve and simplify its definition from func_ir,
and remember the result for later equivalence comparison. Supported
operations are:
1. arithmetic plus and minus with constants
2. wrap_index ... | Besides incrementing the definition count of the given variable
name, it will also retrieve and simplify its definition from func_ir,
and remember the result for later equivalence comparison. Supported
operations are:
1. arithmetic plus and minus with constants
2. wrap_index ... | [
"Besides",
"incrementing",
"the",
"definition",
"count",
"of",
"the",
"given",
"variable",
"name",
"it",
"will",
"also",
"retrieve",
"and",
"simplify",
"its",
"definition",
"from",
"func_ir",
"and",
"remember",
"the",
"result",
"for",
"later",
"equivalence",
"co... | def define(self, var, redefined, func_ir=None, typ=None):
"""Besides incrementing the definition count of the given variable
name, it will also retrieve and simplify its definition from func_ir,
and remember the result for later equivalence comparison. Supported
operations are:
... | [
"def",
"define",
"(",
"self",
",",
"var",
",",
"redefined",
",",
"func_ir",
"=",
"None",
",",
"typ",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"var",
",",
"ir",
".",
"Var",
")",
":",
"name",
"=",
"var",
".",
"name",
"else",
":",
"name",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/array_analysis.py#L825-L852 | ||
nest/nest-simulator | f2623eb78518cdbd55e77e0ed486bf1111bcb62f | doc/slihelp_generator/writers.py | python | write_helpindex | (helpdir) | Writes helpindex.html and helpindex.hlp
--------------------------------------- | Writes helpindex.html and helpindex.hlp
--------------------------------------- | [
"Writes",
"helpindex",
".",
"html",
"and",
"helpindex",
".",
"hlp",
"---------------------------------------"
] | def write_helpindex(helpdir):
"""
Writes helpindex.html and helpindex.hlp
---------------------------------------
"""
# We only have to generate a helpindex if the help directory exists
if not os.path.exists(helpdir):
print("Error: Help directory not found: " + helpdir)
return
... | [
"def",
"write_helpindex",
"(",
"helpdir",
")",
":",
"# We only have to generate a helpindex if the help directory exists",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"helpdir",
")",
":",
"print",
"(",
"\"Error: Help directory not found: \"",
"+",
"helpdir",
")"... | https://github.com/nest/nest-simulator/blob/f2623eb78518cdbd55e77e0ed486bf1111bcb62f/doc/slihelp_generator/writers.py#L152-L251 | ||
macchina-io/macchina.io | ef24ba0e18379c3dd48fb84e6dbf991101cb8db0 | platform/JS/V8/tools/gyp/pylib/gyp/generator/ninja.py | python | NinjaWriter.WriteMacXCassets | (self, xcassets, bundle_depends) | return partial_info_plist | Writes ninja edges for 'mac_bundle_resources' .xcassets files.
This add an invocation of 'actool' via the 'mac_tool.py' helper script.
It assumes that the assets catalogs define at least one imageset and
thus an Assets.car file will be generated in the application resources
directory. If this is not th... | Writes ninja edges for 'mac_bundle_resources' .xcassets files. | [
"Writes",
"ninja",
"edges",
"for",
"mac_bundle_resources",
".",
"xcassets",
"files",
"."
] | def WriteMacXCassets(self, xcassets, bundle_depends):
"""Writes ninja edges for 'mac_bundle_resources' .xcassets files.
This add an invocation of 'actool' via the 'mac_tool.py' helper script.
It assumes that the assets catalogs define at least one imageset and
thus an Assets.car file will be generated ... | [
"def",
"WriteMacXCassets",
"(",
"self",
",",
"xcassets",
",",
"bundle_depends",
")",
":",
"if",
"not",
"xcassets",
":",
"return",
"extra_arguments",
"=",
"{",
"}",
"settings_to_arg",
"=",
"{",
"'XCASSETS_APP_ICON'",
":",
"'app-icon'",
",",
"'XCASSETS_LAUNCH_IMAGE'... | https://github.com/macchina-io/macchina.io/blob/ef24ba0e18379c3dd48fb84e6dbf991101cb8db0/platform/JS/V8/tools/gyp/pylib/gyp/generator/ninja.py#L824-L868 | |
microsoft/AirSim | 8057725712c0cd46979135396381784075ffc0f3 | PythonClient/airsim/client.py | python | VehicleClient.simListAssets | (self) | return self.client.call('simListAssets') | Lists all the assets present in the Asset Registry
Returns:
list[str]: Names of all the assets | Lists all the assets present in the Asset Registry | [
"Lists",
"all",
"the",
"assets",
"present",
"in",
"the",
"Asset",
"Registry"
] | def simListAssets(self):
"""
Lists all the assets present in the Asset Registry
Returns:
list[str]: Names of all the assets
"""
return self.client.call('simListAssets') | [
"def",
"simListAssets",
"(",
"self",
")",
":",
"return",
"self",
".",
"client",
".",
"call",
"(",
"'simListAssets'",
")"
] | https://github.com/microsoft/AirSim/blob/8057725712c0cd46979135396381784075ffc0f3/PythonClient/airsim/client.py#L568-L575 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_controls.py | python | TreeCtrl.AppendItem | (*args, **kwargs) | return _controls_.TreeCtrl_AppendItem(*args, **kwargs) | AppendItem(self, TreeItemId parent, String text, int image=-1, int selectedImage=-1,
TreeItemData data=None) -> TreeItemId | AppendItem(self, TreeItemId parent, String text, int image=-1, int selectedImage=-1,
TreeItemData data=None) -> TreeItemId | [
"AppendItem",
"(",
"self",
"TreeItemId",
"parent",
"String",
"text",
"int",
"image",
"=",
"-",
"1",
"int",
"selectedImage",
"=",
"-",
"1",
"TreeItemData",
"data",
"=",
"None",
")",
"-",
">",
"TreeItemId"
] | def AppendItem(*args, **kwargs):
"""
AppendItem(self, TreeItemId parent, String text, int image=-1, int selectedImage=-1,
TreeItemData data=None) -> TreeItemId
"""
return _controls_.TreeCtrl_AppendItem(*args, **kwargs) | [
"def",
"AppendItem",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"TreeCtrl_AppendItem",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_controls.py#L5444-L5449 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/python/ops/variable_scope.py | python | VariableScope.reuse_variables | (self) | Reuse variables in this scope. | Reuse variables in this scope. | [
"Reuse",
"variables",
"in",
"this",
"scope",
"."
] | def reuse_variables(self):
"""Reuse variables in this scope."""
self._reuse = True | [
"def",
"reuse_variables",
"(",
"self",
")",
":",
"self",
".",
"_reuse",
"=",
"True"
] | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/python/ops/variable_scope.py#L636-L638 | ||
hszhao/PSPNet | cf7e5a99ba37e46118026e96be5821a9bc63bde0 | scripts/cpp_lint.py | python | CheckForIncludeWhatYouUse | (filename, clean_lines, include_state, error,
io=codecs) | Reports for missing stl includes.
This function will output warnings to make sure you are including the headers
necessary for the stl containers and functions that you use. We only give one
reason to include a header. For example, if you use both equal_to<> and
less<> in a .h file, only one (the latter in the ... | Reports for missing stl includes. | [
"Reports",
"for",
"missing",
"stl",
"includes",
"."
] | def CheckForIncludeWhatYouUse(filename, clean_lines, include_state, error,
io=codecs):
"""Reports for missing stl includes.
This function will output warnings to make sure you are including the headers
necessary for the stl containers and functions that you use. We only give one
r... | [
"def",
"CheckForIncludeWhatYouUse",
"(",
"filename",
",",
"clean_lines",
",",
"include_state",
",",
"error",
",",
"io",
"=",
"codecs",
")",
":",
"required",
"=",
"{",
"}",
"# A map of header name to linenumber and the template entity.",
"# Example of required: { '<functiona... | https://github.com/hszhao/PSPNet/blob/cf7e5a99ba37e46118026e96be5821a9bc63bde0/scripts/cpp_lint.py#L4483-L4573 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/autograph/impl/conversion.py | python | convert_func_to_ast | (f, program_ctx, do_rename=True) | return (node,), new_name, entity_info | Specialization of `convert_entity_to_ast` for callable functions. | Specialization of `convert_entity_to_ast` for callable functions. | [
"Specialization",
"of",
"convert_entity_to_ast",
"for",
"callable",
"functions",
"."
] | def convert_func_to_ast(f, program_ctx, do_rename=True):
"""Specialization of `convert_entity_to_ast` for callable functions."""
future_features = inspect_utils.getfutureimports(f)
node, source = parser.parse_entity(f, future_features=future_features)
logging.log(3, 'Source code of %s:\n\n%s\n', f, source)
#... | [
"def",
"convert_func_to_ast",
"(",
"f",
",",
"program_ctx",
",",
"do_rename",
"=",
"True",
")",
":",
"future_features",
"=",
"inspect_utils",
".",
"getfutureimports",
"(",
"f",
")",
"node",
",",
"source",
"=",
"parser",
".",
"parse_entity",
"(",
"f",
",",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/autograph/impl/conversion.py#L626-L679 | |
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TStrV.Sort | (self, Asc=True) | return _snap.TStrV_Sort(self, Asc) | Sort(TStrV self, bool const & Asc=True)
Parameters:
Asc: bool const &
Sort(TStrV self)
Parameters:
self: TVec< TStr,int > * | Sort(TStrV self, bool const & Asc=True) | [
"Sort",
"(",
"TStrV",
"self",
"bool",
"const",
"&",
"Asc",
"=",
"True",
")"
] | def Sort(self, Asc=True):
"""
Sort(TStrV self, bool const & Asc=True)
Parameters:
Asc: bool const &
Sort(TStrV self)
Parameters:
self: TVec< TStr,int > *
"""
return _snap.TStrV_Sort(self, Asc) | [
"def",
"Sort",
"(",
"self",
",",
"Asc",
"=",
"True",
")",
":",
"return",
"_snap",
".",
"TStrV_Sort",
"(",
"self",
",",
"Asc",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L19712-L19725 | |
sdhash/sdhash | b9eff63e4e5867e910f41fd69032bbb1c94a2a5e | external/tools/build/v2/util/path.py | python | glob_in_parents | (dir, patterns, upper_limit=None) | return result | Recursive version of GLOB which glob sall parent directories
of dir until the first match is found. Returns an empty result if no match
is found | Recursive version of GLOB which glob sall parent directories
of dir until the first match is found. Returns an empty result if no match
is found | [
"Recursive",
"version",
"of",
"GLOB",
"which",
"glob",
"sall",
"parent",
"directories",
"of",
"dir",
"until",
"the",
"first",
"match",
"is",
"found",
".",
"Returns",
"an",
"empty",
"result",
"if",
"no",
"match",
"is",
"found"
] | def glob_in_parents(dir, patterns, upper_limit=None):
"""Recursive version of GLOB which glob sall parent directories
of dir until the first match is found. Returns an empty result if no match
is found"""
assert(isinstance(dir, str))
assert(isinstance(patterns, list))
result = []
... | [
"def",
"glob_in_parents",
"(",
"dir",
",",
"patterns",
",",
"upper_limit",
"=",
"None",
")",
":",
"assert",
"(",
"isinstance",
"(",
"dir",
",",
"str",
")",
")",
"assert",
"(",
"isinstance",
"(",
"patterns",
",",
"list",
")",
")",
"result",
"=",
"[",
... | https://github.com/sdhash/sdhash/blob/b9eff63e4e5867e910f41fd69032bbb1c94a2a5e/external/tools/build/v2/util/path.py#L857-L878 | |
OpenGenus/quark | 225ad96efdfcc66cb6584a756c17eb3871e6eb62 | code/code/data_structures/src/tree/b_tree/b_tree/b_tree.py | python | BTree.search | (self, k, x=None) | Search the B-Tree for the key k.
args
=====================
k : Key to search for
x : (optional) Node at which to begin search. Can be None, in which case the entire tree is searched. | Search the B-Tree for the key k.
args
=====================
k : Key to search for
x : (optional) Node at which to begin search. Can be None, in which case the entire tree is searched. | [
"Search",
"the",
"B",
"-",
"Tree",
"for",
"the",
"key",
"k",
".",
"args",
"=====================",
"k",
":",
"Key",
"to",
"search",
"for",
"x",
":",
"(",
"optional",
")",
"Node",
"at",
"which",
"to",
"begin",
"search",
".",
"Can",
"be",
"None",
"in",... | def search(self, k, x=None):
"""Search the B-Tree for the key k.
args
=====================
k : Key to search for
x : (optional) Node at which to begin search. Can be None, in which case the entire tree is searched.
"""
if isinstance(x, BTreeNode... | [
"def",
"search",
"(",
"self",
",",
"k",
",",
"x",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"BTreeNode",
")",
":",
"i",
"=",
"0",
"while",
"i",
"<",
"len",
"(",
"x",
".",
"keys",
")",
"and",
"k",
">",
"x",
".",
"keys",
"[",
... | https://github.com/OpenGenus/quark/blob/225ad96efdfcc66cb6584a756c17eb3871e6eb62/code/code/data_structures/src/tree/b_tree/b_tree/b_tree.py#L30-L50 | ||
tensorflow/minigo | 6d89c202cdceaf449aefc3149ab2110d44f1a6a4 | ratings/cbt_ratings.py | python | current_run | (model_ids) | return 'v' + str(max_num) | Return the largest number run.
If you want something different, feel free to extend with fsdb or something. | Return the largest number run. | [
"Return",
"the",
"largest",
"number",
"run",
"."
] | def current_run(model_ids):
"""Return the largest number run.
If you want something different, feel free to extend with fsdb or something.
"""
all_runs = set(run for run, name in model_ids)
# TODO fix before submit
return max(all_runs)
# Assumption of the run format.
assert all(re.mat... | [
"def",
"current_run",
"(",
"model_ids",
")",
":",
"all_runs",
"=",
"set",
"(",
"run",
"for",
"run",
",",
"name",
"in",
"model_ids",
")",
"# TODO fix before submit",
"return",
"max",
"(",
"all_runs",
")",
"# Assumption of the run format.",
"assert",
"all",
"(",
... | https://github.com/tensorflow/minigo/blob/6d89c202cdceaf449aefc3149ab2110d44f1a6a4/ratings/cbt_ratings.py#L321-L336 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/sets.py | python | BaseSet.symmetric_difference | (self, other) | return result | Return the symmetric difference of two sets as a new set.
(I.e. all elements that are in exactly one of the sets.) | Return the symmetric difference of two sets as a new set. | [
"Return",
"the",
"symmetric",
"difference",
"of",
"two",
"sets",
"as",
"a",
"new",
"set",
"."
] | def symmetric_difference(self, other):
"""Return the symmetric difference of two sets as a new set.
(I.e. all elements that are in exactly one of the sets.)
"""
result = self.__class__()
data = result._data
value = True
selfdata = self._data
try:
... | [
"def",
"symmetric_difference",
"(",
"self",
",",
"other",
")",
":",
"result",
"=",
"self",
".",
"__class__",
"(",
")",
"data",
"=",
"result",
".",
"_data",
"value",
"=",
"True",
"selfdata",
"=",
"self",
".",
"_data",
"try",
":",
"otherdata",
"=",
"othe... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/sets.py#L228-L245 | |
albertz/openlierox | d316c14a8eb57848ef56e9bfa7b23a56f694a51b | tools/DedicatedServerVideo/gdata/tlslite/VerifierDB.py | python | VerifierDB.makeVerifier | (username, password, bits) | return mathtls.makeVerifier(username, password, bits) | Create a verifier entry which can be stored in a VerifierDB.
@type username: str
@param username: The username for this verifier. Must be less
than 256 characters in length.
@type password: str
@param password: The password for this verifier.
@type bits: int
@... | Create a verifier entry which can be stored in a VerifierDB. | [
"Create",
"a",
"verifier",
"entry",
"which",
"can",
"be",
"stored",
"in",
"a",
"VerifierDB",
"."
] | def makeVerifier(username, password, bits):
"""Create a verifier entry which can be stored in a VerifierDB.
@type username: str
@param username: The username for this verifier. Must be less
than 256 characters in length.
@type password: str
@param password: The passwor... | [
"def",
"makeVerifier",
"(",
"username",
",",
"password",
",",
"bits",
")",
":",
"return",
"mathtls",
".",
"makeVerifier",
"(",
"username",
",",
"password",
",",
"bits",
")"
] | https://github.com/albertz/openlierox/blob/d316c14a8eb57848ef56e9bfa7b23a56f694a51b/tools/DedicatedServerVideo/gdata/tlslite/VerifierDB.py#L70-L89 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/botocore/vendored/requests/packages/urllib3/packages/six.py | python | iterkeys | (d) | return iter(getattr(d, _iterkeys)()) | Return an iterator over the keys of a dictionary. | Return an iterator over the keys of a dictionary. | [
"Return",
"an",
"iterator",
"over",
"the",
"keys",
"of",
"a",
"dictionary",
"."
] | def iterkeys(d):
"""Return an iterator over the keys of a dictionary."""
return iter(getattr(d, _iterkeys)()) | [
"def",
"iterkeys",
"(",
"d",
")",
":",
"return",
"iter",
"(",
"getattr",
"(",
"d",
",",
"_iterkeys",
")",
"(",
")",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/botocore/vendored/requests/packages/urllib3/packages/six.py#L263-L265 | |
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Tools/CryVersionSelector/cryselect.py | python | error_engine_path_not_found | (args, engine_id) | Error to specify that the engine path could not be found,
because the engine was not registered. | Error to specify that the engine path could not be found,
because the engine was not registered. | [
"Error",
"to",
"specify",
"that",
"the",
"engine",
"path",
"could",
"not",
"be",
"found",
"because",
"the",
"engine",
"was",
"not",
"registered",
"."
] | def error_engine_path_not_found(args, engine_id):
"""
Error to specify that the engine path could not be found,
because the engine was not registered.
"""
message = "CryEngine '{}' has not been registered locally.\n".format(
engine_id)
if not args.silent and HAS_WIN_MODULES:
MESS... | [
"def",
"error_engine_path_not_found",
"(",
"args",
",",
"engine_id",
")",
":",
"message",
"=",
"\"CryEngine '{}' has not been registered locally.\\n\"",
".",
"format",
"(",
"engine_id",
")",
"if",
"not",
"args",
".",
"silent",
"and",
"HAS_WIN_MODULES",
":",
"MESSAGEBO... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Tools/CryVersionSelector/cryselect.py#L126-L138 | ||
martinrotter/textosaurus | 4e2ad75abaf5b7e6a823766a2aa8a30f0c965cb8 | src/libtextosaurus/3rd-party/scintilla-lt/scripts/Dependencies.py | python | InsertSynonym | (dependencies, current, additional) | return result | Insert a copy of one object file with dependencies under a different name.
Used when one source file is used to create two object files with different
preprocessor definitions. | Insert a copy of one object file with dependencies under a different name.
Used when one source file is used to create two object files with different
preprocessor definitions. | [
"Insert",
"a",
"copy",
"of",
"one",
"object",
"file",
"with",
"dependencies",
"under",
"a",
"different",
"name",
".",
"Used",
"when",
"one",
"source",
"file",
"is",
"used",
"to",
"create",
"two",
"object",
"files",
"with",
"different",
"preprocessor",
"defin... | def InsertSynonym(dependencies, current, additional):
""" Insert a copy of one object file with dependencies under a different name.
Used when one source file is used to create two object files with different
preprocessor definitions. """
result = []
for dep in dependencies:
result.append(dep)
if (dep[0] == cu... | [
"def",
"InsertSynonym",
"(",
"dependencies",
",",
"current",
",",
"additional",
")",
":",
"result",
"=",
"[",
"]",
"for",
"dep",
"in",
"dependencies",
":",
"result",
".",
"append",
"(",
"dep",
")",
"if",
"(",
"dep",
"[",
"0",
"]",
"==",
"current",
")... | https://github.com/martinrotter/textosaurus/blob/4e2ad75abaf5b7e6a823766a2aa8a30f0c965cb8/src/libtextosaurus/3rd-party/scintilla-lt/scripts/Dependencies.py#L89-L99 | |
jsupancic/deep_hand_pose | 22cbeae1a8410ff5d37c060c7315719d0a5d608f | scripts/cpp_lint.py | python | RemoveMultiLineCommentsFromRange | (lines, begin, end) | Clears a range of lines for multi-line comments. | Clears a range of lines for multi-line comments. | [
"Clears",
"a",
"range",
"of",
"lines",
"for",
"multi",
"-",
"line",
"comments",
"."
] | def RemoveMultiLineCommentsFromRange(lines, begin, end):
"""Clears a range of lines for multi-line comments."""
# Having // dummy comments makes the lines non-empty, so we will not get
# unnecessary blank line warnings later in the code.
for i in range(begin, end):
lines[i] = '// dummy' | [
"def",
"RemoveMultiLineCommentsFromRange",
"(",
"lines",
",",
"begin",
",",
"end",
")",
":",
"# Having // dummy comments makes the lines non-empty, so we will not get",
"# unnecessary blank line warnings later in the code.",
"for",
"i",
"in",
"range",
"(",
"begin",
",",
"end",
... | https://github.com/jsupancic/deep_hand_pose/blob/22cbeae1a8410ff5d37c060c7315719d0a5d608f/scripts/cpp_lint.py#L1143-L1148 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/keras/_impl/keras/backend.py | python | moving_average_update | (x, value, momentum) | return moving_averages.assign_moving_average(
x, value, momentum, zero_debias=False) | Compute the moving average of a variable.
Arguments:
x: A Variable.
value: A tensor with the same shape as `variable`.
momentum: The moving average momentum.
Returns:
An Operation to update the variable. | Compute the moving average of a variable. | [
"Compute",
"the",
"moving",
"average",
"of",
"a",
"variable",
"."
] | def moving_average_update(x, value, momentum):
"""Compute the moving average of a variable.
Arguments:
x: A Variable.
value: A tensor with the same shape as `variable`.
momentum: The moving average momentum.
Returns:
An Operation to update the variable.
"""
return moving_averages.ass... | [
"def",
"moving_average_update",
"(",
"x",
",",
"value",
",",
"momentum",
")",
":",
"return",
"moving_averages",
".",
"assign_moving_average",
"(",
"x",
",",
"value",
",",
"momentum",
",",
"zero_debias",
"=",
"False",
")"
] | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/keras/_impl/keras/backend.py#L1125-L1137 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/sparse/compressed.py | python | _cs_matrix.sort_indices | (self) | Sort the indices of this matrix *in place* | Sort the indices of this matrix *in place* | [
"Sort",
"the",
"indices",
"of",
"this",
"matrix",
"*",
"in",
"place",
"*"
] | def sort_indices(self):
"""Sort the indices of this matrix *in place*
"""
if not self.has_sorted_indices:
_sparsetools.csr_sort_indices(len(self.indptr) - 1, self.indptr,
self.indices, self.data)
self.has_sorted_indices = True | [
"def",
"sort_indices",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"has_sorted_indices",
":",
"_sparsetools",
".",
"csr_sort_indices",
"(",
"len",
"(",
"self",
".",
"indptr",
")",
"-",
"1",
",",
"self",
".",
"indptr",
",",
"self",
".",
"indices",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/sparse/compressed.py#L1069-L1076 | ||
livecode/livecode | 4606a10ea10b16d5071d0f9f263ccdd7ede8b31d | gyp/pylib/gyp/__init__.py | python | RegeneratableOptionParser.add_option | (self, *args, **kw) | Add an option to the parser.
This accepts the same arguments as OptionParser.add_option, plus the
following:
regenerate: can be set to False to prevent this option from being included
in regeneration.
env_name: name of environment variable that additional values for this
... | Add an option to the parser. | [
"Add",
"an",
"option",
"to",
"the",
"parser",
"."
] | def add_option(self, *args, **kw):
"""Add an option to the parser.
This accepts the same arguments as OptionParser.add_option, plus the
following:
regenerate: can be set to False to prevent this option from being included
in regeneration.
env_name: name of environment variable... | [
"def",
"add_option",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"env_name",
"=",
"kw",
".",
"pop",
"(",
"'env_name'",
",",
"None",
")",
"if",
"'dest'",
"in",
"kw",
"and",
"kw",
".",
"pop",
"(",
"'regenerate'",
",",
"True",
")",... | https://github.com/livecode/livecode/blob/4606a10ea10b16d5071d0f9f263ccdd7ede8b31d/gyp/pylib/gyp/__init__.py#L242-L271 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_gdi.py | python | Font.Smaller | (*args, **kwargs) | return _gdi_.Font_Smaller(*args, **kwargs) | Smaller(self) -> Font | Smaller(self) -> Font | [
"Smaller",
"(",
"self",
")",
"-",
">",
"Font"
] | def Smaller(*args, **kwargs):
"""Smaller(self) -> Font"""
return _gdi_.Font_Smaller(*args, **kwargs) | [
"def",
"Smaller",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"Font_Smaller",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_gdi.py#L2488-L2490 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/pyfakefs/pyfakefs/fake_filesystem.py | python | FakeOsModule.close | (self, file_des) | Closes a file descriptor.
Args:
file_des: An integer file descriptor for the file object requested.
Raises:
OSError: bad file descriptor.
TypeError: if file descriptor is not an integer. | Closes a file descriptor. | [
"Closes",
"a",
"file",
"descriptor",
"."
] | def close(self, file_des):
"""Closes a file descriptor.
Args:
file_des: An integer file descriptor for the file object requested.
Raises:
OSError: bad file descriptor.
TypeError: if file descriptor is not an integer.
"""
fh = self.filesystem.GetOpenFile(file_des)
fh.close() | [
"def",
"close",
"(",
"self",
",",
"file_des",
")",
":",
"fh",
"=",
"self",
".",
"filesystem",
".",
"GetOpenFile",
"(",
"file_des",
")",
"fh",
".",
"close",
"(",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/pyfakefs/pyfakefs/fake_filesystem.py#L1259-L1270 | ||
s9xie/hed | 94fb22f10cbfec8d84fbc0642b224022014b6bd6 | scripts/cpp_lint.py | python | FindNextMatchingAngleBracket | (clean_lines, linenum, init_suffix) | return True | Find the corresponding > to close a template.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: Current line number.
init_suffix: Remainder of the current line after the initial <.
Returns:
True if a matching bracket exists. | Find the corresponding > to close a template. | [
"Find",
"the",
"corresponding",
">",
"to",
"close",
"a",
"template",
"."
] | def FindNextMatchingAngleBracket(clean_lines, linenum, init_suffix):
"""Find the corresponding > to close a template.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: Current line number.
init_suffix: Remainder of the current line after the initial <.
Returns:
True if a ... | [
"def",
"FindNextMatchingAngleBracket",
"(",
"clean_lines",
",",
"linenum",
",",
"init_suffix",
")",
":",
"line",
"=",
"init_suffix",
"nesting_stack",
"=",
"[",
"'<'",
"]",
"while",
"True",
":",
"# Find the next operator that can tell us whether < is used as an",
"# openin... | https://github.com/s9xie/hed/blob/94fb22f10cbfec8d84fbc0642b224022014b6bd6/scripts/cpp_lint.py#L2517-L2583 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/third_party/web-page-replay/platformsettings.py | python | _LinuxPlatformSettings.setup_temporary_loopback_config | (self) | Setup Linux to temporarily use reasonably sized frames.
Linux uses jumbo frames by default (16KB), using the combination
of MTU probing and a base MSS makes it use normal sized packets.
The reason this works is because tcp_base_mss is only used when MTU
probing is enabled. And since we're using the m... | Setup Linux to temporarily use reasonably sized frames. | [
"Setup",
"Linux",
"to",
"temporarily",
"use",
"reasonably",
"sized",
"frames",
"."
] | def setup_temporary_loopback_config(self):
"""Setup Linux to temporarily use reasonably sized frames.
Linux uses jumbo frames by default (16KB), using the combination
of MTU probing and a base MSS makes it use normal sized packets.
The reason this works is because tcp_base_mss is only used when MTU
... | [
"def",
"setup_temporary_loopback_config",
"(",
"self",
")",
":",
"ENABLE_MTU_PROBING",
"=",
"2",
"original_probing",
"=",
"self",
".",
"get_sysctl",
"(",
"self",
".",
"TCP_MTU_PROBING",
")",
"self",
".",
"set_sysctl",
"(",
"self",
".",
"TCP_MTU_PROBING",
",",
"E... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/third_party/web-page-replay/platformsettings.py#L542-L561 | ||
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Draft/draftguitools/gui_clone.py | python | Clone.GetResources | (self) | return {'Pixmap': 'Draft_Clone',
'Accel': "C,L",
'MenuText': QT_TRANSLATE_NOOP("Draft_Clone", "Clone"),
'ToolTip': QT_TRANSLATE_NOOP("Draft_Clone", "Creates a clone of the selected objects.\nThe resulting clone can be scaled in each of its three directions.")} | Set icon, menu and tooltip. | Set icon, menu and tooltip. | [
"Set",
"icon",
"menu",
"and",
"tooltip",
"."
] | def GetResources(self):
"""Set icon, menu and tooltip."""
return {'Pixmap': 'Draft_Clone',
'Accel': "C,L",
'MenuText': QT_TRANSLATE_NOOP("Draft_Clone", "Clone"),
'ToolTip': QT_TRANSLATE_NOOP("Draft_Clone", "Creates a clone of the selected objects.\nThe re... | [
"def",
"GetResources",
"(",
"self",
")",
":",
"return",
"{",
"'Pixmap'",
":",
"'Draft_Clone'",
",",
"'Accel'",
":",
"\"C,L\"",
",",
"'MenuText'",
":",
"QT_TRANSLATE_NOOP",
"(",
"\"Draft_Clone\"",
",",
"\"Clone\"",
")",
",",
"'ToolTip'",
":",
"QT_TRANSLATE_NOOP",... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Draft/draftguitools/gui_clone.py#L65-L71 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/html2.py | python | WebViewFactory.Create | (*args) | return _html2.WebViewFactory_Create(*args) | Create(self) -> WebView
Create(self, Window parent, int id, String url=wxWebViewDefaultURLStr,
Point pos=DefaultPosition, Size size=DefaultSize,
long style=0, String name=wxWebViewNameStr) -> WebView | Create(self) -> WebView
Create(self, Window parent, int id, String url=wxWebViewDefaultURLStr,
Point pos=DefaultPosition, Size size=DefaultSize,
long style=0, String name=wxWebViewNameStr) -> WebView | [
"Create",
"(",
"self",
")",
"-",
">",
"WebView",
"Create",
"(",
"self",
"Window",
"parent",
"int",
"id",
"String",
"url",
"=",
"wxWebViewDefaultURLStr",
"Point",
"pos",
"=",
"DefaultPosition",
"Size",
"size",
"=",
"DefaultSize",
"long",
"style",
"=",
"0",
... | def Create(*args):
"""
Create(self) -> WebView
Create(self, Window parent, int id, String url=wxWebViewDefaultURLStr,
Point pos=DefaultPosition, Size size=DefaultSize,
long style=0, String name=wxWebViewNameStr) -> WebView
"""
return _html2.WebViewFactor... | [
"def",
"Create",
"(",
"*",
"args",
")",
":",
"return",
"_html2",
".",
"WebViewFactory_Create",
"(",
"*",
"args",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/html2.py#L114-L121 | |
rodeofx/OpenWalter | 6116fbe3f04f1146c854afbfbdbe944feaee647e | walter/common/walterWidgets/utils.py | python | toPyObject | (obj) | return obj | Call QVariant.toPyObject on the case we are in PyQt. | Call QVariant.toPyObject on the case we are in PyQt. | [
"Call",
"QVariant",
".",
"toPyObject",
"on",
"the",
"case",
"we",
"are",
"in",
"PyQt",
"."
] | def toPyObject(obj):
"""Call QVariant.toPyObject on the case we are in PyQt."""
# QAbstractItemModel.data() returns QVariant in PyQt and a python type in
# PySide. The result of this function should be the same for all the Qts.
if obj and qtBinding == "PyQt4":
return obj.toPyObject()
return... | [
"def",
"toPyObject",
"(",
"obj",
")",
":",
"# QAbstractItemModel.data() returns QVariant in PyQt and a python type in",
"# PySide. The result of this function should be the same for all the Qts.",
"if",
"obj",
"and",
"qtBinding",
"==",
"\"PyQt4\"",
":",
"return",
"obj",
".",
"toP... | https://github.com/rodeofx/OpenWalter/blob/6116fbe3f04f1146c854afbfbdbe944feaee647e/walter/common/walterWidgets/utils.py#L21-L28 | |
wujian16/Cornell-MOE | df299d1be882d2af9796d7a68b3f9505cac7a53e | moe/optimal_learning/python/cpp_wrappers/domain.py | python | TensorProductDomain.get_bounding_box | (self) | return copy.copy(self._domain_bounds) | Return a list of ClosedIntervals representing a bounding box for this domain. | Return a list of ClosedIntervals representing a bounding box for this domain. | [
"Return",
"a",
"list",
"of",
"ClosedIntervals",
"representing",
"a",
"bounding",
"box",
"for",
"this",
"domain",
"."
] | def get_bounding_box(self):
"""Return a list of ClosedIntervals representing a bounding box for this domain."""
return copy.copy(self._domain_bounds) | [
"def",
"get_bounding_box",
"(",
"self",
")",
":",
"return",
"copy",
".",
"copy",
"(",
"self",
".",
"_domain_bounds",
")"
] | https://github.com/wujian16/Cornell-MOE/blob/df299d1be882d2af9796d7a68b3f9505cac7a53e/moe/optimal_learning/python/cpp_wrappers/domain.py#L74-L76 | |
metashell/metashell | f4177e4854ea00c8dbc722cadab26ef413d798ea | 3rd/templight/compiler-rt/lib/sanitizer_common/scripts/cpplint.py | python | _CppLintState.AddFilters | (self, filters) | Adds more filters to the existing list of error-message filters. | Adds more filters to the existing list of error-message filters. | [
"Adds",
"more",
"filters",
"to",
"the",
"existing",
"list",
"of",
"error",
"-",
"message",
"filters",
"."
] | def AddFilters(self, filters):
""" Adds more filters to the existing list of error-message filters. """
for filt in filters.split(','):
clean_filt = filt.strip()
if clean_filt:
self.filters.append(clean_filt)
for filt in self.filters:
if not (filt.startswith('+') or filt.startswith... | [
"def",
"AddFilters",
"(",
"self",
",",
"filters",
")",
":",
"for",
"filt",
"in",
"filters",
".",
"split",
"(",
"','",
")",
":",
"clean_filt",
"=",
"filt",
".",
"strip",
"(",
")",
"if",
"clean_filt",
":",
"self",
".",
"filters",
".",
"append",
"(",
... | https://github.com/metashell/metashell/blob/f4177e4854ea00c8dbc722cadab26ef413d798ea/3rd/templight/compiler-rt/lib/sanitizer_common/scripts/cpplint.py#L919-L928 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.