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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | qa/tasks/ragweed.py | python | download | (ctx, config) | Download the s3 tests from the git builder.
Remove downloaded s3 file upon exit.
The context passed in should be identical to the context
passed in to the main task. | Download the s3 tests from the git builder.
Remove downloaded s3 file upon exit. | [
"Download",
"the",
"s3",
"tests",
"from",
"the",
"git",
"builder",
".",
"Remove",
"downloaded",
"s3",
"file",
"upon",
"exit",
"."
] | def download(ctx, config):
"""
Download the s3 tests from the git builder.
Remove downloaded s3 file upon exit.
The context passed in should be identical to the context
passed in to the main task.
"""
assert isinstance(config, dict)
log.info('Downloading ragweed...')
testdir = teuth... | [
"def",
"download",
"(",
"ctx",
",",
"config",
")",
":",
"assert",
"isinstance",
"(",
"config",
",",
"dict",
")",
"log",
".",
"info",
"(",
"'Downloading ragweed...'",
")",
"testdir",
"=",
"teuthology",
".",
"get_testdir",
"(",
"ctx",
")",
"for",
"(",
"cli... | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/qa/tasks/ragweed.py#L48-L94 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/Tkinter.py | python | Misc.getboolean | (self, s) | return self.tk.getboolean(s) | Return a boolean value for Tcl boolean values true and false given as parameter. | Return a boolean value for Tcl boolean values true and false given as parameter. | [
"Return",
"a",
"boolean",
"value",
"for",
"Tcl",
"boolean",
"values",
"true",
"and",
"false",
"given",
"as",
"parameter",
"."
] | def getboolean(self, s):
"""Return a boolean value for Tcl boolean values true and false given as parameter."""
return self.tk.getboolean(s) | [
"def",
"getboolean",
"(",
"self",
",",
"s",
")",
":",
"return",
"self",
".",
"tk",
".",
"getboolean",
"(",
"s",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/Tkinter.py#L457-L459 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/html.py | python | PreHtmlHelpDialog | (*args, **kwargs) | return val | PreHtmlHelpDialog(HtmlHelpData data=None) -> HtmlHelpDialog | PreHtmlHelpDialog(HtmlHelpData data=None) -> HtmlHelpDialog | [
"PreHtmlHelpDialog",
"(",
"HtmlHelpData",
"data",
"=",
"None",
")",
"-",
">",
"HtmlHelpDialog"
] | def PreHtmlHelpDialog(*args, **kwargs):
"""PreHtmlHelpDialog(HtmlHelpData data=None) -> HtmlHelpDialog"""
val = _html.new_PreHtmlHelpDialog(*args, **kwargs)
self._setOORInfo(self)
return val | [
"def",
"PreHtmlHelpDialog",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"val",
"=",
"_html",
".",
"new_PreHtmlHelpDialog",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"self",
".",
"_setOORInfo",
"(",
"self",
")",
"return",
"val"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/html.py#L1850-L1854 | |
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Tool/zip.py | python | generate | (env) | Add Builders and construction variables for zip to an Environment. | Add Builders and construction variables for zip to an Environment. | [
"Add",
"Builders",
"and",
"construction",
"variables",
"for",
"zip",
"to",
"an",
"Environment",
"."
] | def generate(env):
"""Add Builders and construction variables for zip to an Environment."""
try:
bld = env['BUILDERS']['Zip']
except KeyError:
bld = ZipBuilder
env['BUILDERS']['Zip'] = bld
env['ZIP'] = 'zip'
env['ZIPFLAGS'] = SCons.Util.CLVar('')
env['ZIPCOM'] ... | [
"def",
"generate",
"(",
"env",
")",
":",
"try",
":",
"bld",
"=",
"env",
"[",
"'BUILDERS'",
"]",
"[",
"'Zip'",
"]",
"except",
"KeyError",
":",
"bld",
"=",
"ZipBuilder",
"env",
"[",
"'BUILDERS'",
"]",
"[",
"'Zip'",
"]",
"=",
"bld",
"env",
"[",
"'ZIP'... | https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Tool/zip.py#L78-L91 | ||
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/clang/tools/scan-build-py/libscanbuild/runner.py | python | classify_parameters | (command) | return result | Prepare compiler flags (filters some and add others) and take out
language (-x) and architecture (-arch) flags for future processing. | Prepare compiler flags (filters some and add others) and take out
language (-x) and architecture (-arch) flags for future processing. | [
"Prepare",
"compiler",
"flags",
"(",
"filters",
"some",
"and",
"add",
"others",
")",
"and",
"take",
"out",
"language",
"(",
"-",
"x",
")",
"and",
"architecture",
"(",
"-",
"arch",
")",
"flags",
"for",
"future",
"processing",
"."
] | def classify_parameters(command):
""" Prepare compiler flags (filters some and add others) and take out
language (-x) and architecture (-arch) flags for future processing. """
result = {
'flags': [], # the filtered compiler flags
'arch_list': [], # list of architecture flags
'lang... | [
"def",
"classify_parameters",
"(",
"command",
")",
":",
"result",
"=",
"{",
"'flags'",
":",
"[",
"]",
",",
"# the filtered compiler flags",
"'arch_list'",
":",
"[",
"]",
",",
"# list of architecture flags",
"'language'",
":",
"None",
",",
"# compilation language, No... | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/clang/tools/scan-build-py/libscanbuild/runner.py#L266-L302 | |
rampageX/firmware-mod-kit | c94cd6aeee50d92ec5280a6dba6d74828fd3606b | src/binwalk-2.1.1/src/binwalk/core/magic.py | python | Magic.match | (self, data) | return self.scan(data, 1) | Match the beginning of a data buffer to a signature.
@data - The data buffer to match against the loaded signature list.
Returns a list of SignatureResult objects. | Match the beginning of a data buffer to a signature. | [
"Match",
"the",
"beginning",
"of",
"a",
"data",
"buffer",
"to",
"a",
"signature",
"."
] | def match(self, data):
'''
Match the beginning of a data buffer to a signature.
@data - The data buffer to match against the loaded signature list.
Returns a list of SignatureResult objects.
'''
return self.scan(data, 1) | [
"def",
"match",
"(",
"self",
",",
"data",
")",
":",
"return",
"self",
".",
"scan",
"(",
"data",
",",
"1",
")"
] | https://github.com/rampageX/firmware-mod-kit/blob/c94cd6aeee50d92ec5280a6dba6d74828fd3606b/src/binwalk-2.1.1/src/binwalk/core/magic.py#L716-L724 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/multiprocessing/util.py | python | Finalize.cancel | (self) | Cancel finalization of the object | Cancel finalization of the object | [
"Cancel",
"finalization",
"of",
"the",
"object"
] | def cancel(self):
'''
Cancel finalization of the object
'''
try:
del _finalizer_registry[self._key]
except KeyError:
pass
else:
self._weakref = self._callback = self._args = \
self._kwargs = self._key = None | [
"def",
"cancel",
"(",
"self",
")",
":",
"try",
":",
"del",
"_finalizer_registry",
"[",
"self",
".",
"_key",
"]",
"except",
"KeyError",
":",
"pass",
"else",
":",
"self",
".",
"_weakref",
"=",
"self",
".",
"_callback",
"=",
"self",
".",
"_args",
"=",
"... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/multiprocessing/util.py#L206-L216 | ||
arangodb/arangodb | 0d658689c7d1b721b314fa3ca27d38303e1570c8 | 3rdParty/V8/gyp/generator/xcodeproj_file.py | python | XCConfigurationList.HasBuildSetting | (self, key) | return 1 | Determines the state of a build setting in all XCBuildConfiguration
child objects.
If all child objects have key in their build settings, and the value is the
same in all child objects, returns 1.
If no child objects have the key in their build settings, returns 0.
If some, but not all, child obj... | Determines the state of a build setting in all XCBuildConfiguration
child objects. | [
"Determines",
"the",
"state",
"of",
"a",
"build",
"setting",
"in",
"all",
"XCBuildConfiguration",
"child",
"objects",
"."
] | def HasBuildSetting(self, key):
"""Determines the state of a build setting in all XCBuildConfiguration
child objects.
If all child objects have key in their build settings, and the value is the
same in all child objects, returns 1.
If no child objects have the key in their build settings, returns ... | [
"def",
"HasBuildSetting",
"(",
"self",
",",
"key",
")",
":",
"has",
"=",
"None",
"value",
"=",
"None",
"for",
"configuration",
"in",
"self",
".",
"_properties",
"[",
"'buildConfigurations'",
"]",
":",
"configuration_has",
"=",
"configuration",
".",
"HasBuildSe... | https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/V8/gyp/generator/xcodeproj_file.py#L1626-L1658 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/symsrc/pdb_fingerprint_from_img.py | python | GetPDBInfoFromImg | (filename) | Returns the PDB fingerprint and the pdb filename given an image file | Returns the PDB fingerprint and the pdb filename given an image file | [
"Returns",
"the",
"PDB",
"fingerprint",
"and",
"the",
"pdb",
"filename",
"given",
"an",
"image",
"file"
] | def GetPDBInfoFromImg(filename):
"""Returns the PDB fingerprint and the pdb filename given an image file"""
pe = pefile.PE(filename)
for dbg in pe.DIRECTORY_ENTRY_DEBUG:
if dbg.struct.Type == 2: # IMAGE_DEBUG_TYPE_CODEVIEW
off = dbg.struct.AddressOfRawData
size = dbg.struct.SizeOfData
dat... | [
"def",
"GetPDBInfoFromImg",
"(",
"filename",
")",
":",
"pe",
"=",
"pefile",
".",
"PE",
"(",
"filename",
")",
"for",
"dbg",
"in",
"pe",
".",
"DIRECTORY_ENTRY_DEBUG",
":",
"if",
"dbg",
".",
"struct",
".",
"Type",
"==",
"2",
":",
"# IMAGE_DEBUG_TYPE_CODEVIEW"... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/symsrc/pdb_fingerprint_from_img.py#L26-L50 | ||
GXYM/DRRG | 9e074fa9052de8d131f55ca1f6ae6673c1bfeca4 | dataset/total_text/Evaluation_Protocol/Python_scripts/Deteval.py | python | tau_calculation | (det_x, det_y, gt_x, gt_y) | return np.round((area_of_intersection(det_x, det_y, gt_x, gt_y) / area(det_x, det_y)), 2) | tau = inter_area / det_area | tau = inter_area / det_area | [
"tau",
"=",
"inter_area",
"/",
"det_area"
] | def tau_calculation(det_x, det_y, gt_x, gt_y):
"""
tau = inter_area / det_area
"""
return np.round((area_of_intersection(det_x, det_y, gt_x, gt_y) / area(det_x, det_y)), 2) | [
"def",
"tau_calculation",
"(",
"det_x",
",",
"det_y",
",",
"gt_x",
",",
"gt_y",
")",
":",
"return",
"np",
".",
"round",
"(",
"(",
"area_of_intersection",
"(",
"det_x",
",",
"det_y",
",",
"gt_x",
",",
"gt_y",
")",
"/",
"area",
"(",
"det_x",
",",
"det_... | https://github.com/GXYM/DRRG/blob/9e074fa9052de8d131f55ca1f6ae6673c1bfeca4/dataset/total_text/Evaluation_Protocol/Python_scripts/Deteval.py#L78-L82 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/resolvelib/providers.py | python | AbstractProvider.is_satisfied_by | (self, requirement, candidate) | Whether the given requirement can be satisfied by a candidate.
The candidate is guarenteed to have been generated from the
requirement.
A boolean should be returned to indicate whether `candidate` is a
viable solution to the requirement. | Whether the given requirement can be satisfied by a candidate. | [
"Whether",
"the",
"given",
"requirement",
"can",
"be",
"satisfied",
"by",
"a",
"candidate",
"."
] | def is_satisfied_by(self, requirement, candidate):
"""Whether the given requirement can be satisfied by a candidate.
The candidate is guarenteed to have been generated from the
requirement.
A boolean should be returned to indicate whether `candidate` is a
viable solution to the... | [
"def",
"is_satisfied_by",
"(",
"self",
",",
"requirement",
",",
"candidate",
")",
":",
"raise",
"NotImplementedError"
] | 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/resolvelib/providers.py#L78-L87 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/asyncio/tasks.py | python | run_coroutine_threadsafe | (coro, loop) | return future | Submit a coroutine object to a given event loop.
Return a concurrent.futures.Future to access the result. | Submit a coroutine object to a given event loop. | [
"Submit",
"a",
"coroutine",
"object",
"to",
"a",
"given",
"event",
"loop",
"."
] | def run_coroutine_threadsafe(coro, loop):
"""Submit a coroutine object to a given event loop.
Return a concurrent.futures.Future to access the result.
"""
if not coroutines.iscoroutine(coro):
raise TypeError('A coroutine object is required')
future = concurrent.futures.Future()
def cal... | [
"def",
"run_coroutine_threadsafe",
"(",
"coro",
",",
"loop",
")",
":",
"if",
"not",
"coroutines",
".",
"iscoroutine",
"(",
"coro",
")",
":",
"raise",
"TypeError",
"(",
"'A coroutine object is required'",
")",
"future",
"=",
"concurrent",
".",
"futures",
".",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/asyncio/tasks.py#L915-L935 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_controls.py | python | Choicebook.Create | (*args, **kwargs) | return _controls_.Choicebook_Create(*args, **kwargs) | Create(self, Window parent, int id, Point pos=DefaultPosition, Size size=DefaultSize,
long style=0, String name=EmptyString) -> bool | Create(self, Window parent, int id, Point pos=DefaultPosition, Size size=DefaultSize,
long style=0, String name=EmptyString) -> bool | [
"Create",
"(",
"self",
"Window",
"parent",
"int",
"id",
"Point",
"pos",
"=",
"DefaultPosition",
"Size",
"size",
"=",
"DefaultSize",
"long",
"style",
"=",
"0",
"String",
"name",
"=",
"EmptyString",
")",
"-",
">",
"bool"
] | def Create(*args, **kwargs):
"""
Create(self, Window parent, int id, Point pos=DefaultPosition, Size size=DefaultSize,
long style=0, String name=EmptyString) -> bool
"""
return _controls_.Choicebook_Create(*args, **kwargs) | [
"def",
"Create",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"Choicebook_Create",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_controls.py#L3271-L3276 | |
intel/caffe | 3f494b442ee3f9d17a07b09ecbd5fa2bbda00836 | examples/rfcn/lib/datasets/ds_utils.py | python | validate_boxes | (boxes, width=0, height=0) | Check that a set of boxes are valid. | Check that a set of boxes are valid. | [
"Check",
"that",
"a",
"set",
"of",
"boxes",
"are",
"valid",
"."
] | def validate_boxes(boxes, width=0, height=0):
"""Check that a set of boxes are valid."""
x1 = boxes[:, 0]
y1 = boxes[:, 1]
x2 = boxes[:, 2]
y2 = boxes[:, 3]
assert (x1 >= 0).all()
assert (y1 >= 0).all()
assert (x2 >= x1).all()
assert (y2 >= y1).all()
assert (x2 < width).all()
... | [
"def",
"validate_boxes",
"(",
"boxes",
",",
"width",
"=",
"0",
",",
"height",
"=",
"0",
")",
":",
"x1",
"=",
"boxes",
"[",
":",
",",
"0",
"]",
"y1",
"=",
"boxes",
"[",
":",
",",
"1",
"]",
"x2",
"=",
"boxes",
"[",
":",
",",
"2",
"]",
"y2",
... | https://github.com/intel/caffe/blob/3f494b442ee3f9d17a07b09ecbd5fa2bbda00836/examples/rfcn/lib/datasets/ds_utils.py#L24-L35 | ||
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Editor/Python/windows/Lib/site-packages/setuptools/msvc.py | python | msvc9_find_vcvarsall | (version) | return get_unpatched(msvc9_find_vcvarsall)(version) | Patched "distutils.msvc9compiler.find_vcvarsall" to use the standalone
compiler build for Python (VCForPython). Fall back to original behavior
when the standalone compiler is not available.
Redirect the path of "vcvarsall.bat".
Known supported compilers
-------------------------
Microsoft Visu... | Patched "distutils.msvc9compiler.find_vcvarsall" to use the standalone
compiler build for Python (VCForPython). Fall back to original behavior
when the standalone compiler is not available. | [
"Patched",
"distutils",
".",
"msvc9compiler",
".",
"find_vcvarsall",
"to",
"use",
"the",
"standalone",
"compiler",
"build",
"for",
"Python",
"(",
"VCForPython",
")",
".",
"Fall",
"back",
"to",
"original",
"behavior",
"when",
"the",
"standalone",
"compiler",
"is"... | def msvc9_find_vcvarsall(version):
"""
Patched "distutils.msvc9compiler.find_vcvarsall" to use the standalone
compiler build for Python (VCForPython). Fall back to original behavior
when the standalone compiler is not available.
Redirect the path of "vcvarsall.bat".
Known supported compilers
... | [
"def",
"msvc9_find_vcvarsall",
"(",
"version",
")",
":",
"VC_BASE",
"=",
"r'Software\\%sMicrosoft\\DevDiv\\VCForPython\\%0.1f'",
"key",
"=",
"VC_BASE",
"%",
"(",
"''",
",",
"version",
")",
"try",
":",
"# Per-user installs register the compiler path here",
"productdir",
"=... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Editor/Python/windows/Lib/site-packages/setuptools/msvc.py#L63-L103 | |
rootm0s/Protectors | 5b3f4d11687a5955caf9c3af30666c4bfc2c19ab | OWASP-ZSC/module/readline_windows/pyreadline/lineeditor/history.py | python | LineHistory.get_history_item | (self, index) | return item.get_line_text() | Return the current contents of history item at index (starts with index 1). | Return the current contents of history item at index (starts with index 1). | [
"Return",
"the",
"current",
"contents",
"of",
"history",
"item",
"at",
"index",
"(",
"starts",
"with",
"index",
"1",
")",
"."
] | def get_history_item(self, index):
'''Return the current contents of history item at index (starts with index 1).'''
item = self.history[index - 1]
log("get_history_item: index:%d item:%r" % (index, item))
return item.get_line_text() | [
"def",
"get_history_item",
"(",
"self",
",",
"index",
")",
":",
"item",
"=",
"self",
".",
"history",
"[",
"index",
"-",
"1",
"]",
"log",
"(",
"\"get_history_item: index:%d item:%r\"",
"%",
"(",
"index",
",",
"item",
")",
")",
"return",
"item",
".",
"get_... | https://github.com/rootm0s/Protectors/blob/5b3f4d11687a5955caf9c3af30666c4bfc2c19ab/OWASP-ZSC/module/readline_windows/pyreadline/lineeditor/history.py#L53-L57 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/pickle.py | python | Pickler.memoize | (self, obj) | Store an object in the memo. | Store an object in the memo. | [
"Store",
"an",
"object",
"in",
"the",
"memo",
"."
] | def memoize(self, obj):
"""Store an object in the memo."""
# The Pickler memo is a dictionary mapping object ids to 2-tuples
# that contain the Unpickler memo key and the object being memoized.
# The memo key is written to the pickle and will become
# the key in the Unpickler's ... | [
"def",
"memoize",
"(",
"self",
",",
"obj",
")",
":",
"# The Pickler memo is a dictionary mapping object ids to 2-tuples",
"# that contain the Unpickler memo key and the object being memoized.",
"# The memo key is written to the pickle and will become",
"# the key in the Unpickler's memo. The ... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/pickle.py#L227-L247 | ||
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/framework/ops.py | python | RegisterShape.__call__ | (self, f) | return f | Registers "f" as the shape function for "op_type". | Registers "f" as the shape function for "op_type". | [
"Registers",
"f",
"as",
"the",
"shape",
"function",
"for",
"op_type",
"."
] | def __call__(self, f):
"""Registers "f" as the shape function for "op_type"."""
if f is None:
# None is a special "weak" value that provides a default shape function,
# and can be overridden by a non-None registration.
try:
_default_shape_function_registry.register(_no_shape_function,
... | [
"def",
"__call__",
"(",
"self",
",",
"f",
")",
":",
"if",
"f",
"is",
"None",
":",
"# None is a special \"weak\" value that provides a default shape function,",
"# and can be overridden by a non-None registration.",
"try",
":",
"_default_shape_function_registry",
".",
"register"... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/framework/ops.py#L1752-L1768 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/imaplib.py | python | IMAP4.subscribe | (self, mailbox) | return self._simple_command('SUBSCRIBE', mailbox) | Subscribe to new mailbox.
(typ, [data]) = <instance>.subscribe(mailbox) | Subscribe to new mailbox. | [
"Subscribe",
"to",
"new",
"mailbox",
"."
] | def subscribe(self, mailbox):
"""Subscribe to new mailbox.
(typ, [data]) = <instance>.subscribe(mailbox)
"""
return self._simple_command('SUBSCRIBE', mailbox) | [
"def",
"subscribe",
"(",
"self",
",",
"mailbox",
")",
":",
"return",
"self",
".",
"_simple_command",
"(",
"'SUBSCRIBE'",
",",
"mailbox",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/imaplib.py#L725-L730 | |
manutdzou/KITTI_SSD | 5b620c2f291d36a0fe14489214f22a992f173f44 | scripts/cpp_lint.py | python | GetPreviousNonBlankLine | (clean_lines, linenum) | return ('', -1) | Return the most recent non-blank line and its line number.
Args:
clean_lines: A CleansedLines instance containing the file contents.
linenum: The number of the line to check.
Returns:
A tuple with two elements. The first element is the contents of the last
non-blank line before the current line, ... | Return the most recent non-blank line and its line number. | [
"Return",
"the",
"most",
"recent",
"non",
"-",
"blank",
"line",
"and",
"its",
"line",
"number",
"."
] | def GetPreviousNonBlankLine(clean_lines, linenum):
"""Return the most recent non-blank line and its line number.
Args:
clean_lines: A CleansedLines instance containing the file contents.
linenum: The number of the line to check.
Returns:
A tuple with two elements. The first element is the contents ... | [
"def",
"GetPreviousNonBlankLine",
"(",
"clean_lines",
",",
"linenum",
")",
":",
"prevlinenum",
"=",
"linenum",
"-",
"1",
"while",
"prevlinenum",
">=",
"0",
":",
"prevline",
"=",
"clean_lines",
".",
"elided",
"[",
"prevlinenum",
"]",
"if",
"not",
"IsBlankLine",... | https://github.com/manutdzou/KITTI_SSD/blob/5b620c2f291d36a0fe14489214f22a992f173f44/scripts/cpp_lint.py#L3050-L3070 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/distutils/command/install_egg_info.py | python | safe_name | (name) | return re.sub('[^A-Za-z0-9.]+', '-', name) | Convert an arbitrary string to a standard distribution name
Any runs of non-alphanumeric/. characters are replaced with a single '-'. | Convert an arbitrary string to a standard distribution name | [
"Convert",
"an",
"arbitrary",
"string",
"to",
"a",
"standard",
"distribution",
"name"
] | def safe_name(name):
"""Convert an arbitrary string to a standard distribution name
Any runs of non-alphanumeric/. characters are replaced with a single '-'.
"""
return re.sub('[^A-Za-z0-9.]+', '-', name) | [
"def",
"safe_name",
"(",
"name",
")",
":",
"return",
"re",
".",
"sub",
"(",
"'[^A-Za-z0-9.]+'",
",",
"'-'",
",",
"name",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/distutils/command/install_egg_info.py#L55-L60 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/tpu/python/tpu/tpu_estimator.py | python | _wrap_computation_in_while_loop | (device, op_fn) | Wraps the ops generated by `op_fn` in tf.while_loop. | Wraps the ops generated by `op_fn` in tf.while_loop. | [
"Wraps",
"the",
"ops",
"generated",
"by",
"op_fn",
"in",
"tf",
".",
"while_loop",
"."
] | def _wrap_computation_in_while_loop(device, op_fn):
"""Wraps the ops generated by `op_fn` in tf.while_loop."""
def computation(i):
with ops.control_dependencies(op_fn()):
return i + 1
iterations_per_loop_var = _create_or_get_iterations_per_loop()
# By setting parallel_iterations=1, the parallel execu... | [
"def",
"_wrap_computation_in_while_loop",
"(",
"device",
",",
"op_fn",
")",
":",
"def",
"computation",
"(",
"i",
")",
":",
"with",
"ops",
".",
"control_dependencies",
"(",
"op_fn",
"(",
")",
")",
":",
"return",
"i",
"+",
"1",
"iterations_per_loop_var",
"=",
... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/tpu/python/tpu/tpu_estimator.py#L1654-L1667 | ||
tensorflow/io | 92b44e180674a8af0e12e405530f7343e3e693e4 | tensorflow_io/python/ops/io_dataset.py | python | IODataset.from_audio | (cls, filename, **kwargs) | Creates an `IODataset` from an audio file.
The following audio file formats are supported:
- WAV
- Flac
- Vorbis
- MP3
Args:
filename: A string, the filename of an audio file.
name: A name prefix for the IOTensor (optional).
Returns:
... | Creates an `IODataset` from an audio file. | [
"Creates",
"an",
"IODataset",
"from",
"an",
"audio",
"file",
"."
] | def from_audio(cls, filename, **kwargs):
"""Creates an `IODataset` from an audio file.
The following audio file formats are supported:
- WAV
- Flac
- Vorbis
- MP3
Args:
filename: A string, the filename of an audio file.
name: A name prefix fo... | [
"def",
"from_audio",
"(",
"cls",
",",
"filename",
",",
"*",
"*",
"kwargs",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"kwargs",
".",
"get",
"(",
"\"name\"",
",",
"\"IOFromAudio\"",
")",
")",
":",
"return",
"audio_ops",
".",
"AudioIODataset",
"(",
... | https://github.com/tensorflow/io/blob/92b44e180674a8af0e12e405530f7343e3e693e4/tensorflow_io/python/ops/io_dataset.py#L100-L118 | ||
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/python/training/summary_io.py | python | SummaryWriter.add_summary | (self, summary, global_step=None) | Adds a `Summary` protocol buffer to the event file.
This method wraps the provided summary in an `Event` protocol buffer
and adds it to the event file.
You can pass the result of evaluating any summary op, using
[`Session.run()`](client.md#Session.run) or
[`Tensor.eval()`](framework.md#Tensor.eval... | Adds a `Summary` protocol buffer to the event file. | [
"Adds",
"a",
"Summary",
"protocol",
"buffer",
"to",
"the",
"event",
"file",
"."
] | def add_summary(self, summary, global_step=None):
"""Adds a `Summary` protocol buffer to the event file.
This method wraps the provided summary in an `Event` protocol buffer
and adds it to the event file.
You can pass the result of evaluating any summary op, using
[`Session.run()`](client.md#Sessi... | [
"def",
"add_summary",
"(",
"self",
",",
"summary",
",",
"global_step",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"summary",
",",
"bytes",
")",
":",
"summ",
"=",
"summary_pb2",
".",
"Summary",
"(",
")",
"summ",
".",
"ParseFromString",
"(",
"summary"... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/training/summary_io.py#L127-L152 | ||
borglab/gtsam | a5bee157efce6a0563704bce6a5d188c29817f39 | python/gtsam/utils/logging_optimizer.py | python | optimize | (optimizer, check_convergence, hook) | Given an optimizer and a convergence check, iterate until convergence.
After each iteration, hook(optimizer, error) is called.
After the function, use values and errors to get the result.
Arguments:
optimizer (T): needs an iterate and an error function.
check_convergence:... | Given an optimizer and a convergence check, iterate until convergence.
After each iteration, hook(optimizer, error) is called.
After the function, use values and errors to get the result.
Arguments:
optimizer (T): needs an iterate and an error function.
check_convergence:... | [
"Given",
"an",
"optimizer",
"and",
"a",
"convergence",
"check",
"iterate",
"until",
"convergence",
".",
"After",
"each",
"iteration",
"hook",
"(",
"optimizer",
"error",
")",
"is",
"called",
".",
"After",
"the",
"function",
"use",
"values",
"and",
"errors",
"... | def optimize(optimizer, check_convergence, hook):
""" Given an optimizer and a convergence check, iterate until convergence.
After each iteration, hook(optimizer, error) is called.
After the function, use values and errors to get the result.
Arguments:
optimizer (T): needs an ite... | [
"def",
"optimize",
"(",
"optimizer",
",",
"check_convergence",
",",
"hook",
")",
":",
"# the optimizer is created with default values which incur the error below",
"current_error",
"=",
"optimizer",
".",
"error",
"(",
")",
"hook",
"(",
"optimizer",
",",
"current_error",
... | https://github.com/borglab/gtsam/blob/a5bee157efce6a0563704bce6a5d188c29817f39/python/gtsam/utils/logging_optimizer.py#L11-L32 | ||
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | current/deps/v8/tools/stats-viewer.py | python | StatsViewer.Run | (self) | The main entry-point to running the stats viewer. | The main entry-point to running the stats viewer. | [
"The",
"main",
"entry",
"-",
"point",
"to",
"running",
"the",
"stats",
"viewer",
"."
] | def Run(self):
"""The main entry-point to running the stats viewer."""
try:
self.data = self.MountSharedData()
# OpenWindow blocks until the main window is closed
self.OpenWindow()
finally:
self.CleanUp() | [
"def",
"Run",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"data",
"=",
"self",
".",
"MountSharedData",
"(",
")",
"# OpenWindow blocks until the main window is closed",
"self",
".",
"OpenWindow",
"(",
")",
"finally",
":",
"self",
".",
"CleanUp",
"(",
")"
... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/current/deps/v8/tools/stats-viewer.py#L90-L97 | ||
danxuhk/ContinuousCRF-CNN | 2b6dcaf179620f118b225ed12c890414ca828e21 | tools/extra/extract_seconds.py | python | get_log_created_year | (input_file) | return log_created_year | Get year from log file system timestamp | Get year from log file system timestamp | [
"Get",
"year",
"from",
"log",
"file",
"system",
"timestamp"
] | def get_log_created_year(input_file):
"""Get year from log file system timestamp
"""
log_created_time = os.path.getctime(input_file)
log_created_year = datetime.datetime.fromtimestamp(log_created_time).year
return log_created_year | [
"def",
"get_log_created_year",
"(",
"input_file",
")",
":",
"log_created_time",
"=",
"os",
".",
"path",
".",
"getctime",
"(",
"input_file",
")",
"log_created_year",
"=",
"datetime",
".",
"datetime",
".",
"fromtimestamp",
"(",
"log_created_time",
")",
".",
"year"... | https://github.com/danxuhk/ContinuousCRF-CNN/blob/2b6dcaf179620f118b225ed12c890414ca828e21/tools/extra/extract_seconds.py#L22-L28 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/window/rolling.py | python | _Window._wrap_result | (self, result, block=None, obj=None) | return result | Wrap a single result. | Wrap a single result. | [
"Wrap",
"a",
"single",
"result",
"."
] | def _wrap_result(self, result, block=None, obj=None):
"""
Wrap a single result.
"""
if obj is None:
obj = self._selected_obj
index = obj.index
if isinstance(result, np.ndarray):
if result.ndim == 1:
from pandas import Series
... | [
"def",
"_wrap_result",
"(",
"self",
",",
"result",
",",
"block",
"=",
"None",
",",
"obj",
"=",
"None",
")",
":",
"if",
"obj",
"is",
"None",
":",
"obj",
"=",
"self",
".",
"_selected_obj",
"index",
"=",
"obj",
".",
"index",
"if",
"isinstance",
"(",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/window/rolling.py#L283-L300 | |
olliw42/storm32bgc | 99d62a6130ae2950514022f50eb669c45a8cc1ba | old/betacopter/old/betacopter36dev-v003/modules/uavcan/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/pyratemp.py | python | LoaderString.load | (self, s) | return u | Return template-string as unicode. | Return template-string as unicode. | [
"Return",
"template",
"-",
"string",
"as",
"unicode",
"."
] | def load(self, s):
"""Return template-string as unicode.
"""
if isinstance(s, unicode):
u = s
else:
u = s.decode(self.encoding)
return u | [
"def",
"load",
"(",
"self",
",",
"s",
")",
":",
"if",
"isinstance",
"(",
"s",
",",
"unicode",
")",
":",
"u",
"=",
"s",
"else",
":",
"u",
"=",
"s",
".",
"decode",
"(",
"self",
".",
"encoding",
")",
"return",
"u"
] | https://github.com/olliw42/storm32bgc/blob/99d62a6130ae2950514022f50eb669c45a8cc1ba/old/betacopter/old/betacopter36dev-v003/modules/uavcan/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/pyratemp.py#L376-L383 | |
taichi-dev/taichi | 973c04d6ba40f34e9e3bd5a28ae0ee0802f136a6 | python/taichi/linalg/sparse_matrix.py | python | SparseMatrixBuilder.print_triplets | (self) | Print the triplets stored in the builder | Print the triplets stored in the builder | [
"Print",
"the",
"triplets",
"stored",
"in",
"the",
"builder"
] | def print_triplets(self):
"""Print the triplets stored in the builder"""
self.ptr.print_triplets() | [
"def",
"print_triplets",
"(",
"self",
")",
":",
"self",
".",
"ptr",
".",
"print_triplets",
"(",
")"
] | https://github.com/taichi-dev/taichi/blob/973c04d6ba40f34e9e3bd5a28ae0ee0802f136a6/python/taichi/linalg/sparse_matrix.py#L153-L155 | ||
intel/caffe | 3f494b442ee3f9d17a07b09ecbd5fa2bbda00836 | examples/rfcn/tools/train_rfcn_alt_opt_5stage.py | python | rpn_compute_stats | (queue=None, imdb_name=None, cfg=None, rpn_test_prototxt=None) | Compute mean stds for anchors | Compute mean stds for anchors | [
"Compute",
"mean",
"stds",
"for",
"anchors"
] | def rpn_compute_stats(queue=None, imdb_name=None, cfg=None, rpn_test_prototxt=None):
"""Compute mean stds for anchors
"""
cfg.TRAIN.HAS_RPN = True
cfg.TRAIN.BBOX_REG = False # applies only to R-FCN bbox regression
cfg.TRAIN.PROPOSAL_METHOD = 'gt'
cfg.TRAIN.IMS_PER_BATCH = 1
import caffe
... | [
"def",
"rpn_compute_stats",
"(",
"queue",
"=",
"None",
",",
"imdb_name",
"=",
"None",
",",
"cfg",
"=",
"None",
",",
"rpn_test_prototxt",
"=",
"None",
")",
":",
"cfg",
".",
"TRAIN",
".",
"HAS_RPN",
"=",
"True",
"cfg",
".",
"TRAIN",
".",
"BBOX_REG",
"=",... | https://github.com/intel/caffe/blob/3f494b442ee3f9d17a07b09ecbd5fa2bbda00836/examples/rfcn/tools/train_rfcn_alt_opt_5stage.py#L237-L269 | ||
Xilinx/Vitis_Libraries | 4bd100518d93a8842d1678046ad7457f94eb355c | hpc/L3/src/sw/mlp/python_api/xfhpc_L3.py | python | XFHPCManager.sendMat | (self, A, idxKernel, idxDevice) | return self._lib.xfhpcSend(
A, c_ulonglong(
A.size), c_uint(
A.itemsize), idxKernel, idxDevice) | send mat from host to device
Parameters
A: ndarray
matrix in host memory
idxKernel: int
index of kernel to be used
idxDeivce: int
index of local device to be used | send mat from host to device | [
"send",
"mat",
"from",
"host",
"to",
"device"
] | def sendMat(self, A, idxKernel, idxDevice):
'''
send mat from host to device
Parameters
A: ndarray
matrix in host memory
idxKernel: int
index of kernel to be used
idxDeivce: int
index of local device... | [
"def",
"sendMat",
"(",
"self",
",",
"A",
",",
"idxKernel",
",",
"idxDevice",
")",
":",
"return",
"self",
".",
"_lib",
".",
"xfhpcSend",
"(",
"A",
",",
"c_ulonglong",
"(",
"A",
".",
"size",
")",
",",
"c_uint",
"(",
"A",
".",
"itemsize",
")",
",",
... | https://github.com/Xilinx/Vitis_Libraries/blob/4bd100518d93a8842d1678046ad7457f94eb355c/hpc/L3/src/sw/mlp/python_api/xfhpc_L3.py#L95-L111 | |
BitMEX/api-connectors | 37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812 | official-ws/python/bitmex_websocket.py | python | BitMEXWebsocket.__init__ | (self, endpoint, symbol, api_key=None, api_secret=None, subscriptions=DEFAULT_SUBS) | Connect to the websocket and initialize data stores. | Connect to the websocket and initialize data stores. | [
"Connect",
"to",
"the",
"websocket",
"and",
"initialize",
"data",
"stores",
"."
] | def __init__(self, endpoint, symbol, api_key=None, api_secret=None, subscriptions=DEFAULT_SUBS):
'''Connect to the websocket and initialize data stores.'''
self.logger = logging.getLogger(__name__)
self.logger.debug("Initializing WebSocket.")
self.endpoint = endpoint
self.symbol... | [
"def",
"__init__",
"(",
"self",
",",
"endpoint",
",",
"symbol",
",",
"api_key",
"=",
"None",
",",
"api_secret",
"=",
"None",
",",
"subscriptions",
"=",
"DEFAULT_SUBS",
")",
":",
"self",
".",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")... | https://github.com/BitMEX/api-connectors/blob/37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812/official-ws/python/bitmex_websocket.py#L25-L56 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/html5lib/html5parser.py | python | parse | (doc, treebuilder="etree", namespaceHTMLElements=True, **kwargs) | return p.parse(doc, **kwargs) | Parse an HTML document as a string or file-like object into a tree
:arg doc: the document to parse as a string or file-like object
:arg treebuilder: the treebuilder to use when parsing
:arg namespaceHTMLElements: whether or not to namespace HTML elements
:returns: parsed tree
Example:
>>> ... | Parse an HTML document as a string or file-like object into a tree | [
"Parse",
"an",
"HTML",
"document",
"as",
"a",
"string",
"or",
"file",
"-",
"like",
"object",
"into",
"a",
"tree"
] | def parse(doc, treebuilder="etree", namespaceHTMLElements=True, **kwargs):
"""Parse an HTML document as a string or file-like object into a tree
:arg doc: the document to parse as a string or file-like object
:arg treebuilder: the treebuilder to use when parsing
:arg namespaceHTMLElements: whether or... | [
"def",
"parse",
"(",
"doc",
",",
"treebuilder",
"=",
"\"etree\"",
",",
"namespaceHTMLElements",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"tb",
"=",
"treebuilders",
".",
"getTreeBuilder",
"(",
"treebuilder",
")",
"p",
"=",
"HTMLParser",
"(",
"tb",
... | 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/html5lib/html5parser.py#L26-L46 | |
facebookarchive/LogDevice | ce7726050edc49a1e15d9160e81c890736b779e2 | logdevice/ops/ldops/admin_api.py | python | check_impact | (
client: AdminAPI, req: Optional[CheckImpactRequest] = None
) | return await client.checkImpact(req or CheckImpactRequest()) | Wrapper for checkImpact() Thrift method | Wrapper for checkImpact() Thrift method | [
"Wrapper",
"for",
"checkImpact",
"()",
"Thrift",
"method"
] | async def check_impact(
client: AdminAPI, req: Optional[CheckImpactRequest] = None
) -> CheckImpactResponse:
"""
Wrapper for checkImpact() Thrift method
"""
return await client.checkImpact(req or CheckImpactRequest()) | [
"async",
"def",
"check_impact",
"(",
"client",
":",
"AdminAPI",
",",
"req",
":",
"Optional",
"[",
"CheckImpactRequest",
"]",
"=",
"None",
")",
"->",
"CheckImpactResponse",
":",
"return",
"await",
"client",
".",
"checkImpact",
"(",
"req",
"or",
"CheckImpactRequ... | https://github.com/facebookarchive/LogDevice/blob/ce7726050edc49a1e15d9160e81c890736b779e2/logdevice/ops/ldops/admin_api.py#L184-L190 | |
domino-team/openwrt-cc | 8b181297c34d14d3ca521cc9f31430d561dbc688 | package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/v8/tools/release/check_clusterfuzz.py | python | APIRequest | (key, **params) | return None | Send a request to the clusterfuzz api.
Returns a json dict of the response. | Send a request to the clusterfuzz api. | [
"Send",
"a",
"request",
"to",
"the",
"clusterfuzz",
"api",
"."
] | def APIRequest(key, **params):
"""Send a request to the clusterfuzz api.
Returns a json dict of the response.
"""
params["api_key"] = key
params = urllib.urlencode(params)
headers = {"Content-type": "application/x-www-form-urlencoded"}
try:
conn = httplib.HTTPSConnection(HOSTNAME)
conn.request... | [
"def",
"APIRequest",
"(",
"key",
",",
"*",
"*",
"params",
")",
":",
"params",
"[",
"\"api_key\"",
"]",
"=",
"key",
"params",
"=",
"urllib",
".",
"urlencode",
"(",
"params",
")",
"headers",
"=",
"{",
"\"Content-type\"",
":",
"\"application/x-www-form-urlencod... | https://github.com/domino-team/openwrt-cc/blob/8b181297c34d14d3ca521cc9f31430d561dbc688/package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/v8/tools/release/check_clusterfuzz.py#L150-L177 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/deps/v8/third_party/jinja2/compiler.py | python | UndeclaredNameVisitor.visit_Block | (self, node) | Stop visiting a blocks. | Stop visiting a blocks. | [
"Stop",
"visiting",
"a",
"blocks",
"."
] | def visit_Block(self, node):
"""Stop visiting a blocks.""" | [
"def",
"visit_Block",
"(",
"self",
",",
"node",
")",
":"
] | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/deps/v8/third_party/jinja2/compiler.py#L233-L234 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/Tkinter.py | python | Misc.winfo_screenwidth | (self) | return getint(
self.tk.call('winfo', 'screenwidth', self._w)) | Return the number of pixels of the width of the screen of
this widget in pixel. | Return the number of pixels of the width of the screen of
this widget in pixel. | [
"Return",
"the",
"number",
"of",
"pixels",
"of",
"the",
"width",
"of",
"the",
"screen",
"of",
"this",
"widget",
"in",
"pixel",
"."
] | def winfo_screenwidth(self):
"""Return the number of pixels of the width of the screen of
this widget in pixel."""
return getint(
self.tk.call('winfo', 'screenwidth', self._w)) | [
"def",
"winfo_screenwidth",
"(",
"self",
")",
":",
"return",
"getint",
"(",
"self",
".",
"tk",
".",
"call",
"(",
"'winfo'",
",",
"'screenwidth'",
",",
"self",
".",
"_w",
")",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/Tkinter.py#L881-L885 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/dynamodb2/fields.py | python | BaseSchemaField.definition | (self) | return {
'AttributeName': self.name,
'AttributeType': self.data_type,
} | Returns the attribute definition structure DynamoDB expects.
Example::
>>> field.definition()
{
'AttributeName': 'username',
'AttributeType': 'S',
} | Returns the attribute definition structure DynamoDB expects. | [
"Returns",
"the",
"attribute",
"definition",
"structure",
"DynamoDB",
"expects",
"."
] | def definition(self):
"""
Returns the attribute definition structure DynamoDB expects.
Example::
>>> field.definition()
{
'AttributeName': 'username',
'AttributeType': 'S',
}
"""
return {
'Attribut... | [
"def",
"definition",
"(",
"self",
")",
":",
"return",
"{",
"'AttributeName'",
":",
"self",
".",
"name",
",",
"'AttributeType'",
":",
"self",
".",
"data_type",
",",
"}"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/dynamodb2/fields.py#L27-L43 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/nn/wrap/grad_reducer.py | python | _tensors_allreduce_with_sparse | (degree, mean, allgather, allreduce, allreduce_filter, grad) | return grad | Apply allgather on gradient instead of allreduce for sparse feature.
Allgather is a communication operation used for distributed deep learning.
Args:
degree (int): The mean coefficient.
mean (bool): When mean is true, the mean coefficient (degree) would apply on gradients.
allgather (Pr... | Apply allgather on gradient instead of allreduce for sparse feature.
Allgather is a communication operation used for distributed deep learning. | [
"Apply",
"allgather",
"on",
"gradient",
"instead",
"of",
"allreduce",
"for",
"sparse",
"feature",
".",
"Allgather",
"is",
"a",
"communication",
"operation",
"used",
"for",
"distributed",
"deep",
"learning",
"."
] | def _tensors_allreduce_with_sparse(degree, mean, allgather, allreduce, allreduce_filter, grad):
"""
Apply allgather on gradient instead of allreduce for sparse feature.
Allgather is a communication operation used for distributed deep learning.
Args:
degree (int): The mean coefficient.
m... | [
"def",
"_tensors_allreduce_with_sparse",
"(",
"degree",
",",
"mean",
",",
"allgather",
",",
"allreduce",
",",
"allreduce_filter",
",",
"grad",
")",
":",
"if",
"allreduce_filter",
":",
"indices",
"=",
"allgather",
"(",
"grad",
".",
"indices",
")",
"dout",
"=",
... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/nn/wrap/grad_reducer.py#L158-L180 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py | python | Target.FinalOutput | (self) | return self.bundle or self.binary or self.actions_stamp | Return the last output of the target, which depends on all prior
steps. | Return the last output of the target, which depends on all prior
steps. | [
"Return",
"the",
"last",
"output",
"of",
"the",
"target",
"which",
"depends",
"on",
"all",
"prior",
"steps",
"."
] | def FinalOutput(self):
"""Return the last output of the target, which depends on all prior
steps."""
return self.bundle or self.binary or self.actions_stamp | [
"def",
"FinalOutput",
"(",
"self",
")",
":",
"return",
"self",
".",
"bundle",
"or",
"self",
".",
"binary",
"or",
"self",
".",
"actions_stamp"
] | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py#L182-L185 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/propgrid.py | python | PropertyGridManager.GetIterator | (*args) | return _propgrid.PropertyGridManager_GetIterator(*args) | GetIterator(self, int flags=PG_ITERATE_DEFAULT, PGProperty firstProp=None) -> PropertyGridIterator
GetIterator(self, int flags=PG_ITERATE_DEFAULT, PGProperty firstProp=None) -> PropertyGridConstIterator
GetIterator(self, int flags, int startPos) -> PropertyGridIterator
GetIterator(self, int flag... | GetIterator(self, int flags=PG_ITERATE_DEFAULT, PGProperty firstProp=None) -> PropertyGridIterator
GetIterator(self, int flags=PG_ITERATE_DEFAULT, PGProperty firstProp=None) -> PropertyGridConstIterator
GetIterator(self, int flags, int startPos) -> PropertyGridIterator
GetIterator(self, int flag... | [
"GetIterator",
"(",
"self",
"int",
"flags",
"=",
"PG_ITERATE_DEFAULT",
"PGProperty",
"firstProp",
"=",
"None",
")",
"-",
">",
"PropertyGridIterator",
"GetIterator",
"(",
"self",
"int",
"flags",
"=",
"PG_ITERATE_DEFAULT",
"PGProperty",
"firstProp",
"=",
"None",
")"... | def GetIterator(*args):
"""
GetIterator(self, int flags=PG_ITERATE_DEFAULT, PGProperty firstProp=None) -> PropertyGridIterator
GetIterator(self, int flags=PG_ITERATE_DEFAULT, PGProperty firstProp=None) -> PropertyGridConstIterator
GetIterator(self, int flags, int startPos) -> PropertyGri... | [
"def",
"GetIterator",
"(",
"*",
"args",
")",
":",
"return",
"_propgrid",
".",
"PropertyGridManager_GetIterator",
"(",
"*",
"args",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/propgrid.py#L3468-L3475 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | base/android/jni_generator/jni_generator.py | python | InlHeaderFileGenerator.GetJNINativeMethodsString | (self) | return self.SubstituteNativeMethods(template) | Returns the implementation of the array of native methods. | Returns the implementation of the array of native methods. | [
"Returns",
"the",
"implementation",
"of",
"the",
"array",
"of",
"native",
"methods",
"."
] | def GetJNINativeMethodsString(self):
"""Returns the implementation of the array of native methods."""
template = Template("""\
static const JNINativeMethod kMethods${JAVA_CLASS}[] = {
${KMETHODS}
};
""")
return self.SubstituteNativeMethods(template) | [
"def",
"GetJNINativeMethodsString",
"(",
"self",
")",
":",
"template",
"=",
"Template",
"(",
"\"\"\"\\\nstatic const JNINativeMethod kMethods${JAVA_CLASS}[] = {\n${KMETHODS}\n};\n\"\"\"",
")",
"return",
"self",
".",
"SubstituteNativeMethods",
"(",
"template",
")"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/base/android/jni_generator/jni_generator.py#L749-L756 | |
OSGeo/gdal | 3748fc4ba4fba727492774b2b908a2130c864a83 | swig/python/osgeo/ogr.py | python | Geometry.Segmentize | (self, *args) | return _ogr.Geometry_Segmentize(self, *args) | r"""
Segmentize(Geometry self, double dfMaxLength)
void OGR_G_Segmentize(OGRGeometryH
hGeom, double dfMaxLength)
Modify the geometry such it has no segment longer then the given
distance.
Interpolated points will have Z and M values (if needed) set to 0.
Distanc... | r"""
Segmentize(Geometry self, double dfMaxLength)
void OGR_G_Segmentize(OGRGeometryH
hGeom, double dfMaxLength) | [
"r",
"Segmentize",
"(",
"Geometry",
"self",
"double",
"dfMaxLength",
")",
"void",
"OGR_G_Segmentize",
"(",
"OGRGeometryH",
"hGeom",
"double",
"dfMaxLength",
")"
] | def Segmentize(self, *args):
r"""
Segmentize(Geometry self, double dfMaxLength)
void OGR_G_Segmentize(OGRGeometryH
hGeom, double dfMaxLength)
Modify the geometry such it has no segment longer then the given
distance.
Interpolated points will have Z and M values ... | [
"def",
"Segmentize",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_ogr",
".",
"Geometry_Segmentize",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/OSGeo/gdal/blob/3748fc4ba4fba727492774b2b908a2130c864a83/swig/python/osgeo/ogr.py#L7084-L7106 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/lib2to3/pytree.py | python | Leaf.prefix | (self) | return self._prefix | The whitespace and comments preceding this token in the input. | The whitespace and comments preceding this token in the input. | [
"The",
"whitespace",
"and",
"comments",
"preceding",
"this",
"token",
"in",
"the",
"input",
"."
] | def prefix(self):
"""
The whitespace and comments preceding this token in the input.
"""
return self._prefix | [
"def",
"prefix",
"(",
"self",
")",
":",
"return",
"self",
".",
"_prefix"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/lib2to3/pytree.py#L384-L388 | |
nasa/astrobee | 9241e67e6692810d6e275abb3165b6d02f4ca5ef | scripts/git/cpplint.py | python | CheckRedundantOverrideOrFinal | (filename, clean_lines, linenum, error) | Check if line contains a redundant "override" or "final" virt-specifier.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found. | Check if line contains a redundant "override" or "final" virt-specifier. | [
"Check",
"if",
"line",
"contains",
"a",
"redundant",
"override",
"or",
"final",
"virt",
"-",
"specifier",
"."
] | def CheckRedundantOverrideOrFinal(filename, clean_lines, linenum, error):
"""Check if line contains a redundant "override" or "final" virt-specifier.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to che... | [
"def",
"CheckRedundantOverrideOrFinal",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"# Check that at most one of \"override\" or \"final\" is present, not both",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"if",
"Search... | https://github.com/nasa/astrobee/blob/9241e67e6692810d6e275abb3165b6d02f4ca5ef/scripts/git/cpplint.py#L6499-L6520 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/pydoc.py | python | ispackage | (path) | return False | Guess whether a path refers to a package directory. | Guess whether a path refers to a package directory. | [
"Guess",
"whether",
"a",
"path",
"refers",
"to",
"a",
"package",
"directory",
"."
] | def ispackage(path):
"""Guess whether a path refers to a package directory."""
if os.path.isdir(path):
for ext in ('.py', '.pyc', '.pyo'):
if os.path.isfile(os.path.join(path, '__init__' + ext)):
return True
return False | [
"def",
"ispackage",
"(",
"path",
")",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"path",
")",
":",
"for",
"ext",
"in",
"(",
"'.py'",
",",
"'.pyc'",
",",
"'.pyo'",
")",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"os",
".",
"path",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/pydoc.py#L187-L193 | |
cmu-db/noisepage | 79276e68fe83322f1249e8a8be96bd63c583ae56 | build-support/cpplint.py | python | FileInfo.Split | (self) | return (project,) + os.path.splitext(rest) | Splits the file into the directory, basename, and extension.
For 'chrome/browser/browser.cc', Split() would
return ('chrome/browser', 'browser', '.cc')
Returns:
A tuple of (directory, basename, extension). | Splits the file into the directory, basename, and extension. | [
"Splits",
"the",
"file",
"into",
"the",
"directory",
"basename",
"and",
"extension",
"."
] | def Split(self):
"""Splits the file into the directory, basename, and extension.
For 'chrome/browser/browser.cc', Split() would
return ('chrome/browser', 'browser', '.cc')
Returns:
A tuple of (directory, basename, extension).
"""
googlename = self.RepositoryName()
projec... | [
"def",
"Split",
"(",
"self",
")",
":",
"googlename",
"=",
"self",
".",
"RepositoryName",
"(",
")",
"project",
",",
"rest",
"=",
"os",
".",
"path",
".",
"split",
"(",
"googlename",
")",
"return",
"(",
"project",
",",
")",
"+",
"os",
".",
"path",
"."... | https://github.com/cmu-db/noisepage/blob/79276e68fe83322f1249e8a8be96bd63c583ae56/build-support/cpplint.py#L1379-L1391 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/optimize/linesearch.py | python | scalar_search_wolfe1 | (phi, derphi, phi0=None, old_phi0=None, derphi0=None,
c1=1e-4, c2=0.9,
amax=50, amin=1e-8, xtol=1e-14) | return stp, phi1, phi0 | Scalar function search for alpha that satisfies strong Wolfe conditions
alpha > 0 is assumed to be a descent direction.
Parameters
----------
phi : callable phi(alpha)
Function at point `alpha`
derphi : callable dphi(alpha)
Derivative `d phi(alpha)/ds`. Returns a scalar.
phi0 ... | Scalar function search for alpha that satisfies strong Wolfe conditions | [
"Scalar",
"function",
"search",
"for",
"alpha",
"that",
"satisfies",
"strong",
"Wolfe",
"conditions"
] | def scalar_search_wolfe1(phi, derphi, phi0=None, old_phi0=None, derphi0=None,
c1=1e-4, c2=0.9,
amax=50, amin=1e-8, xtol=1e-14):
"""
Scalar function search for alpha that satisfies strong Wolfe conditions
alpha > 0 is assumed to be a descent direction.
... | [
"def",
"scalar_search_wolfe1",
"(",
"phi",
",",
"derphi",
",",
"phi0",
"=",
"None",
",",
"old_phi0",
"=",
"None",
",",
"derphi0",
"=",
"None",
",",
"c1",
"=",
"1e-4",
",",
"c2",
"=",
"0.9",
",",
"amax",
"=",
"50",
",",
"amin",
"=",
"1e-8",
",",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/optimize/linesearch.py#L106-L185 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/coremltools_wrap/coremltools/coremltools/converters/onnx/_operators_nd.py | python | _convert_conv | (builder, node, graph, err) | convert to CoreML Convolution Layer:
https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L1418 | convert to CoreML Convolution Layer:
https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L1418 | [
"convert",
"to",
"CoreML",
"Convolution",
"Layer",
":",
"https",
":",
"//",
"github",
".",
"com",
"/",
"apple",
"/",
"coremltools",
"/",
"blob",
"/",
"655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492",
"/",
"mlmodel",
"/",
"format",
"/",
"NeuralNetwork",
".",
"proto#L14... | def _convert_conv(builder, node, graph, err):
"""
convert to CoreML Convolution Layer:
https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L1418
"""
params_dict = dict()
params_dict["is_deconv"] = False
if node.op_type.endswit... | [
"def",
"_convert_conv",
"(",
"builder",
",",
"node",
",",
"graph",
",",
"err",
")",
":",
"params_dict",
"=",
"dict",
"(",
")",
"params_dict",
"[",
"\"is_deconv\"",
"]",
"=",
"False",
"if",
"node",
".",
"op_type",
".",
"endswith",
"(",
"\"Transpose\"",
")... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/coremltools_wrap/coremltools/coremltools/converters/onnx/_operators_nd.py#L594-L653 | ||
unitusdev/unitus | 4cd523cb5b46cf224bbed7a653618d2b9e832455 | contrib/devtools/security-check.py | python | check_PE_NX | (executable) | return (bits & IMAGE_DLL_CHARACTERISTICS_NX_COMPAT) == IMAGE_DLL_CHARACTERISTICS_NX_COMPAT | NX: DllCharacteristics bit 0x100 signifies nxcompat (DEP) | NX: DllCharacteristics bit 0x100 signifies nxcompat (DEP) | [
"NX",
":",
"DllCharacteristics",
"bit",
"0x100",
"signifies",
"nxcompat",
"(",
"DEP",
")"
] | def check_PE_NX(executable):
'''NX: DllCharacteristics bit 0x100 signifies nxcompat (DEP)'''
(arch,bits) = get_PE_dll_characteristics(executable)
return (bits & IMAGE_DLL_CHARACTERISTICS_NX_COMPAT) == IMAGE_DLL_CHARACTERISTICS_NX_COMPAT | [
"def",
"check_PE_NX",
"(",
"executable",
")",
":",
"(",
"arch",
",",
"bits",
")",
"=",
"get_PE_dll_characteristics",
"(",
"executable",
")",
"return",
"(",
"bits",
"&",
"IMAGE_DLL_CHARACTERISTICS_NX_COMPAT",
")",
"==",
"IMAGE_DLL_CHARACTERISTICS_NX_COMPAT"
] | https://github.com/unitusdev/unitus/blob/4cd523cb5b46cf224bbed7a653618d2b9e832455/contrib/devtools/security-check.py#L161-L164 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/beanstalk/layer1.py | python | Layer1.validate_configuration_settings | (self, application_name,
option_settings, template_name=None,
environment_name=None) | return self._get_response('ValidateConfigurationSettings', params) | Takes a set of configuration settings and either a
configuration template or environment, and determines whether
those values are valid. This action returns a list of messages
indicating any errors or warnings associated with the selection
of option values.
:type application_na... | Takes a set of configuration settings and either a
configuration template or environment, and determines whether
those values are valid. This action returns a list of messages
indicating any errors or warnings associated with the selection
of option values. | [
"Takes",
"a",
"set",
"of",
"configuration",
"settings",
"and",
"either",
"a",
"configuration",
"template",
"or",
"environment",
"and",
"determines",
"whether",
"those",
"values",
"are",
"valid",
".",
"This",
"action",
"returns",
"a",
"list",
"of",
"messages",
... | def validate_configuration_settings(self, application_name,
option_settings, template_name=None,
environment_name=None):
"""
Takes a set of configuration settings and either a
configuration template or environment, a... | [
"def",
"validate_configuration_settings",
"(",
"self",
",",
"application_name",
",",
"option_settings",
",",
"template_name",
"=",
"None",
",",
"environment_name",
"=",
"None",
")",
":",
"params",
"=",
"{",
"'ApplicationName'",
":",
"application_name",
"}",
"self",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/beanstalk/layer1.py#L1146-L1184 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | python/mxnet/gluon/parameter.py | python | Parameter.grad | (self, ctx=None) | return self._check_and_get(self._grad, ctx) | Returns a gradient buffer for this parameter on one context.
Parameters
----------
ctx : Context
Desired context. | Returns a gradient buffer for this parameter on one context. | [
"Returns",
"a",
"gradient",
"buffer",
"for",
"this",
"parameter",
"on",
"one",
"context",
"."
] | def grad(self, ctx=None):
"""Returns a gradient buffer for this parameter on one context.
Parameters
----------
ctx : Context
Desired context.
"""
if self._data is not None and self._grad is None:
raise RuntimeError(
"Cannot get gr... | [
"def",
"grad",
"(",
"self",
",",
"ctx",
"=",
"None",
")",
":",
"if",
"self",
".",
"_data",
"is",
"not",
"None",
"and",
"self",
".",
"_grad",
"is",
"None",
":",
"raise",
"RuntimeError",
"(",
"\"Cannot get gradient array for Parameter '%s' \"",
"\"because grad_r... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/gluon/parameter.py#L560-L572 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/idlelib/pyshell.py | python | fix_x11_paste | (root) | Make paste replace selection on x11. See issue #5124. | Make paste replace selection on x11. See issue #5124. | [
"Make",
"paste",
"replace",
"selection",
"on",
"x11",
".",
"See",
"issue",
"#5124",
"."
] | def fix_x11_paste(root):
"Make paste replace selection on x11. See issue #5124."
if root._windowingsystem == 'x11':
for cls in 'Text', 'Entry', 'Spinbox':
root.bind_class(
cls,
'<<Paste>>',
'catch {%W delete sel.first sel.last}\n' +
... | [
"def",
"fix_x11_paste",
"(",
"root",
")",
":",
"if",
"root",
".",
"_windowingsystem",
"==",
"'x11'",
":",
"for",
"cls",
"in",
"'Text'",
",",
"'Entry'",
",",
"'Spinbox'",
":",
"root",
".",
"bind_class",
"(",
"cls",
",",
"'<<Paste>>'",
",",
"'catch {%W delet... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/idlelib/pyshell.py#L1324-L1332 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Parser/asdl.py | python | ASDLParser.p_field_4 | (self, (type, _)) | return Field(type, seq=True) | field ::= Id * | field ::= Id * | [
"field",
"::",
"=",
"Id",
"*"
] | def p_field_4(self, (type, _)):
" field ::= Id * "
return Field(type, seq=True) | [
"def",
"p_field_4",
"(",
"self",
",",
"(",
"type",
",",
"_",
")",
")",
":",
"return",
"Field",
"(",
"type",
",",
"seq",
"=",
"True",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Parser/asdl.py#L213-L215 | |
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/ops/candidate_sampling_ops.py | python | learned_unigram_candidate_sampler | (true_classes, num_true, num_sampled,
unique, range_max, seed=None, name=None) | return gen_candidate_sampling_ops._learned_unigram_candidate_sampler(
true_classes, num_true, num_sampled, unique, range_max, seed=seed1,
seed2=seed2, name=name) | Samples a set of classes from a distribution learned during training.
This operation randomly samples a tensor of sampled classes
(`sampled_candidates`) from the range of integers `[0, range_max)`.
The elements of `sampled_candidates` are drawn without replacement
(if `unique=True`) or with replacement (if `u... | Samples a set of classes from a distribution learned during training. | [
"Samples",
"a",
"set",
"of",
"classes",
"from",
"a",
"distribution",
"learned",
"during",
"training",
"."
] | def learned_unigram_candidate_sampler(true_classes, num_true, num_sampled,
unique, range_max, seed=None, name=None):
"""Samples a set of classes from a distribution learned during training.
This operation randomly samples a tensor of sampled classes
(`sampled_candidates`) fr... | [
"def",
"learned_unigram_candidate_sampler",
"(",
"true_classes",
",",
"num_true",
",",
"num_sampled",
",",
"unique",
",",
"range_max",
",",
"seed",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"seed1",
",",
"seed2",
"=",
"random_seed",
".",
"get_seed",
"... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/ops/candidate_sampling_ops.py#L139-L192 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/tools/gyp/pylib/gyp/generator/analyzer.py | python | CalculateVariables | (default_variables, params) | Calculate additional variables for use in the build (called by gyp). | Calculate additional variables for use in the build (called by gyp). | [
"Calculate",
"additional",
"variables",
"for",
"use",
"in",
"the",
"build",
"(",
"called",
"by",
"gyp",
")",
"."
] | def CalculateVariables(default_variables, params):
"""Calculate additional variables for use in the build (called by gyp)."""
flavor = gyp.common.GetFlavor(params)
if flavor == "mac":
default_variables.setdefault("OS", "mac")
elif flavor == "win":
default_variables.setdefault("OS", "win"... | [
"def",
"CalculateVariables",
"(",
"default_variables",
",",
"params",
")",
":",
"flavor",
"=",
"gyp",
".",
"common",
".",
"GetFlavor",
"(",
"params",
")",
"if",
"flavor",
"==",
"\"mac\"",
":",
"default_variables",
".",
"setdefault",
"(",
"\"OS\"",
",",
"\"ma... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/gyp/pylib/gyp/generator/analyzer.py#L614-L626 | ||
macchina-io/macchina.io | ef24ba0e18379c3dd48fb84e6dbf991101cb8db0 | platform/JS/V8/tools/gyp/pylib/gyp/input.py | python | ParallelState.LoadTargetBuildFileCallback | (self, result) | Handle the results of running LoadTargetBuildFile in another process. | Handle the results of running LoadTargetBuildFile in another process. | [
"Handle",
"the",
"results",
"of",
"running",
"LoadTargetBuildFile",
"in",
"another",
"process",
"."
] | def LoadTargetBuildFileCallback(self, result):
"""Handle the results of running LoadTargetBuildFile in another process.
"""
self.condition.acquire()
if not result:
self.error = True
self.condition.notify()
self.condition.release()
return
(build_file_path0, build_file_data0, d... | [
"def",
"LoadTargetBuildFileCallback",
"(",
"self",
",",
"result",
")",
":",
"self",
".",
"condition",
".",
"acquire",
"(",
")",
"if",
"not",
"result",
":",
"self",
".",
"error",
"=",
"True",
"self",
".",
"condition",
".",
"notify",
"(",
")",
"self",
".... | https://github.com/macchina-io/macchina.io/blob/ef24ba0e18379c3dd48fb84e6dbf991101cb8db0/platform/JS/V8/tools/gyp/pylib/gyp/input.py#L553-L571 | ||
GeometryCollective/boundary-first-flattening | 8250e5a0e85980ec50b5e8aa8f49dd6519f915cd | deps/nanogui/ext/pybind11/tools/clang/cindex.py | python | File.from_name | (translation_unit, file_name) | return File(conf.lib.clang_getFile(translation_unit, file_name)) | Retrieve a file handle within the given translation unit. | Retrieve a file handle within the given translation unit. | [
"Retrieve",
"a",
"file",
"handle",
"within",
"the",
"given",
"translation",
"unit",
"."
] | def from_name(translation_unit, file_name):
"""Retrieve a file handle within the given translation unit."""
return File(conf.lib.clang_getFile(translation_unit, file_name)) | [
"def",
"from_name",
"(",
"translation_unit",
",",
"file_name",
")",
":",
"return",
"File",
"(",
"conf",
".",
"lib",
".",
"clang_getFile",
"(",
"translation_unit",
",",
"file_name",
")",
")"
] | https://github.com/GeometryCollective/boundary-first-flattening/blob/8250e5a0e85980ec50b5e8aa8f49dd6519f915cd/deps/nanogui/ext/pybind11/tools/clang/cindex.py#L2677-L2679 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/state_ops.py | python | batch_scatter_update | (ref, indices, updates, use_locking=True, name=None) | Generalization of `tf.compat.v1.scatter_update` to axis different than 0.
Analogous to `batch_gather`. This assumes that `ref`, `indices` and `updates`
have a series of leading dimensions that are the same for all of them, and the
updates are performed on the last dimension of indices. In other words, the
dime... | Generalization of `tf.compat.v1.scatter_update` to axis different than 0. | [
"Generalization",
"of",
"tf",
".",
"compat",
".",
"v1",
".",
"scatter_update",
"to",
"axis",
"different",
"than",
"0",
"."
] | def batch_scatter_update(ref, indices, updates, use_locking=True, name=None):
"""Generalization of `tf.compat.v1.scatter_update` to axis different than 0.
Analogous to `batch_gather`. This assumes that `ref`, `indices` and `updates`
have a series of leading dimensions that are the same for all of them, and the
... | [
"def",
"batch_scatter_update",
"(",
"ref",
",",
"indices",
",",
"updates",
",",
"use_locking",
"=",
"True",
",",
"name",
"=",
"None",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"name",
")",
":",
"indices",
"=",
"ops",
".",
"convert_to_tensor",
"(",... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/state_ops.py#L821-L915 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/urllib3/util/retry.py | python | Retry.is_exhausted | (self) | return min(retry_counts) < 0 | Are we out of retries? | Are we out of retries? | [
"Are",
"we",
"out",
"of",
"retries?"
] | def is_exhausted(self):
""" Are we out of retries? """
retry_counts = (self.total, self.connect, self.read, self.redirect, self.status)
retry_counts = list(filter(None, retry_counts))
if not retry_counts:
return False
return min(retry_counts) < 0 | [
"def",
"is_exhausted",
"(",
"self",
")",
":",
"retry_counts",
"=",
"(",
"self",
".",
"total",
",",
"self",
".",
"connect",
",",
"self",
".",
"read",
",",
"self",
".",
"redirect",
",",
"self",
".",
"status",
")",
"retry_counts",
"=",
"list",
"(",
"fil... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/urllib3/util/retry.py#L346-L353 | |
openthread/openthread | 9fcdbed9c526c70f1556d1ed84099c1535c7cd32 | tools/harness-thci/OpenThread.py | python | OpenThreadTHCI.__skipSeqNoIncrease | (self) | return self.__executeCommand(cmd)[-1] == 'Done' | skip sequence number increase when recovering BBR Dataset from Network Data
Returns:
True: successful to set the behavior.
False: fail to set the behavior. | skip sequence number increase when recovering BBR Dataset from Network Data | [
"skip",
"sequence",
"number",
"increase",
"when",
"recovering",
"BBR",
"Dataset",
"from",
"Network",
"Data"
] | def __skipSeqNoIncrease(self):
"""skip sequence number increase when recovering BBR Dataset from Network Data
Returns:
True: successful to set the behavior.
False: fail to set the behavior.
"""
print('call __skipSeqNoIncrease()')
cmd = 'bbr skipseqnuminc'... | [
"def",
"__skipSeqNoIncrease",
"(",
"self",
")",
":",
"print",
"(",
"'call __skipSeqNoIncrease()'",
")",
"cmd",
"=",
"'bbr skipseqnuminc'",
"return",
"self",
".",
"__executeCommand",
"(",
"cmd",
")",
"[",
"-",
"1",
"]",
"==",
"'Done'"
] | https://github.com/openthread/openthread/blob/9fcdbed9c526c70f1556d1ed84099c1535c7cd32/tools/harness-thci/OpenThread.py#L542-L551 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_controls.py | python | RadioButton.GetClassDefaultAttributes | (*args, **kwargs) | return _controls_.RadioButton_GetClassDefaultAttributes(*args, **kwargs) | GetClassDefaultAttributes(int variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes
Get the default attributes for this class. This is useful if you want
to use the same font or colour in your own control as in a standard
control -- which is a much better idea than hard coding specific
co... | GetClassDefaultAttributes(int variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes | [
"GetClassDefaultAttributes",
"(",
"int",
"variant",
"=",
"WINDOW_VARIANT_NORMAL",
")",
"-",
">",
"VisualAttributes"
] | def GetClassDefaultAttributes(*args, **kwargs):
"""
GetClassDefaultAttributes(int variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes
Get the default attributes for this class. This is useful if you want
to use the same font or colour in your own control as in a standard
control... | [
"def",
"GetClassDefaultAttributes",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"RadioButton_GetClassDefaultAttributes",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_controls.py#L2755-L2770 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/contrib/quantization/tools/quantize_graph.py | python | GraphRewriter.eightbitize_bias_add_node | (self, original_node) | Replaces a BiasAdd node with the eight bit equivalent sub-graph. | Replaces a BiasAdd node with the eight bit equivalent sub-graph. | [
"Replaces",
"a",
"BiasAdd",
"node",
"with",
"the",
"eight",
"bit",
"equivalent",
"sub",
"-",
"graph",
"."
] | def eightbitize_bias_add_node(self, original_node):
"""Replaces a BiasAdd node with the eight bit equivalent sub-graph."""
quantized_bias_add_name = (original_node.name +
"_eightbit_quantized_bias_add")
all_input_names = self.add_eightbit_prologue_nodes(original_node)
quan... | [
"def",
"eightbitize_bias_add_node",
"(",
"self",
",",
"original_node",
")",
":",
"quantized_bias_add_name",
"=",
"(",
"original_node",
".",
"name",
"+",
"\"_eightbit_quantized_bias_add\"",
")",
"all_input_names",
"=",
"self",
".",
"add_eightbit_prologue_nodes",
"(",
"or... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/contrib/quantization/tools/quantize_graph.py#L602-L616 | ||
CaoWGG/TensorRT-CenterNet | f949252e37b51e60f873808f46d3683f15735e79 | onnx-tensorrt/third_party/onnx/third_party/pybind11/tools/clang/cindex.py | python | Type.get_named_type | (self) | return conf.lib.clang_Type_getNamedType(self) | Retrieve the type named by the qualified-id. | Retrieve the type named by the qualified-id. | [
"Retrieve",
"the",
"type",
"named",
"by",
"the",
"qualified",
"-",
"id",
"."
] | def get_named_type(self):
"""
Retrieve the type named by the qualified-id.
"""
return conf.lib.clang_Type_getNamedType(self) | [
"def",
"get_named_type",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_Type_getNamedType",
"(",
"self",
")"
] | https://github.com/CaoWGG/TensorRT-CenterNet/blob/f949252e37b51e60f873808f46d3683f15735e79/onnx-tensorrt/third_party/onnx/third_party/pybind11/tools/clang/cindex.py#L2078-L2082 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/propgrid.py | python | PropertyGridManager.GetGrid | (*args) | return _propgrid.PropertyGridManager_GetGrid(*args) | GetGrid(self) -> PropertyGrid
GetGrid(self) -> PropertyGrid | GetGrid(self) -> PropertyGrid
GetGrid(self) -> PropertyGrid | [
"GetGrid",
"(",
"self",
")",
"-",
">",
"PropertyGrid",
"GetGrid",
"(",
"self",
")",
"-",
">",
"PropertyGrid"
] | def GetGrid(*args):
"""
GetGrid(self) -> PropertyGrid
GetGrid(self) -> PropertyGrid
"""
return _propgrid.PropertyGridManager_GetGrid(*args) | [
"def",
"GetGrid",
"(",
"*",
"args",
")",
":",
"return",
"_propgrid",
".",
"PropertyGridManager_GetGrid",
"(",
"*",
"args",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/propgrid.py#L3461-L3466 | |
ArduPilot/ardupilot | 6e684b3496122b8158ac412b609d00004b7ac306 | libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py | python | generic_pin.get_ODR_F1_value | (self) | return v | return one of LOW, HIGH | return one of LOW, HIGH | [
"return",
"one",
"of",
"LOW",
"HIGH"
] | def get_ODR_F1_value(self):
'''return one of LOW, HIGH'''
values = ['LOW', 'HIGH']
v = 'HIGH'
if self.type == 'OUTPUT':
v = 'LOW'
elif self.label is not None and self.label.startswith('I2C'):
v = 'LOW'
for e in self.extra:
if e in value... | [
"def",
"get_ODR_F1_value",
"(",
"self",
")",
":",
"values",
"=",
"[",
"'LOW'",
",",
"'HIGH'",
"]",
"v",
"=",
"'HIGH'",
"if",
"self",
".",
"type",
"==",
"'OUTPUT'",
":",
"v",
"=",
"'LOW'",
"elif",
"self",
".",
"label",
"is",
"not",
"None",
"and",
"s... | https://github.com/ArduPilot/ardupilot/blob/6e684b3496122b8158ac412b609d00004b7ac306/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py#L401-L417 | |
KratosMultiphysics/Kratos | 0000833054ed0503424eb28205d6508d9ca6cbbc | applications/MeshingApplication/python_scripts/mmg_process.py | python | MmgProcess._CreateGradientProcess | (self) | This method is responsible of create the gradients for the level-set process
Keyword arguments:
self -- It signifies an instance of a class. | This method is responsible of create the gradients for the level-set process | [
"This",
"method",
"is",
"responsible",
"of",
"create",
"the",
"gradients",
"for",
"the",
"level",
"-",
"set",
"process"
] | def _CreateGradientProcess(self):
""" This method is responsible of create the gradients for the level-set process
Keyword arguments:
self -- It signifies an instance of a class.
"""
# We compute the scalar value gradient
if self.domain_size == 2:
self.local_... | [
"def",
"_CreateGradientProcess",
"(",
"self",
")",
":",
"# We compute the scalar value gradient",
"if",
"self",
".",
"domain_size",
"==",
"2",
":",
"self",
".",
"local_gradient",
"=",
"KratosMultiphysics",
".",
"ComputeNodalGradientProcess2D",
"(",
"self",
".",
"main_... | https://github.com/KratosMultiphysics/Kratos/blob/0000833054ed0503424eb28205d6508d9ca6cbbc/applications/MeshingApplication/python_scripts/mmg_process.py#L552-L562 | ||
HackWebRTC/webrtc | 7abfc990c00ab35090fff285fcf635d1d7892433 | tools_webrtc/gn_check_autofix.py | python | FirstNonEmpty | (iterable) | return next((x for x in iterable if x), None) | Return first item which evaluates to True, or fallback to None. | Return first item which evaluates to True, or fallback to None. | [
"Return",
"first",
"item",
"which",
"evaluates",
"to",
"True",
"or",
"fallback",
"to",
"None",
"."
] | def FirstNonEmpty(iterable):
"""Return first item which evaluates to True, or fallback to None."""
return next((x for x in iterable if x), None) | [
"def",
"FirstNonEmpty",
"(",
"iterable",
")",
":",
"return",
"next",
"(",
"(",
"x",
"for",
"x",
"in",
"iterable",
"if",
"x",
")",
",",
"None",
")"
] | https://github.com/HackWebRTC/webrtc/blob/7abfc990c00ab35090fff285fcf635d1d7892433/tools_webrtc/gn_check_autofix.py#L94-L96 | |
qgis/QGIS | 15a77662d4bb712184f6aa60d0bd663010a76a75 | python/plugins/MetaSearch/dialogs/maindialog.py | python | MetaSearchDialog.manageGui | (self) | open window | open window | [
"open",
"window"
] | def manageGui(self):
"""open window"""
def _on_timeout_change(value):
self.settings.setValue('/MetaSearch/timeout', value)
self.timeout = value
def _on_records_change(value):
self.settings.setValue('/MetaSearch/returnRecords', value)
self.maxrecor... | [
"def",
"manageGui",
"(",
"self",
")",
":",
"def",
"_on_timeout_change",
"(",
"value",
")",
":",
"self",
".",
"settings",
".",
"setValue",
"(",
"'/MetaSearch/timeout'",
",",
"value",
")",
"self",
".",
"timeout",
"=",
"value",
"def",
"_on_records_change",
"(",... | https://github.com/qgis/QGIS/blob/15a77662d4bb712184f6aa60d0bd663010a76a75/python/plugins/MetaSearch/dialogs/maindialog.py#L141-L178 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Source/ThirdParty/CEF3/pristine/cef_source/tools/cefbuilds/cef_json_builder.py | python | cef_json_builder.clear | (self) | Clear the contents of this object. | Clear the contents of this object. | [
"Clear",
"the",
"contents",
"of",
"this",
"object",
"."
] | def clear(self):
""" Clear the contents of this object. """
self._data = {}
for platform in self.get_platforms():
self._data[platform] = {'versions': []}
self._versions = {}
self._queryct = 0 | [
"def",
"clear",
"(",
"self",
")",
":",
"self",
".",
"_data",
"=",
"{",
"}",
"for",
"platform",
"in",
"self",
".",
"get_platforms",
"(",
")",
":",
"self",
".",
"_data",
"[",
"platform",
"]",
"=",
"{",
"'versions'",
":",
"[",
"]",
"}",
"self",
".",... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Source/ThirdParty/CEF3/pristine/cef_source/tools/cefbuilds/cef_json_builder.py#L108-L114 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/importlib/resources.py | python | contents | (package: Package) | return list(item.name for item in _common.from_package(package).iterdir()) | Return an iterable of entries in 'package'.
Note that not all entries are resources. Specifically, directories are
not considered resources. Use `is_resource()` on each entry returned here
to check if it is a resource or not. | Return an iterable of entries in 'package'. | [
"Return",
"an",
"iterable",
"of",
"entries",
"in",
"package",
"."
] | def contents(package: Package) -> Iterable[str]:
"""Return an iterable of entries in 'package'.
Note that not all entries are resources. Specifically, directories are
not considered resources. Use `is_resource()` on each entry returned here
to check if it is a resource or not.
"""
package = _... | [
"def",
"contents",
"(",
"package",
":",
"Package",
")",
"->",
"Iterable",
"[",
"str",
"]",
":",
"package",
"=",
"_get_package",
"(",
"package",
")",
"reader",
"=",
"_get_resource_reader",
"(",
"package",
")",
"if",
"reader",
"is",
"not",
"None",
":",
"re... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/importlib/resources.py#L196-L215 | |
tensorflow/deepmath | b5b721f54de1d5d6a02d78f5da5995237f9995f9 | deepmath/deephol/train/data.py | python | generic_parser | (serialized_example, feature_list, label_list) | return features, labels | Parses a HOL example, keeping requested features and labels.
Args:
serialized_example: A tf.Example for a parameterized tactic application.
feature_list: List of string feature names to parse (subset of features).
label_list: List of string label names to parse (subset of labels).
Returns:
feature... | Parses a HOL example, keeping requested features and labels. | [
"Parses",
"a",
"HOL",
"example",
"keeping",
"requested",
"features",
"and",
"labels",
"."
] | def generic_parser(serialized_example, feature_list, label_list):
"""Parses a HOL example, keeping requested features and labels.
Args:
serialized_example: A tf.Example for a parameterized tactic application.
feature_list: List of string feature names to parse (subset of features).
label_list: List of ... | [
"def",
"generic_parser",
"(",
"serialized_example",
",",
"feature_list",
",",
"label_list",
")",
":",
"example",
"=",
"tf",
".",
"parse_single_example",
"(",
"serialized_example",
",",
"features",
"=",
"{",
"# Subgoal features",
"# goal: the consequent term of the subgoal... | https://github.com/tensorflow/deepmath/blob/b5b721f54de1d5d6a02d78f5da5995237f9995f9/deepmath/deephol/train/data.py#L77-L114 | |
PixarAnimationStudios/USD | faed18ce62c8736b02413635b584a2f637156bad | pxr/base/tf/__init__.py | python | PreparePythonModule | (moduleName=None) | Prepare an extension module at import time. This will import the
Python module associated with the caller's module (e.g. '_tf' for 'pxr.Tf')
or the module with the specified moduleName and copy its contents into
the caller's local namespace.
Generally, this should only be called by the __init__.py scr... | Prepare an extension module at import time. This will import the
Python module associated with the caller's module (e.g. '_tf' for 'pxr.Tf')
or the module with the specified moduleName and copy its contents into
the caller's local namespace. | [
"Prepare",
"an",
"extension",
"module",
"at",
"import",
"time",
".",
"This",
"will",
"import",
"the",
"Python",
"module",
"associated",
"with",
"the",
"caller",
"s",
"module",
"(",
"e",
".",
"g",
".",
"_tf",
"for",
"pxr",
".",
"Tf",
")",
"or",
"the",
... | def PreparePythonModule(moduleName=None):
"""Prepare an extension module at import time. This will import the
Python module associated with the caller's module (e.g. '_tf' for 'pxr.Tf')
or the module with the specified moduleName and copy its contents into
the caller's local namespace.
Generally, ... | [
"def",
"PreparePythonModule",
"(",
"moduleName",
"=",
"None",
")",
":",
"import",
"importlib",
"import",
"inspect",
"frame",
"=",
"inspect",
".",
"currentframe",
"(",
")",
".",
"f_back",
"try",
":",
"f_locals",
"=",
"frame",
".",
"f_locals",
"# If an explicit ... | https://github.com/PixarAnimationStudios/USD/blob/faed18ce62c8736b02413635b584a2f637156bad/pxr/base/tf/__init__.py#L66-L108 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_core.py | python | Sizer.SetVirtualSizeHints | (*args, **kwargs) | return _core_.Sizer_SetVirtualSizeHints(*args, **kwargs) | SetVirtualSizeHints(self, Window window)
Tell the sizer to set the minimal size of the window virtual area to
match the sizer's minimal size. For windows with managed scrollbars
this will set them appropriately.
:see: `wx.ScrolledWindow.SetScrollbars` | SetVirtualSizeHints(self, Window window) | [
"SetVirtualSizeHints",
"(",
"self",
"Window",
"window",
")"
] | def SetVirtualSizeHints(*args, **kwargs):
"""
SetVirtualSizeHints(self, Window window)
Tell the sizer to set the minimal size of the window virtual area to
match the sizer's minimal size. For windows with managed scrollbars
this will set them appropriately.
:see: `wx.Sc... | [
"def",
"SetVirtualSizeHints",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Sizer_SetVirtualSizeHints",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_core.py#L14912-L14923 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/fx/experimental/graph_gradual_typechecker.py | python | get_parameter | (traced, target: str) | return param | Returns the parameter given by ``target`` if it exists,
otherwise throws an error.
See the docstring for ``get_submodule`` for a more detailed
explanation of this method's functionality as well as how to
correctly specify ``target``.
Args:
target: The fully-qualified string name of the Par... | Returns the parameter given by ``target`` if it exists,
otherwise throws an error. | [
"Returns",
"the",
"parameter",
"given",
"by",
"target",
"if",
"it",
"exists",
"otherwise",
"throws",
"an",
"error",
"."
] | def get_parameter(traced, target: str):
"""
Returns the parameter given by ``target`` if it exists,
otherwise throws an error.
See the docstring for ``get_submodule`` for a more detailed
explanation of this method's functionality as well as how to
correctly specify ``target``.
Args:
... | [
"def",
"get_parameter",
"(",
"traced",
",",
"target",
":",
"str",
")",
":",
"module_path",
",",
"_",
",",
"param_name",
"=",
"target",
".",
"rpartition",
"(",
"\".\"",
")",
"mod",
":",
"torch",
".",
"nn",
".",
"Module",
"=",
"traced",
".",
"get_submodu... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/fx/experimental/graph_gradual_typechecker.py#L894-L925 | |
netket/netket | 0d534e54ecbf25b677ea72af6b85947979420652 | netket/driver/abstract_variational_driver.py | python | AbstractVariationalDriver.info | (self, depth=0) | Returns an info string used to print information to screen about this driver. | Returns an info string used to print information to screen about this driver. | [
"Returns",
"an",
"info",
"string",
"used",
"to",
"print",
"information",
"to",
"screen",
"about",
"this",
"driver",
"."
] | def info(self, depth=0):
"""
Returns an info string used to print information to screen about this driver.
"""
pass | [
"def",
"info",
"(",
"self",
",",
"depth",
"=",
"0",
")",
":",
"pass"
] | https://github.com/netket/netket/blob/0d534e54ecbf25b677ea72af6b85947979420652/netket/driver/abstract_variational_driver.py#L119-L123 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/io/common.py | python | _is_binary_mode | (handle: FilePathOrBuffer, mode: str) | return isinstance(handle, binary_classes) or "b" in getattr(handle, "mode", mode) | Whether the handle is opened in binary mode | Whether the handle is opened in binary mode | [
"Whether",
"the",
"handle",
"is",
"opened",
"in",
"binary",
"mode"
] | def _is_binary_mode(handle: FilePathOrBuffer, mode: str) -> bool:
"""Whether the handle is opened in binary mode"""
# specified by user
if "t" in mode or "b" in mode:
return "b" in mode
# exceptions
text_classes = (
# classes that expect string but have 'b' in mode
codecs.St... | [
"def",
"_is_binary_mode",
"(",
"handle",
":",
"FilePathOrBuffer",
",",
"mode",
":",
"str",
")",
"->",
"bool",
":",
"# specified by user",
"if",
"\"t\"",
"in",
"mode",
"or",
"\"b\"",
"in",
"mode",
":",
"return",
"\"b\"",
"in",
"mode",
"# exceptions",
"text_cl... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/io/common.py#L942-L962 | |
avast/retdec | b9879088a5f0278508185ec645494e6c5c57a455 | scripts/type_extractor/type_extractor/parse_includes.py | python | is_wanted | (func_info) | return True | Do we want to include the given function in our extracted files? | Do we want to include the given function in our extracted files? | [
"Do",
"we",
"want",
"to",
"include",
"the",
"given",
"function",
"in",
"our",
"extracted",
"files?"
] | def is_wanted(func_info):
"""Do we want to include the given function in our extracted files?"""
# We do not want to include generic Windows functions whose arguments or
# return types are "T" types (e.g. LPCTSTR). They are never present in
# binary files. Instead, their A/W variants are used, depending... | [
"def",
"is_wanted",
"(",
"func_info",
")",
":",
"# We do not want to include generic Windows functions whose arguments or",
"# return types are \"T\" types (e.g. LPCTSTR). They are never present in",
"# binary files. Instead, their A/W variants are used, depending on whether",
"# UNICODE was defin... | https://github.com/avast/retdec/blob/b9879088a5f0278508185ec645494e6c5c57a455/scripts/type_extractor/type_extractor/parse_includes.py#L138-L167 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py3/numpy/distutils/ccompiler_opt.py | python | _Parse._parse_policy_not_keepsort | (self, has_baseline, final_targets, extra_flags) | return has_baseline, final_targets, extra_flags | sorted depend on the highest interest | sorted depend on the highest interest | [
"sorted",
"depend",
"on",
"the",
"highest",
"interest"
] | def _parse_policy_not_keepsort(self, has_baseline, final_targets, extra_flags):
"""sorted depend on the highest interest"""
final_targets = self.feature_sorted(final_targets, reverse=True)
return has_baseline, final_targets, extra_flags | [
"def",
"_parse_policy_not_keepsort",
"(",
"self",
",",
"has_baseline",
",",
"final_targets",
",",
"extra_flags",
")",
":",
"final_targets",
"=",
"self",
".",
"feature_sorted",
"(",
"final_targets",
",",
"reverse",
"=",
"True",
")",
"return",
"has_baseline",
",",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py3/numpy/distutils/ccompiler_opt.py#L2064-L2067 | |
OSGeo/gdal | 3748fc4ba4fba727492774b2b908a2130c864a83 | swig/python/osgeo/gdal.py | python | GetConfigOption | (*args) | return _gdal.GetConfigOption(*args) | r"""GetConfigOption(char const * pszKey, char const * pszDefault=None) -> char const * | r"""GetConfigOption(char const * pszKey, char const * pszDefault=None) -> char const * | [
"r",
"GetConfigOption",
"(",
"char",
"const",
"*",
"pszKey",
"char",
"const",
"*",
"pszDefault",
"=",
"None",
")",
"-",
">",
"char",
"const",
"*"
] | def GetConfigOption(*args):
r"""GetConfigOption(char const * pszKey, char const * pszDefault=None) -> char const *"""
return _gdal.GetConfigOption(*args) | [
"def",
"GetConfigOption",
"(",
"*",
"args",
")",
":",
"return",
"_gdal",
".",
"GetConfigOption",
"(",
"*",
"args",
")"
] | https://github.com/OSGeo/gdal/blob/3748fc4ba4fba727492774b2b908a2130c864a83/swig/python/osgeo/gdal.py#L1648-L1650 | |
microsoft/TSS.MSR | 0f2516fca2cd9929c31d5450e39301c9bde43688 | TSS.Py/src/TpmTypes.py | python | TPM2_PCR_Allocate_REQUEST.fromTpm | (buf) | return buf.createObj(TPM2_PCR_Allocate_REQUEST) | Returns new TPM2_PCR_Allocate_REQUEST object constructed from its
marshaled representation in the given TpmBuffer buffer | Returns new TPM2_PCR_Allocate_REQUEST object constructed from its
marshaled representation in the given TpmBuffer buffer | [
"Returns",
"new",
"TPM2_PCR_Allocate_REQUEST",
"object",
"constructed",
"from",
"its",
"marshaled",
"representation",
"in",
"the",
"given",
"TpmBuffer",
"buffer"
] | def fromTpm(buf):
""" Returns new TPM2_PCR_Allocate_REQUEST object constructed from its
marshaled representation in the given TpmBuffer buffer
"""
return buf.createObj(TPM2_PCR_Allocate_REQUEST) | [
"def",
"fromTpm",
"(",
"buf",
")",
":",
"return",
"buf",
".",
"createObj",
"(",
"TPM2_PCR_Allocate_REQUEST",
")"
] | https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L13914-L13918 | |
moflow/moflow | 2dfb27c799c90c6caf1477508eca3eec616ef7d2 | bap/libtracewrap/libtrace/protobuf/python/google/protobuf/message.py | python | Message.SerializeToString | (self) | Serializes the protocol message to a binary string.
Returns:
A binary string representation of the message if all of the required
fields in the message are set (i.e. the message is initialized).
Raises:
message.EncodeError if the message isn't initialized. | Serializes the protocol message to a binary string. | [
"Serializes",
"the",
"protocol",
"message",
"to",
"a",
"binary",
"string",
"."
] | def SerializeToString(self):
"""Serializes the protocol message to a binary string.
Returns:
A binary string representation of the message if all of the required
fields in the message are set (i.e. the message is initialized).
Raises:
message.EncodeError if the message isn't initialized.... | [
"def",
"SerializeToString",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/moflow/moflow/blob/2dfb27c799c90c6caf1477508eca3eec616ef7d2/bap/libtracewrap/libtrace/protobuf/python/google/protobuf/message.py#L184-L194 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/logging/__init__.py | python | LoggerAdapter.__init__ | (self, logger, extra) | Initialize the adapter with a logger and a dict-like object which
provides contextual information. This constructor signature allows
easy stacking of LoggerAdapters, if so desired.
You can effectively pass keyword arguments as shown in the
following example:
adapter = LoggerAda... | Initialize the adapter with a logger and a dict-like object which
provides contextual information. This constructor signature allows
easy stacking of LoggerAdapters, if so desired. | [
"Initialize",
"the",
"adapter",
"with",
"a",
"logger",
"and",
"a",
"dict",
"-",
"like",
"object",
"which",
"provides",
"contextual",
"information",
".",
"This",
"constructor",
"signature",
"allows",
"easy",
"stacking",
"of",
"LoggerAdapters",
"if",
"so",
"desire... | def __init__(self, logger, extra):
"""
Initialize the adapter with a logger and a dict-like object which
provides contextual information. This constructor signature allows
easy stacking of LoggerAdapters, if so desired.
You can effectively pass keyword arguments as shown in the
... | [
"def",
"__init__",
"(",
"self",
",",
"logger",
",",
"extra",
")",
":",
"self",
".",
"logger",
"=",
"logger",
"self",
".",
"extra",
"=",
"extra"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/logging/__init__.py#L1389-L1401 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_gdi.py | python | Palette.GetColoursCount | (*args, **kwargs) | return _gdi_.Palette_GetColoursCount(*args, **kwargs) | GetColoursCount(self) -> int | GetColoursCount(self) -> int | [
"GetColoursCount",
"(",
"self",
")",
"-",
">",
"int"
] | def GetColoursCount(*args, **kwargs):
"""GetColoursCount(self) -> int"""
return _gdi_.Palette_GetColoursCount(*args, **kwargs) | [
"def",
"GetColoursCount",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"Palette_GetColoursCount",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_gdi.py#L349-L351 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/tools/gyp/pylib/gyp/msvs_emulation.py | python | MsvsSettings.IsLinkIncremental | (self, config) | return link_inc != '1' | Returns whether the target should be linked incrementally. | Returns whether the target should be linked incrementally. | [
"Returns",
"whether",
"the",
"target",
"should",
"be",
"linked",
"incrementally",
"."
] | def IsLinkIncremental(self, config):
"""Returns whether the target should be linked incrementally."""
config = self._TargetConfig(config)
link_inc = self._Setting(('VCLinkerTool', 'LinkIncremental'), config)
return link_inc != '1' | [
"def",
"IsLinkIncremental",
"(",
"self",
",",
"config",
")",
":",
"config",
"=",
"self",
".",
"_TargetConfig",
"(",
"config",
")",
"link_inc",
"=",
"self",
".",
"_Setting",
"(",
"(",
"'VCLinkerTool'",
",",
"'LinkIncremental'",
")",
",",
"config",
")",
"ret... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/tools/gyp/pylib/gyp/msvs_emulation.py#L794-L798 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/package/package_importer.py | python | PackageImporter.load_pickle | (self, package: str, resource: str, map_location=None) | return result | Unpickles the resource from the package, loading any modules that are needed to construct the objects
using :meth:`import_module`.
Args:
package (str): The name of module package (e.g. ``"my_package.my_subpackage"``).
resource (str): The unique name for the resource.
... | Unpickles the resource from the package, loading any modules that are needed to construct the objects
using :meth:`import_module`. | [
"Unpickles",
"the",
"resource",
"from",
"the",
"package",
"loading",
"any",
"modules",
"that",
"are",
"needed",
"to",
"construct",
"the",
"objects",
"using",
":",
"meth",
":",
"import_module",
"."
] | def load_pickle(self, package: str, resource: str, map_location=None) -> Any:
"""Unpickles the resource from the package, loading any modules that are needed to construct the objects
using :meth:`import_module`.
Args:
package (str): The name of module package (e.g. ``"my_package.my_... | [
"def",
"load_pickle",
"(",
"self",
",",
"package",
":",
"str",
",",
"resource",
":",
"str",
",",
"map_location",
"=",
"None",
")",
"->",
"Any",
":",
"pickle_file",
"=",
"self",
".",
"_zipfile_path",
"(",
"package",
",",
"resource",
")",
"restore_location",... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/package/package_importer.py#L169-L262 | |
google/nucleus | 68d3947fafba1337f294c0668a6e1c7f3f1273e3 | nucleus/util/vis.py | python | array_to_png | (arr,
path=None,
show=True,
vmin=None,
vmax=None,
scale=None,
labels=None) | Save an array as a PNG image with PIL and show it.
Args:
arr: numpy array. Should be 2-dimensional or 3-dimensional where the third
dimension has 3 channels.
path: str. Path for the image output. Default is /tmp/tmp.png for quickly
showing the image in a notebook.
show: bool. Whether to show ... | Save an array as a PNG image with PIL and show it. | [
"Save",
"an",
"array",
"as",
"a",
"PNG",
"image",
"with",
"PIL",
"and",
"show",
"it",
"."
] | def array_to_png(arr,
path=None,
show=True,
vmin=None,
vmax=None,
scale=None,
labels=None):
"""Save an array as a PNG image with PIL and show it.
Args:
arr: numpy array. Should be 2-dimensional or 3-dimensiona... | [
"def",
"array_to_png",
"(",
"arr",
",",
"path",
"=",
"None",
",",
"show",
"=",
"True",
",",
"vmin",
"=",
"None",
",",
"vmax",
"=",
"None",
",",
"scale",
"=",
"None",
",",
"labels",
"=",
"None",
")",
":",
"scaled",
",",
"image_mode",
"=",
"autoscale... | https://github.com/google/nucleus/blob/68d3947fafba1337f294c0668a6e1c7f3f1273e3/nucleus/util/vis.py#L354-L396 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/lib-tk/Tkinter.py | python | Text.image_names | (self) | return self.tk.call(self._w, "image", "names") | Return all names of embedded images in this widget. | Return all names of embedded images in this widget. | [
"Return",
"all",
"names",
"of",
"embedded",
"images",
"in",
"this",
"widget",
"."
] | def image_names(self):
"""Return all names of embedded images in this widget."""
return self.tk.call(self._w, "image", "names") | [
"def",
"image_names",
"(",
"self",
")",
":",
"return",
"self",
".",
"tk",
".",
"call",
"(",
"self",
".",
"_w",
",",
"\"image\"",
",",
"\"names\"",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/lib-tk/Tkinter.py#L3106-L3108 | |
albertz/openlierox | d316c14a8eb57848ef56e9bfa7b23a56f694a51b | tools/DedicatedServerVideo/gdata/data.py | python | BatchFeed.add_update | (self, entry, batch_id_string=None) | Add an update request to the list of batch operations in this feed.
Sets the operation type of the entry to insert if it is not already set
and assigns the desired batch id to the entry so that it can be
referenced in the server's response.
Args:
entry: BatchEntry The entry which will be sent to... | Add an update request to the list of batch operations in this feed. | [
"Add",
"an",
"update",
"request",
"to",
"the",
"list",
"of",
"batch",
"operations",
"in",
"this",
"feed",
"."
] | def add_update(self, entry, batch_id_string=None):
"""Add an update request to the list of batch operations in this feed.
Sets the operation type of the entry to insert if it is not already set
and assigns the desired batch id to the entry so that it can be
referenced in the server's response.
Arg... | [
"def",
"add_update",
"(",
"self",
",",
"entry",
",",
"batch_id_string",
"=",
"None",
")",
":",
"self",
".",
"add_batch_entry",
"(",
"entry",
"=",
"entry",
",",
"batch_id_string",
"=",
"batch_id_string",
",",
"operation_string",
"=",
"BATCH_UPDATE",
")"
] | https://github.com/albertz/openlierox/blob/d316c14a8eb57848ef56e9bfa7b23a56f694a51b/tools/DedicatedServerVideo/gdata/data.py#L478-L495 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/socketserver.py | python | BaseServer.server_activate | (self) | Called by constructor to activate the server.
May be overridden. | Called by constructor to activate the server. | [
"Called",
"by",
"constructor",
"to",
"activate",
"the",
"server",
"."
] | def server_activate(self):
"""Called by constructor to activate the server.
May be overridden.
"""
pass | [
"def",
"server_activate",
"(",
"self",
")",
":",
"pass"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/socketserver.py#L207-L213 | ||
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/contrib/framework/python/framework/tensor_util.py | python | _is_shape | (expected_shape, actual_tensor, actual_shape=None) | Returns whether actual_tensor's shape is expected_shape.
Args:
expected_shape: Integer list defining the expected shape, or tensor of same.
actual_tensor: Tensor to test.
actual_shape: Shape of actual_tensor, if we already have it.
Returns:
New tensor. | Returns whether actual_tensor's shape is expected_shape. | [
"Returns",
"whether",
"actual_tensor",
"s",
"shape",
"is",
"expected_shape",
"."
] | def _is_shape(expected_shape, actual_tensor, actual_shape=None):
"""Returns whether actual_tensor's shape is expected_shape.
Args:
expected_shape: Integer list defining the expected shape, or tensor of same.
actual_tensor: Tensor to test.
actual_shape: Shape of actual_tensor, if we already have it.
R... | [
"def",
"_is_shape",
"(",
"expected_shape",
",",
"actual_tensor",
",",
"actual_shape",
"=",
"None",
")",
":",
"with",
"ops",
".",
"op_scope",
"(",
"[",
"actual_tensor",
"]",
",",
"'is_shape'",
")",
"as",
"scope",
":",
"is_rank",
"=",
"_is_rank",
"(",
"array... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/contrib/framework/python/framework/tensor_util.py#L161-L178 | ||
NVIDIA/TensorRT | 42805f078052daad1a98bc5965974fcffaad0960 | samples/python/efficientdet/build_engine.py | python | EngineBuilder.create_network | (self, onnx_path) | Parse the ONNX graph and create the corresponding TensorRT network definition.
:param onnx_path: The path to the ONNX graph to load. | Parse the ONNX graph and create the corresponding TensorRT network definition.
:param onnx_path: The path to the ONNX graph to load. | [
"Parse",
"the",
"ONNX",
"graph",
"and",
"create",
"the",
"corresponding",
"TensorRT",
"network",
"definition",
".",
":",
"param",
"onnx_path",
":",
"The",
"path",
"to",
"the",
"ONNX",
"graph",
"to",
"load",
"."
] | def create_network(self, onnx_path):
"""
Parse the ONNX graph and create the corresponding TensorRT network definition.
:param onnx_path: The path to the ONNX graph to load.
"""
network_flags = (1 << int(trt.NetworkDefinitionCreationFlag.EXPLICIT_BATCH))
self.network = s... | [
"def",
"create_network",
"(",
"self",
",",
"onnx_path",
")",
":",
"network_flags",
"=",
"(",
"1",
"<<",
"int",
"(",
"trt",
".",
"NetworkDefinitionCreationFlag",
".",
"EXPLICIT_BATCH",
")",
")",
"self",
".",
"network",
"=",
"self",
".",
"builder",
".",
"cre... | https://github.com/NVIDIA/TensorRT/blob/42805f078052daad1a98bc5965974fcffaad0960/samples/python/efficientdet/build_engine.py#L134-L162 | ||
sonyxperiadev/WebGL | 0299b38196f78c6d5f74bcf6fa312a3daee6de60 | Tools/Scripts/webkitpy/thirdparty/BeautifulSoup.py | python | Tag.__init__ | (self, parser, name, attrs=None, parent=None,
previous=None) | Basic constructor. | Basic constructor. | [
"Basic",
"constructor",
"."
] | def __init__(self, parser, name, attrs=None, parent=None,
previous=None):
"Basic constructor."
# We don't actually store the parser object: that lets extracted
# chunks be garbage-collected
self.parserClass = parser.__class__
self.isSelfClosing = parser.isSelfCl... | [
"def",
"__init__",
"(",
"self",
",",
"parser",
",",
"name",
",",
"attrs",
"=",
"None",
",",
"parent",
"=",
"None",
",",
"previous",
"=",
"None",
")",
":",
"# We don't actually store the parser object: that lets extracted",
"# chunks be garbage-collected",
"self",
".... | https://github.com/sonyxperiadev/WebGL/blob/0299b38196f78c6d5f74bcf6fa312a3daee6de60/Tools/Scripts/webkitpy/thirdparty/BeautifulSoup.py#L500-L527 | ||
vusec/vuzzer64 | 2b1b0ed757a3dca114db0192fa4ab1add92348bc | fuzzer-code/bb-weight-new.py | python | get_backedges | (root) | return backedge | tries to retrieve back edges. this analysis may produce FP/FN. the algorith is based on assumption that if we
traverse a graph width first, the whenever we hit a node that has been traversed before, we get a backedge. | tries to retrieve back edges. this analysis may produce FP/FN. the algorith is based on assumption that if we
traverse a graph width first, the whenever we hit a node that has been traversed before, we get a backedge. | [
"tries",
"to",
"retrieve",
"back",
"edges",
".",
"this",
"analysis",
"may",
"produce",
"FP",
"/",
"FN",
".",
"the",
"algorith",
"is",
"based",
"on",
"assumption",
"that",
"if",
"we",
"traverse",
"a",
"graph",
"width",
"first",
"the",
"whenever",
"we",
"h... | def get_backedges(root):
''' tries to retrieve back edges. this analysis may produce FP/FN. the algorith is based on assumption that if we
traverse a graph width first, the whenever we hit a node that has been traversed before, we get a backedge.
'''
tmp=deque([])
visited=set()
backedge=[]# a li... | [
"def",
"get_backedges",
"(",
"root",
")",
":",
"tmp",
"=",
"deque",
"(",
"[",
"]",
")",
"visited",
"=",
"set",
"(",
")",
"backedge",
"=",
"[",
"]",
"# a list of tuple of the form (startEA,endEA), denoting an edge.",
"#for cr in root.succs():",
"# tmp.append(cr)",
... | https://github.com/vusec/vuzzer64/blob/2b1b0ed757a3dca114db0192fa4ab1add92348bc/fuzzer-code/bb-weight-new.py#L123-L176 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py | python | _GenerateMSBuildRulePropsFile | (props_path, msbuild_rules) | Generate the .props file. | Generate the .props file. | [
"Generate",
"the",
".",
"props",
"file",
"."
] | def _GenerateMSBuildRulePropsFile(props_path, msbuild_rules):
"""Generate the .props file."""
content = [
"Project",
{"xmlns": "http://schemas.microsoft.com/developer/msbuild/2003"},
]
for rule in msbuild_rules:
content.extend(
[
[
... | [
"def",
"_GenerateMSBuildRulePropsFile",
"(",
"props_path",
",",
"msbuild_rules",
")",
":",
"content",
"=",
"[",
"\"Project\"",
",",
"{",
"\"xmlns\"",
":",
"\"http://schemas.microsoft.com/developer/msbuild/2003\"",
"}",
",",
"]",
"for",
"rule",
"in",
"msbuild_rules",
"... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py#L2438-L2477 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/richtext.py | python | RichTextCtrl.PromoteList | (*args, **kwargs) | return _richtext.RichTextCtrl_PromoteList(*args, **kwargs) | PromoteList(self, int promoteBy, RichTextRange range, String defName,
int flags=RICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel=-1) -> bool | PromoteList(self, int promoteBy, RichTextRange range, String defName,
int flags=RICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel=-1) -> bool | [
"PromoteList",
"(",
"self",
"int",
"promoteBy",
"RichTextRange",
"range",
"String",
"defName",
"int",
"flags",
"=",
"RICHTEXT_SETSTYLE_WITH_UNDO",
"int",
"specifiedLevel",
"=",
"-",
"1",
")",
"-",
">",
"bool"
] | def PromoteList(*args, **kwargs):
"""
PromoteList(self, int promoteBy, RichTextRange range, String defName,
int flags=RICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel=-1) -> bool
"""
return _richtext.RichTextCtrl_PromoteList(*args, **kwargs) | [
"def",
"PromoteList",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextCtrl_PromoteList",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/richtext.py#L3199-L3204 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/debug/cli/cli_shared.py | python | get_run_short_description | (run_call_count,
fetches,
feed_dict,
is_callable_runner=False) | return description | Get a short description of the run() call.
Args:
run_call_count: (int) Run call counter.
fetches: Fetches of the `Session.run()` call. See doc of `Session.run()`
for more details.
feed_dict: Feeds to the `Session.run()` call. See doc of `Session.run()`
for more details.
is_callable_runner... | Get a short description of the run() call. | [
"Get",
"a",
"short",
"description",
"of",
"the",
"run",
"()",
"call",
"."
] | def get_run_short_description(run_call_count,
fetches,
feed_dict,
is_callable_runner=False):
"""Get a short description of the run() call.
Args:
run_call_count: (int) Run call counter.
fetches: Fetches of the `Session... | [
"def",
"get_run_short_description",
"(",
"run_call_count",
",",
"fetches",
",",
"feed_dict",
",",
"is_callable_runner",
"=",
"False",
")",
":",
"if",
"is_callable_runner",
":",
"return",
"\"runner from make_callable()\"",
"description",
"=",
"\"run #%d: \"",
"%",
"run_c... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/debug/cli/cli_shared.py#L418-L462 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/tf_asymmetry_fitting/tf_asymmetry_fitting_model.py | python | TFAsymmetryFittingModel._toggle_fix_normalisation_in_tf_asymmetry_single_fit_mode | (self, dataset_index: int, is_fixed: bool) | Fixes the current normalisation to its current value in single fit mode, or unfixes it. | Fixes the current normalisation to its current value in single fit mode, or unfixes it. | [
"Fixes",
"the",
"current",
"normalisation",
"to",
"its",
"current",
"value",
"in",
"single",
"fit",
"mode",
"or",
"unfixes",
"it",
"."
] | def _toggle_fix_normalisation_in_tf_asymmetry_single_fit_mode(self, dataset_index: int, is_fixed: bool) -> None:
"""Fixes the current normalisation to its current value in single fit mode, or unfixes it."""
current_tf_single_fit_function = self.fitting_context.tf_asymmetry_single_functions[dataset_index... | [
"def",
"_toggle_fix_normalisation_in_tf_asymmetry_single_fit_mode",
"(",
"self",
",",
"dataset_index",
":",
"int",
",",
"is_fixed",
":",
"bool",
")",
"->",
"None",
":",
"current_tf_single_fit_function",
"=",
"self",
".",
"fitting_context",
".",
"tf_asymmetry_single_functi... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/tf_asymmetry_fitting/tf_asymmetry_fitting_model.py#L461-L468 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/requests_toolbelt/_compat.py | python | HTTPHeaderDict.pop | (self, key, default=__marker) | D.pop(k[,d]) -> v, remove specified key and return its value.
If key is not found, d is returned if given, otherwise KeyError is
raised. | D.pop(k[,d]) -> v, remove specified key and return its value. | [
"D",
".",
"pop",
"(",
"k",
"[",
"d",
"]",
")",
"-",
">",
"v",
"remove",
"specified",
"key",
"and",
"return",
"its",
"value",
"."
] | def pop(self, key, default=__marker):
"""D.pop(k[,d]) -> v, remove specified key and return its value.
If key is not found, d is returned if given, otherwise KeyError is
raised.
"""
# Using the MutableMapping function directly fails due to the private
# marker.
#... | [
"def",
"pop",
"(",
"self",
",",
"key",
",",
"default",
"=",
"__marker",
")",
":",
"# Using the MutableMapping function directly fails due to the private",
"# marker.",
"# Using ordinary dict.pop would expose the internal structures.",
"# So let's reinvent the wheel.",
"try",
":",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/requests_toolbelt/_compat.py#L153-L171 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.