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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/floatcanvas/FloatCanvas.py | python | XYObjectMixin.Move | (self, Delta ) | Move(Delta): moves the object by delta, where delta is a
(dx,dy) pair. Ideally a Numpy array of shape (2,) | [] | def Move(self, Delta ):
"""
Move(Delta): moves the object by delta, where delta is a
(dx,dy) pair. Ideally a Numpy array of shape (2,)
"""
Delta = N.asarray(Delta, N.float)
self.XY += Delta
self.BoundingBox += Delta
if self._Canvas:
self._C... | [
"def",
"Move",
"(",
"self",
",",
"Delta",
")",
":",
"Delta",
"=",
"N",
".",
"asarray",
"(",
"Delta",
",",
"N",
".",
"float",
")",
"self",
".",
"XY",
"+=",
"Delta",
"self",
".",
"BoundingBox",
"+=",
"Delta",
"if",
"self",
".",
"_Canvas",
":",
"sel... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/floatcanvas/FloatCanvas.py#L550-L563 | |||
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/framework/meta_graph.py | python | create_meta_graph_def | (meta_info_def=None,
graph_def=None,
saver_def=None,
collection_list=None) | return meta_graph_def | Construct and returns a `MetaGraphDef` protocol buffer.
Args:
meta_info_def: `MetaInfoDef` protocol buffer.
graph_def: `GraphDef` protocol buffer.
saver_def: `SaverDef` protocol buffer.
collection_list: List of string keys to collect.
Returns:
MetaGraphDef protocol buffer.
Raises:
TypeE... | Construct and returns a `MetaGraphDef` protocol buffer. | [
"Construct",
"and",
"returns",
"a",
"MetaGraphDef",
"protocol",
"buffer",
"."
] | def create_meta_graph_def(meta_info_def=None,
graph_def=None,
saver_def=None,
collection_list=None):
"""Construct and returns a `MetaGraphDef` protocol buffer.
Args:
meta_info_def: `MetaInfoDef` protocol buffer.
graph_def: `Graph... | [
"def",
"create_meta_graph_def",
"(",
"meta_info_def",
"=",
"None",
",",
"graph_def",
"=",
"None",
",",
"saver_def",
"=",
"None",
",",
"collection_list",
"=",
"None",
")",
":",
"# Type check.",
"if",
"meta_info_def",
"and",
"not",
"isinstance",
"(",
"meta_info_de... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/framework/meta_graph.py#L184-L245 | |
scylladb/seastar | 0cdd2329beb1cc4c0af8828598c26114397ffa9c | seastar_cmake.py | python | translate_arg | (arg, new_name, value_when_none='no') | return '-DSeastar_{}={}'.format(new_name, value) | Translate a value populated from the command-line into a name to pass to the invocation of CMake. | Translate a value populated from the command-line into a name to pass to the invocation of CMake. | [
"Translate",
"a",
"value",
"populated",
"from",
"the",
"command",
"-",
"line",
"into",
"a",
"name",
"to",
"pass",
"to",
"the",
"invocation",
"of",
"CMake",
"."
] | def translate_arg(arg, new_name, value_when_none='no'):
"""
Translate a value populated from the command-line into a name to pass to the invocation of CMake.
"""
if arg is None:
value = value_when_none
elif type(arg) is bool:
value = 'yes' if arg else 'no'
else:
value = a... | [
"def",
"translate_arg",
"(",
"arg",
",",
"new_name",
",",
"value_when_none",
"=",
"'no'",
")",
":",
"if",
"arg",
"is",
"None",
":",
"value",
"=",
"value_when_none",
"elif",
"type",
"(",
"arg",
")",
"is",
"bool",
":",
"value",
"=",
"'yes'",
"if",
"arg",... | https://github.com/scylladb/seastar/blob/0cdd2329beb1cc4c0af8828598c26114397ffa9c/seastar_cmake.py#L38-L49 | |
GoSSIP-SJTU/TripleDoggy | 03648d6b19c812504b14e8b98c8c7b3f443f4e54 | tools/clang/tools/scan-build-py/libscanbuild/report.py | python | crash_report | (output_dir, prefix) | return name | Creates a fragment from the compiler crashes. | Creates a fragment from the compiler crashes. | [
"Creates",
"a",
"fragment",
"from",
"the",
"compiler",
"crashes",
"."
] | def crash_report(output_dir, prefix):
""" Creates a fragment from the compiler crashes. """
pretty = prettify_crash(prefix, output_dir)
crashes = (pretty(crash) for crash in read_crashes(output_dir))
name = os.path.join(output_dir, 'crashes.html.fragment')
with open(name, 'w') as handle:
i... | [
"def",
"crash_report",
"(",
"output_dir",
",",
"prefix",
")",
":",
"pretty",
"=",
"prettify_crash",
"(",
"prefix",
",",
"output_dir",
")",
"crashes",
"=",
"(",
"pretty",
"(",
"crash",
")",
"for",
"crash",
"in",
"read_crashes",
"(",
"output_dir",
")",
")",
... | https://github.com/GoSSIP-SJTU/TripleDoggy/blob/03648d6b19c812504b14e8b98c8c7b3f443f4e54/tools/clang/tools/scan-build-py/libscanbuild/report.py#L210-L245 | |
seqan/seqan | f5f658343c366c9c3d44ba358ffc9317e78a09ed | util/py_lib/seqan/dox/proc_doc.py | python | ProcTag.local_name | (self) | Returns name without group prefix. | Returns name without group prefix. | [
"Returns",
"name",
"without",
"group",
"prefix",
"."
] | def local_name(self):
"""Returns name without group prefix."""
if '#' in self.name:
return self.name.split('#', 1)[-1]
else:
return self.name | [
"def",
"local_name",
"(",
"self",
")",
":",
"if",
"'#'",
"in",
"self",
".",
"name",
":",
"return",
"self",
".",
"name",
".",
"split",
"(",
"'#'",
",",
"1",
")",
"[",
"-",
"1",
"]",
"else",
":",
"return",
"self",
".",
"name"
] | https://github.com/seqan/seqan/blob/f5f658343c366c9c3d44ba358ffc9317e78a09ed/util/py_lib/seqan/dox/proc_doc.py#L568-L573 | ||
NeoGeographyToolkit/StereoPipeline | eedf54a919fb5cce1ab0e280bb0df4050763aa11 | src/asp/IceBridge/process_icebridge_batch.py | python | robustPcAlign | (options, outputPrefix, lidarFile, lidarDemPath,
demPath, finalAlignedDEM,
projString, lidarCsvFormatString, threadText, logger) | return alignedDem, lidarDiffPath, results['Mean'] | Try pc_align with increasing max displacements until we it completes
with enough lidar points used in the comparison | Try pc_align with increasing max displacements until we it completes
with enough lidar points used in the comparison | [
"Try",
"pc_align",
"with",
"increasing",
"max",
"displacements",
"until",
"we",
"it",
"completes",
"with",
"enough",
"lidar",
"points",
"used",
"in",
"the",
"comparison"
] | def robustPcAlign(options, outputPrefix, lidarFile, lidarDemPath,
demPath, finalAlignedDEM,
projString, lidarCsvFormatString, threadText, logger):
'''Try pc_align with increasing max displacements until we it completes
with enough lidar points used in the comparison'''
... | [
"def",
"robustPcAlign",
"(",
"options",
",",
"outputPrefix",
",",
"lidarFile",
",",
"lidarDemPath",
",",
"demPath",
",",
"finalAlignedDEM",
",",
"projString",
",",
"lidarCsvFormatString",
",",
"threadText",
",",
"logger",
")",
":",
"# Displacements are still since an ... | https://github.com/NeoGeographyToolkit/StereoPipeline/blob/eedf54a919fb5cce1ab0e280bb0df4050763aa11/src/asp/IceBridge/process_icebridge_batch.py#L126-L319 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/src/robotsim.py | python | RigidObjectModel.setContactParameters | (self, params) | return _robotsim.RigidObjectModel_setContactParameters(self, params) | setContactParameters(RigidObjectModel self, ContactParameters params) | setContactParameters(RigidObjectModel self, ContactParameters params) | [
"setContactParameters",
"(",
"RigidObjectModel",
"self",
"ContactParameters",
"params",
")"
] | def setContactParameters(self, params):
"""
setContactParameters(RigidObjectModel self, ContactParameters params)
"""
return _robotsim.RigidObjectModel_setContactParameters(self, params) | [
"def",
"setContactParameters",
"(",
"self",
",",
"params",
")",
":",
"return",
"_robotsim",
".",
"RigidObjectModel_setContactParameters",
"(",
"self",
",",
"params",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/src/robotsim.py#L5446-L5453 | |
devsisters/libquic | 8954789a056d8e7d5fcb6452fd1572ca57eb5c4e | src/third_party/protobuf/python/google/protobuf/json_format.py | python | _ConvertAnyMessage | (value, message) | Convert a JSON representation into Any message. | Convert a JSON representation into Any message. | [
"Convert",
"a",
"JSON",
"representation",
"into",
"Any",
"message",
"."
] | def _ConvertAnyMessage(value, message):
"""Convert a JSON representation into Any message."""
if isinstance(value, dict) and not value:
return
try:
type_url = value['@type']
except KeyError:
raise ParseError('@type is missing when parsing any message.')
sub_message = _CreateMessageFromTypeUrl(typ... | [
"def",
"_ConvertAnyMessage",
"(",
"value",
",",
"message",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"dict",
")",
"and",
"not",
"value",
":",
"return",
"try",
":",
"type_url",
"=",
"value",
"[",
"'@type'",
"]",
"except",
"KeyError",
":",
"raise",
... | https://github.com/devsisters/libquic/blob/8954789a056d8e7d5fcb6452fd1572ca57eb5c4e/src/third_party/protobuf/python/google/protobuf/json_format.py#L425-L446 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py3/setuptools/msvc.py | python | RegistryInfo.vc_for_python | (self) | return r'DevDiv\VCForPython' | Microsoft Visual C++ for Python registry key.
Return
------
str
Registry key | Microsoft Visual C++ for Python registry key. | [
"Microsoft",
"Visual",
"C",
"++",
"for",
"Python",
"registry",
"key",
"."
] | def vc_for_python(self):
"""
Microsoft Visual C++ for Python registry key.
Return
------
str
Registry key
"""
return r'DevDiv\VCForPython' | [
"def",
"vc_for_python",
"(",
"self",
")",
":",
"return",
"r'DevDiv\\VCForPython'"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py3/setuptools/msvc.py#L553-L562 | |
arangodb/arangodb | 0d658689c7d1b721b314fa3ca27d38303e1570c8 | 3rdParty/V8/gyp/generator/xcodeproj_file.py | python | XCObject._XCKVPrint | (self, file, tabs, key, value) | Prints a key and value, members of an XCObject's _properties dictionary,
to file.
tabs is an int identifying the indentation level. If the class'
_should_print_single_line variable is True, tabs is ignored and the
key-value pair will be followed by a space insead of a newline. | Prints a key and value, members of an XCObject's _properties dictionary,
to file. | [
"Prints",
"a",
"key",
"and",
"value",
"members",
"of",
"an",
"XCObject",
"s",
"_properties",
"dictionary",
"to",
"file",
"."
] | def _XCKVPrint(self, file, tabs, key, value):
"""Prints a key and value, members of an XCObject's _properties dictionary,
to file.
tabs is an int identifying the indentation level. If the class'
_should_print_single_line variable is True, tabs is ignored and the
key-value pair will be followed by ... | [
"def",
"_XCKVPrint",
"(",
"self",
",",
"file",
",",
"tabs",
",",
"key",
",",
"value",
")",
":",
"if",
"self",
".",
"_should_print_single_line",
":",
"printable",
"=",
"''",
"after_kv",
"=",
"' '",
"else",
":",
"printable",
"=",
"'\\t'",
"*",
"tabs",
"a... | https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/V8/gyp/generator/xcodeproj_file.py#L649-L709 | ||
domino-team/openwrt-cc | 8b181297c34d14d3ca521cc9f31430d561dbc688 | package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/tools/gyp/pylib/gyp/win_tool.py | python | WinTool.ExecStamp | (self, path) | Simple stamp command. | Simple stamp command. | [
"Simple",
"stamp",
"command",
"."
] | def ExecStamp(self, path):
"""Simple stamp command."""
open(path, 'w').close() | [
"def",
"ExecStamp",
"(",
"self",
",",
"path",
")",
":",
"open",
"(",
"path",
",",
"'w'",
")",
".",
"close",
"(",
")"
] | https://github.com/domino-team/openwrt-cc/blob/8b181297c34d14d3ca521cc9f31430d561dbc688/package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/tools/gyp/pylib/gyp/win_tool.py#L85-L87 | ||
DISTORTEC/distortos | 49266f5818f08e10e4faca7298f1e6b60be733ba | scripts/PrettyPrinters/__init__.py | python | registerPrettyPrinters | (obj) | Register pretty-printers. | Register pretty-printers. | [
"Register",
"pretty",
"-",
"printers",
"."
] | def registerPrettyPrinters(obj):
"""Register pretty-printers."""
import PrettyPrinters.estd
PrettyPrinters.estd.registerPrettyPrinters(obj)
import PrettyPrinters.distortos
PrettyPrinters.distortos.registerPrettyPrinters(obj) | [
"def",
"registerPrettyPrinters",
"(",
"obj",
")",
":",
"import",
"PrettyPrinters",
".",
"estd",
"PrettyPrinters",
".",
"estd",
".",
"registerPrettyPrinters",
"(",
"obj",
")",
"import",
"PrettyPrinters",
".",
"distortos",
"PrettyPrinters",
".",
"distortos",
".",
"r... | https://github.com/DISTORTEC/distortos/blob/49266f5818f08e10e4faca7298f1e6b60be733ba/scripts/PrettyPrinters/__init__.py#L14-L19 | ||
stack-of-tasks/pinocchio | 593d4d43fded997bb9aa2421f4e55294dbd233c4 | bindings/python/pinocchio/visualize/base_visualizer.py | python | BaseVisualizer.clean | (self) | Delete all the objects from the whole scene | Delete all the objects from the whole scene | [
"Delete",
"all",
"the",
"objects",
"from",
"the",
"whole",
"scene"
] | def clean(self):
""" Delete all the objects from the whole scene """
pass | [
"def",
"clean",
"(",
"self",
")",
":",
"pass"
] | https://github.com/stack-of-tasks/pinocchio/blob/593d4d43fded997bb9aa2421f4e55294dbd233c4/bindings/python/pinocchio/visualize/base_visualizer.py#L61-L63 | ||
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/contrib/graph_editor/subgraph.py | python | _check_graph | (sgv, graph) | return sgv | Check if sgv belongs to the given graph.
Args:
sgv: a SubGraphView.
graph: a graph or None.
Returns:
The SubGraphView sgv.
Raises:
TypeError: if sgv is not a SubGraphView or if graph is not None and not
a tf.Graph.
ValueError: if the graph of sgv and the given graph are not None and
... | Check if sgv belongs to the given graph. | [
"Check",
"if",
"sgv",
"belongs",
"to",
"the",
"given",
"graph",
"."
] | def _check_graph(sgv, graph):
"""Check if sgv belongs to the given graph.
Args:
sgv: a SubGraphView.
graph: a graph or None.
Returns:
The SubGraphView sgv.
Raises:
TypeError: if sgv is not a SubGraphView or if graph is not None and not
a tf.Graph.
ValueError: if the graph of sgv and t... | [
"def",
"_check_graph",
"(",
"sgv",
",",
"graph",
")",
":",
"if",
"not",
"isinstance",
"(",
"sgv",
",",
"SubGraphView",
")",
":",
"raise",
"TypeError",
"(",
"\"Expected a SubGraphView, got: {}\"",
".",
"format",
"(",
"type",
"(",
"graph",
")",
")",
")",
"if... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/graph_editor/subgraph.py#L571-L593 | |
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py | python | uCSIsUnifiedCanadianAboriginalSyllabics | (code) | return ret | Check whether the character is part of
UnifiedCanadianAboriginalSyllabics UCS Block | Check whether the character is part of
UnifiedCanadianAboriginalSyllabics UCS Block | [
"Check",
"whether",
"the",
"character",
"is",
"part",
"of",
"UnifiedCanadianAboriginalSyllabics",
"UCS",
"Block"
] | def uCSIsUnifiedCanadianAboriginalSyllabics(code):
"""Check whether the character is part of
UnifiedCanadianAboriginalSyllabics UCS Block """
ret = libxml2mod.xmlUCSIsUnifiedCanadianAboriginalSyllabics(code)
return ret | [
"def",
"uCSIsUnifiedCanadianAboriginalSyllabics",
"(",
"code",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlUCSIsUnifiedCanadianAboriginalSyllabics",
"(",
"code",
")",
"return",
"ret"
] | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py#L2175-L2179 | |
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TNGraph_New | (*args) | return _snap.TNGraph_New(*args) | New() -> PNGraph
TNGraph_New(int const & Nodes, int const & Edges) -> PNGraph
Parameters:
Nodes: int const &
Edges: int const & | New() -> PNGraph
TNGraph_New(int const & Nodes, int const & Edges) -> PNGraph | [
"New",
"()",
"-",
">",
"PNGraph",
"TNGraph_New",
"(",
"int",
"const",
"&",
"Nodes",
"int",
"const",
"&",
"Edges",
")",
"-",
">",
"PNGraph"
] | def TNGraph_New(*args):
"""
New() -> PNGraph
TNGraph_New(int const & Nodes, int const & Edges) -> PNGraph
Parameters:
Nodes: int const &
Edges: int const &
"""
return _snap.TNGraph_New(*args) | [
"def",
"TNGraph_New",
"(",
"*",
"args",
")",
":",
"return",
"_snap",
".",
"TNGraph_New",
"(",
"*",
"args",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L4292-L4302 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/multiprocessing/managers.py | python | AutoProxy | (token, serializer, manager=None, authkey=None,
exposed=None, incref=True) | return proxy | Return an auto-proxy for `token` | Return an auto-proxy for `token` | [
"Return",
"an",
"auto",
"-",
"proxy",
"for",
"token"
] | def AutoProxy(token, serializer, manager=None, authkey=None,
exposed=None, incref=True):
'''
Return an auto-proxy for `token`
'''
_Client = listener_client[serializer][1]
if exposed is None:
conn = _Client(token.address, authkey=authkey)
try:
exposed = disp... | [
"def",
"AutoProxy",
"(",
"token",
",",
"serializer",
",",
"manager",
"=",
"None",
",",
"authkey",
"=",
"None",
",",
"exposed",
"=",
"None",
",",
"incref",
"=",
"True",
")",
":",
"_Client",
"=",
"listener_client",
"[",
"serializer",
"]",
"[",
"1",
"]",
... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/multiprocessing/managers.py#L906-L929 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/src/motionplanning.py | python | PlannerInterface.__init__ | (self, cspace: "CSpaceInterface") | r"""
__init__(PlannerInterface self, CSpaceInterface cspace) -> PlannerInterface | r"""
__init__(PlannerInterface self, CSpaceInterface cspace) -> PlannerInterface | [
"r",
"__init__",
"(",
"PlannerInterface",
"self",
"CSpaceInterface",
"cspace",
")",
"-",
">",
"PlannerInterface"
] | def __init__(self, cspace: "CSpaceInterface"):
r"""
__init__(PlannerInterface self, CSpaceInterface cspace) -> PlannerInterface
"""
_motionplanning.PlannerInterface_swiginit(self, _motionplanning.new_PlannerInterface(cspace)) | [
"def",
"__init__",
"(",
"self",
",",
"cspace",
":",
"\"CSpaceInterface\"",
")",
":",
"_motionplanning",
".",
"PlannerInterface_swiginit",
"(",
"self",
",",
"_motionplanning",
".",
"new_PlannerInterface",
"(",
"cspace",
")",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/src/motionplanning.py#L882-L888 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/ftplib.py | python | parse257 | (resp) | return dirname | Parse the '257' response for a MKD or PWD request.
This is a response to a MKD or PWD request: a directory name.
Returns the directoryname in the 257 reply. | Parse the '257' response for a MKD or PWD request.
This is a response to a MKD or PWD request: a directory name.
Returns the directoryname in the 257 reply. | [
"Parse",
"the",
"257",
"response",
"for",
"a",
"MKD",
"or",
"PWD",
"request",
".",
"This",
"is",
"a",
"response",
"to",
"a",
"MKD",
"or",
"PWD",
"request",
":",
"a",
"directory",
"name",
".",
"Returns",
"the",
"directoryname",
"in",
"the",
"257",
"repl... | def parse257(resp):
'''Parse the '257' response for a MKD or PWD request.
This is a response to a MKD or PWD request: a directory name.
Returns the directoryname in the 257 reply.'''
if resp[:3] != '257':
raise error_reply(resp)
if resp[3:5] != ' "':
return '' # Not compliant to RFC ... | [
"def",
"parse257",
"(",
"resp",
")",
":",
"if",
"resp",
"[",
":",
"3",
"]",
"!=",
"'257'",
":",
"raise",
"error_reply",
"(",
"resp",
")",
"if",
"resp",
"[",
"3",
":",
"5",
"]",
"!=",
"' \"'",
":",
"return",
"''",
"# Not compliant to RFC 959, but UNIX f... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/ftplib.py#L874-L893 | |
hpi-xnor/BMXNet | ed0b201da6667887222b8e4b5f997c4f6b61943d | python/mxnet/gluon/model_zoo/vision/densenet.py | python | densenet169 | (**kwargs) | return get_densenet(169, **kwargs) | r"""Densenet-BC 169-layer model from the
`"Densely Connected Convolutional Networks" <https://arxiv.org/pdf/1608.06993.pdf>`_ paper.
Parameters
----------
pretrained : bool, default False
Whether to load the pretrained weights for model.
ctx : Context, default CPU
The context in whi... | r"""Densenet-BC 169-layer model from the
`"Densely Connected Convolutional Networks" <https://arxiv.org/pdf/1608.06993.pdf>`_ paper. | [
"r",
"Densenet",
"-",
"BC",
"169",
"-",
"layer",
"model",
"from",
"the",
"Densely",
"Connected",
"Convolutional",
"Networks",
"<https",
":",
"//",
"arxiv",
".",
"org",
"/",
"pdf",
"/",
"1608",
".",
"06993",
".",
"pdf",
">",
"_",
"paper",
"."
] | def densenet169(**kwargs):
r"""Densenet-BC 169-layer model from the
`"Densely Connected Convolutional Networks" <https://arxiv.org/pdf/1608.06993.pdf>`_ paper.
Parameters
----------
pretrained : bool, default False
Whether to load the pretrained weights for model.
ctx : Context, default... | [
"def",
"densenet169",
"(",
"*",
"*",
"kwargs",
")",
":",
"return",
"get_densenet",
"(",
"169",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/hpi-xnor/BMXNet/blob/ed0b201da6667887222b8e4b5f997c4f6b61943d/python/mxnet/gluon/model_zoo/vision/densenet.py#L174-L187 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/src/robotsim.py | python | setRandomSeed | (seed) | return _robotsim.setRandomSeed(seed) | setRandomSeed(int seed)
Sets the random seed used by the configuration sampler. | setRandomSeed(int seed) | [
"setRandomSeed",
"(",
"int",
"seed",
")"
] | def setRandomSeed(seed):
"""
setRandomSeed(int seed)
Sets the random seed used by the configuration sampler.
"""
return _robotsim.setRandomSeed(seed) | [
"def",
"setRandomSeed",
"(",
"seed",
")",
":",
"return",
"_robotsim",
".",
"setRandomSeed",
"(",
"seed",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/src/robotsim.py#L8649-L8658 | |
microsoft/checkedc-clang | a173fefde5d7877b7750e7ce96dd08cf18baebf2 | lldb/third_party/Python/module/ptyprocess-0.6.0/ptyprocess/ptyprocess.py | python | PtyProcess.eof | (self) | return self.flag_eof | This returns True if the EOF exception was ever raised. | This returns True if the EOF exception was ever raised. | [
"This",
"returns",
"True",
"if",
"the",
"EOF",
"exception",
"was",
"ever",
"raised",
"."
] | def eof(self):
'''This returns True if the EOF exception was ever raised.
'''
return self.flag_eof | [
"def",
"eof",
"(",
"self",
")",
":",
"return",
"self",
".",
"flag_eof"
] | https://github.com/microsoft/checkedc-clang/blob/a173fefde5d7877b7750e7ce96dd08cf18baebf2/lldb/third_party/Python/module/ptyprocess-0.6.0/ptyprocess/ptyprocess.py#L610-L614 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/docutils/utils/roman.py | python | toRoman | (n) | return result | convert integer to Roman numeral | convert integer to Roman numeral | [
"convert",
"integer",
"to",
"Roman",
"numeral"
] | def toRoman(n):
"""convert integer to Roman numeral"""
if not (0 < n < 5000):
raise OutOfRangeError, "number out of range (must be 1..4999)"
if int(n) != n:
raise NotIntegerError, "decimals can not be converted"
result = ""
for numeral, integer in romanNumeralMap:
while n >=... | [
"def",
"toRoman",
"(",
"n",
")",
":",
"if",
"not",
"(",
"0",
"<",
"n",
"<",
"5000",
")",
":",
"raise",
"OutOfRangeError",
",",
"\"number out of range (must be 1..4999)\"",
"if",
"int",
"(",
"n",
")",
"!=",
"n",
":",
"raise",
"NotIntegerError",
",",
"\"de... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/docutils/utils/roman.py#L40-L52 | |
zhaoweicai/cascade-rcnn | 2252f46158ea6555868ca6fa5c221ea71d9b5e6c | python/caffe/io.py | python | Transformer.preprocess | (self, in_, data) | return caffe_in | Format input for Caffe:
- convert to single
- resize to input dimensions (preserving number of channels)
- transpose dimensions to K x H x W
- reorder channels (for instance color to BGR)
- scale raw input (e.g. from [0, 1] to [0, 255] for ImageNet models)
- subtract mean... | Format input for Caffe:
- convert to single
- resize to input dimensions (preserving number of channels)
- transpose dimensions to K x H x W
- reorder channels (for instance color to BGR)
- scale raw input (e.g. from [0, 1] to [0, 255] for ImageNet models)
- subtract mean... | [
"Format",
"input",
"for",
"Caffe",
":",
"-",
"convert",
"to",
"single",
"-",
"resize",
"to",
"input",
"dimensions",
"(",
"preserving",
"number",
"of",
"channels",
")",
"-",
"transpose",
"dimensions",
"to",
"K",
"x",
"H",
"x",
"W",
"-",
"reorder",
"channe... | def preprocess(self, in_, data):
"""
Format input for Caffe:
- convert to single
- resize to input dimensions (preserving number of channels)
- transpose dimensions to K x H x W
- reorder channels (for instance color to BGR)
- scale raw input (e.g. from [0, 1] to ... | [
"def",
"preprocess",
"(",
"self",
",",
"in_",
",",
"data",
")",
":",
"self",
".",
"__check_input",
"(",
"in_",
")",
"caffe_in",
"=",
"data",
".",
"astype",
"(",
"np",
".",
"float32",
",",
"copy",
"=",
"False",
")",
"transpose",
"=",
"self",
".",
"t... | https://github.com/zhaoweicai/cascade-rcnn/blob/2252f46158ea6555868ca6fa5c221ea71d9b5e6c/python/caffe/io.py#L122-L162 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/io/clipboard/__init__.py | python | lazy_load_stub_copy | (text) | return copy(text) | A stub function for copy(), which will load the real copy() function when
called so that the real copy() function is used for later calls.
This allows users to import pyperclip without having determine_clipboard()
automatically run, which will automatically select a clipboard mechanism.
This could be a... | A stub function for copy(), which will load the real copy() function when
called so that the real copy() function is used for later calls. | [
"A",
"stub",
"function",
"for",
"copy",
"()",
"which",
"will",
"load",
"the",
"real",
"copy",
"()",
"function",
"when",
"called",
"so",
"that",
"the",
"real",
"copy",
"()",
"function",
"is",
"used",
"for",
"later",
"calls",
"."
] | def lazy_load_stub_copy(text):
"""
A stub function for copy(), which will load the real copy() function when
called so that the real copy() function is used for later calls.
This allows users to import pyperclip without having determine_clipboard()
automatically run, which will automatically select... | [
"def",
"lazy_load_stub_copy",
"(",
"text",
")",
":",
"global",
"copy",
",",
"paste",
"copy",
",",
"paste",
"=",
"determine_clipboard",
"(",
")",
"return",
"copy",
"(",
"text",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/io/clipboard/__init__.py#L609-L628 | |
livecode/livecode | 4606a10ea10b16d5071d0f9f263ccdd7ede8b31d | gyp/pylib/gyp/xcodeproj_file.py | python | XCObject.UpdateProperties | (self, properties, do_copy=False) | Merge the supplied properties into the _properties dictionary.
The input properties must adhere to the class schema or a KeyError or
TypeError exception will be raised. If adding an object of an XCObject
subclass and the schema indicates a strong relationship, the object's
parent will be set to this o... | Merge the supplied properties into the _properties dictionary. | [
"Merge",
"the",
"supplied",
"properties",
"into",
"the",
"_properties",
"dictionary",
"."
] | def UpdateProperties(self, properties, do_copy=False):
"""Merge the supplied properties into the _properties dictionary.
The input properties must adhere to the class schema or a KeyError or
TypeError exception will be raised. If adding an object of an XCObject
subclass and the schema indicates a stro... | [
"def",
"UpdateProperties",
"(",
"self",
",",
"properties",
",",
"do_copy",
"=",
"False",
")",
":",
"if",
"properties",
"is",
"None",
":",
"return",
"for",
"property",
",",
"value",
"in",
"properties",
".",
"iteritems",
"(",
")",
":",
"# Make sure the propert... | https://github.com/livecode/livecode/blob/4606a10ea10b16d5071d0f9f263ccdd7ede8b31d/gyp/pylib/gyp/xcodeproj_file.py#L739-L819 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/platebtn.py | python | PlateButton.SetWindowStyle | (self, style) | Sets the window style bytes, the updates take place
immediately no need to call refresh afterwards.
:param `style`: bitmask of PB_STYLE_* values | Sets the window style bytes, the updates take place
immediately no need to call refresh afterwards. | [
"Sets",
"the",
"window",
"style",
"bytes",
"the",
"updates",
"take",
"place",
"immediately",
"no",
"need",
"to",
"call",
"refresh",
"afterwards",
"."
] | def SetWindowStyle(self, style):
"""Sets the window style bytes, the updates take place
immediately no need to call refresh afterwards.
:param `style`: bitmask of PB_STYLE_* values
"""
self._style = style
self.Refresh() | [
"def",
"SetWindowStyle",
"(",
"self",
",",
"style",
")",
":",
"self",
".",
"_style",
"=",
"style",
"self",
".",
"Refresh",
"(",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/platebtn.py#L726-L734 | ||
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/onnx/mx2onnx/_op_translations/_op_translations_opset12.py | python | convert_zeros | (node, **kwargs) | return nodes, (dtype,) | Map MXNet's zeros operator attributes to onnx's ConstantOfShape operator. | Map MXNet's zeros operator attributes to onnx's ConstantOfShape operator. | [
"Map",
"MXNet",
"s",
"zeros",
"operator",
"attributes",
"to",
"onnx",
"s",
"ConstantOfShape",
"operator",
"."
] | def convert_zeros(node, **kwargs):
"""Map MXNet's zeros operator attributes to onnx's ConstantOfShape operator.
"""
from onnx.helper import make_node, make_tensor
name, _, attrs = get_inputs(node, kwargs)
dtype = attrs.get('dtype')
data_type = onnx.mapping.NP_TYPE_TO_TENSOR_TYPE[np.dtype(dtype)]... | [
"def",
"convert_zeros",
"(",
"node",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"onnx",
".",
"helper",
"import",
"make_node",
",",
"make_tensor",
"name",
",",
"_",
",",
"attrs",
"=",
"get_inputs",
"(",
"node",
",",
"kwargs",
")",
"dtype",
"=",
"attrs",... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/onnx/mx2onnx/_op_translations/_op_translations_opset12.py#L3246-L3261 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/math_grad.py | python | _MatMulGrad | (op, grad) | return grad_a, grad_b | Gradient for MatMul. | Gradient for MatMul. | [
"Gradient",
"for",
"MatMul",
"."
] | def _MatMulGrad(op, grad):
"""Gradient for MatMul."""
t_a = op.get_attr("transpose_a")
t_b = op.get_attr("transpose_b")
a = math_ops.conj(op.inputs[0])
b = math_ops.conj(op.inputs[1])
if not t_a and not t_b:
grad_a = math_ops.matmul(grad, b, transpose_b=True)
grad_b = math_ops.matmul(a, grad, trans... | [
"def",
"_MatMulGrad",
"(",
"op",
",",
"grad",
")",
":",
"t_a",
"=",
"op",
".",
"get_attr",
"(",
"\"transpose_a\"",
")",
"t_b",
"=",
"op",
".",
"get_attr",
"(",
"\"transpose_b\"",
")",
"a",
"=",
"math_ops",
".",
"conj",
"(",
"op",
".",
"inputs",
"[",
... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/math_grad.py#L866-L885 | |
microsoft/ELL | a1d6bacc37a14879cc025d9be2ba40b1a0632315 | docs/tutorials/shared/tutorial_helpers.py | python | draw_regions_on_image | (image, regions, offset, scale) | Draws a bounding box with a text label for each `Region` instance in
`regions` on `image`. | Draws a bounding box with a text label for each `Region` instance in
`regions` on `image`. | [
"Draws",
"a",
"bounding",
"box",
"with",
"a",
"text",
"label",
"for",
"each",
"Region",
"instance",
"in",
"regions",
"on",
"image",
"."
] | def draw_regions_on_image(image, regions, offset, scale):
"""Draws a bounding box with a text label for each `Region` instance in
`regions` on `image`."""
for r in regions:
# Unpack the location
x, y, w, h = r.location
width = image.shape[1]
height = image.shape[0]
... | [
"def",
"draw_regions_on_image",
"(",
"image",
",",
"regions",
",",
"offset",
",",
"scale",
")",
":",
"for",
"r",
"in",
"regions",
":",
"# Unpack the location",
"x",
",",
"y",
",",
"w",
",",
"h",
"=",
"r",
".",
"location",
"width",
"=",
"image",
".",
... | https://github.com/microsoft/ELL/blob/a1d6bacc37a14879cc025d9be2ba40b1a0632315/docs/tutorials/shared/tutorial_helpers.py#L560-L586 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/turtle.py | python | TNavigator.ycor | (self) | return self._position[1] | Return the turtle's y coordinate
---
No arguments.
Example (for a Turtle instance named turtle):
>>> reset()
>>> turtle.left(60)
>>> turtle.forward(100)
>>> print turtle.ycor()
86.6025403784 | Return the turtle's y coordinate
---
No arguments. | [
"Return",
"the",
"turtle",
"s",
"y",
"coordinate",
"---",
"No",
"arguments",
"."
] | def ycor(self):
""" Return the turtle's y coordinate
---
No arguments.
Example (for a Turtle instance named turtle):
>>> reset()
>>> turtle.left(60)
>>> turtle.forward(100)
>>> print turtle.ycor()
86.6025403784
"""
return self._pos... | [
"def",
"ycor",
"(",
"self",
")",
":",
"return",
"self",
".",
"_position",
"[",
"1",
"]"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/turtle.py#L1728-L1740 | |
smilehao/xlua-framework | a03801538be2b0e92d39332d445b22caca1ef61f | ConfigData/trunk/tools/protobuf-2.5.0/protobuf-2.5.0/python/build/lib/google/protobuf/internal/containers.py | python | RepeatedScalarFieldContainer.__setslice__ | (self, start, stop, values) | Sets the subset of items from between the specified indices. | Sets the subset of items from between the specified indices. | [
"Sets",
"the",
"subset",
"of",
"items",
"from",
"between",
"the",
"specified",
"indices",
"."
] | def __setslice__(self, start, stop, values):
"""Sets the subset of items from between the specified indices."""
new_values = []
for value in values:
self._type_checker.CheckValue(value)
new_values.append(value)
self._values[start:stop] = new_values
self._message_listener.Modified() | [
"def",
"__setslice__",
"(",
"self",
",",
"start",
",",
"stop",
",",
"values",
")",
":",
"new_values",
"=",
"[",
"]",
"for",
"value",
"in",
"values",
":",
"self",
".",
"_type_checker",
".",
"CheckValue",
"(",
"value",
")",
"new_values",
".",
"append",
"... | https://github.com/smilehao/xlua-framework/blob/a03801538be2b0e92d39332d445b22caca1ef61f/ConfigData/trunk/tools/protobuf-2.5.0/protobuf-2.5.0/python/build/lib/google/protobuf/internal/containers.py#L157-L164 | ||
okex/V3-Open-API-SDK | c5abb0db7e2287718e0055e17e57672ce0ec7fd9 | okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_vendor/pyparsing.py | python | ParserElement.leaveWhitespace | ( self ) | return self | Disables the skipping of whitespace before matching the characters in the
:class:`ParserElement`'s defined pattern. This is normally only used internally by
the pyparsing module, but may be needed in some whitespace-sensitive grammars. | Disables the skipping of whitespace before matching the characters in the
:class:`ParserElement`'s defined pattern. This is normally only used internally by
the pyparsing module, but may be needed in some whitespace-sensitive grammars. | [
"Disables",
"the",
"skipping",
"of",
"whitespace",
"before",
"matching",
"the",
"characters",
"in",
"the",
":",
"class",
":",
"ParserElement",
"s",
"defined",
"pattern",
".",
"This",
"is",
"normally",
"only",
"used",
"internally",
"by",
"the",
"pyparsing",
"mo... | def leaveWhitespace( self ):
"""
Disables the skipping of whitespace before matching the characters in the
:class:`ParserElement`'s defined pattern. This is normally only used internally by
the pyparsing module, but may be needed in some whitespace-sensitive grammars.
"""
... | [
"def",
"leaveWhitespace",
"(",
"self",
")",
":",
"self",
".",
"skipWhitespace",
"=",
"False",
"return",
"self"
] | https://github.com/okex/V3-Open-API-SDK/blob/c5abb0db7e2287718e0055e17e57672ce0ec7fd9/okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_vendor/pyparsing.py#L2226-L2233 | |
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py | python | SBProcess.RemoteLaunch | (self, *args) | return _lldb.SBProcess_RemoteLaunch(self, *args) | RemoteLaunch(self, list argv, list envp, str stdin_path, str stdout_path,
str stderr_path, str working_directory,
uint32_t launch_flags, bool stop_at_entry,
SBError error) -> bool
See SBTarget.Launch for argument description and usage. | RemoteLaunch(self, list argv, list envp, str stdin_path, str stdout_path,
str stderr_path, str working_directory,
uint32_t launch_flags, bool stop_at_entry,
SBError error) -> bool | [
"RemoteLaunch",
"(",
"self",
"list",
"argv",
"list",
"envp",
"str",
"stdin_path",
"str",
"stdout_path",
"str",
"stderr_path",
"str",
"working_directory",
"uint32_t",
"launch_flags",
"bool",
"stop_at_entry",
"SBError",
"error",
")",
"-",
">",
"bool"
] | def RemoteLaunch(self, *args):
"""
RemoteLaunch(self, list argv, list envp, str stdin_path, str stdout_path,
str stderr_path, str working_directory,
uint32_t launch_flags, bool stop_at_entry,
SBError error) -> bool
See SBTarget.Launch for argument descript... | [
"def",
"RemoteLaunch",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_lldb",
".",
"SBProcess_RemoteLaunch",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py#L7024-L7033 | |
WaykiChain/WaykiChain | 544bfb64c1b739ed9d6999ffc4bfd63c32d0f3e8 | share/qt/extract_strings_qt.py | python | parse_po | (text) | return messages | Parse 'po' format produced by xgettext.
Return a list of (msgid,msgstr) tuples. | Parse 'po' format produced by xgettext.
Return a list of (msgid,msgstr) tuples. | [
"Parse",
"po",
"format",
"produced",
"by",
"xgettext",
".",
"Return",
"a",
"list",
"of",
"(",
"msgid",
"msgstr",
")",
"tuples",
"."
] | def parse_po(text):
"""
Parse 'po' format produced by xgettext.
Return a list of (msgid,msgstr) tuples.
"""
messages = []
msgid = []
msgstr = []
in_msgid = False
in_msgstr = False
for line in text.split('\n'):
line = line.rstrip('\r')
if line.startswith('msgid ')... | [
"def",
"parse_po",
"(",
"text",
")",
":",
"messages",
"=",
"[",
"]",
"msgid",
"=",
"[",
"]",
"msgstr",
"=",
"[",
"]",
"in_msgid",
"=",
"False",
"in_msgstr",
"=",
"False",
"for",
"line",
"in",
"text",
".",
"split",
"(",
"'\\n'",
")",
":",
"line",
... | https://github.com/WaykiChain/WaykiChain/blob/544bfb64c1b739ed9d6999ffc4bfd63c32d0f3e8/share/qt/extract_strings_qt.py#L14-L48 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_controls.py | python | ListCtrl.Create | (*args, **kwargs) | return _controls_.ListCtrl_Create(*args, **kwargs) | Create(self, Window parent, int id=-1, Point pos=DefaultPosition,
Size size=DefaultSize, long style=LC_ICON,
Validator validator=DefaultValidator, String name=ListCtrlNameStr) -> bool
Do the 2nd phase and create the GUI control. | Create(self, Window parent, int id=-1, Point pos=DefaultPosition,
Size size=DefaultSize, long style=LC_ICON,
Validator validator=DefaultValidator, String name=ListCtrlNameStr) -> bool | [
"Create",
"(",
"self",
"Window",
"parent",
"int",
"id",
"=",
"-",
"1",
"Point",
"pos",
"=",
"DefaultPosition",
"Size",
"size",
"=",
"DefaultSize",
"long",
"style",
"=",
"LC_ICON",
"Validator",
"validator",
"=",
"DefaultValidator",
"String",
"name",
"=",
"Lis... | def Create(*args, **kwargs):
"""
Create(self, Window parent, int id=-1, Point pos=DefaultPosition,
Size size=DefaultSize, long style=LC_ICON,
Validator validator=DefaultValidator, String name=ListCtrlNameStr) -> bool
Do the 2nd phase and create the GUI control.
... | [
"def",
"Create",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"ListCtrl_Create",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_controls.py#L4444-L4452 | |
deepmind/open_spiel | 4ca53bea32bb2875c7385d215424048ae92f78c8 | open_spiel/python/pytorch/losses/rl_losses.py | python | compute_regrets | (policy_logits, action_values) | return regrets | Compute regrets using pi and Q. | Compute regrets using pi and Q. | [
"Compute",
"regrets",
"using",
"pi",
"and",
"Q",
"."
] | def compute_regrets(policy_logits, action_values):
"""Compute regrets using pi and Q."""
# Compute regret.
policy = F.softmax(policy_logits, dim=1)
# Avoid computing gradients for action_values.
action_values = action_values.detach()
baseline = compute_baseline(policy, action_values)
regrets = torch.sum... | [
"def",
"compute_regrets",
"(",
"policy_logits",
",",
"action_values",
")",
":",
"# Compute regret.",
"policy",
"=",
"F",
".",
"softmax",
"(",
"policy_logits",
",",
"dim",
"=",
"1",
")",
"# Avoid computing gradients for action_values.",
"action_values",
"=",
"action_va... | https://github.com/deepmind/open_spiel/blob/4ca53bea32bb2875c7385d215424048ae92f78c8/open_spiel/python/pytorch/losses/rl_losses.py#L54-L66 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_misc.py | python | UIActionSimulator.MouseDragDrop | (*args, **kwargs) | return _misc_.UIActionSimulator_MouseDragDrop(*args, **kwargs) | MouseDragDrop(self, long x1, long y1, long x2, long y2, int button=MOUSE_BTN_LEFT) -> bool | MouseDragDrop(self, long x1, long y1, long x2, long y2, int button=MOUSE_BTN_LEFT) -> bool | [
"MouseDragDrop",
"(",
"self",
"long",
"x1",
"long",
"y1",
"long",
"x2",
"long",
"y2",
"int",
"button",
"=",
"MOUSE_BTN_LEFT",
")",
"-",
">",
"bool"
] | def MouseDragDrop(*args, **kwargs):
"""MouseDragDrop(self, long x1, long y1, long x2, long y2, int button=MOUSE_BTN_LEFT) -> bool"""
return _misc_.UIActionSimulator_MouseDragDrop(*args, **kwargs) | [
"def",
"MouseDragDrop",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"UIActionSimulator_MouseDragDrop",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_misc.py#L6983-L6985 | |
openmm/openmm | cb293447c4fc8b03976dfe11399f107bab70f3d9 | wrappers/python/openmm/app/internal/customgbforces.py | python | CustomAmberGBForceBase.getStandardParameters | (topology) | Gets list of standard parameters for this GB model based on an input Topology
Parameters
----------
topology : openmm.app.Topology
Topology of the system to get parameters for
Returns
-------
list of float
List of all parameters needed for this G... | Gets list of standard parameters for this GB model based on an input Topology | [
"Gets",
"list",
"of",
"standard",
"parameters",
"for",
"this",
"GB",
"model",
"based",
"on",
"an",
"input",
"Topology"
] | def getStandardParameters(topology):
""" Gets list of standard parameters for this GB model based on an input Topology
Parameters
----------
topology : openmm.app.Topology
Topology of the system to get parameters for
Returns
-------
list of float
... | [
"def",
"getStandardParameters",
"(",
"topology",
")",
":",
"raise",
"NotImplementedError",
"(",
"'getStandardParameters must be defined in derived classes'",
")"
] | https://github.com/openmm/openmm/blob/cb293447c4fc8b03976dfe11399f107bab70f3d9/wrappers/python/openmm/app/internal/customgbforces.py#L484-L501 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/training/supervisor.py | python | Supervisor._init_summary_op | (self, summary_op=USE_DEFAULT) | Initializes summary_op.
Args:
summary_op: An Operation that returns a Summary for the event logs.
If set to USE_DEFAULT, create an op that merges all the summaries. | Initializes summary_op. | [
"Initializes",
"summary_op",
"."
] | def _init_summary_op(self, summary_op=USE_DEFAULT):
"""Initializes summary_op.
Args:
summary_op: An Operation that returns a Summary for the event logs.
If set to USE_DEFAULT, create an op that merges all the summaries.
"""
if summary_op is Supervisor.USE_DEFAULT:
summary_op = self.... | [
"def",
"_init_summary_op",
"(",
"self",
",",
"summary_op",
"=",
"USE_DEFAULT",
")",
":",
"if",
"summary_op",
"is",
"Supervisor",
".",
"USE_DEFAULT",
":",
"summary_op",
"=",
"self",
".",
"_get_first_op_from_collection",
"(",
"ops",
".",
"GraphKeys",
".",
"SUMMARY... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/training/supervisor.py#L452-L465 | ||
taichi-dev/taichi | 973c04d6ba40f34e9e3bd5a28ae0ee0802f136a6 | python/taichi/lang/matrix.py | python | Matrix.trace | (self) | return _sum | The sum of a matrix diagonal elements.
Returns:
The sum of a matrix diagonal elements. | The sum of a matrix diagonal elements. | [
"The",
"sum",
"of",
"a",
"matrix",
"diagonal",
"elements",
"."
] | def trace(self):
"""The sum of a matrix diagonal elements.
Returns:
The sum of a matrix diagonal elements.
"""
assert self.n == self.m
_sum = self(0, 0)
for i in range(1, self.n):
_sum = _sum + self(i, i)
return _sum | [
"def",
"trace",
"(",
"self",
")",
":",
"assert",
"self",
".",
"n",
"==",
"self",
".",
"m",
"_sum",
"=",
"self",
"(",
"0",
",",
"0",
")",
"for",
"i",
"in",
"range",
"(",
"1",
",",
"self",
".",
"n",
")",
":",
"_sum",
"=",
"_sum",
"+",
"self",... | https://github.com/taichi-dev/taichi/blob/973c04d6ba40f34e9e3bd5a28ae0ee0802f136a6/python/taichi/lang/matrix.py#L410-L421 | |
NVIDIA/TensorRT | 42805f078052daad1a98bc5965974fcffaad0960 | samples/python/tensorflow_object_detection_api/image_batcher.py | python | ImageBatcher.get_batch | (self) | Retrieve the batches. This is a generator object, so you can use it within a loop as:
for batch, images in batcher.get_batch():
...
Or outside of a batch with the next() function.
:return: A generator yielding three items per iteration: a numpy array holding a batch of images, the lis... | Retrieve the batches. This is a generator object, so you can use it within a loop as:
for batch, images in batcher.get_batch():
...
Or outside of a batch with the next() function.
:return: A generator yielding three items per iteration: a numpy array holding a batch of images, the lis... | [
"Retrieve",
"the",
"batches",
".",
"This",
"is",
"a",
"generator",
"object",
"so",
"you",
"can",
"use",
"it",
"within",
"a",
"loop",
"as",
":",
"for",
"batch",
"images",
"in",
"batcher",
".",
"get_batch",
"()",
":",
"...",
"Or",
"outside",
"of",
"a",
... | def get_batch(self):
"""
Retrieve the batches. This is a generator object, so you can use it within a loop as:
for batch, images in batcher.get_batch():
...
Or outside of a batch with the next() function.
:return: A generator yielding three items per iteration: a numpy... | [
"def",
"get_batch",
"(",
"self",
")",
":",
"for",
"i",
",",
"batch_images",
"in",
"enumerate",
"(",
"self",
".",
"batches",
")",
":",
"batch_data",
"=",
"np",
".",
"zeros",
"(",
"self",
".",
"shape",
",",
"dtype",
"=",
"self",
".",
"dtype",
")",
"b... | https://github.com/NVIDIA/TensorRT/blob/42805f078052daad1a98bc5965974fcffaad0960/samples/python/tensorflow_object_detection_api/image_batcher.py#L155-L171 | ||
protocolbuffers/protobuf | b5ab0b7a18b7336c60130f4ddb2d97c51792f896 | python/google/protobuf/descriptor_pool.py | python | DescriptorPool._SetFieldType | (self, field_proto, field_desc, package, scope) | Sets the field's type, cpp_type, message_type and enum_type.
Args:
field_proto: Data about the field in proto format.
field_desc: The descriptor to modify.
package: The package the field's container is in.
scope: Enclosing scope of available types. | Sets the field's type, cpp_type, message_type and enum_type. | [
"Sets",
"the",
"field",
"s",
"type",
"cpp_type",
"message_type",
"and",
"enum_type",
"."
] | def _SetFieldType(self, field_proto, field_desc, package, scope):
"""Sets the field's type, cpp_type, message_type and enum_type.
Args:
field_proto: Data about the field in proto format.
field_desc: The descriptor to modify.
package: The package the field's container is in.
scope: Enclo... | [
"def",
"_SetFieldType",
"(",
"self",
",",
"field_proto",
",",
"field_desc",
",",
"package",
",",
"scope",
")",
":",
"if",
"field_proto",
".",
"type_name",
":",
"desc",
"=",
"self",
".",
"_GetTypeFromScope",
"(",
"package",
",",
"field_proto",
".",
"type_name... | https://github.com/protocolbuffers/protobuf/blob/b5ab0b7a18b7336c60130f4ddb2d97c51792f896/python/google/protobuf/descriptor_pool.py#L1058-L1132 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/examples/speech_commands/input_data.py | python | AudioProcessor.prepare_data_index | (self, silence_percentage, unknown_percentage,
wanted_words, validation_percentage,
testing_percentage) | Prepares a list of the samples organized by set and label.
The training loop needs a list of all the available data, organized by
which partition it should belong to, and with ground truth labels attached.
This function analyzes the folders below the `data_dir`, figures out the
right
labels for eac... | Prepares a list of the samples organized by set and label. | [
"Prepares",
"a",
"list",
"of",
"the",
"samples",
"organized",
"by",
"set",
"and",
"label",
"."
] | def prepare_data_index(self, silence_percentage, unknown_percentage,
wanted_words, validation_percentage,
testing_percentage):
"""Prepares a list of the samples organized by set and label.
The training loop needs a list of all the available data, organized by
... | [
"def",
"prepare_data_index",
"(",
"self",
",",
"silence_percentage",
",",
"unknown_percentage",
",",
"wanted_words",
",",
"validation_percentage",
",",
"testing_percentage",
")",
":",
"# Make sure the shuffling and picking of unknowns is deterministic.",
"random",
".",
"seed",
... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/examples/speech_commands/input_data.py#L206-L289 | ||
SmingHub/Sming | cde389ed030905694983121a32f9028976b57194 | Sming/Components/Storage/Tools/hwconfig/common.py | python | parse_int | (v, keywords=None) | Generic parser for integer fields.
int(x,0) with provision for k/m/K/M suffixes and 'keyword' value lookup. | Generic parser for integer fields. | [
"Generic",
"parser",
"for",
"integer",
"fields",
"."
] | def parse_int(v, keywords=None):
"""Generic parser for integer fields.
int(x,0) with provision for k/m/K/M suffixes and 'keyword' value lookup.
"""
if not isinstance(v, str):
return v
if keywords is None or len(keywords) == 0:
try:
for letter, multiplier in [("k", 1024),... | [
"def",
"parse_int",
"(",
"v",
",",
"keywords",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"v",
",",
"str",
")",
":",
"return",
"v",
"if",
"keywords",
"is",
"None",
"or",
"len",
"(",
"keywords",
")",
"==",
"0",
":",
"try",
":",
"for",
... | https://github.com/SmingHub/Sming/blob/cde389ed030905694983121a32f9028976b57194/Sming/Components/Storage/Tools/hwconfig/common.py#L32-L50 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/grit/grit/format/policy_templates/writers/doc_writer.py | python | DocWriter._AddPolicySection | (self, parent, policy) | Adds a section about the policy in the detailed policy listing.
Args:
parent: The DOM node of the <div> of the detailed policy list.
policy: The data structure of the policy. | Adds a section about the policy in the detailed policy listing. | [
"Adds",
"a",
"section",
"about",
"the",
"policy",
"in",
"the",
"detailed",
"policy",
"listing",
"."
] | def _AddPolicySection(self, parent, policy):
'''Adds a section about the policy in the detailed policy listing.
Args:
parent: The DOM node of the <div> of the detailed policy list.
policy: The data structure of the policy.
'''
# Set style according to group nesting level.
indent = 'marg... | [
"def",
"_AddPolicySection",
"(",
"self",
",",
"parent",
",",
"policy",
")",
":",
"# Set style according to group nesting level.",
"indent",
"=",
"'margin-left: %dpx'",
"%",
"(",
"self",
".",
"_indent_level",
"*",
"28",
")",
"if",
"policy",
"[",
"'type'",
"]",
"=... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/grit/grit/format/policy_templates/writers/doc_writer.py#L589-L623 | ||
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/code.py | python | InteractiveInterpreter.runsource | (self, source, filename="<input>", symbol="single") | return False | Compile and run some source in the interpreter.
Arguments are as for compile_command().
One several things can happen:
1) The input is incorrect; compile_command() raised an
exception (SyntaxError or OverflowError). A syntax traceback
will be printed by calling the showsyntax... | Compile and run some source in the interpreter. | [
"Compile",
"and",
"run",
"some",
"source",
"in",
"the",
"interpreter",
"."
] | def runsource(self, source, filename="<input>", symbol="single"):
"""Compile and run some source in the interpreter.
Arguments are as for compile_command().
One several things can happen:
1) The input is incorrect; compile_command() raised an
exception (SyntaxError or Overflow... | [
"def",
"runsource",
"(",
"self",
",",
"source",
",",
"filename",
"=",
"\"<input>\"",
",",
"symbol",
"=",
"\"single\"",
")",
":",
"try",
":",
"code",
"=",
"self",
".",
"compile",
"(",
"source",
",",
"filename",
",",
"symbol",
")",
"except",
"(",
"Overfl... | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/code.py#L51-L88 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/sorting.py | python | get_group_index_sorter | (group_index, ngroups: int) | algos.groupsort_indexer implements `counting sort` and it is at least
O(ngroups), where
ngroups = prod(shape)
shape = map(len, keys)
that is, linear in the number of combinations (cartesian product) of unique
values of groupby keys. This can be huge when doing multi-key groupby.
np.argso... | algos.groupsort_indexer implements `counting sort` and it is at least
O(ngroups), where
ngroups = prod(shape)
shape = map(len, keys)
that is, linear in the number of combinations (cartesian product) of unique
values of groupby keys. This can be huge when doing multi-key groupby.
np.argso... | [
"algos",
".",
"groupsort_indexer",
"implements",
"counting",
"sort",
"and",
"it",
"is",
"at",
"least",
"O",
"(",
"ngroups",
")",
"where",
"ngroups",
"=",
"prod",
"(",
"shape",
")",
"shape",
"=",
"map",
"(",
"len",
"keys",
")",
"that",
"is",
"linear",
"... | def get_group_index_sorter(group_index, ngroups: int):
"""
algos.groupsort_indexer implements `counting sort` and it is at least
O(ngroups), where
ngroups = prod(shape)
shape = map(len, keys)
that is, linear in the number of combinations (cartesian product) of unique
values of groupb... | [
"def",
"get_group_index_sorter",
"(",
"group_index",
",",
"ngroups",
":",
"int",
")",
":",
"count",
"=",
"len",
"(",
"group_index",
")",
"alpha",
"=",
"0.0",
"# taking complexities literally; there may be",
"beta",
"=",
"1.0",
"# some room for fine-tuning these paramete... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/sorting.py#L348-L370 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py3/numpy/polynomial/chebyshev.py | python | chebvander2d | (x, y, deg) | return pu._vander_nd_flat((chebvander, chebvander), (x, y), deg) | Pseudo-Vandermonde matrix of given degrees.
Returns the pseudo-Vandermonde matrix of degrees `deg` and sample
points `(x, y)`. The pseudo-Vandermonde matrix is defined by
.. math:: V[..., (deg[1] + 1)*i + j] = T_i(x) * T_j(y),
where `0 <= i <= deg[0]` and `0 <= j <= deg[1]`. The leading indices of
... | Pseudo-Vandermonde matrix of given degrees. | [
"Pseudo",
"-",
"Vandermonde",
"matrix",
"of",
"given",
"degrees",
"."
] | def chebvander2d(x, y, deg):
"""Pseudo-Vandermonde matrix of given degrees.
Returns the pseudo-Vandermonde matrix of degrees `deg` and sample
points `(x, y)`. The pseudo-Vandermonde matrix is defined by
.. math:: V[..., (deg[1] + 1)*i + j] = T_i(x) * T_j(y),
where `0 <= i <= deg[0]` and `0 <= j <... | [
"def",
"chebvander2d",
"(",
"x",
",",
"y",
",",
"deg",
")",
":",
"return",
"pu",
".",
"_vander_nd_flat",
"(",
"(",
"chebvander",
",",
"chebvander",
")",
",",
"(",
"x",
",",
"y",
")",
",",
"deg",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py3/numpy/polynomial/chebyshev.py#L1440-L1490 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/generic.py | python | NDFrame.__delitem__ | (self, key) | Delete item | Delete item | [
"Delete",
"item"
] | def __delitem__(self, key) -> None:
"""
Delete item
"""
deleted = False
maybe_shortcut = False
if self.ndim == 2 and isinstance(self.columns, MultiIndex):
try:
maybe_shortcut = key not in self.columns._engine
except TypeError:
... | [
"def",
"__delitem__",
"(",
"self",
",",
"key",
")",
"->",
"None",
":",
"deleted",
"=",
"False",
"maybe_shortcut",
"=",
"False",
"if",
"self",
".",
"ndim",
"==",
"2",
"and",
"isinstance",
"(",
"self",
".",
"columns",
",",
"MultiIndex",
")",
":",
"try",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/generic.py#L3733-L3765 | ||
nodejs/nan | 8db8c8f544f2b6ce1b0859ef6ecdd0a3873a9e62 | cpplint.py | python | _SetQuiet | (quiet) | return _cpplint_state.SetQuiet(quiet) | Set the module's quiet status, and return previous setting. | Set the module's quiet status, and return previous setting. | [
"Set",
"the",
"module",
"s",
"quiet",
"status",
"and",
"return",
"previous",
"setting",
"."
] | def _SetQuiet(quiet):
"""Set the module's quiet status, and return previous setting."""
return _cpplint_state.SetQuiet(quiet) | [
"def",
"_SetQuiet",
"(",
"quiet",
")",
":",
"return",
"_cpplint_state",
".",
"SetQuiet",
"(",
"quiet",
")"
] | https://github.com/nodejs/nan/blob/8db8c8f544f2b6ce1b0859ef6ecdd0a3873a9e62/cpplint.py#L1184-L1186 | |
generalized-intelligence/GAAS | 29ab17d3e8a4ba18edef3a57c36d8db6329fac73 | deprecated/algorithms/sfm/OpenSfM/opensfm/reconstruction.py | python | remove_outliers | (graph, reconstruction, config) | Remove points with large reprojection error. | Remove points with large reprojection error. | [
"Remove",
"points",
"with",
"large",
"reprojection",
"error",
"."
] | def remove_outliers(graph, reconstruction, config):
"""Remove points with large reprojection error."""
threshold = config['bundle_outlier_threshold']
if threshold > 0:
outliers = []
for track in reconstruction.points:
error = reconstruction.points[track].reprojection_error
... | [
"def",
"remove_outliers",
"(",
"graph",
",",
"reconstruction",
",",
"config",
")",
":",
"threshold",
"=",
"config",
"[",
"'bundle_outlier_threshold'",
"]",
"if",
"threshold",
">",
"0",
":",
"outliers",
"=",
"[",
"]",
"for",
"track",
"in",
"reconstruction",
"... | https://github.com/generalized-intelligence/GAAS/blob/29ab17d3e8a4ba18edef3a57c36d8db6329fac73/deprecated/algorithms/sfm/OpenSfM/opensfm/reconstruction.py#L918-L929 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/framework/tensor_shape.py | python | Dimension.__ge__ | (self, other) | Returns True if `self` is known to be greater than or equal to `other`.
Dimensions are compared as follows:
Dimension(m) >= Dimension(n) == m >= n
Dimension(m) >= Dimension(None) == None
Dimension(None) >= Dimension(n) == None
Dimension(None) >= Dimension(None) == None
Arg... | Returns True if `self` is known to be greater than or equal to `other`. | [
"Returns",
"True",
"if",
"self",
"is",
"known",
"to",
"be",
"greater",
"than",
"or",
"equal",
"to",
"other",
"."
] | def __ge__(self, other):
"""Returns True if `self` is known to be greater than or equal to `other`.
Dimensions are compared as follows:
Dimension(m) >= Dimension(n) == m >= n
Dimension(m) >= Dimension(None) == None
Dimension(None) >= Dimension(n) == None
Dimension(None) >= ... | [
"def",
"__ge__",
"(",
"self",
",",
"other",
")",
":",
"other",
"=",
"as_dimension",
"(",
"other",
")",
"if",
"self",
".",
"_value",
"is",
"None",
"or",
"other",
".",
"value",
"is",
"None",
":",
"return",
"None",
"else",
":",
"return",
"self",
".",
... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/framework/tensor_shape.py#L341-L362 | ||
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/deps/v8/third_party/jinja2/ext.py | python | Extension.bind | (self, environment) | return rv | Create a copy of this extension bound to another environment. | Create a copy of this extension bound to another environment. | [
"Create",
"a",
"copy",
"of",
"this",
"extension",
"bound",
"to",
"another",
"environment",
"."
] | def bind(self, environment):
"""Create a copy of this extension bound to another environment."""
rv = object.__new__(self.__class__)
rv.__dict__.update(self.__dict__)
rv.environment = environment
return rv | [
"def",
"bind",
"(",
"self",
",",
"environment",
")",
":",
"rv",
"=",
"object",
".",
"__new__",
"(",
"self",
".",
"__class__",
")",
"rv",
".",
"__dict__",
".",
"update",
"(",
"self",
".",
"__dict__",
")",
"rv",
".",
"environment",
"=",
"environment",
... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/deps/v8/third_party/jinja2/ext.py#L75-L80 | |
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py | python | uCSIsEnclosedAlphanumerics | (code) | return ret | Check whether the character is part of
EnclosedAlphanumerics UCS Block | Check whether the character is part of
EnclosedAlphanumerics UCS Block | [
"Check",
"whether",
"the",
"character",
"is",
"part",
"of",
"EnclosedAlphanumerics",
"UCS",
"Block"
] | def uCSIsEnclosedAlphanumerics(code):
"""Check whether the character is part of
EnclosedAlphanumerics UCS Block """
ret = libxml2mod.xmlUCSIsEnclosedAlphanumerics(code)
return ret | [
"def",
"uCSIsEnclosedAlphanumerics",
"(",
"code",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlUCSIsEnclosedAlphanumerics",
"(",
"code",
")",
"return",
"ret"
] | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py#L2499-L2503 | |
NVIDIA/DALI | bf16cc86ba8f091b145f91962f21fe1b6aff243d | docs/examples/use_cases/tensorflow/resnet-n/resnet_model.py | python | resnet50 | (num_classes,
batch_size=None,
use_l2_regularizer=True,
rescale_inputs=False) | return models.Model(img_input, x, name='resnet50') | Instantiates the ResNet50 architecture.
Args:
num_classes: `int` number of classes for image classification.
batch_size: Size of the batches for each step.
use_l2_regularizer: whether to use L2 regularizer on Conv/Dense layer.
rescale_inputs: whether to rescale inputs from 0 to 1.
Returns:
A K... | Instantiates the ResNet50 architecture.
Args:
num_classes: `int` number of classes for image classification.
batch_size: Size of the batches for each step.
use_l2_regularizer: whether to use L2 regularizer on Conv/Dense layer.
rescale_inputs: whether to rescale inputs from 0 to 1.
Returns:
A K... | [
"Instantiates",
"the",
"ResNet50",
"architecture",
".",
"Args",
":",
"num_classes",
":",
"int",
"number",
"of",
"classes",
"for",
"image",
"classification",
".",
"batch_size",
":",
"Size",
"of",
"the",
"batches",
"for",
"each",
"step",
".",
"use_l2_regularizer",... | def resnet50(num_classes,
batch_size=None,
use_l2_regularizer=True,
rescale_inputs=False):
"""Instantiates the ResNet50 architecture.
Args:
num_classes: `int` number of classes for image classification.
batch_size: Size of the batches for each step.
use_l2_regulari... | [
"def",
"resnet50",
"(",
"num_classes",
",",
"batch_size",
"=",
"None",
",",
"use_l2_regularizer",
"=",
"True",
",",
"rescale_inputs",
"=",
"False",
")",
":",
"input_shape",
"=",
"(",
"224",
",",
"224",
",",
"3",
")",
"img_input",
"=",
"layers",
".",
"Inp... | https://github.com/NVIDIA/DALI/blob/bf16cc86ba8f091b145f91962f21fe1b6aff243d/docs/examples/use_cases/tensorflow/resnet-n/resnet_model.py#L194-L365 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/examples/speech_commands/freeze.py | python | save_graph_def | (file_name, frozen_graph_def) | Writes a graph def file out to disk.
Args:
file_name: Where to save the file.
frozen_graph_def: GraphDef proto object to save. | Writes a graph def file out to disk. | [
"Writes",
"a",
"graph",
"def",
"file",
"out",
"to",
"disk",
"."
] | def save_graph_def(file_name, frozen_graph_def):
"""Writes a graph def file out to disk.
Args:
file_name: Where to save the file.
frozen_graph_def: GraphDef proto object to save.
"""
tf.io.write_graph(
frozen_graph_def,
os.path.dirname(file_name),
os.path.basename(file_name),
as... | [
"def",
"save_graph_def",
"(",
"file_name",
",",
"frozen_graph_def",
")",
":",
"tf",
".",
"io",
".",
"write_graph",
"(",
"frozen_graph_def",
",",
"os",
".",
"path",
".",
"dirname",
"(",
"file_name",
")",
",",
"os",
".",
"path",
".",
"basename",
"(",
"file... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/examples/speech_commands/freeze.py#L157-L169 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/abc.py | python | ABCMeta.__subclasscheck__ | (cls, subclass) | return False | Override for issubclass(subclass, cls). | Override for issubclass(subclass, cls). | [
"Override",
"for",
"issubclass",
"(",
"subclass",
"cls",
")",
"."
] | def __subclasscheck__(cls, subclass):
"""Override for issubclass(subclass, cls)."""
# Check cache
if subclass in cls._abc_cache:
return True
# Check negative cache; may have to invalidate
if cls._abc_negative_cache_version < ABCMeta._abc_invalidation_counter:
... | [
"def",
"__subclasscheck__",
"(",
"cls",
",",
"subclass",
")",
":",
"# Check cache",
"if",
"subclass",
"in",
"cls",
".",
"_abc_cache",
":",
"return",
"True",
"# Check negative cache; may have to invalidate",
"if",
"cls",
".",
"_abc_negative_cache_version",
"<",
"ABCMet... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/abc.py#L148-L185 | |
ApolloAuto/apollo | 463fb82f9e979d02dcb25044e60931293ab2dba0 | modules/tools/perception/replay_perception.py | python | distance | (a, b) | return math.sqrt((b[0] - a[0])**2 + (b[1] - a[1])**2 + (b[2] - a[2])**2) | Return distance between a and b | Return distance between a and b | [
"Return",
"distance",
"between",
"a",
"and",
"b"
] | def distance(a, b):
"""
Return distance between a and b
"""
return math.sqrt((b[0] - a[0])**2 + (b[1] - a[1])**2 + (b[2] - a[2])**2) | [
"def",
"distance",
"(",
"a",
",",
"b",
")",
":",
"return",
"math",
".",
"sqrt",
"(",
"(",
"b",
"[",
"0",
"]",
"-",
"a",
"[",
"0",
"]",
")",
"**",
"2",
"+",
"(",
"b",
"[",
"1",
"]",
"-",
"a",
"[",
"1",
"]",
")",
"**",
"2",
"+",
"(",
... | https://github.com/ApolloAuto/apollo/blob/463fb82f9e979d02dcb25044e60931293ab2dba0/modules/tools/perception/replay_perception.py#L177-L181 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/ros_comm/rosbag/src/rosbag/bag.py | python | Bag._set_chunk_threshold | (self, chunk_threshold) | Set the chunk threshold to use for writing. | Set the chunk threshold to use for writing. | [
"Set",
"the",
"chunk",
"threshold",
"to",
"use",
"for",
"writing",
"."
] | def _set_chunk_threshold(self, chunk_threshold):
"""Set the chunk threshold to use for writing."""
if chunk_threshold < 0:
raise ValueError('chunk_threshold must be greater than or equal to zero')
self.flush()
self._chunk_threshold = chunk_threshold | [
"def",
"_set_chunk_threshold",
"(",
"self",
",",
"chunk_threshold",
")",
":",
"if",
"chunk_threshold",
"<",
"0",
":",
"raise",
"ValueError",
"(",
"'chunk_threshold must be greater than or equal to zero'",
")",
"self",
".",
"flush",
"(",
")",
"self",
".",
"_chunk_thr... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros_comm/rosbag/src/rosbag/bag.py#L245-L251 | ||
libornovax/master_thesis_code | 6eca474ed3cae673afde010caef338cf7349f839 | scripts/data/kitti2bb3txt.py | python | translate_file | (path_labels, path_images, outfile, label, flip, filter) | Runs the translation of the KITTI 3d bounding box label format into the BB3TXT format.
Input:
path_labels: Path to the "label_2" folder of the KITTI dataset
path_images: Path to the "image_2" folder with images from the KITTI dataset
outfile: File handle of the open output BBTXT file
label: Which cl... | Runs the translation of the KITTI 3d bounding box label format into the BB3TXT format. | [
"Runs",
"the",
"translation",
"of",
"the",
"KITTI",
"3d",
"bounding",
"box",
"label",
"format",
"into",
"the",
"BB3TXT",
"format",
"."
] | def translate_file(path_labels, path_images, outfile, label, flip, filter):
"""
Runs the translation of the KITTI 3d bounding box label format into the BB3TXT format.
Input:
path_labels: Path to the "label_2" folder of the KITTI dataset
path_images: Path to the "image_2" folder with images from the KITTI datase... | [
"def",
"translate_file",
"(",
"path_labels",
",",
"path_images",
",",
"outfile",
",",
"label",
",",
"flip",
",",
"filter",
")",
":",
"print",
"(",
"'-- TRANSLATING KITTI TO BB3TXT'",
")",
"# Get the list of all label files in the directory",
"filenames",
"=",
"[",
"f"... | https://github.com/libornovax/master_thesis_code/blob/6eca474ed3cae673afde010caef338cf7349f839/scripts/data/kitti2bb3txt.py#L247-L287 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/zipfile.py | python | is_zipfile | (filename) | return result | Quickly see if a file is a ZIP file by checking the magic number.
The filename argument may be a file or file-like object too. | Quickly see if a file is a ZIP file by checking the magic number. | [
"Quickly",
"see",
"if",
"a",
"file",
"is",
"a",
"ZIP",
"file",
"by",
"checking",
"the",
"magic",
"number",
"."
] | def is_zipfile(filename):
"""Quickly see if a file is a ZIP file by checking the magic number.
The filename argument may be a file or file-like object too.
"""
result = False
try:
if hasattr(filename, "read"):
result = _check_zipfile(fp=filename)
else:
with o... | [
"def",
"is_zipfile",
"(",
"filename",
")",
":",
"result",
"=",
"False",
"try",
":",
"if",
"hasattr",
"(",
"filename",
",",
"\"read\"",
")",
":",
"result",
"=",
"_check_zipfile",
"(",
"fp",
"=",
"filename",
")",
"else",
":",
"with",
"open",
"(",
"filena... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/zipfile.py#L197-L211 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/idlelib/parenmatch.py | python | ParenMatch.create_tag_parens | (self, indices) | Highlight the left and right parens | Highlight the left and right parens | [
"Highlight",
"the",
"left",
"and",
"right",
"parens"
] | def create_tag_parens(self, indices):
"""Highlight the left and right parens"""
if self.text.get(indices[1]) in (')', ']', '}'):
rightindex = indices[1]+"+1c"
else:
rightindex = indices[1]
self.text.tag_add("paren", indices[0], indices[0]+"+1c", rightindex+"-1c", ... | [
"def",
"create_tag_parens",
"(",
"self",
",",
"indices",
")",
":",
"if",
"self",
".",
"text",
".",
"get",
"(",
"indices",
"[",
"1",
"]",
")",
"in",
"(",
"')'",
",",
"']'",
",",
"'}'",
")",
":",
"rightindex",
"=",
"indices",
"[",
"1",
"]",
"+",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/idlelib/parenmatch.py#L125-L132 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/core/algorithms.py | python | value_counts_arraylike | (values, dropna: bool) | return res_keys, counts | Parameters
----------
values : arraylike
dropna : bool
Returns
-------
uniques : np.ndarray or ExtensionArray
counts : np.ndarray | Parameters
----------
values : arraylike
dropna : bool | [
"Parameters",
"----------",
"values",
":",
"arraylike",
"dropna",
":",
"bool"
] | def value_counts_arraylike(values, dropna: bool):
"""
Parameters
----------
values : arraylike
dropna : bool
Returns
-------
uniques : np.ndarray or ExtensionArray
counts : np.ndarray
"""
values = _ensure_arraylike(values)
original = values
values, _ = _ensure_data(v... | [
"def",
"value_counts_arraylike",
"(",
"values",
",",
"dropna",
":",
"bool",
")",
":",
"values",
"=",
"_ensure_arraylike",
"(",
"values",
")",
"original",
"=",
"values",
"values",
",",
"_",
"=",
"_ensure_data",
"(",
"values",
")",
"# TODO: handle uint8",
"keys"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/algorithms.py#L876-L903 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/urllib.py | python | splittype | (url) | return None, url | splittype('type:opaquestring') --> 'type', 'opaquestring'. | splittype('type:opaquestring') --> 'type', 'opaquestring'. | [
"splittype",
"(",
"type",
":",
"opaquestring",
")",
"--",
">",
"type",
"opaquestring",
"."
] | def splittype(url):
"""splittype('type:opaquestring') --> 'type', 'opaquestring'."""
global _typeprog
if _typeprog is None:
import re
_typeprog = re.compile('^([^/:]+):')
match = _typeprog.match(url)
if match:
scheme = match.group(1)
return scheme.lower(), url[len(sc... | [
"def",
"splittype",
"(",
"url",
")",
":",
"global",
"_typeprog",
"if",
"_typeprog",
"is",
"None",
":",
"import",
"re",
"_typeprog",
"=",
"re",
".",
"compile",
"(",
"'^([^/:]+):'",
")",
"match",
"=",
"_typeprog",
".",
"match",
"(",
"url",
")",
"if",
"ma... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/urllib.py#L1078-L1089 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/macpath.py | python | expanduser | (path) | return path | Dummy to retain interface-compatibility with other operating systems. | Dummy to retain interface-compatibility with other operating systems. | [
"Dummy",
"to",
"retain",
"interface",
"-",
"compatibility",
"with",
"other",
"operating",
"systems",
"."
] | def expanduser(path):
"""Dummy to retain interface-compatibility with other operating systems."""
return path | [
"def",
"expanduser",
"(",
"path",
")",
":",
"return",
"path"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/macpath.py#L125-L127 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/jedi/jedi/evaluate/compiled/context.py | python | CompiledObject._ensure_one_filter | (self, is_instance) | return CompiledObjectFilter(self.evaluator, self, is_instance) | search_global shouldn't change the fact that there's one dict, this way
there's only one `object`. | search_global shouldn't change the fact that there's one dict, this way
there's only one `object`. | [
"search_global",
"shouldn",
"t",
"change",
"the",
"fact",
"that",
"there",
"s",
"one",
"dict",
"this",
"way",
"there",
"s",
"only",
"one",
"object",
"."
] | def _ensure_one_filter(self, is_instance):
"""
search_global shouldn't change the fact that there's one dict, this way
there's only one `object`.
"""
return CompiledObjectFilter(self.evaluator, self, is_instance) | [
"def",
"_ensure_one_filter",
"(",
"self",
",",
"is_instance",
")",
":",
"return",
"CompiledObjectFilter",
"(",
"self",
".",
"evaluator",
",",
"self",
",",
"is_instance",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/jedi/jedi/evaluate/compiled/context.py#L144-L149 | |
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/lldb/utils/lui/lldbutil.py | python | get_function_names | (thread) | return map(GetFuncName, range(thread.GetNumFrames())) | Returns a sequence of function names from the stack frames of this thread. | Returns a sequence of function names from the stack frames of this thread. | [
"Returns",
"a",
"sequence",
"of",
"function",
"names",
"from",
"the",
"stack",
"frames",
"of",
"this",
"thread",
"."
] | def get_function_names(thread):
"""
Returns a sequence of function names from the stack frames of this thread.
"""
def GetFuncName(i):
return thread.GetFrameAtIndex(i).GetFunctionName()
return map(GetFuncName, range(thread.GetNumFrames())) | [
"def",
"get_function_names",
"(",
"thread",
")",
":",
"def",
"GetFuncName",
"(",
"i",
")",
":",
"return",
"thread",
".",
"GetFrameAtIndex",
"(",
"i",
")",
".",
"GetFunctionName",
"(",
")",
"return",
"map",
"(",
"GetFuncName",
",",
"range",
"(",
"thread",
... | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/utils/lui/lldbutil.py#L703-L710 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/calibration.py | python | _SigmoidCalibration.fit | (self, X, y, sample_weight=None) | return self | Fit the model using X, y as training data.
Parameters
----------
X : array-like, shape (n_samples,)
Training data.
y : array-like, shape (n_samples,)
Training target.
sample_weight : array-like, shape = [n_samples] or None
Sample weights. If... | Fit the model using X, y as training data. | [
"Fit",
"the",
"model",
"using",
"X",
"y",
"as",
"training",
"data",
"."
] | def fit(self, X, y, sample_weight=None):
"""Fit the model using X, y as training data.
Parameters
----------
X : array-like, shape (n_samples,)
Training data.
y : array-like, shape (n_samples,)
Training target.
sample_weight : array-like, shape ... | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
",",
"sample_weight",
"=",
"None",
")",
":",
"X",
"=",
"column_or_1d",
"(",
"X",
")",
"y",
"=",
"column_or_1d",
"(",
"y",
")",
"X",
",",
"y",
"=",
"indexable",
"(",
"X",
",",
"y",
")",
"self",
".... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/calibration.py#L467-L491 | |
GoSSIP-SJTU/TripleDoggy | 03648d6b19c812504b14e8b98c8c7b3f443f4e54 | tools/clang/bindings/python/clang/cindex.py | python | Type.get_declaration | (self) | return conf.lib.clang_getTypeDeclaration(self) | Return the cursor for the declaration of the given type. | Return the cursor for the declaration of the given type. | [
"Return",
"the",
"cursor",
"for",
"the",
"declaration",
"of",
"the",
"given",
"type",
"."
] | def get_declaration(self):
"""
Return the cursor for the declaration of the given type.
"""
return conf.lib.clang_getTypeDeclaration(self) | [
"def",
"get_declaration",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_getTypeDeclaration",
"(",
"self",
")"
] | https://github.com/GoSSIP-SJTU/TripleDoggy/blob/03648d6b19c812504b14e8b98c8c7b3f443f4e54/tools/clang/bindings/python/clang/cindex.py#L2309-L2313 | |
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/VBox/VMM/VMMAll/IEMAllInstructionsPython.py | python | __parseFileByName | (sSrcFile, sDefaultMap) | return cErrors | Parses one source file for instruction specfications. | Parses one source file for instruction specfications. | [
"Parses",
"one",
"source",
"file",
"for",
"instruction",
"specfications",
"."
] | def __parseFileByName(sSrcFile, sDefaultMap):
"""
Parses one source file for instruction specfications.
"""
#
# Read sSrcFile into a line array.
#
try:
oFile = open(sSrcFile, "r");
except Exception as oXcpt:
raise Exception("failed to open %s for reading: %s" % (sSrcFile,... | [
"def",
"__parseFileByName",
"(",
"sSrcFile",
",",
"sDefaultMap",
")",
":",
"#",
"# Read sSrcFile into a line array.",
"#",
"try",
":",
"oFile",
"=",
"open",
"(",
"sSrcFile",
",",
"\"r\"",
")",
"except",
"Exception",
"as",
"oXcpt",
":",
"raise",
"Exception",
"(... | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/VBox/VMM/VMMAll/IEMAllInstructionsPython.py#L3296-L3325 | |
google/skia | 82d65d0487bd72f5f7332d002429ec2dc61d2463 | platform_tools/android/skp_gen/android_skp_capture.py | python | DragAction.run | (self, device) | return device.drag(self.start, self.end, self.duration, self.points) | Perform the action. | Perform the action. | [
"Perform",
"the",
"action",
"."
] | def run(self, device):
"""Perform the action."""
return device.drag(self.start, self.end, self.duration, self.points) | [
"def",
"run",
"(",
"self",
",",
"device",
")",
":",
"return",
"device",
".",
"drag",
"(",
"self",
".",
"start",
",",
"self",
".",
"end",
",",
"self",
".",
"duration",
",",
"self",
".",
"points",
")"
] | https://github.com/google/skia/blob/82d65d0487bd72f5f7332d002429ec2dc61d2463/platform_tools/android/skp_gen/android_skp_capture.py#L33-L35 | |
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/examples/image_retraining/retrain.py | python | variable_summaries | (var, name) | Attach a lot of summaries to a Tensor (for TensorBoard visualization). | Attach a lot of summaries to a Tensor (for TensorBoard visualization). | [
"Attach",
"a",
"lot",
"of",
"summaries",
"to",
"a",
"Tensor",
"(",
"for",
"TensorBoard",
"visualization",
")",
"."
] | def variable_summaries(var, name):
"""Attach a lot of summaries to a Tensor (for TensorBoard visualization)."""
with tf.name_scope('summaries'):
mean = tf.reduce_mean(var)
tf.scalar_summary('mean/' + name, mean)
with tf.name_scope('stddev'):
stddev = tf.sqrt(tf.reduce_mean(tf.square(var - mean)))
... | [
"def",
"variable_summaries",
"(",
"var",
",",
"name",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"'summaries'",
")",
":",
"mean",
"=",
"tf",
".",
"reduce_mean",
"(",
"var",
")",
"tf",
".",
"scalar_summary",
"(",
"'mean/'",
"+",
"name",
",",
"mean"... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/examples/image_retraining/retrain.py#L665-L675 | ||
llvm-mirror/lldb | d01083a850f577b85501a0902b52fd0930de72c7 | examples/python/mach_o.py | python | TerminalColors.underline | (self, on=True) | return '' | Enable or disable underline depending on the "on" parameter. | Enable or disable underline depending on the "on" parameter. | [
"Enable",
"or",
"disable",
"underline",
"depending",
"on",
"the",
"on",
"parameter",
"."
] | def underline(self, on=True):
'''Enable or disable underline depending on the "on" parameter.'''
if self.enabled:
if on:
return "\x1b[4m"
else:
return "\x1b[24m"
return '' | [
"def",
"underline",
"(",
"self",
",",
"on",
"=",
"True",
")",
":",
"if",
"self",
".",
"enabled",
":",
"if",
"on",
":",
"return",
"\"\\x1b[4m\"",
"else",
":",
"return",
"\"\\x1b[24m\"",
"return",
"''"
] | https://github.com/llvm-mirror/lldb/blob/d01083a850f577b85501a0902b52fd0930de72c7/examples/python/mach_o.py#L244-L251 | |
facebook/ThreatExchange | 31914a51820c73c8a0daffe62ccca29a6e3d359e | python-threatexchange/benchmarks/benchmark_pdq_faiss_matchers.py | python | generate_random_hash_with_hamming_distance | (original_hash, desired_hamming_distance) | return binascii.hexlify(new_hash_bytes).decode() | returns a random 256 bit PDQ hash as a hexstring of 64 characters that is the given
hamming distance from the provided original hash | returns a random 256 bit PDQ hash as a hexstring of 64 characters that is the given
hamming distance from the provided original hash | [
"returns",
"a",
"random",
"256",
"bit",
"PDQ",
"hash",
"as",
"a",
"hexstring",
"of",
"64",
"characters",
"that",
"is",
"the",
"given",
"hamming",
"distance",
"from",
"the",
"provided",
"original",
"hash"
] | def generate_random_hash_with_hamming_distance(original_hash, desired_hamming_distance):
"""
returns a random 256 bit PDQ hash as a hexstring of 64 characters that is the given
hamming distance from the provided original hash
"""
original_hash_bytes = numpy.frombuffer(
binascii.unhexlify(ori... | [
"def",
"generate_random_hash_with_hamming_distance",
"(",
"original_hash",
",",
"desired_hamming_distance",
")",
":",
"original_hash_bytes",
"=",
"numpy",
".",
"frombuffer",
"(",
"binascii",
".",
"unhexlify",
"(",
"original_hash",
")",
",",
"dtype",
"=",
"numpy",
".",... | https://github.com/facebook/ThreatExchange/blob/31914a51820c73c8a0daffe62ccca29a6e3d359e/python-threatexchange/benchmarks/benchmark_pdq_faiss_matchers.py#L98-L108 | |
mit-racecar/racecar | 5fce2cc458a6eb74f6d36ef835391aedbcc731c5 | racecar/scripts/joy_teleop.py | python | JoyTeleop.register_action | (self, name, command) | Add an action client for a joystick command | Add an action client for a joystick command | [
"Add",
"an",
"action",
"client",
"for",
"a",
"joystick",
"command"
] | def register_action(self, name, command):
"""Add an action client for a joystick command"""
action_name = command['action_name']
try:
action_type = self.get_message_type(self.get_action_type(action_name))
self.al_clients[action_name] = actionlib.SimpleActionClient(action_... | [
"def",
"register_action",
"(",
"self",
",",
"name",
",",
"command",
")",
":",
"action_name",
"=",
"command",
"[",
"'action_name'",
"]",
"try",
":",
"action_type",
"=",
"self",
".",
"get_message_type",
"(",
"self",
".",
"get_action_type",
"(",
"action_name",
... | https://github.com/mit-racecar/racecar/blob/5fce2cc458a6eb74f6d36ef835391aedbcc731c5/racecar/scripts/joy_teleop.py#L92-L102 | ||
taichi-dev/taichi | 973c04d6ba40f34e9e3bd5a28ae0ee0802f136a6 | python/taichi/ui/gui.py | python | GUI.set_image | (self, img) | Sets an image to display on the window.
The image pixels are set from the values of `img[i, j]`, where `i` indicates the horizontal coordinates (from left to right) and `j` the vertical coordinates (from bottom to top).
If the window size is `(x, y)`, then `img` must be one of:
... | Sets an image to display on the window. | [
"Sets",
"an",
"image",
"to",
"display",
"on",
"the",
"window",
"."
] | def set_image(self, img):
"""Sets an image to display on the window.
The image pixels are set from the values of `img[i, j]`, where `i` indicates the horizontal coordinates (from left to right) and `j` the vertical coordinates (from bottom to top).
If the window size is `(x, y)`, then `... | [
"def",
"set_image",
"(",
"self",
",",
"img",
")",
":",
"if",
"self",
".",
"fast_gui",
":",
"assert",
"isinstance",
"(",
"img",
",",
"taichi",
".",
"lang",
".",
"matrix",
".",
"MatrixField",
")",
",",
"\"Only ti.Vector.field is supported in GUI.set_image when fas... | https://github.com/taichi-dev/taichi/blob/973c04d6ba40f34e9e3bd5a28ae0ee0802f136a6/python/taichi/ui/gui.py#L241-L312 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/memory_inspector/memory_inspector/core/native_heap.py | python | NativeHeap.GetStackFrame | (self, absolute_addr) | return stack_frame | Guarantees that multiple calls with the same addr return the same obj. | Guarantees that multiple calls with the same addr return the same obj. | [
"Guarantees",
"that",
"multiple",
"calls",
"with",
"the",
"same",
"addr",
"return",
"the",
"same",
"obj",
"."
] | def GetStackFrame(self, absolute_addr):
"""Guarantees that multiple calls with the same addr return the same obj."""
assert(isinstance(absolute_addr, (long, int)))
stack_frame = self.stack_frames.get(absolute_addr)
if not stack_frame:
stack_frame = stacktrace.Frame(absolute_addr)
self.stack_... | [
"def",
"GetStackFrame",
"(",
"self",
",",
"absolute_addr",
")",
":",
"assert",
"(",
"isinstance",
"(",
"absolute_addr",
",",
"(",
"long",
",",
"int",
")",
")",
")",
"stack_frame",
"=",
"self",
".",
"stack_frames",
".",
"get",
"(",
"absolute_addr",
")",
"... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/memory_inspector/memory_inspector/core/native_heap.py#L26-L33 | |
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/buildscripts/clang_format.py | python | ClangFormat.format | (self, file_name) | return formatted | Update the format of the specified file | Update the format of the specified file | [
"Update",
"the",
"format",
"of",
"the",
"specified",
"file"
] | def format(self, file_name):
"""Update the format of the specified file
"""
if self._lint(file_name, print_diff=False):
return True
# Update the file with clang-format
formatted = not subprocess.call([self.path, "--style=file", "-i", file_name])
# Version 3.... | [
"def",
"format",
"(",
"self",
",",
"file_name",
")",
":",
"if",
"self",
".",
"_lint",
"(",
"file_name",
",",
"print_diff",
"=",
"False",
")",
":",
"return",
"True",
"# Update the file with clang-format",
"formatted",
"=",
"not",
"subprocess",
".",
"call",
"(... | https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/buildscripts/clang_format.py#L260-L276 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pkg_resources/__init__.py | python | parse_requirements | (strs) | Yield ``Requirement`` objects for each specification in `strs`
`strs` must be a string, or a (possibly-nested) iterable thereof. | Yield ``Requirement`` objects for each specification in `strs` | [
"Yield",
"Requirement",
"objects",
"for",
"each",
"specification",
"in",
"strs"
] | def parse_requirements(strs):
"""Yield ``Requirement`` objects for each specification in `strs`
`strs` must be a string, or a (possibly-nested) iterable thereof.
"""
# create a steppable iterator, so we can handle \-continuations
lines = iter(yield_lines(strs))
for line in lines:
# Dro... | [
"def",
"parse_requirements",
"(",
"strs",
")",
":",
"# create a steppable iterator, so we can handle \\-continuations",
"lines",
"=",
"iter",
"(",
"yield_lines",
"(",
"strs",
")",
")",
"for",
"line",
"in",
"lines",
":",
"# Drop comments -- a hash without a space may be in a... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pkg_resources/__init__.py#L3082-L3101 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/mws/connection.py | python | MWSConnection.get_order_reference_details | (self, request, response, **kw) | return self._post_request(request, kw, response) | Returns details about the Order Reference object and its current
state. | Returns details about the Order Reference object and its current
state. | [
"Returns",
"details",
"about",
"the",
"Order",
"Reference",
"object",
"and",
"its",
"current",
"state",
"."
] | def get_order_reference_details(self, request, response, **kw):
"""Returns details about the Order Reference object and its current
state.
"""
return self._post_request(request, kw, response) | [
"def",
"get_order_reference_details",
"(",
"self",
",",
"request",
",",
"response",
",",
"*",
"*",
"kw",
")",
":",
"return",
"self",
".",
"_post_request",
"(",
"request",
",",
"kw",
",",
"response",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/mws/connection.py#L1076-L1080 | |
zeroc-ice/ice | 6df7df6039674d58fb5ab9a08e46f28591a210f7 | python/python/Ice/__init__.py | python | initialize | (args=None, data=None) | return CommunicatorI(communicator) | Initializes a new communicator. The optional arguments represent
an argument list (such as sys.argv) and an instance of InitializationData.
You can invoke this function as follows:
Ice.initialize()
Ice.initialize(args)
Ice.initialize(data)
Ice.initialize(args, data)
If you supply an argument list, the function remove... | Initializes a new communicator. The optional arguments represent
an argument list (such as sys.argv) and an instance of InitializationData.
You can invoke this function as follows: | [
"Initializes",
"a",
"new",
"communicator",
".",
"The",
"optional",
"arguments",
"represent",
"an",
"argument",
"list",
"(",
"such",
"as",
"sys",
".",
"argv",
")",
"and",
"an",
"instance",
"of",
"InitializationData",
".",
"You",
"can",
"invoke",
"this",
"func... | def initialize(args=None, data=None):
'''Initializes a new communicator. The optional arguments represent
an argument list (such as sys.argv) and an instance of InitializationData.
You can invoke this function as follows:
Ice.initialize()
Ice.initialize(args)
Ice.initialize(data)
Ice.initialize(args, data)
If you... | [
"def",
"initialize",
"(",
"args",
"=",
"None",
",",
"data",
"=",
"None",
")",
":",
"communicator",
"=",
"IcePy",
".",
"Communicator",
"(",
"args",
",",
"data",
")",
"return",
"CommunicatorI",
"(",
"communicator",
")"
] | https://github.com/zeroc-ice/ice/blob/6df7df6039674d58fb5ab9a08e46f28591a210f7/python/python/Ice/__init__.py#L1020-L1034 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/tools/inspector_protocol/jinja2/sandbox.py | python | SandboxedEnvironment.intercept_unop | (self, operator) | return False | Called during template compilation with the name of a unary
operator to check if it should be intercepted at runtime. If this
method returns `True`, :meth:`call_unop` is excuted for this unary
operator. The default implementation of :meth:`call_unop` will use
the :attr:`unop_table` dic... | Called during template compilation with the name of a unary
operator to check if it should be intercepted at runtime. If this
method returns `True`, :meth:`call_unop` is excuted for this unary
operator. The default implementation of :meth:`call_unop` will use
the :attr:`unop_table` dic... | [
"Called",
"during",
"template",
"compilation",
"with",
"the",
"name",
"of",
"a",
"unary",
"operator",
"to",
"check",
"if",
"it",
"should",
"be",
"intercepted",
"at",
"runtime",
".",
"If",
"this",
"method",
"returns",
"True",
":",
"meth",
":",
"call_unop",
... | def intercept_unop(self, operator):
"""Called during template compilation with the name of a unary
operator to check if it should be intercepted at runtime. If this
method returns `True`, :meth:`call_unop` is excuted for this unary
operator. The default implementation of :meth:`call_un... | [
"def",
"intercept_unop",
"(",
"self",
",",
"operator",
")",
":",
"return",
"False"
] | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/inspector_protocol/jinja2/sandbox.py#L299-L314 | |
htcondor/htcondor | 4829724575176d1d6c936e4693dfd78a728569b0 | bindings/python/htcondor/htchirp/htchirp.py | python | HTChirp.ulog | (self, text) | Log a generic string to the job log.
:param text: String to log | Log a generic string to the job log. | [
"Log",
"a",
"generic",
"string",
"to",
"the",
"job",
"log",
"."
] | def ulog(self, text):
"""Log a generic string to the job log.
:param text: String to log
"""
self._simple_command("ulog {0}\n".format(quote(text))) | [
"def",
"ulog",
"(",
"self",
",",
"text",
")",
":",
"self",
".",
"_simple_command",
"(",
"\"ulog {0}\\n\"",
".",
"format",
"(",
"quote",
"(",
"text",
")",
")",
")"
] | https://github.com/htcondor/htcondor/blob/4829724575176d1d6c936e4693dfd78a728569b0/bindings/python/htcondor/htchirp/htchirp.py#L727-L734 | ||
lammps/lammps | b75c3065430a75b1b5543a10e10f46d9b4c91913 | tools/i-pi/ipi/utils/mathtools.py | python | h2abc | (h) | return a, b, c, alpha, beta, gamma | Returns a description of the cell in terms of the length of the
lattice vectors and the angles between them in radians.
Args:
h: Cell matrix in upper triangular column vector form.
Returns:
A list containing the lattice vector lengths and the angles between them. | Returns a description of the cell in terms of the length of the
lattice vectors and the angles between them in radians. | [
"Returns",
"a",
"description",
"of",
"the",
"cell",
"in",
"terms",
"of",
"the",
"length",
"of",
"the",
"lattice",
"vectors",
"and",
"the",
"angles",
"between",
"them",
"in",
"radians",
"."
] | def h2abc(h):
"""Returns a description of the cell in terms of the length of the
lattice vectors and the angles between them in radians.
Args:
h: Cell matrix in upper triangular column vector form.
Returns:
A list containing the lattice vector lengths and the angles between them.
"""
... | [
"def",
"h2abc",
"(",
"h",
")",
":",
"a",
"=",
"float",
"(",
"h",
"[",
"0",
",",
"0",
"]",
")",
"b",
"=",
"math",
".",
"sqrt",
"(",
"h",
"[",
"0",
",",
"1",
"]",
"**",
"2",
"+",
"h",
"[",
"1",
",",
"1",
"]",
"**",
"2",
")",
"c",
"=",... | https://github.com/lammps/lammps/blob/b75c3065430a75b1b5543a10e10f46d9b4c91913/tools/i-pi/ipi/utils/mathtools.py#L153-L171 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/targets/externals.py | python | compile_multi3 | (context) | return library | Compile the multi3() helper function used by LLVM
for 128-bit multiplication on 32-bit platforms. | Compile the multi3() helper function used by LLVM
for 128-bit multiplication on 32-bit platforms. | [
"Compile",
"the",
"multi3",
"()",
"helper",
"function",
"used",
"by",
"LLVM",
"for",
"128",
"-",
"bit",
"multiplication",
"on",
"32",
"-",
"bit",
"platforms",
"."
] | def compile_multi3(context):
"""
Compile the multi3() helper function used by LLVM
for 128-bit multiplication on 32-bit platforms.
"""
codegen = context.codegen()
library = codegen.create_library("multi3")
ir_mod = library.create_ir_module("multi3")
i64 = ir.IntType(64)
i128 = ir.I... | [
"def",
"compile_multi3",
"(",
"context",
")",
":",
"codegen",
"=",
"context",
".",
"codegen",
"(",
")",
"library",
"=",
"codegen",
".",
"create_library",
"(",
"\"multi3\"",
")",
"ir_mod",
"=",
"library",
".",
"create_ir_module",
"(",
"\"multi3\"",
")",
"i64"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/targets/externals.py#L38-L108 | |
amd/OpenCL-caffe | 638543108517265366c18ae5821f3096cf5cf34a | scripts/cpp_lint.py | python | CheckLanguage | (filename, clean_lines, linenum, file_extension,
include_state, nesting_state, error) | Checks rules from the 'C++ language rules' section of cppguide.html.
Some of these rules are hard to test (function overloading, using
uint32 inappropriately), but we do the best we can.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum:... | Checks rules from the 'C++ language rules' section of cppguide.html. | [
"Checks",
"rules",
"from",
"the",
"C",
"++",
"language",
"rules",
"section",
"of",
"cppguide",
".",
"html",
"."
] | def CheckLanguage(filename, clean_lines, linenum, file_extension,
include_state, nesting_state, error):
"""Checks rules from the 'C++ language rules' section of cppguide.html.
Some of these rules are hard to test (function overloading, using
uint32 inappropriately), but we do the best we can.
... | [
"def",
"CheckLanguage",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"file_extension",
",",
"include_state",
",",
"nesting_state",
",",
"error",
")",
":",
"# If the line is empty or consists of entirely a comment, no need to",
"# check it.",
"line",
"=",
"cle... | https://github.com/amd/OpenCL-caffe/blob/638543108517265366c18ae5821f3096cf5cf34a/scripts/cpp_lint.py#L3834-L4132 | ||
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/framework/ops.py | python | RegisterStatistics.__init__ | (self, op_type, statistic_type) | Saves the `op_type` as the `Operation` type. | Saves the `op_type` as the `Operation` type. | [
"Saves",
"the",
"op_type",
"as",
"the",
"Operation",
"type",
"."
] | def __init__(self, op_type, statistic_type):
"""Saves the `op_type` as the `Operation` type."""
if not isinstance(op_type, six.string_types):
raise TypeError("op_type must be a string.")
if "," in op_type:
raise TypeError("op_type must not contain a comma.")
self._op_type = op_type
if no... | [
"def",
"__init__",
"(",
"self",
",",
"op_type",
",",
"statistic_type",
")",
":",
"if",
"not",
"isinstance",
"(",
"op_type",
",",
"six",
".",
"string_types",
")",
":",
"raise",
"TypeError",
"(",
"\"op_type must be a string.\"",
")",
"if",
"\",\"",
"in",
"op_t... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/framework/ops.py#L1892-L1903 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/D7AbsoluteCrossSections.py | python | D7AbsoluteCrossSections._median_delta_two_theta | (ws) | return np.median(dThetas) | Calculate the median theta spacing for a S(Q, w) workspace. | Calculate the median theta spacing for a S(Q, w) workspace. | [
"Calculate",
"the",
"median",
"theta",
"spacing",
"for",
"a",
"S",
"(",
"Q",
"w",
")",
"workspace",
"."
] | def _median_delta_two_theta(ws):
"""Calculate the median theta spacing for a S(Q, w) workspace."""
tmp_ws = '{}_tmp'.format(ws.name())
ConvertSpectrumAxis(InputWorkspace=ws,
OutputWorkspace=tmp_ws,
Target='SignedTheta',
... | [
"def",
"_median_delta_two_theta",
"(",
"ws",
")",
":",
"tmp_ws",
"=",
"'{}_tmp'",
".",
"format",
"(",
"ws",
".",
"name",
"(",
")",
")",
"ConvertSpectrumAxis",
"(",
"InputWorkspace",
"=",
"ws",
",",
"OutputWorkspace",
"=",
"tmp_ws",
",",
"Target",
"=",
"'Si... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/D7AbsoluteCrossSections.py#L110-L121 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/ops/sparse_grad.py | python | _SparseAddGrad | (op, *grads) | return (None, a_val_grad, None, None, b_val_grad, None, None) | The backward operator for the SparseAdd op.
The SparseAdd op calculates A + B, where A, B, and the sum are all represented
as `SparseTensor` objects. This op takes in the upstream gradient w.r.t.
non-empty values of the sum, and outputs the gradients w.r.t. the non-empty
values of A and B.
Args:
op: th... | The backward operator for the SparseAdd op. | [
"The",
"backward",
"operator",
"for",
"the",
"SparseAdd",
"op",
"."
] | def _SparseAddGrad(op, *grads):
"""The backward operator for the SparseAdd op.
The SparseAdd op calculates A + B, where A, B, and the sum are all represented
as `SparseTensor` objects. This op takes in the upstream gradient w.r.t.
non-empty values of the sum, and outputs the gradients w.r.t. the non-empty
v... | [
"def",
"_SparseAddGrad",
"(",
"op",
",",
"*",
"grads",
")",
":",
"val_grad",
"=",
"grads",
"[",
"1",
"]",
"a_indices",
"=",
"op",
".",
"inputs",
"[",
"0",
"]",
"b_indices",
"=",
"op",
".",
"inputs",
"[",
"3",
"]",
"sum_indices",
"=",
"op",
".",
"... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/ops/sparse_grad.py#L64-L96 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_core.py | python | AcceleratorTable.__init__ | (self, *args, **kwargs) | __init__(entries) -> AcceleratorTable
Construct an AcceleratorTable from a list of `wx.AcceleratorEntry`
items or or of 3-tuples (flags, keyCode, cmdID)
:see: `wx.AcceleratorEntry` | __init__(entries) -> AcceleratorTable | [
"__init__",
"(",
"entries",
")",
"-",
">",
"AcceleratorTable"
] | def __init__(self, *args, **kwargs):
"""
__init__(entries) -> AcceleratorTable
Construct an AcceleratorTable from a list of `wx.AcceleratorEntry`
items or or of 3-tuples (flags, keyCode, cmdID)
:see: `wx.AcceleratorEntry`
"""
_core_.AcceleratorTable_swiginit(se... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_core_",
".",
"AcceleratorTable_swiginit",
"(",
"self",
",",
"_core_",
".",
"new_AcceleratorTable",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_core.py#L9002-L9011 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/multiprocessing/managers.py | python | BaseManager._run_server | (cls, registry, address, authkey, serializer, writer,
initializer=None, initargs=()) | Create a server, report its address and run it | Create a server, report its address and run it | [
"Create",
"a",
"server",
"report",
"its",
"address",
"and",
"run",
"it"
] | def _run_server(cls, registry, address, authkey, serializer, writer,
initializer=None, initargs=()):
'''
Create a server, report its address and run it
'''
if initializer is not None:
initializer(*initargs)
# create server
server = cls._Se... | [
"def",
"_run_server",
"(",
"cls",
",",
"registry",
",",
"address",
",",
"authkey",
",",
"serializer",
",",
"writer",
",",
"initializer",
"=",
"None",
",",
"initargs",
"=",
"(",
")",
")",
":",
"if",
"initializer",
"is",
"not",
"None",
":",
"initializer",
... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/multiprocessing/managers.py#L541-L558 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/base64.py | python | b64encode | (s, altchars=None) | return encoded | Encode a string using Base64.
s is the string to encode. Optional altchars must be a string of at least
length 2 (additional characters are ignored) which specifies an
alternative alphabet for the '+' and '/' characters. This allows an
application to e.g. generate url or filesystem safe Base64 string... | Encode a string using Base64. | [
"Encode",
"a",
"string",
"using",
"Base64",
"."
] | def b64encode(s, altchars=None):
"""Encode a string using Base64.
s is the string to encode. Optional altchars must be a string of at least
length 2 (additional characters are ignored) which specifies an
alternative alphabet for the '+' and '/' characters. This allows an
application to e.g. gener... | [
"def",
"b64encode",
"(",
"s",
",",
"altchars",
"=",
"None",
")",
":",
"# Strip off the trailing newline",
"encoded",
"=",
"binascii",
".",
"b2a_base64",
"(",
"s",
")",
"[",
":",
"-",
"1",
"]",
"if",
"altchars",
"is",
"not",
"None",
":",
"return",
"_trans... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/base64.py#L42-L56 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/uu.py | python | encode | (in_file, out_file, name=None, mode=None) | Uuencode file | Uuencode file | [
"Uuencode",
"file"
] | def encode(in_file, out_file, name=None, mode=None):
"""Uuencode file"""
#
# If in_file is a pathname open it and change defaults
#
opened_files = []
try:
if in_file == '-':
in_file = sys.stdin
elif isinstance(in_file, basestring):
if name is None:
... | [
"def",
"encode",
"(",
"in_file",
",",
"out_file",
",",
"name",
"=",
"None",
",",
"mode",
"=",
"None",
")",
":",
"#",
"# If in_file is a pathname open it and change defaults",
"#",
"opened_files",
"=",
"[",
"]",
"try",
":",
"if",
"in_file",
"==",
"'-'",
":",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/uu.py#L42-L87 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/targets/base.py | python | BaseContext.sentry_record_alignment | (self, rectyp, attr) | Assumes offset starts from a properly aligned location | Assumes offset starts from a properly aligned location | [
"Assumes",
"offset",
"starts",
"from",
"a",
"properly",
"aligned",
"location"
] | def sentry_record_alignment(self, rectyp, attr):
"""
Assumes offset starts from a properly aligned location
"""
if self.strict_alignment:
offset = rectyp.offset(attr)
elemty = rectyp.typeof(attr)
align = self.get_abi_alignment(self.get_data_type(elemty... | [
"def",
"sentry_record_alignment",
"(",
"self",
",",
"rectyp",
",",
"attr",
")",
":",
"if",
"self",
".",
"strict_alignment",
":",
"offset",
"=",
"rectyp",
".",
"offset",
"(",
"attr",
")",
"elemty",
"=",
"rectyp",
".",
"typeof",
"(",
"attr",
")",
"align",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/targets/base.py#L942-L953 | ||
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/distutils/cmd.py | python | Command.set_undefined_options | (self, src_cmd, *option_pairs) | Set the values of any "undefined" options from corresponding
option values in some other command object. "Undefined" here means
"is None", which is the convention used to indicate that an option
has not been changed between 'initialize_options()' and
'finalize_options()'. Usually calle... | Set the values of any "undefined" options from corresponding
option values in some other command object. "Undefined" here means
"is None", which is the convention used to indicate that an option
has not been changed between 'initialize_options()' and
'finalize_options()'. Usually calle... | [
"Set",
"the",
"values",
"of",
"any",
"undefined",
"options",
"from",
"corresponding",
"option",
"values",
"in",
"some",
"other",
"command",
"object",
".",
"Undefined",
"here",
"means",
"is",
"None",
"which",
"is",
"the",
"convention",
"used",
"to",
"indicate",... | def set_undefined_options (self, src_cmd, *option_pairs):
"""Set the values of any "undefined" options from corresponding
option values in some other command object. "Undefined" here means
"is None", which is the convention used to indicate that an option
has not been changed between 'i... | [
"def",
"set_undefined_options",
"(",
"self",
",",
"src_cmd",
",",
"*",
"option_pairs",
")",
":",
"# Option_pairs: list of (src_option, dst_option) tuples",
"src_cmd_obj",
"=",
"self",
".",
"distribution",
".",
"get_command_obj",
"(",
"src_cmd",
")",
"src_cmd_obj",
".",
... | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/distutils/cmd.py#L287-L309 | ||
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/ros/roslib/src/roslib/names.py | python | make_global_ns | (name) | return name | Convert name to a global name with a trailing namespace separator.
@param name: ROS resource name. Cannot be a ~name.
@type name: str
@return str: name as a global name, e.g. 'foo' -> '/foo/'.
This does NOT resolve a name.
@rtype: str
@raise ValueError: if name is a ~name | Convert name to a global name with a trailing namespace separator. | [
"Convert",
"name",
"to",
"a",
"global",
"name",
"with",
"a",
"trailing",
"namespace",
"separator",
"."
] | def make_global_ns(name):
"""
Convert name to a global name with a trailing namespace separator.
@param name: ROS resource name. Cannot be a ~name.
@type name: str
@return str: name as a global name, e.g. 'foo' -> '/foo/'.
This does NOT resolve a name.
@rtype: str
@raise ValueE... | [
"def",
"make_global_ns",
"(",
"name",
")",
":",
"if",
"is_private",
"(",
"name",
")",
":",
"raise",
"ValueError",
"(",
"\"cannot turn [%s] into a global name\"",
"%",
"name",
")",
"if",
"not",
"is_global",
"(",
"name",
")",
":",
"name",
"=",
"SEP",
"+",
"n... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros/roslib/src/roslib/names.py#L94-L111 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/_pydecimal.py | python | Decimal._fix | (self, context) | return Decimal(self) | Round if it is necessary to keep self within prec precision.
Rounds and fixes the exponent. Does not raise on a sNaN.
Arguments:
self - Decimal instance
context - context used. | Round if it is necessary to keep self within prec precision. | [
"Round",
"if",
"it",
"is",
"necessary",
"to",
"keep",
"self",
"within",
"prec",
"precision",
"."
] | def _fix(self, context):
"""Round if it is necessary to keep self within prec precision.
Rounds and fixes the exponent. Does not raise on a sNaN.
Arguments:
self - Decimal instance
context - context used.
"""
if self._is_special:
if self._isnan():
... | [
"def",
"_fix",
"(",
"self",
",",
"context",
")",
":",
"if",
"self",
".",
"_is_special",
":",
"if",
"self",
".",
"_isnan",
"(",
")",
":",
"# decapitate payload if necessary",
"return",
"self",
".",
"_fix_nan",
"(",
"context",
")",
"else",
":",
"# self is +/... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/_pydecimal.py#L1661-L1751 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/webapp2/webapp2.py | python | WSGIApplication.handle_exception | (self, request, response, e) | Handles a uncaught exception occurred in :meth:`__call__`.
Uncaught exceptions can be handled by error handlers registered in
:attr:`error_handlers`. This is a dictionary that maps HTTP status
codes to callables that will handle the corresponding error code.
If the exception is not an `... | Handles a uncaught exception occurred in :meth:`__call__`. | [
"Handles",
"a",
"uncaught",
"exception",
"occurred",
"in",
":",
"meth",
":",
"__call__",
"."
] | def handle_exception(self, request, response, e):
"""Handles a uncaught exception occurred in :meth:`__call__`.
Uncaught exceptions can be handled by error handlers registered in
:attr:`error_handlers`. This is a dictionary that maps HTTP status
codes to callables that will handle the c... | [
"def",
"handle_exception",
"(",
"self",
",",
"request",
",",
"response",
",",
"e",
")",
":",
"if",
"isinstance",
"(",
"e",
",",
"HTTPException",
")",
":",
"code",
"=",
"e",
".",
"code",
"else",
":",
"code",
"=",
"500",
"handler",
"=",
"self",
".",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/webapp2/webapp2.py#L1561-L1599 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | Window.ScreenToClient | (*args, **kwargs) | return _core_.Window_ScreenToClient(*args, **kwargs) | ScreenToClient(self, Point pt) -> Point
Converts from screen to client window coordinates. | ScreenToClient(self, Point pt) -> Point | [
"ScreenToClient",
"(",
"self",
"Point",
"pt",
")",
"-",
">",
"Point"
] | def ScreenToClient(*args, **kwargs):
"""
ScreenToClient(self, Point pt) -> Point
Converts from screen to client window coordinates.
"""
return _core_.Window_ScreenToClient(*args, **kwargs) | [
"def",
"ScreenToClient",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Window_ScreenToClient",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L11072-L11078 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.