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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Yijunmaverick/GenerativeFaceCompletion | f72dea0fa27c779fef7b65d2f01e82bcc23a0eb2 | scripts/cpp_lint.py | python | CheckForMultilineCommentsAndStrings | (filename, clean_lines, linenum, error) | Logs an error if we see /* ... */ or "..." that extend past one line.
/* ... */ comments are legit inside macros, for one line.
Otherwise, we prefer // comments, so it's ok to warn about the
other. Likewise, it's ok for strings to extend across multiple
lines, as long as a line continuation character (backsla... | Logs an error if we see /* ... */ or "..." that extend past one line. | [
"Logs",
"an",
"error",
"if",
"we",
"see",
"/",
"*",
"...",
"*",
"/",
"or",
"...",
"that",
"extend",
"past",
"one",
"line",
"."
] | def CheckForMultilineCommentsAndStrings(filename, clean_lines, linenum, error):
"""Logs an error if we see /* ... */ or "..." that extend past one line.
/* ... */ comments are legit inside macros, for one line.
Otherwise, we prefer // comments, so it's ok to warn about the
other. Likewise, it's ok for strings... | [
"def",
"CheckForMultilineCommentsAndStrings",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"# Remove all \\\\ (escaped backslashes) from the line. They are OK, and the",
"# secon... | https://github.com/Yijunmaverick/GenerativeFaceCompletion/blob/f72dea0fa27c779fef7b65d2f01e82bcc23a0eb2/scripts/cpp_lint.py#L1526-L1561 | ||
Caffe-MPI/Caffe-MPI.github.io | df5992af571a2a19981b69635115c393f18d1c76 | python/caffe/pycaffe.py | python | _Net_forward | (self, blobs=None, start=None, end=None, **kwargs) | return {out: self.blobs[out].data for out in outputs} | Forward pass: prepare inputs and run the net forward.
Parameters
----------
blobs : list of blobs to return in addition to output blobs.
kwargs : Keys are input blob names and values are blob ndarrays.
For formatting inputs for Caffe, see Net.preprocess().
If None, input is ta... | Forward pass: prepare inputs and run the net forward. | [
"Forward",
"pass",
":",
"prepare",
"inputs",
"and",
"run",
"the",
"net",
"forward",
"."
] | def _Net_forward(self, blobs=None, start=None, end=None, **kwargs):
"""
Forward pass: prepare inputs and run the net forward.
Parameters
----------
blobs : list of blobs to return in addition to output blobs.
kwargs : Keys are input blob names and values are blob ndarrays.
For form... | [
"def",
"_Net_forward",
"(",
"self",
",",
"blobs",
"=",
"None",
",",
"start",
"=",
"None",
",",
"end",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"blobs",
"is",
"None",
":",
"blobs",
"=",
"[",
"]",
"if",
"start",
"is",
"not",
"None",
... | https://github.com/Caffe-MPI/Caffe-MPI.github.io/blob/df5992af571a2a19981b69635115c393f18d1c76/python/caffe/pycaffe.py#L78-L124 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py2/IPython/core/prefilter.py | python | PrefilterManager.init_handlers | (self) | Create the default handlers. | Create the default handlers. | [
"Create",
"the",
"default",
"handlers",
"."
] | def init_handlers(self):
"""Create the default handlers."""
self._handlers = {}
self._esc_handlers = {}
for handler in _default_handlers:
handler(
shell=self.shell, prefilter_manager=self, parent=self
) | [
"def",
"init_handlers",
"(",
"self",
")",
":",
"self",
".",
"_handlers",
"=",
"{",
"}",
"self",
".",
"_esc_handlers",
"=",
"{",
"}",
"for",
"handler",
"in",
"_default_handlers",
":",
"handler",
"(",
"shell",
"=",
"self",
".",
"shell",
",",
"prefilter_man... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py2/IPython/core/prefilter.py#L203-L210 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/stc.py | python | StyledTextCtrl.GetColumn | (*args, **kwargs) | return _stc.StyledTextCtrl_GetColumn(*args, **kwargs) | GetColumn(self, int pos) -> int
Retrieve the column number of a position, taking tab width into account. | GetColumn(self, int pos) -> int | [
"GetColumn",
"(",
"self",
"int",
"pos",
")",
"-",
">",
"int"
] | def GetColumn(*args, **kwargs):
"""
GetColumn(self, int pos) -> int
Retrieve the column number of a position, taking tab width into account.
"""
return _stc.StyledTextCtrl_GetColumn(*args, **kwargs) | [
"def",
"GetColumn",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_GetColumn",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/stc.py#L3327-L3333 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/idlelib/pyshell.py | python | PyShellEditorWindow.update_breakpoints | (self) | Retrieves all the breakpoints in the current window | Retrieves all the breakpoints in the current window | [
"Retrieves",
"all",
"the",
"breakpoints",
"in",
"the",
"current",
"window"
] | def update_breakpoints(self):
"Retrieves all the breakpoints in the current window"
text = self.text
ranges = text.tag_ranges("BREAK")
linenumber_list = self.ranges_to_linenumbers(ranges)
self.breakpoints = linenumber_list | [
"def",
"update_breakpoints",
"(",
"self",
")",
":",
"text",
"=",
"self",
".",
"text",
"ranges",
"=",
"text",
".",
"tag_ranges",
"(",
"\"BREAK\"",
")",
"linenumber_list",
"=",
"self",
".",
"ranges_to_linenumbers",
"(",
"ranges",
")",
"self",
".",
"breakpoints... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/idlelib/pyshell.py#L286-L291 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/botocore/vendored/requests/utils.py | python | prepend_scheme_if_needed | (url, new_scheme) | return urlunparse((scheme, netloc, path, params, query, fragment)) | Given a URL that may or may not have a scheme, prepend the given scheme.
Does not replace a present scheme with the one provided as an argument. | Given a URL that may or may not have a scheme, prepend the given scheme.
Does not replace a present scheme with the one provided as an argument. | [
"Given",
"a",
"URL",
"that",
"may",
"or",
"may",
"not",
"have",
"a",
"scheme",
"prepend",
"the",
"given",
"scheme",
".",
"Does",
"not",
"replace",
"a",
"present",
"scheme",
"with",
"the",
"one",
"provided",
"as",
"an",
"argument",
"."
] | def prepend_scheme_if_needed(url, new_scheme):
'''Given a URL that may or may not have a scheme, prepend the given scheme.
Does not replace a present scheme with the one provided as an argument.'''
scheme, netloc, path, params, query, fragment = urlparse(url, new_scheme)
# urlparse is a finicky beast, ... | [
"def",
"prepend_scheme_if_needed",
"(",
"url",
",",
"new_scheme",
")",
":",
"scheme",
",",
"netloc",
",",
"path",
",",
"params",
",",
"query",
",",
"fragment",
"=",
"urlparse",
"(",
"url",
",",
"new_scheme",
")",
"# urlparse is a finicky beast, and sometimes decid... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/botocore/vendored/requests/utils.py#L649-L660 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py | python | ResourceManager.resource_string | (self, package_or_requirement, resource_name) | return get_provider(package_or_requirement).get_resource_string(
self, resource_name
) | Return specified resource as a string | Return specified resource as a string | [
"Return",
"specified",
"resource",
"as",
"a",
"string"
] | def resource_string(self, package_or_requirement, resource_name):
"""Return specified resource as a string"""
return get_provider(package_or_requirement).get_resource_string(
self, resource_name
) | [
"def",
"resource_string",
"(",
"self",
",",
"package_or_requirement",
",",
"resource_name",
")",
":",
"return",
"get_provider",
"(",
"package_or_requirement",
")",
".",
"get_resource_string",
"(",
"self",
",",
"resource_name",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L1154-L1158 | |
ros-planning/moveit | ee48dc5cedc981d0869352aa3db0b41469c2735c | moveit_ros/benchmarks/scripts/moveit_benchmark_statistics.py | python | readBenchmarkLog | (dbname, filenames) | Parse benchmark log files and store the parsed data in a sqlite3 database. | Parse benchmark log files and store the parsed data in a sqlite3 database. | [
"Parse",
"benchmark",
"log",
"files",
"and",
"store",
"the",
"parsed",
"data",
"in",
"a",
"sqlite3",
"database",
"."
] | def readBenchmarkLog(dbname, filenames):
"""Parse benchmark log files and store the parsed data in a sqlite3 database."""
conn = sqlite3.connect(dbname)
c = conn.cursor()
c.execute("PRAGMA FOREIGN_KEYS = ON")
# create all tables if they don't already exist
c.executescript(
"""CREATE TA... | [
"def",
"readBenchmarkLog",
"(",
"dbname",
",",
"filenames",
")",
":",
"conn",
"=",
"sqlite3",
".",
"connect",
"(",
"dbname",
")",
"c",
"=",
"conn",
".",
"cursor",
"(",
")",
"c",
".",
"execute",
"(",
"\"PRAGMA FOREIGN_KEYS = ON\"",
")",
"# create all tables i... | https://github.com/ros-planning/moveit/blob/ee48dc5cedc981d0869352aa3db0b41469c2735c/moveit_ros/benchmarks/scripts/moveit_benchmark_statistics.py#L112-L389 | ||
abforce/xposed_art_n | ec3fbe417d74d4664cec053d91dd4e3881176374 | tools/checker/match/file.py | python | matchDagGroup | (assertions, c1Pass, scope, variables) | return MatchInfo(MatchScope(min(matchedLines), max(matchedLines)), variables) | Attempts to find matching `c1Pass` lines for a group of DAG assertions.
Assertions are matched in the list order and variable values propagated. Only
lines in `scope` are scanned and each line can only match one assertion.
Returns the range of `c1Pass` lines covered by this group (min/max of matching
line num... | Attempts to find matching `c1Pass` lines for a group of DAG assertions. | [
"Attempts",
"to",
"find",
"matching",
"c1Pass",
"lines",
"for",
"a",
"group",
"of",
"DAG",
"assertions",
"."
] | def matchDagGroup(assertions, c1Pass, scope, variables):
""" Attempts to find matching `c1Pass` lines for a group of DAG assertions.
Assertions are matched in the list order and variable values propagated. Only
lines in `scope` are scanned and each line can only match one assertion.
Returns the range of `c1Pa... | [
"def",
"matchDagGroup",
"(",
"assertions",
",",
"c1Pass",
",",
"scope",
",",
"variables",
")",
":",
"matchedLines",
"=",
"[",
"]",
"for",
"assertion",
"in",
"assertions",
":",
"assert",
"assertion",
".",
"variant",
"==",
"TestAssertion",
".",
"Variant",
".",... | https://github.com/abforce/xposed_art_n/blob/ec3fbe417d74d4664cec053d91dd4e3881176374/tools/checker/match/file.py#L64-L83 | |
lhmRyan/deep-supervised-hashing-DSH | 631901f82e2ab031fbac33f914a5b08ef8e21d57 | scripts/cpp_lint.py | python | _FunctionState.End | (self) | Stop analyzing function body. | Stop analyzing function body. | [
"Stop",
"analyzing",
"function",
"body",
"."
] | def End(self):
"""Stop analyzing function body."""
self.in_a_function = False | [
"def",
"End",
"(",
"self",
")",
":",
"self",
".",
"in_a_function",
"=",
"False"
] | https://github.com/lhmRyan/deep-supervised-hashing-DSH/blob/631901f82e2ab031fbac33f914a5b08ef8e21d57/scripts/cpp_lint.py#L861-L863 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/sparse/sputils.py | python | upcast | (*args) | Returns the nearest supported sparse dtype for the
combination of one or more types.
upcast(t0, t1, ..., tn) -> T where T is a supported dtype
Examples
--------
>>> upcast('int32')
<type 'numpy.int32'>
>>> upcast('bool')
<type 'numpy.bool_'>
>>> upcast('int32','float32')
<typ... | Returns the nearest supported sparse dtype for the
combination of one or more types. | [
"Returns",
"the",
"nearest",
"supported",
"sparse",
"dtype",
"for",
"the",
"combination",
"of",
"one",
"or",
"more",
"types",
"."
] | def upcast(*args):
"""Returns the nearest supported sparse dtype for the
combination of one or more types.
upcast(t0, t1, ..., tn) -> T where T is a supported dtype
Examples
--------
>>> upcast('int32')
<type 'numpy.int32'>
>>> upcast('bool')
<type 'numpy.bool_'>
>>> upcast('... | [
"def",
"upcast",
"(",
"*",
"args",
")",
":",
"t",
"=",
"_upcast_memo",
".",
"get",
"(",
"hash",
"(",
"args",
")",
")",
"if",
"t",
"is",
"not",
"None",
":",
"return",
"t",
"upcast",
"=",
"np",
".",
"find_common_type",
"(",
"args",
",",
"[",
"]",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/sparse/sputils.py#L28-L59 | ||
qt/qt | 0a2f2382541424726168804be2c90b91381608c6 | src/3rdparty/freetype/src/tools/glnames.py | python | adobe_glyph_values | () | return glyphs, values | return the list of glyph names and their unicode values | return the list of glyph names and their unicode values | [
"return",
"the",
"list",
"of",
"glyph",
"names",
"and",
"their",
"unicode",
"values"
] | def adobe_glyph_values():
"""return the list of glyph names and their unicode values"""
lines = string.split( adobe_glyph_list, '\n' )
glyphs = []
values = []
for line in lines:
if line:
fields = string.split( line, ';' )
# print fields[1] + ' - ' + fields[0]
subfields = string.split( f... | [
"def",
"adobe_glyph_values",
"(",
")",
":",
"lines",
"=",
"string",
".",
"split",
"(",
"adobe_glyph_list",
",",
"'\\n'",
")",
"glyphs",
"=",
"[",
"]",
"values",
"=",
"[",
"]",
"for",
"line",
"in",
"lines",
":",
"if",
"line",
":",
"fields",
"=",
"stri... | https://github.com/qt/qt/blob/0a2f2382541424726168804be2c90b91381608c6/src/3rdparty/freetype/src/tools/glnames.py#L4952-L4968 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/idlelib/rpc.py | python | RPCServer.server_activate | (self) | Override TCPServer method, connect() instead of listen()
Due to the reversed connection, self.server_address is actually the
address of the Idle Client to which we are connecting. | Override TCPServer method, connect() instead of listen() | [
"Override",
"TCPServer",
"method",
"connect",
"()",
"instead",
"of",
"listen",
"()"
] | def server_activate(self):
"""Override TCPServer method, connect() instead of listen()
Due to the reversed connection, self.server_address is actually the
address of the Idle Client to which we are connecting.
"""
self.socket.connect(self.server_address) | [
"def",
"server_activate",
"(",
"self",
")",
":",
"self",
".",
"socket",
".",
"connect",
"(",
"self",
".",
"server_address",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/idlelib/rpc.py#L85-L92 | ||
NVIDIAGameWorks/kaolin | e5148d05e9c1e2ce92a07881ce3593b1c5c3f166 | kaolin/io/dataset.py | python | ProcessedDataset.get_data | (self, index) | return data | Returns the data at the given index. | Returns the data at the given index. | [
"Returns",
"the",
"data",
"at",
"the",
"given",
"index",
"."
] | def get_data(self, index):
"""Returns the data at the given index. """
data = (self._get_base_data(index) if self.cache_convert is None else
self.cache_convert.try_get(self.get_cache_key(index)))
if self.transform is not None:
data = self.transform(data)
ret... | [
"def",
"get_data",
"(",
"self",
",",
"index",
")",
":",
"data",
"=",
"(",
"self",
".",
"_get_base_data",
"(",
"index",
")",
"if",
"self",
".",
"cache_convert",
"is",
"None",
"else",
"self",
".",
"cache_convert",
".",
"try_get",
"(",
"self",
".",
"get_c... | https://github.com/NVIDIAGameWorks/kaolin/blob/e5148d05e9c1e2ce92a07881ce3593b1c5c3f166/kaolin/io/dataset.py#L253-L261 | |
openthread/openthread | 9fcdbed9c526c70f1556d1ed84099c1535c7cd32 | tools/otci/otci/otci.py | python | OTCI.__init__ | (self, otcmd: OTCommandHandler) | This method initializes an OTCI instance.
:param otcmd: An OpenThread Command Handler instance to execute OpenThread CLI commands. | This method initializes an OTCI instance. | [
"This",
"method",
"initializes",
"an",
"OTCI",
"instance",
"."
] | def __init__(self, otcmd: OTCommandHandler):
"""
This method initializes an OTCI instance.
:param otcmd: An OpenThread Command Handler instance to execute OpenThread CLI commands.
"""
self.__otcmd: OTCommandHandler = otcmd
self.__logger = logging.getLogger(name=str(self)... | [
"def",
"__init__",
"(",
"self",
",",
"otcmd",
":",
"OTCommandHandler",
")",
":",
"self",
".",
"__otcmd",
":",
"OTCommandHandler",
"=",
"otcmd",
"self",
".",
"__logger",
"=",
"logging",
".",
"getLogger",
"(",
"name",
"=",
"str",
"(",
"self",
")",
")"
] | https://github.com/openthread/openthread/blob/9fcdbed9c526c70f1556d1ed84099c1535c7cd32/tools/otci/otci/otci.py#L54-L61 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/nn/probability/bijector/scalar_affine.py | python | ScalarAffine.extend_repr | (self) | return str_info | Display instance object as string. | Display instance object as string. | [
"Display",
"instance",
"object",
"as",
"string",
"."
] | def extend_repr(self):
"""Display instance object as string."""
if self.is_scalar_batch:
str_info = 'scale = {}, shift = {}'.format(self.scale, self.shift)
else:
str_info = 'batch_shape = {}'.format(self.batch_shape)
return str_info | [
"def",
"extend_repr",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_scalar_batch",
":",
"str_info",
"=",
"'scale = {}, shift = {}'",
".",
"format",
"(",
"self",
".",
"scale",
",",
"self",
".",
"shift",
")",
"else",
":",
"str_info",
"=",
"'batch_shape = {}'",... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/nn/probability/bijector/scalar_affine.py#L128-L134 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_windows.py | python | Dialog.GetLayoutAdaptationMode | (*args, **kwargs) | return _windows_.Dialog_GetLayoutAdaptationMode(*args, **kwargs) | GetLayoutAdaptationMode(self) -> int | GetLayoutAdaptationMode(self) -> int | [
"GetLayoutAdaptationMode",
"(",
"self",
")",
"-",
">",
"int"
] | def GetLayoutAdaptationMode(*args, **kwargs):
"""GetLayoutAdaptationMode(self) -> int"""
return _windows_.Dialog_GetLayoutAdaptationMode(*args, **kwargs) | [
"def",
"GetLayoutAdaptationMode",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"Dialog_GetLayoutAdaptationMode",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_windows.py#L855-L857 | |
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | tools/generate_stubs/generate_stubs.py | python | WriteWindowsDefFile | (module_name, signatures, outfile) | Writes a windows def file to the given output file object.
The def file format is basically a list of function names. Generation is
simple. After outputting the LIBRARY and EXPORTS lines, print out each
function name, one to a line, preceeded by 2 spaces.
Args:
module_name: The name of the module ... | Writes a windows def file to the given output file object. | [
"Writes",
"a",
"windows",
"def",
"file",
"to",
"the",
"given",
"output",
"file",
"object",
"."
] | def WriteWindowsDefFile(module_name, signatures, outfile):
"""Writes a windows def file to the given output file object.
The def file format is basically a list of function names. Generation is
simple. After outputting the LIBRARY and EXPORTS lines, print out each
function name, one to a line, preceede... | [
"def",
"WriteWindowsDefFile",
"(",
"module_name",
",",
"signatures",
",",
"outfile",
")",
":",
"outfile",
".",
"write",
"(",
"'LIBRARY %s\\n'",
"%",
"module_name",
")",
"outfile",
".",
"write",
"(",
"'EXPORTS\\n'",
")",
"for",
"sig",
"in",
"signatures",
":",
... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/tools/generate_stubs/generate_stubs.py#L422-L439 | ||
asLody/whale | 6a661b27cc4cf83b7b5a3b02451597ee1ac7f264 | whale/cpplint.py | python | CheckTrailingSemicolon | (filename, clean_lines, linenum, error) | Looks for redundant trailing semicolon.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found. | Looks for redundant trailing semicolon. | [
"Looks",
"for",
"redundant",
"trailing",
"semicolon",
"."
] | def CheckTrailingSemicolon(filename, clean_lines, linenum, error):
"""Looks for redundant trailing semicolon.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any error... | [
"def",
"CheckTrailingSemicolon",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"# Block bodies should not be followed by a semicolon. Due to C++11",
"# brace initialization, ther... | https://github.com/asLody/whale/blob/6a661b27cc4cf83b7b5a3b02451597ee1ac7f264/whale/cpplint.py#L3855-L3999 | ||
cathywu/Sentiment-Analysis | eb501fd1375c0c3f3ab430f963255f1bb858e659 | PyML-0.7.9/PyML/classifiers/random_forests.py | python | RF.cleanup | (self) | return | remove the directory that was created using training/testing | remove the directory that was created using training/testing | [
"remove",
"the",
"directory",
"that",
"was",
"created",
"using",
"training",
"/",
"testing"
] | def cleanup(self) :
"""remove the directory that was created using training/testing"""
return
directory = self.trainingDirectory
if directory is None : return
if os.path.exists(directory) :
os.system('rm -rf ' + directory) | [
"def",
"cleanup",
"(",
"self",
")",
":",
"return",
"directory",
"=",
"self",
".",
"trainingDirectory",
"if",
"directory",
"is",
"None",
":",
"return",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"directory",
")",
":",
"os",
".",
"system",
"(",
"'rm -r... | https://github.com/cathywu/Sentiment-Analysis/blob/eb501fd1375c0c3f3ab430f963255f1bb858e659/PyML-0.7.9/PyML/classifiers/random_forests.py#L179-L185 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/email/_header_value_parser.py | python | get_mailbox_list | (value) | return mailbox_list, value | mailbox-list = (mailbox *("," mailbox)) / obs-mbox-list
obs-mbox-list = *([CFWS] ",") mailbox *("," [mailbox / CFWS])
For this routine we go outside the formal grammar in order to improve error
handling. We recognize the end of the mailbox list only at the end of the
value or at a ';' (the group t... | mailbox-list = (mailbox *("," mailbox)) / obs-mbox-list
obs-mbox-list = *([CFWS] ",") mailbox *("," [mailbox / CFWS]) | [
"mailbox",
"-",
"list",
"=",
"(",
"mailbox",
"*",
"(",
"mailbox",
"))",
"/",
"obs",
"-",
"mbox",
"-",
"list",
"obs",
"-",
"mbox",
"-",
"list",
"=",
"*",
"(",
"[",
"CFWS",
"]",
")",
"mailbox",
"*",
"(",
"[",
"mailbox",
"/",
"CFWS",
"]",
")"
] | def get_mailbox_list(value):
""" mailbox-list = (mailbox *("," mailbox)) / obs-mbox-list
obs-mbox-list = *([CFWS] ",") mailbox *("," [mailbox / CFWS])
For this routine we go outside the formal grammar in order to improve error
handling. We recognize the end of the mailbox list only at the end of t... | [
"def",
"get_mailbox_list",
"(",
"value",
")",
":",
"mailbox_list",
"=",
"MailboxList",
"(",
")",
"while",
"value",
"and",
"value",
"[",
"0",
"]",
"!=",
"';'",
":",
"try",
":",
"token",
",",
"value",
"=",
"get_mailbox",
"(",
"value",
")",
"mailbox_list",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/email/_header_value_parser.py#L1822-L1876 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/interpolate/ndgriddata.py | python | griddata | (points, values, xi, method='linear', fill_value=np.nan,
rescale=False) | Interpolate unstructured D-dimensional data.
Parameters
----------
points : ndarray of floats, shape (n, D)
Data point coordinates. Can either be an array of
shape (n, D), or a tuple of `ndim` arrays.
values : ndarray of float or complex, shape (n,)
Data values.
xi : 2-D nda... | Interpolate unstructured D-dimensional data. | [
"Interpolate",
"unstructured",
"D",
"-",
"dimensional",
"data",
"."
] | def griddata(points, values, xi, method='linear', fill_value=np.nan,
rescale=False):
"""
Interpolate unstructured D-dimensional data.
Parameters
----------
points : ndarray of floats, shape (n, D)
Data point coordinates. Can either be an array of
shape (n, D), or a tupl... | [
"def",
"griddata",
"(",
"points",
",",
"values",
",",
"xi",
",",
"method",
"=",
"'linear'",
",",
"fill_value",
"=",
"np",
".",
"nan",
",",
"rescale",
"=",
"False",
")",
":",
"points",
"=",
"_ndim_coords_from_arrays",
"(",
"points",
")",
"if",
"points",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/interpolate/ndgriddata.py#L88-L230 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqt/mantidqt/widgets/samplelogs/view.py | python | SampleLogsView.get_selected_row_indexes | (self) | return [row.row() for row in self.table.selectionModel().selectedRows()] | Return a list of selected row from table | Return a list of selected row from table | [
"Return",
"a",
"list",
"of",
"selected",
"row",
"from",
"table"
] | def get_selected_row_indexes(self):
"""Return a list of selected row from table"""
return [row.row() for row in self.table.selectionModel().selectedRows()] | [
"def",
"get_selected_row_indexes",
"(",
"self",
")",
":",
"return",
"[",
"row",
".",
"row",
"(",
")",
"for",
"row",
"in",
"self",
".",
"table",
".",
"selectionModel",
"(",
")",
".",
"selectedRows",
"(",
")",
"]"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqt/mantidqt/widgets/samplelogs/view.py#L212-L214 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/gradient_checker_v2.py | python | _to_numpy | (a) | return a | Converts Tensors, EagerTensors, and IndexedSlicesValue to numpy arrays.
Args:
a: any value.
Returns:
If a is EagerTensor or Tensor, returns the evaluation of a by calling
numpy() or run(). If a is IndexedSlicesValue, constructs the corresponding
dense numpy array. Otherwise returns a unchanged. | Converts Tensors, EagerTensors, and IndexedSlicesValue to numpy arrays. | [
"Converts",
"Tensors",
"EagerTensors",
"and",
"IndexedSlicesValue",
"to",
"numpy",
"arrays",
"."
] | def _to_numpy(a):
"""Converts Tensors, EagerTensors, and IndexedSlicesValue to numpy arrays.
Args:
a: any value.
Returns:
If a is EagerTensor or Tensor, returns the evaluation of a by calling
numpy() or run(). If a is IndexedSlicesValue, constructs the corresponding
dense numpy array. Otherwise ... | [
"def",
"_to_numpy",
"(",
"a",
")",
":",
"if",
"isinstance",
"(",
"a",
",",
"ops",
".",
"EagerTensor",
")",
":",
"return",
"a",
".",
"numpy",
"(",
")",
"if",
"isinstance",
"(",
"a",
",",
"ops",
".",
"Tensor",
")",
":",
"sess",
"=",
"ops",
".",
"... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/gradient_checker_v2.py#L64-L90 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/python_message.py | python | _GetFieldByName | (message_descriptor, field_name) | Returns a field descriptor by field name.
Args:
message_descriptor: A Descriptor describing all fields in message.
field_name: The name of the field to retrieve.
Returns:
The field descriptor associated with the field name. | Returns a field descriptor by field name. | [
"Returns",
"a",
"field",
"descriptor",
"by",
"field",
"name",
"."
] | def _GetFieldByName(message_descriptor, field_name):
"""Returns a field descriptor by field name.
Args:
message_descriptor: A Descriptor describing all fields in message.
field_name: The name of the field to retrieve.
Returns:
The field descriptor associated with the field name.
"""
try:
retu... | [
"def",
"_GetFieldByName",
"(",
"message_descriptor",
",",
"field_name",
")",
":",
"try",
":",
"return",
"message_descriptor",
".",
"fields_by_name",
"[",
"field_name",
"]",
"except",
"KeyError",
":",
"raise",
"ValueError",
"(",
"'Protocol message %s has no \"%s\" field.... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/python_message.py#L534-L547 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/series.py | python | Series.diff | (self, periods=1) | return self._constructor(result, index=self.index).__finalize__(self) | First discrete difference of element.
Calculates the difference of a Series element compared with another
element in the Series (default is element in previous row).
Parameters
----------
periods : int, default 1
Periods to shift for calculating difference, accepts ... | First discrete difference of element. | [
"First",
"discrete",
"difference",
"of",
"element",
"."
] | def diff(self, periods=1):
"""
First discrete difference of element.
Calculates the difference of a Series element compared with another
element in the Series (default is element in previous row).
Parameters
----------
periods : int, default 1
Period... | [
"def",
"diff",
"(",
"self",
",",
"periods",
"=",
"1",
")",
":",
"result",
"=",
"algorithms",
".",
"diff",
"(",
"self",
".",
"array",
",",
"periods",
")",
"return",
"self",
".",
"_constructor",
"(",
"result",
",",
"index",
"=",
"self",
".",
"index",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/series.py#L2292-L2359 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/ops/nn_grad.py | python | _BatchNormWithGlobalNormalizationGrad | (op, grad) | return dx, dm, dv, db, dg | Return the gradients for the 5 inputs of BatchNormWithGlobalNormalization.
We do not backprop anything for the mean and var intentionally as they are
not being trained with backprop in the operation.
Args:
op: The BatchNormOp for which we need to generate gradients.
grad: Tensor. The gradients passed t... | Return the gradients for the 5 inputs of BatchNormWithGlobalNormalization. | [
"Return",
"the",
"gradients",
"for",
"the",
"5",
"inputs",
"of",
"BatchNormWithGlobalNormalization",
"."
] | def _BatchNormWithGlobalNormalizationGrad(op, grad):
"""Return the gradients for the 5 inputs of BatchNormWithGlobalNormalization.
We do not backprop anything for the mean and var intentionally as they are
not being trained with backprop in the operation.
Args:
op: The BatchNormOp for which we need to gen... | [
"def",
"_BatchNormWithGlobalNormalizationGrad",
"(",
"op",
",",
"grad",
")",
":",
"dx",
",",
"dm",
",",
"dv",
",",
"db",
",",
"dg",
"=",
"gen_nn_ops",
".",
"_batch_norm_with_global_normalization_grad",
"(",
"op",
".",
"inputs",
"[",
"0",
"]",
",",
"op",
".... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/ops/nn_grad.py#L449-L472 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py3/pkg_resources/_vendor/pyparsing.py | python | indentedBlock | (blockStatementExpr, indentStack, indent=True) | return smExpr.setName('indented block') | Helper method for defining space-delimited indentation blocks, such as
those used to define block statements in Python source code.
Parameters:
- blockStatementExpr - expression defining syntax of statement that
is repeated within the indented block
- indentStack - list created by caller ... | Helper method for defining space-delimited indentation blocks, such as
those used to define block statements in Python source code. | [
"Helper",
"method",
"for",
"defining",
"space",
"-",
"delimited",
"indentation",
"blocks",
"such",
"as",
"those",
"used",
"to",
"define",
"block",
"statements",
"in",
"Python",
"source",
"code",
"."
] | def indentedBlock(blockStatementExpr, indentStack, indent=True):
"""
Helper method for defining space-delimited indentation blocks, such as
those used to define block statements in Python source code.
Parameters:
- blockStatementExpr - expression defining syntax of statement that
is re... | [
"def",
"indentedBlock",
"(",
"blockStatementExpr",
",",
"indentStack",
",",
"indent",
"=",
"True",
")",
":",
"def",
"checkPeerIndent",
"(",
"s",
",",
"l",
",",
"t",
")",
":",
"if",
"l",
">=",
"len",
"(",
"s",
")",
":",
"return",
"curCol",
"=",
"col",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py3/pkg_resources/_vendor/pyparsing.py#L5247-L5359 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/urllib.py | python | FancyURLopener.http_error_default | (self, url, fp, errcode, errmsg, headers) | return addinfourl(fp, headers, "http:" + url, errcode) | Default error handling -- don't raise an exception. | Default error handling -- don't raise an exception. | [
"Default",
"error",
"handling",
"--",
"don",
"t",
"raise",
"an",
"exception",
"."
] | def http_error_default(self, url, fp, errcode, errmsg, headers):
"""Default error handling -- don't raise an exception."""
return addinfourl(fp, headers, "http:" + url, errcode) | [
"def",
"http_error_default",
"(",
"self",
",",
"url",
",",
"fp",
",",
"errcode",
",",
"errmsg",
",",
"headers",
")",
":",
"return",
"addinfourl",
"(",
"fp",
",",
"headers",
",",
"\"http:\"",
"+",
"url",
",",
"errcode",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/urllib.py#L619-L621 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/gluon/probability/distributions/utils.py | python | logit2prob | (logit, binary=True) | return npx.softmax(logit) | r"""Convert logit into probability form.
For the binary case, `sigmoid()` is applied on the logit tensor.
Whereas for the multinomial case, `softmax` is applied along the last
dimension of the logit tensor. | r"""Convert logit into probability form.
For the binary case, `sigmoid()` is applied on the logit tensor.
Whereas for the multinomial case, `softmax` is applied along the last
dimension of the logit tensor. | [
"r",
"Convert",
"logit",
"into",
"probability",
"form",
".",
"For",
"the",
"binary",
"case",
"sigmoid",
"()",
"is",
"applied",
"on",
"the",
"logit",
"tensor",
".",
"Whereas",
"for",
"the",
"multinomial",
"case",
"softmax",
"is",
"applied",
"along",
"the",
... | def logit2prob(logit, binary=True):
r"""Convert logit into probability form.
For the binary case, `sigmoid()` is applied on the logit tensor.
Whereas for the multinomial case, `softmax` is applied along the last
dimension of the logit tensor.
"""
if binary:
return npx.sigmoid(logit)
... | [
"def",
"logit2prob",
"(",
"logit",
",",
"binary",
"=",
"True",
")",
":",
"if",
"binary",
":",
"return",
"npx",
".",
"sigmoid",
"(",
"logit",
")",
"return",
"npx",
".",
"softmax",
"(",
"logit",
")"
] | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/gluon/probability/distributions/utils.py#L159-L167 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/losses/python/losses/loss_ops.py | python | sparse_softmax_cross_entropy | (logits, labels, weights=1.0, scope=None) | Cross-entropy loss using `tf.nn.sparse_softmax_cross_entropy_with_logits`.
`weights` acts as a coefficient for the loss. If a scalar is provided,
then the loss is simply scaled by the given value. If `weights` is a
tensor of size [`batch_size`], then the loss weights apply to each
corresponding sample.
Args... | Cross-entropy loss using `tf.nn.sparse_softmax_cross_entropy_with_logits`. | [
"Cross",
"-",
"entropy",
"loss",
"using",
"tf",
".",
"nn",
".",
"sparse_softmax_cross_entropy_with_logits",
"."
] | def sparse_softmax_cross_entropy(logits, labels, weights=1.0, scope=None):
"""Cross-entropy loss using `tf.nn.sparse_softmax_cross_entropy_with_logits`.
`weights` acts as a coefficient for the loss. If a scalar is provided,
then the loss is simply scaled by the given value. If `weights` is a
tensor of size [`b... | [
"def",
"sparse_softmax_cross_entropy",
"(",
"logits",
",",
"labels",
",",
"weights",
"=",
"1.0",
",",
"scope",
"=",
"None",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"scope",
",",
"\"sparse_softmax_cross_entropy_loss\"",
",",
"[",
"logits",
",",
"labels... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/losses/python/losses/loss_ops.py#L405-L435 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/http/cookiejar.py | python | escape_path | (path) | return path | Escape any invalid characters in HTTP URL, and uppercase all escapes. | Escape any invalid characters in HTTP URL, and uppercase all escapes. | [
"Escape",
"any",
"invalid",
"characters",
"in",
"HTTP",
"URL",
"and",
"uppercase",
"all",
"escapes",
"."
] | def escape_path(path):
"""Escape any invalid characters in HTTP URL, and uppercase all escapes."""
# There's no knowing what character encoding was used to create URLs
# containing %-escapes, but since we have to pick one to escape invalid
# path characters, we pick UTF-8, as recommended in the HTML 4.0... | [
"def",
"escape_path",
"(",
"path",
")",
":",
"# There's no knowing what character encoding was used to create URLs",
"# containing %-escapes, but since we have to pick one to escape invalid",
"# path characters, we pick UTF-8, as recommended in the HTML 4.0",
"# specification:",
"# http://www.w3... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/http/cookiejar.py#L669-L681 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/dataview.py | python | DataViewTreeStore.SetItemData | (*args, **kwargs) | return _dataview.DataViewTreeStore_SetItemData(*args, **kwargs) | SetItemData(self, DataViewItem item, wxClientData data) | SetItemData(self, DataViewItem item, wxClientData data) | [
"SetItemData",
"(",
"self",
"DataViewItem",
"item",
"wxClientData",
"data",
")"
] | def SetItemData(*args, **kwargs):
"""SetItemData(self, DataViewItem item, wxClientData data)"""
return _dataview.DataViewTreeStore_SetItemData(*args, **kwargs) | [
"def",
"SetItemData",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_dataview",
".",
"DataViewTreeStore_SetItemData",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/dataview.py#L2436-L2438 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/util/_decorators.py | python | Substitution.from_params | (cls, params) | return result | In the case where the params is a mutable sequence (list or dictionary)
and it may change before this class is called, one may explicitly use a
reference to the params rather than using *args or **kwargs which will
copy the values and not reference them. | In the case where the params is a mutable sequence (list or dictionary)
and it may change before this class is called, one may explicitly use a
reference to the params rather than using *args or **kwargs which will
copy the values and not reference them. | [
"In",
"the",
"case",
"where",
"the",
"params",
"is",
"a",
"mutable",
"sequence",
"(",
"list",
"or",
"dictionary",
")",
"and",
"it",
"may",
"change",
"before",
"this",
"class",
"is",
"called",
"one",
"may",
"explicitly",
"use",
"a",
"reference",
"to",
"th... | def from_params(cls, params):
"""
In the case where the params is a mutable sequence (list or dictionary)
and it may change before this class is called, one may explicitly use a
reference to the params rather than using *args or **kwargs which will
copy the values and not referen... | [
"def",
"from_params",
"(",
"cls",
",",
"params",
")",
":",
"result",
"=",
"cls",
"(",
")",
"result",
".",
"params",
"=",
"params",
"return",
"result"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/util/_decorators.py#L271-L280 | |
zeusees/HyperVID | f189944a278eea2c0d2e9322a31698d5bf5417a3 | Prj-Python/model_forward.py | python | softmax | (x) | return x | Compute softmax values for each sets of scores in x. | Compute softmax values for each sets of scores in x. | [
"Compute",
"softmax",
"values",
"for",
"each",
"sets",
"of",
"scores",
"in",
"x",
"."
] | def softmax(x):
"""Compute softmax values for each sets of scores in x."""
pass # TODO: Compute and return softmax(x)
x = np.array(x)
x = np.exp(x)
x.astype('float32')
if x.ndim == 1:
sumcol = sum(x)
for i in range(x.size):
x[i] = x[i]/float(sumcol)
if x.ndim > 1... | [
"def",
"softmax",
"(",
"x",
")",
":",
"pass",
"# TODO: Compute and return softmax(x)",
"x",
"=",
"np",
".",
"array",
"(",
"x",
")",
"x",
"=",
"np",
".",
"exp",
"(",
"x",
")",
"x",
".",
"astype",
"(",
"'float32'",
")",
"if",
"x",
".",
"ndim",
"==",
... | https://github.com/zeusees/HyperVID/blob/f189944a278eea2c0d2e9322a31698d5bf5417a3/Prj-Python/model_forward.py#L5-L20 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/boosted_trees/lib/learner/batch/ordinal_split_handler.py | python | sparse_make_stats_update | (
is_active, are_buckets_ready, sparse_column_indices, sparse_column_values,
sparse_column_shape, quantile_buckets, example_partition_ids, gradients,
hessians, weights, empty_gradients, empty_hessians) | return (quantile_indices, quantile_values, quantile_shape, quantile_weights,
example_partition_ids, feature_ids, gradients, hessians) | Updates the state for this split handler. | Updates the state for this split handler. | [
"Updates",
"the",
"state",
"for",
"this",
"split",
"handler",
"."
] | def sparse_make_stats_update(
is_active, are_buckets_ready, sparse_column_indices, sparse_column_values,
sparse_column_shape, quantile_buckets, example_partition_ids, gradients,
hessians, weights, empty_gradients, empty_hessians):
"""Updates the state for this split handler."""
def quantiles_ready():
... | [
"def",
"sparse_make_stats_update",
"(",
"is_active",
",",
"are_buckets_ready",
",",
"sparse_column_indices",
",",
"sparse_column_values",
",",
"sparse_column_shape",
",",
"quantile_buckets",
",",
"example_partition_ids",
",",
"gradients",
",",
"hessians",
",",
"weights",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/boosted_trees/lib/learner/batch/ordinal_split_handler.py#L651-L732 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/dateutil/tz/win.py | python | tzwinbase.transitions | (self, year) | return dston, dstoff | For a given year, get the DST on and off transition times, expressed
always on the standard time side. For zones with no transitions, this
function returns ``None``.
:param year:
The year whose transitions you would like to query.
:return:
Returns a :class:`tupl... | For a given year, get the DST on and off transition times, expressed
always on the standard time side. For zones with no transitions, this
function returns ``None``. | [
"For",
"a",
"given",
"year",
"get",
"the",
"DST",
"on",
"and",
"off",
"transition",
"times",
"expressed",
"always",
"on",
"the",
"standard",
"time",
"side",
".",
"For",
"zones",
"with",
"no",
"transitions",
"this",
"function",
"returns",
"None",
"."
] | def transitions(self, year):
"""
For a given year, get the DST on and off transition times, expressed
always on the standard time side. For zones with no transitions, this
function returns ``None``.
:param year:
The year whose transitions you would like to query.
... | [
"def",
"transitions",
"(",
"self",
",",
"year",
")",
":",
"if",
"not",
"self",
".",
"hasdst",
":",
"return",
"None",
"dston",
"=",
"picknthweekday",
"(",
"year",
",",
"self",
".",
"_dstmonth",
",",
"self",
".",
"_dstdayofweek",
",",
"self",
".",
"_dsth... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/dateutil/tz/win.py#L163-L192 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | third_party/jinja2/filters.py | python | do_sort | (environment, value, reverse=False, case_sensitive=False,
attribute=None) | return sorted(value, key=sort_func, reverse=reverse) | Sort an iterable. Per default it sorts ascending, if you pass it
true as first argument it will reverse the sorting.
If the iterable is made of strings the third parameter can be used to
control the case sensitiveness of the comparison which is disabled by
default.
.. sourcecode:: jinja
... | Sort an iterable. Per default it sorts ascending, if you pass it
true as first argument it will reverse the sorting. | [
"Sort",
"an",
"iterable",
".",
"Per",
"default",
"it",
"sorts",
"ascending",
"if",
"you",
"pass",
"it",
"true",
"as",
"first",
"argument",
"it",
"will",
"reverse",
"the",
"sorting",
"."
] | def do_sort(environment, value, reverse=False, case_sensitive=False,
attribute=None):
"""Sort an iterable. Per default it sorts ascending, if you pass it
true as first argument it will reverse the sorting.
If the iterable is made of strings the third parameter can be used to
control the ca... | [
"def",
"do_sort",
"(",
"environment",
",",
"value",
",",
"reverse",
"=",
"False",
",",
"case_sensitive",
"=",
"False",
",",
"attribute",
"=",
"None",
")",
":",
"if",
"not",
"case_sensitive",
":",
"def",
"sort_func",
"(",
"item",
")",
":",
"if",
"isinstan... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/third_party/jinja2/filters.py#L227-L265 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/parallel_for/pfor.py | python | _create_op | (op_type, inputs, op_dtypes, attrs=None) | return op | Utility to create an op. | Utility to create an op. | [
"Utility",
"to",
"create",
"an",
"op",
"."
] | def _create_op(op_type, inputs, op_dtypes, attrs=None):
"""Utility to create an op."""
op = ops.get_default_graph().create_op(
op_type, inputs, op_dtypes, attrs=attrs, compute_device=True)
flat_attrs = nest.flatten([(str(a), op.get_attr(str(a))) for a in attrs])
execute.record_gradient(
op_type, op.... | [
"def",
"_create_op",
"(",
"op_type",
",",
"inputs",
",",
"op_dtypes",
",",
"attrs",
"=",
"None",
")",
":",
"op",
"=",
"ops",
".",
"get_default_graph",
"(",
")",
".",
"create_op",
"(",
"op_type",
",",
"inputs",
",",
"op_dtypes",
",",
"attrs",
"=",
"attr... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/parallel_for/pfor.py#L901-L908 | |
panda3d/panda3d | 833ad89ebad58395d0af0b7ec08538e5e4308265 | direct/src/extensions_native/NodePath_extensions.py | python | getAncestry | (self) | return ancestors | Deprecated. Get a list of a node path's ancestors | Deprecated. Get a list of a node path's ancestors | [
"Deprecated",
".",
"Get",
"a",
"list",
"of",
"a",
"node",
"path",
"s",
"ancestors"
] | def getAncestry(self):
"""Deprecated. Get a list of a node path's ancestors"""
if __debug__:
warnings.warn("NodePath.getAncestry() is deprecated. Use get_ancestors() instead.", DeprecationWarning, stacklevel=2)
ancestors = list(self.getAncestors())
ancestors.reverse()
return ancestors | [
"def",
"getAncestry",
"(",
"self",
")",
":",
"if",
"__debug__",
":",
"warnings",
".",
"warn",
"(",
"\"NodePath.getAncestry() is deprecated. Use get_ancestors() instead.\"",
",",
"DeprecationWarning",
",",
"stacklevel",
"=",
"2",
")",
"ancestors",
"=",
"list",
"(",
... | https://github.com/panda3d/panda3d/blob/833ad89ebad58395d0af0b7ec08538e5e4308265/direct/src/extensions_native/NodePath_extensions.py#L170-L176 | |
Evolving-AI-Lab/fooling | 66f097dd6bd2eb6794ade3e187a7adfdf1887688 | caffe/python/caffe/io.py | python | load_image | (filename, color=True) | return img | Load an image converting from grayscale or alpha as needed.
Take
filename: string
color: flag for color format. True (default) loads as RGB while False
loads as intensity (if image is already grayscale).
Give
image: an image with type np.float32 of size (H x W x 3) in RGB or
of siz... | Load an image converting from grayscale or alpha as needed. | [
"Load",
"an",
"image",
"converting",
"from",
"grayscale",
"or",
"alpha",
"as",
"needed",
"."
] | def load_image(filename, color=True):
"""
Load an image converting from grayscale or alpha as needed.
Take
filename: string
color: flag for color format. True (default) loads as RGB while False
loads as intensity (if image is already grayscale).
Give
image: an image with type np.fl... | [
"def",
"load_image",
"(",
"filename",
",",
"color",
"=",
"True",
")",
":",
"img",
"=",
"skimage",
".",
"img_as_float",
"(",
"skimage",
".",
"io",
".",
"imread",
"(",
"filename",
")",
")",
".",
"astype",
"(",
"np",
".",
"float32",
")",
"if",
"img",
... | https://github.com/Evolving-AI-Lab/fooling/blob/66f097dd6bd2eb6794ade3e187a7adfdf1887688/caffe/python/caffe/io.py#L8-L28 | |
bulletphysics/bullet3 | f0f2a952e146f016096db6f85cf0c44ed75b0b9a | examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_trotting_env.py | python | MinitaurTrottingEnv._signal | (self, t) | return signal | Generates the trotting gait for the robot.
Args:
t: Current time in simulation.
Returns:
A numpy array of the reference leg positions. | Generates the trotting gait for the robot. | [
"Generates",
"the",
"trotting",
"gait",
"for",
"the",
"robot",
"."
] | def _signal(self, t):
"""Generates the trotting gait for the robot.
Args:
t: Current time in simulation.
Returns:
A numpy array of the reference leg positions.
"""
# Generates the leg trajectories for the two digonal pair of legs.
ext_first_pair, sw_first_pair = self._gen_signal(t,... | [
"def",
"_signal",
"(",
"self",
",",
"t",
")",
":",
"# Generates the leg trajectories for the two digonal pair of legs.",
"ext_first_pair",
",",
"sw_first_pair",
"=",
"self",
".",
"_gen_signal",
"(",
"t",
",",
"0",
")",
"ext_second_pair",
",",
"sw_second_pair",
"=",
... | https://github.com/bulletphysics/bullet3/blob/f0f2a952e146f016096db6f85cf0c44ed75b0b9a/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_trotting_env.py#L182-L200 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/propgrid.py | python | PGProperty.GetEditorClass | (*args, **kwargs) | return _propgrid.PGProperty_GetEditorClass(*args, **kwargs) | GetEditorClass(self) -> PGEditor | GetEditorClass(self) -> PGEditor | [
"GetEditorClass",
"(",
"self",
")",
"-",
">",
"PGEditor"
] | def GetEditorClass(*args, **kwargs):
"""GetEditorClass(self) -> PGEditor"""
return _propgrid.PGProperty_GetEditorClass(*args, **kwargs) | [
"def",
"GetEditorClass",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PGProperty_GetEditorClass",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/propgrid.py#L555-L557 | |
microsoft/LightGBM | 904b2d5158703c4900b68008617951dd2f9ff21b | python-package/lightgbm/callback.py | python | early_stopping | (stopping_rounds: int, first_metric_only: bool = False, verbose: bool = True, min_delta: Union[float, List[float]] = 0.0) | return _callback | Create a callback that activates early stopping.
Activates early stopping.
The model will train until the validation score doesn't improve by at least ``min_delta``.
Validation score needs to improve at least every ``stopping_rounds`` round(s)
to continue training.
Requires at least one validation ... | Create a callback that activates early stopping. | [
"Create",
"a",
"callback",
"that",
"activates",
"early",
"stopping",
"."
] | def early_stopping(stopping_rounds: int, first_metric_only: bool = False, verbose: bool = True, min_delta: Union[float, List[float]] = 0.0) -> Callable:
"""Create a callback that activates early stopping.
Activates early stopping.
The model will train until the validation score doesn't improve by at least ... | [
"def",
"early_stopping",
"(",
"stopping_rounds",
":",
"int",
",",
"first_metric_only",
":",
"bool",
"=",
"False",
",",
"verbose",
":",
"bool",
"=",
"True",
",",
"min_delta",
":",
"Union",
"[",
"float",
",",
"List",
"[",
"float",
"]",
"]",
"=",
"0.0",
"... | https://github.com/microsoft/LightGBM/blob/904b2d5158703c4900b68008617951dd2f9ff21b/python-package/lightgbm/callback.py#L187-L339 | |
WeitaoVan/L-GM-loss | 598582f0631bac876b3eeb8d6c4cd1d780269e03 | python/caffe/net_spec.py | python | Top.to_proto | (self) | return to_proto(self) | Generate a NetParameter that contains all layers needed to compute
this top. | Generate a NetParameter that contains all layers needed to compute
this top. | [
"Generate",
"a",
"NetParameter",
"that",
"contains",
"all",
"layers",
"needed",
"to",
"compute",
"this",
"top",
"."
] | def to_proto(self):
"""Generate a NetParameter that contains all layers needed to compute
this top."""
return to_proto(self) | [
"def",
"to_proto",
"(",
"self",
")",
":",
"return",
"to_proto",
"(",
"self",
")"
] | https://github.com/WeitaoVan/L-GM-loss/blob/598582f0631bac876b3eeb8d6c4cd1d780269e03/python/caffe/net_spec.py#L90-L94 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/Calibration/tofpd/diagnostics.py | python | __calculate_dspacing | (obs: dict) | return np.asarray(list(obs.values())[1:-2]) | Extract the dspacing values from a row in output dspace table workspace from PDCalibration | Extract the dspacing values from a row in output dspace table workspace from PDCalibration | [
"Extract",
"the",
"dspacing",
"values",
"from",
"a",
"row",
"in",
"output",
"dspace",
"table",
"workspace",
"from",
"PDCalibration"
] | def __calculate_dspacing(obs: dict):
"""Extract the dspacing values from a row in output dspace table workspace from PDCalibration"""
# Trim the table row since this is from the output of PDCalibration, so remove detid, chisq and normchisq columns
return np.asarray(list(obs.values())[1:-2]) | [
"def",
"__calculate_dspacing",
"(",
"obs",
":",
"dict",
")",
":",
"# Trim the table row since this is from the output of PDCalibration, so remove detid, chisq and normchisq columns",
"return",
"np",
".",
"asarray",
"(",
"list",
"(",
"obs",
".",
"values",
"(",
")",
")",
"[... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/Calibration/tofpd/diagnostics.py#L310-L313 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/grid.py | python | GridEvent.__init__ | (self, *args, **kwargs) | __init__(self, int id, EventType type, Object obj, int row=-1, int col=-1,
int x=-1, int y=-1, bool sel=True, bool control=False,
bool shift=False, bool alt=False,
bool meta=False) -> GridEvent | __init__(self, int id, EventType type, Object obj, int row=-1, int col=-1,
int x=-1, int y=-1, bool sel=True, bool control=False,
bool shift=False, bool alt=False,
bool meta=False) -> GridEvent | [
"__init__",
"(",
"self",
"int",
"id",
"EventType",
"type",
"Object",
"obj",
"int",
"row",
"=",
"-",
"1",
"int",
"col",
"=",
"-",
"1",
"int",
"x",
"=",
"-",
"1",
"int",
"y",
"=",
"-",
"1",
"bool",
"sel",
"=",
"True",
"bool",
"control",
"=",
"Fal... | def __init__(self, *args, **kwargs):
"""
__init__(self, int id, EventType type, Object obj, int row=-1, int col=-1,
int x=-1, int y=-1, bool sel=True, bool control=False,
bool shift=False, bool alt=False,
bool meta=False) -> GridEvent
"""
_grid.Gri... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_grid",
".",
"GridEvent_swiginit",
"(",
"self",
",",
"_grid",
".",
"new_GridEvent",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/grid.py#L2297-L2304 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_controls.py | python | TreeCtrl.GetSpacing | (*args, **kwargs) | return _controls_.TreeCtrl_GetSpacing(*args, **kwargs) | GetSpacing(self) -> unsigned int | GetSpacing(self) -> unsigned int | [
"GetSpacing",
"(",
"self",
")",
"-",
">",
"unsigned",
"int"
] | def GetSpacing(*args, **kwargs):
"""GetSpacing(self) -> unsigned int"""
return _controls_.TreeCtrl_GetSpacing(*args, **kwargs) | [
"def",
"GetSpacing",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"TreeCtrl_GetSpacing",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_controls.py#L5228-L5230 | |
wujian16/Cornell-MOE | df299d1be882d2af9796d7a68b3f9505cac7a53e | moe/optimal_learning/python/cpp_wrappers/domain.py | python | TensorProductDomain.domain_bounds | (self) | return self._domain_bounds | Return the [min, max] bounds for each spatial dimension. | Return the [min, max] bounds for each spatial dimension. | [
"Return",
"the",
"[",
"min",
"max",
"]",
"bounds",
"for",
"each",
"spatial",
"dimension",
"."
] | def domain_bounds(self):
"""Return the [min, max] bounds for each spatial dimension."""
return self._domain_bounds | [
"def",
"domain_bounds",
"(",
"self",
")",
":",
"return",
"self",
".",
"_domain_bounds"
] | https://github.com/wujian16/Cornell-MOE/blob/df299d1be882d2af9796d7a68b3f9505cac7a53e/moe/optimal_learning/python/cpp_wrappers/domain.py#L62-L64 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/ed_i18n.py | python | GetLangId | (lang_n) | return lang_desc.get(lang_n, wx.LANGUAGE_DEFAULT) | Gets the ID of a language from the description string. If the
language cannot be found the function simply returns the default language
@param lang_n: Canonical name of a language
@return: wx.LANGUAGE_*** id of language | Gets the ID of a language from the description string. If the
language cannot be found the function simply returns the default language
@param lang_n: Canonical name of a language
@return: wx.LANGUAGE_*** id of language | [
"Gets",
"the",
"ID",
"of",
"a",
"language",
"from",
"the",
"description",
"string",
".",
"If",
"the",
"language",
"cannot",
"be",
"found",
"the",
"function",
"simply",
"returns",
"the",
"default",
"language",
"@param",
"lang_n",
":",
"Canonical",
"name",
"of... | def GetLangId(lang_n):
"""Gets the ID of a language from the description string. If the
language cannot be found the function simply returns the default language
@param lang_n: Canonical name of a language
@return: wx.LANGUAGE_*** id of language
"""
if lang_n == "Default":
# No language... | [
"def",
"GetLangId",
"(",
"lang_n",
")",
":",
"if",
"lang_n",
"==",
"\"Default\"",
":",
"# No language set, default to English",
"return",
"wx",
".",
"LANGUAGE_ENGLISH_US",
"lang_desc",
"=",
"GetLocaleDict",
"(",
"GetAvailLocales",
"(",
")",
",",
"OPT_DESCRIPT",
")",... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/ed_i18n.py#L87-L98 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_aarch64/python2.7/dist-packages/catkin_pkg/package_templates.py | python | _create_depend_tag | (dep_type,
name,
version_eq=None,
version_lt=None,
version_lte=None,
version_gt=None,
version_gte=None) | return result | Helper to create xml snippet for package.xml | Helper to create xml snippet for package.xml | [
"Helper",
"to",
"create",
"xml",
"snippet",
"for",
"package",
".",
"xml"
] | def _create_depend_tag(dep_type,
name,
version_eq=None,
version_lt=None,
version_lte=None,
version_gt=None,
version_gte=None):
"""
Helper to create xml snippet for package.xm... | [
"def",
"_create_depend_tag",
"(",
"dep_type",
",",
"name",
",",
"version_eq",
"=",
"None",
",",
"version_lt",
"=",
"None",
",",
"version_lte",
"=",
"None",
",",
"version_gt",
"=",
"None",
",",
"version_gte",
"=",
"None",
")",
":",
"version_string",
"=",
"[... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_aarch64/python2.7/dist-packages/catkin_pkg/package_templates.py#L316-L339 | |
macchina-io/macchina.io | ef24ba0e18379c3dd48fb84e6dbf991101cb8db0 | platform/JS/V8/tools/gyp/pylib/gyp/generator/ninja.py | python | NinjaWriter.WritePchTargets | (self, ninja_file, pch_commands) | Writes ninja rules to compile prefix headers. | Writes ninja rules to compile prefix headers. | [
"Writes",
"ninja",
"rules",
"to",
"compile",
"prefix",
"headers",
"."
] | def WritePchTargets(self, ninja_file, pch_commands):
"""Writes ninja rules to compile prefix headers."""
if not pch_commands:
return
for gch, lang_flag, lang, input in pch_commands:
var_name = {
'c': 'cflags_pch_c',
'cc': 'cflags_pch_cc',
'm': 'cflags_pch_objc',
... | [
"def",
"WritePchTargets",
"(",
"self",
",",
"ninja_file",
",",
"pch_commands",
")",
":",
"if",
"not",
"pch_commands",
":",
"return",
"for",
"gch",
",",
"lang_flag",
",",
"lang",
",",
"input",
"in",
"pch_commands",
":",
"var_name",
"=",
"{",
"'c'",
":",
"... | https://github.com/macchina-io/macchina.io/blob/ef24ba0e18379c3dd48fb84e6dbf991101cb8db0/platform/JS/V8/tools/gyp/pylib/gyp/generator/ninja.py#L1086-L1101 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/logging/__init__.py | python | info | (msg, *args, **kwargs) | Log a message with severity 'INFO' on the root logger. | Log a message with severity 'INFO' on the root logger. | [
"Log",
"a",
"message",
"with",
"severity",
"INFO",
"on",
"the",
"root",
"logger",
"."
] | def info(msg, *args, **kwargs):
"""
Log a message with severity 'INFO' on the root logger.
"""
if len(root.handlers) == 0:
basicConfig()
root.info(msg, *args, **kwargs) | [
"def",
"info",
"(",
"msg",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"len",
"(",
"root",
".",
"handlers",
")",
"==",
"0",
":",
"basicConfig",
"(",
")",
"root",
".",
"info",
"(",
"msg",
",",
"*",
"args",
",",
"*",
"*",
"kwargs... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/logging/__init__.py#L1605-L1611 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/botocore/vendored/requests/packages/urllib3/util/response.py | python | is_fp_closed | (obj) | Checks whether a given file-like object is closed.
:param obj:
The file-like object to check. | Checks whether a given file-like object is closed. | [
"Checks",
"whether",
"a",
"given",
"file",
"-",
"like",
"object",
"is",
"closed",
"."
] | def is_fp_closed(obj):
"""
Checks whether a given file-like object is closed.
:param obj:
The file-like object to check.
"""
try:
# Check via the official file-like-object way.
return obj.closed
except AttributeError:
pass
try:
# Check if the object... | [
"def",
"is_fp_closed",
"(",
"obj",
")",
":",
"try",
":",
"# Check via the official file-like-object way.",
"return",
"obj",
".",
"closed",
"except",
"AttributeError",
":",
"pass",
"try",
":",
"# Check if the object is a container for another file-like object that",
"# gets re... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/botocore/vendored/requests/packages/urllib3/util/response.py#L1-L22 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/colorama/ansitowin32.py | python | AnsiToWin32.should_wrap | (self) | return self.convert or self.strip or self.autoreset | True if this class is actually needed. If false, then the output
stream will not be affected, nor will win32 calls be issued, so
wrapping stdout is not actually required. This will generally be
False on non-Windows platforms, unless optional functionality like
autoreset has been requeste... | True if this class is actually needed. If false, then the output
stream will not be affected, nor will win32 calls be issued, so
wrapping stdout is not actually required. This will generally be
False on non-Windows platforms, unless optional functionality like
autoreset has been requeste... | [
"True",
"if",
"this",
"class",
"is",
"actually",
"needed",
".",
"If",
"false",
"then",
"the",
"output",
"stream",
"will",
"not",
"be",
"affected",
"nor",
"will",
"win32",
"calls",
"be",
"issued",
"so",
"wrapping",
"stdout",
"is",
"not",
"actually",
"requir... | def should_wrap(self):
'''
True if this class is actually needed. If false, then the output
stream will not be affected, nor will win32 calls be issued, so
wrapping stdout is not actually required. This will generally be
False on non-Windows platforms, unless optional functionali... | [
"def",
"should_wrap",
"(",
"self",
")",
":",
"return",
"self",
".",
"convert",
"or",
"self",
".",
"strip",
"or",
"self",
".",
"autoreset"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/colorama/ansitowin32.py#L106-L114 | |
vtraag/leidenalg | b53366829360e10922a2dbf57eb405a516c23bc9 | src/leidenalg/functions.py | python | time_slices_to_layers | (graphs,
interslice_weight=1,
slice_attr='slice',
vertex_id_attr='id',
edge_type_attr='type',
weight_attr='weight') | return slices_to_layers(G_slices,
slice_attr,
vertex_id_attr,
edge_type_attr,
weight_attr) | Convert time slices to layer graphs.
Each graph is considered to represent a time slice. This function simply
connects all the consecutive slices (i.e. the slice graph) with an
``interslice_weight``. The further conversion is then delegated to
:func:`slices_to_layers`, which also provides further details.
... | Convert time slices to layer graphs. | [
"Convert",
"time",
"slices",
"to",
"layer",
"graphs",
"."
] | def time_slices_to_layers(graphs,
interslice_weight=1,
slice_attr='slice',
vertex_id_attr='id',
edge_type_attr='type',
weight_attr='weight'):
""" Convert time slices to layer graphs.
Ea... | [
"def",
"time_slices_to_layers",
"(",
"graphs",
",",
"interslice_weight",
"=",
"1",
",",
"slice_attr",
"=",
"'slice'",
",",
"vertex_id_attr",
"=",
"'id'",
",",
"edge_type_attr",
"=",
"'type'",
",",
"weight_attr",
"=",
"'weight'",
")",
":",
"G_slices",
"=",
"_ig... | https://github.com/vtraag/leidenalg/blob/b53366829360e10922a2dbf57eb405a516c23bc9/src/leidenalg/functions.py#L331-L358 | |
OSGeo/gdal | 3748fc4ba4fba727492774b2b908a2130c864a83 | swig/python/osgeo/gdal.py | python | BuildVRTInternalObjects | (*args) | return _gdal.BuildVRTInternalObjects(*args) | r"""BuildVRTInternalObjects(char const * dest, int object_list_count, GDALBuildVRTOptions options, GDALProgressFunc callback=0, void * callback_data=None) -> Dataset | r"""BuildVRTInternalObjects(char const * dest, int object_list_count, GDALBuildVRTOptions options, GDALProgressFunc callback=0, void * callback_data=None) -> Dataset | [
"r",
"BuildVRTInternalObjects",
"(",
"char",
"const",
"*",
"dest",
"int",
"object_list_count",
"GDALBuildVRTOptions",
"options",
"GDALProgressFunc",
"callback",
"=",
"0",
"void",
"*",
"callback_data",
"=",
"None",
")",
"-",
">",
"Dataset"
] | def BuildVRTInternalObjects(*args):
r"""BuildVRTInternalObjects(char const * dest, int object_list_count, GDALBuildVRTOptions options, GDALProgressFunc callback=0, void * callback_data=None) -> Dataset"""
return _gdal.BuildVRTInternalObjects(*args) | [
"def",
"BuildVRTInternalObjects",
"(",
"*",
"args",
")",
":",
"return",
"_gdal",
".",
"BuildVRTInternalObjects",
"(",
"*",
"args",
")"
] | https://github.com/OSGeo/gdal/blob/3748fc4ba4fba727492774b2b908a2130c864a83/swig/python/osgeo/gdal.py#L4348-L4350 | |
floooh/oryol | eb08cffe1b1cb6b05ed14ec692bca9372cef064e | fips-files/generators/util/png.py | python | Reader.read | (self) | return self.width, self.height, pixels, meta | Read the PNG file and decode it. Returns (`width`, `height`,
`pixels`, `metadata`).
May use excessive memory.
`pixels` are returned in boxed row flat pixel format. | Read the PNG file and decode it. Returns (`width`, `height`,
`pixels`, `metadata`). | [
"Read",
"the",
"PNG",
"file",
"and",
"decode",
"it",
".",
"Returns",
"(",
"width",
"height",
"pixels",
"metadata",
")",
"."
] | def read(self):
"""
Read the PNG file and decode it. Returns (`width`, `height`,
`pixels`, `metadata`).
May use excessive memory.
`pixels` are returned in boxed row flat pixel format.
"""
def iteridat():
"""Iterator that yields all the ``IDAT`` chu... | [
"def",
"read",
"(",
"self",
")",
":",
"def",
"iteridat",
"(",
")",
":",
"\"\"\"Iterator that yields all the ``IDAT`` chunks as strings.\"\"\"",
"while",
"True",
":",
"try",
":",
"type",
",",
"data",
"=",
"self",
".",
"chunk",
"(",
")",
"except",
"ValueError",
... | https://github.com/floooh/oryol/blob/eb08cffe1b1cb6b05ed14ec692bca9372cef064e/fips-files/generators/util/png.py#L1849-L1914 | |
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Code/Tools/waf-1.7.13/waflib/Tools/msvc.py | python | gather_wsdk_versions | (conf, versions) | Use winreg to add the msvc versions to the input list
:param versions: list to modify
:type versions: list | Use winreg to add the msvc versions to the input list | [
"Use",
"winreg",
"to",
"add",
"the",
"msvc",
"versions",
"to",
"the",
"input",
"list"
] | def gather_wsdk_versions(conf, versions):
"""
Use winreg to add the msvc versions to the input list
:param versions: list to modify
:type versions: list
"""
version_pattern = re.compile('^v..?.?\...?.?')
try:
all_versions = Utils.winreg.OpenKey(Utils.winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Wow6432node\\Microsof... | [
"def",
"gather_wsdk_versions",
"(",
"conf",
",",
"versions",
")",
":",
"version_pattern",
"=",
"re",
".",
"compile",
"(",
"'^v..?.?\\...?.?'",
")",
"try",
":",
"all_versions",
"=",
"Utils",
".",
"winreg",
".",
"OpenKey",
"(",
"Utils",
".",
"winreg",
".",
"... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Code/Tools/waf-1.7.13/waflib/Tools/msvc.py#L185-L221 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/indexes/base.py | python | Index.to_frame | (self, index=True, name=None) | return result | Create a DataFrame with a column containing the Index.
.. versionadded:: 0.24.0
Parameters
----------
index : bool, default True
Set the index of the returned DataFrame as the original Index.
name : object, default None
The passed name should substitute... | Create a DataFrame with a column containing the Index. | [
"Create",
"a",
"DataFrame",
"with",
"a",
"column",
"containing",
"the",
"Index",
"."
] | def to_frame(self, index=True, name=None):
"""
Create a DataFrame with a column containing the Index.
.. versionadded:: 0.24.0
Parameters
----------
index : bool, default True
Set the index of the returned DataFrame as the original Index.
name : obj... | [
"def",
"to_frame",
"(",
"self",
",",
"index",
"=",
"True",
",",
"name",
"=",
"None",
")",
":",
"from",
"pandas",
"import",
"DataFrame",
"if",
"name",
"is",
"None",
":",
"name",
"=",
"self",
".",
"name",
"or",
"0",
"result",
"=",
"DataFrame",
"(",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/indexes/base.py#L1117-L1177 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/distutils/msvccompiler.py | python | MSVCCompiler.get_msvc_paths | (self, path, platform='x86') | return [] | Get a list of devstudio directories (include, lib or path).
Return a list of strings. The list will be empty if unable to
access the registry or appropriate registry keys not found. | Get a list of devstudio directories (include, lib or path). | [
"Get",
"a",
"list",
"of",
"devstudio",
"directories",
"(",
"include",
"lib",
"or",
"path",
")",
"."
] | def get_msvc_paths(self, path, platform='x86'):
"""Get a list of devstudio directories (include, lib or path).
Return a list of strings. The list will be empty if unable to
access the registry or appropriate registry keys not found.
"""
if not _can_read_reg:
return... | [
"def",
"get_msvc_paths",
"(",
"self",
",",
"path",
",",
"platform",
"=",
"'x86'",
")",
":",
"if",
"not",
"_can_read_reg",
":",
"return",
"[",
"]",
"path",
"=",
"path",
"+",
"\" dirs\"",
"if",
"self",
".",
"__version",
">=",
"7",
":",
"key",
"=",
"(",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/distutils/msvccompiler.py#L602-L637 | |
fifengine/fifengine | 4b62c42e85bec19893cef8e63e6855927cff2c47 | engine/python/fife/extensions/pychan/widgets/slider.py | python | Slider._getScaleEnd | (self) | return self.real_widget.getScaleEnd() | getScaleEnd(self) -> double | getScaleEnd(self) -> double | [
"getScaleEnd",
"(",
"self",
")",
"-",
">",
"double"
] | def _getScaleEnd(self):
"""getScaleEnd(self) -> double"""
return self.real_widget.getScaleEnd() | [
"def",
"_getScaleEnd",
"(",
"self",
")",
":",
"return",
"self",
".",
"real_widget",
".",
"getScaleEnd",
"(",
")"
] | https://github.com/fifengine/fifengine/blob/4b62c42e85bec19893cef8e63e6855927cff2c47/engine/python/fife/extensions/pychan/widgets/slider.py#L196-L198 | |
domino-team/openwrt-cc | 8b181297c34d14d3ca521cc9f31430d561dbc688 | package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py | python | WriteRules | (target_name, rules, extra_sources, extra_deps,
path_to_gyp, output) | Write CMake for the 'rules' in the target.
Args:
target_name: the name of the CMake target being generated.
actions: the Gyp 'actions' dict for this target.
extra_sources: [(<cmake_src>, <src>)] to append with generated source files.
extra_deps: [<cmake_taget>] to append with generated targets.
p... | Write CMake for the 'rules' in the target. | [
"Write",
"CMake",
"for",
"the",
"rules",
"in",
"the",
"target",
"."
] | def WriteRules(target_name, rules, extra_sources, extra_deps,
path_to_gyp, output):
"""Write CMake for the 'rules' in the target.
Args:
target_name: the name of the CMake target being generated.
actions: the Gyp 'actions' dict for this target.
extra_sources: [(<cmake_src>, <src>)] to app... | [
"def",
"WriteRules",
"(",
"target_name",
",",
"rules",
",",
"extra_sources",
",",
"extra_deps",
",",
"path_to_gyp",
",",
"output",
")",
":",
"for",
"rule",
"in",
"rules",
":",
"rule_name",
"=",
"StringToCMakeTargetName",
"(",
"target_name",
"+",
"'__'",
"+",
... | https://github.com/domino-team/openwrt-cc/blob/8b181297c34d14d3ca521cc9f31430d561dbc688/package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py#L329-L440 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/BilbyCustomFunctions_Reduction.py | python | string_boolean | (line) | return bool_string | Convert string to boolean; needed to read "true" and "false" from the csv Data reduction settings table | Convert string to boolean; needed to read "true" and "false" from the csv Data reduction settings table | [
"Convert",
"string",
"to",
"boolean",
";",
"needed",
"to",
"read",
"true",
"and",
"false",
"from",
"the",
"csv",
"Data",
"reduction",
"settings",
"table"
] | def string_boolean(line):
""" Convert string to boolean; needed to read "true" and "false" from the csv Data reduction settings table """
if line == 'false':
bool_string = False
elif line == 'true':
bool_string = True
else:
print("Check value of {}".format(line))
print("... | [
"def",
"string_boolean",
"(",
"line",
")",
":",
"if",
"line",
"==",
"'false'",
":",
"bool_string",
"=",
"False",
"elif",
"line",
"==",
"'true'",
":",
"bool_string",
"=",
"True",
"else",
":",
"print",
"(",
"\"Check value of {}\"",
".",
"format",
"(",
"line"... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/BilbyCustomFunctions_Reduction.py#L20-L31 | |
blackberry/Boost | fc90c3fde129c62565c023f091eddc4a7ed9902b | tools/build/v2/build/engine.py | python | Engine.register_action | (self, action_name, command, bound_list = [], flags = [],
function = None) | Creates a new build engine action.
Creates on bjam side an action named 'action_name', with
'command' as the command to be executed, 'bound_variables'
naming the list of variables bound when the command is executed
and specified flag.
If 'function' is not None, it should be a ca... | Creates a new build engine action. | [
"Creates",
"a",
"new",
"build",
"engine",
"action",
"."
] | def register_action (self, action_name, command, bound_list = [], flags = [],
function = None):
"""Creates a new build engine action.
Creates on bjam side an action named 'action_name', with
'command' as the command to be executed, 'bound_variables'
naming the l... | [
"def",
"register_action",
"(",
"self",
",",
"action_name",
",",
"command",
",",
"bound_list",
"=",
"[",
"]",
",",
"flags",
"=",
"[",
"]",
",",
"function",
"=",
"None",
")",
":",
"if",
"self",
".",
"actions",
".",
"has_key",
"(",
"action_name",
")",
"... | https://github.com/blackberry/Boost/blob/fc90c3fde129c62565c023f091eddc4a7ed9902b/tools/build/v2/build/engine.py#L111-L142 | ||
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | current/tools/gyp/pylib/gyp/xcode_emulation.py | python | XcodeSettings._GetBundleBinaryPath | (self) | return os.path.join(self.GetBundleExecutableFolderPath(), \
self.GetExecutableName()) | Returns the name of the bundle binary of by this target.
E.g. Chromium.app/Contents/MacOS/Chromium. Only valid for bundles. | Returns the name of the bundle binary of by this target.
E.g. Chromium.app/Contents/MacOS/Chromium. Only valid for bundles. | [
"Returns",
"the",
"name",
"of",
"the",
"bundle",
"binary",
"of",
"by",
"this",
"target",
".",
"E",
".",
"g",
".",
"Chromium",
".",
"app",
"/",
"Contents",
"/",
"MacOS",
"/",
"Chromium",
".",
"Only",
"valid",
"for",
"bundles",
"."
] | def _GetBundleBinaryPath(self):
"""Returns the name of the bundle binary of by this target.
E.g. Chromium.app/Contents/MacOS/Chromium. Only valid for bundles."""
assert self._IsBundle()
return os.path.join(self.GetBundleExecutableFolderPath(), \
self.GetExecutableName()) | [
"def",
"_GetBundleBinaryPath",
"(",
"self",
")",
":",
"assert",
"self",
".",
"_IsBundle",
"(",
")",
"return",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"GetBundleExecutableFolderPath",
"(",
")",
",",
"self",
".",
"GetExecutableName",
"(",
")",
")"
... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/current/tools/gyp/pylib/gyp/xcode_emulation.py#L424-L429 | |
Alexhuszagh/rust-lexical | 01fcdcf8efc8850edb35d8fc65fd5f31bd0981a0 | scripts/size.py | python | plot_bar | (
xlabel=None,
data=None,
path=None,
title=None,
key=None
) | Plot a generic bar chart. | Plot a generic bar chart. | [
"Plot",
"a",
"generic",
"bar",
"chart",
"."
] | def plot_bar(
xlabel=None,
data=None,
path=None,
title=None,
key=None
):
'''Plot a generic bar chart.'''
keys = [i.split('_') for i in data.keys()]
xticks = sorted({i[1] for i in keys})
libraries = sorted({i[0] for i in keys})
def plot_ax(ax, xticks):
'''Plot an axis wi... | [
"def",
"plot_bar",
"(",
"xlabel",
"=",
"None",
",",
"data",
"=",
"None",
",",
"path",
"=",
"None",
",",
"title",
"=",
"None",
",",
"key",
"=",
"None",
")",
":",
"keys",
"=",
"[",
"i",
".",
"split",
"(",
"'_'",
")",
"for",
"i",
"in",
"data",
"... | https://github.com/Alexhuszagh/rust-lexical/blob/01fcdcf8efc8850edb35d8fc65fd5f31bd0981a0/scripts/size.py#L101-L141 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/matlib.py | python | eye | (n,M=None, k=0, dtype=float, order='C') | return asmatrix(np.eye(n, M=M, k=k, dtype=dtype, order=order)) | Return a matrix with ones on the diagonal and zeros elsewhere.
Parameters
----------
n : int
Number of rows in the output.
M : int, optional
Number of columns in the output, defaults to `n`.
k : int, optional
Index of the diagonal: 0 refers to the main diagonal,
a po... | Return a matrix with ones on the diagonal and zeros elsewhere. | [
"Return",
"a",
"matrix",
"with",
"ones",
"on",
"the",
"diagonal",
"and",
"zeros",
"elsewhere",
"."
] | def eye(n,M=None, k=0, dtype=float, order='C'):
"""
Return a matrix with ones on the diagonal and zeros elsewhere.
Parameters
----------
n : int
Number of rows in the output.
M : int, optional
Number of columns in the output, defaults to `n`.
k : int, optional
Index ... | [
"def",
"eye",
"(",
"n",
",",
"M",
"=",
"None",
",",
"k",
"=",
"0",
",",
"dtype",
"=",
"float",
",",
"order",
"=",
"'C'",
")",
":",
"return",
"asmatrix",
"(",
"np",
".",
"eye",
"(",
"n",
",",
"M",
"=",
"M",
",",
"k",
"=",
"k",
",",
"dtype"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/matlib.py#L176-L218 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/core/dtypes/base.py | python | ExtensionDtype._get_common_dtype | (self, dtypes: list[DtypeObj]) | Return the common dtype, if one exists.
Used in `find_common_type` implementation. This is for example used
to determine the resulting dtype in a concat operation.
If no common dtype exists, return None (which gives the other dtypes
the chance to determine a common dtype). If all dtype... | Return the common dtype, if one exists. | [
"Return",
"the",
"common",
"dtype",
"if",
"one",
"exists",
"."
] | def _get_common_dtype(self, dtypes: list[DtypeObj]) -> DtypeObj | None:
"""
Return the common dtype, if one exists.
Used in `find_common_type` implementation. This is for example used
to determine the resulting dtype in a concat operation.
If no common dtype exists, return None... | [
"def",
"_get_common_dtype",
"(",
"self",
",",
"dtypes",
":",
"list",
"[",
"DtypeObj",
"]",
")",
"->",
"DtypeObj",
"|",
"None",
":",
"if",
"len",
"(",
"set",
"(",
"dtypes",
")",
")",
"==",
"1",
":",
"# only itself",
"return",
"self",
"else",
":",
"ret... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/dtypes/base.py#L335-L361 | ||
microsoft/BlingFire | 7634ad43b521ee6a596266d82c3f0c46cd43e222 | scripts/tokenization.py | python | _is_control | (char) | return False | Checks whether `chars` is a control character. | Checks whether `chars` is a control character. | [
"Checks",
"whether",
"chars",
"is",
"a",
"control",
"character",
"."
] | def _is_control(char):
"""Checks whether `chars` is a control character."""
# These are technically control characters but we count them as whitespace
# characters.
if char == "\t" or char == "\n" or char == "\r":
return False
cat = unicodedata.category(char)
if cat.startswith("C"):
return True
re... | [
"def",
"_is_control",
"(",
"char",
")",
":",
"# These are technically control characters but we count them as whitespace",
"# characters.",
"if",
"char",
"==",
"\"\\t\"",
"or",
"char",
"==",
"\"\\n\"",
"or",
"char",
"==",
"\"\\r\"",
":",
"return",
"False",
"cat",
"=",... | https://github.com/microsoft/BlingFire/blob/7634ad43b521ee6a596266d82c3f0c46cd43e222/scripts/tokenization.py#L374-L383 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/dygraph/amp/loss_scaler.py | python | AmpScaler.set_incr_every_n_steps | (self, new_incr_every_n_steps) | Set the num `n` by `new_incr_every_n_steps`, `n` represent increases loss scaling every `n` consecutive steps with finite gradients.
Args:
new_incr_every_n_steps(int): The new_incr_every_n_steps used to update the num `n`, `n` represent increases loss scaling every `n` consecutive steps with finit... | Set the num `n` by `new_incr_every_n_steps`, `n` represent increases loss scaling every `n` consecutive steps with finite gradients. | [
"Set",
"the",
"num",
"n",
"by",
"new_incr_every_n_steps",
"n",
"represent",
"increases",
"loss",
"scaling",
"every",
"n",
"consecutive",
"steps",
"with",
"finite",
"gradients",
"."
] | def set_incr_every_n_steps(self, new_incr_every_n_steps):
"""
Set the num `n` by `new_incr_every_n_steps`, `n` represent increases loss scaling every `n` consecutive steps with finite gradients.
Args:
new_incr_every_n_steps(int): The new_incr_every_n_steps used to update the num `n... | [
"def",
"set_incr_every_n_steps",
"(",
"self",
",",
"new_incr_every_n_steps",
")",
":",
"self",
".",
"_incr_every_n_steps",
"=",
"new_incr_every_n_steps"
] | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/dygraph/amp/loss_scaler.py#L418-L425 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/src/motionplanning.py | python | CSpaceInterface.__init__ | (self, *args) | __init__(CSpaceInterface self) -> CSpaceInterface
__init__(CSpaceInterface self, CSpaceInterface arg2) -> CSpaceInterface | __init__(CSpaceInterface self) -> CSpaceInterface
__init__(CSpaceInterface self, CSpaceInterface arg2) -> CSpaceInterface | [
"__init__",
"(",
"CSpaceInterface",
"self",
")",
"-",
">",
"CSpaceInterface",
"__init__",
"(",
"CSpaceInterface",
"self",
"CSpaceInterface",
"arg2",
")",
"-",
">",
"CSpaceInterface"
] | def __init__(self, *args):
"""
__init__(CSpaceInterface self) -> CSpaceInterface
__init__(CSpaceInterface self, CSpaceInterface arg2) -> CSpaceInterface
"""
this = _motionplanning.new_CSpaceInterface(*args)
try:
self.this.append(this)
except Excepti... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
")",
":",
"this",
"=",
"_motionplanning",
".",
"new_CSpaceInterface",
"(",
"*",
"args",
")",
"try",
":",
"self",
".",
"this",
".",
"append",
"(",
"this",
")",
"except",
"Exception",
":",
"self",
".",
... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/src/motionplanning.py#L310-L322 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/pkg_resources/_vendor/pyparsing.py | python | ParserElement.leaveWhitespace | ( self ) | return self | Disables the skipping of whitespace before matching the characters in the
C{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
C{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",
"C",
"{",
"ParserElement",
"}",
"s",
"defined",
"pattern",
".",
"This",
"is",
"normally",
"only",
"used",
"internally",
"by",
"the",
"pyparsing",
"module... | def leaveWhitespace( self ):
"""
Disables the skipping of whitespace before matching the characters in the
C{ParserElement}'s defined pattern. This is normally only used internally by
the pyparsing module, but may be needed in some whitespace-sensitive grammars.
"""
self... | [
"def",
"leaveWhitespace",
"(",
"self",
")",
":",
"self",
".",
"skipWhitespace",
"=",
"False",
"return",
"self"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/pkg_resources/_vendor/pyparsing.py#L2011-L2018 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/protobuf/py2/google/protobuf/text_format.py | python | Tokenizer.ParseErrorPreviousToken | (self, message) | return ParseError(message, self._previous_line + 1,
self._previous_column + 1) | Creates and *returns* a ParseError for the previously read token.
Args:
message: A message to set for the exception.
Returns:
A ParseError instance. | Creates and *returns* a ParseError for the previously read token. | [
"Creates",
"and",
"*",
"returns",
"*",
"a",
"ParseError",
"for",
"the",
"previously",
"read",
"token",
"."
] | def ParseErrorPreviousToken(self, message):
"""Creates and *returns* a ParseError for the previously read token.
Args:
message: A message to set for the exception.
Returns:
A ParseError instance.
"""
return ParseError(message, self._previous_line + 1,
self._previo... | [
"def",
"ParseErrorPreviousToken",
"(",
"self",
",",
"message",
")",
":",
"return",
"ParseError",
"(",
"message",
",",
"self",
".",
"_previous_line",
"+",
"1",
",",
"self",
".",
"_previous_column",
"+",
"1",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/protobuf/py2/google/protobuf/text_format.py#L1531-L1541 | |
etternagame/etterna | 8775f74ac9c353320128609d4b4150672e9a6d04 | extern/crashpad/crashpad/third_party/mini_chromium/mini_chromium/build/ios/sdk_info.py | python | SplitVersion | (version) | return itertools.islice(itertools.chain(version, itertools.repeat('0')), 0, 3) | Splits the Xcode version to 3 values.
>>> list(SplitVersion('8.2.1.1'))
['8', '2', '1']
>>> list(SplitVersion('9.3'))
['9', '3', '0']
>>> list(SplitVersion('10.0'))
['10', '0', '0'] | Splits the Xcode version to 3 values. | [
"Splits",
"the",
"Xcode",
"version",
"to",
"3",
"values",
"."
] | def SplitVersion(version):
"""Splits the Xcode version to 3 values.
>>> list(SplitVersion('8.2.1.1'))
['8', '2', '1']
>>> list(SplitVersion('9.3'))
['9', '3', '0']
>>> list(SplitVersion('10.0'))
['10', '0', '0']
"""
version = version.split('.')
return itertools.islice(itertools.chain(version, itert... | [
"def",
"SplitVersion",
"(",
"version",
")",
":",
"version",
"=",
"version",
".",
"split",
"(",
"'.'",
")",
"return",
"itertools",
".",
"islice",
"(",
"itertools",
".",
"chain",
"(",
"version",
",",
"itertools",
".",
"repeat",
"(",
"'0'",
")",
")",
",",... | https://github.com/etternagame/etterna/blob/8775f74ac9c353320128609d4b4150672e9a6d04/extern/crashpad/crashpad/third_party/mini_chromium/mini_chromium/build/ios/sdk_info.py#L21-L32 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/Jinja2/py2/jinja2/environment.py | python | Environment.compile_expression | (self, source, undefined_to_none=True) | return TemplateExpression(template, undefined_to_none) | A handy helper method that returns a callable that accepts keyword
arguments that appear as variables in the expression. If called it
returns the result of the expression.
This is useful if applications want to use the same rules as Jinja
in template "configuration files" or similar si... | A handy helper method that returns a callable that accepts keyword
arguments that appear as variables in the expression. If called it
returns the result of the expression. | [
"A",
"handy",
"helper",
"method",
"that",
"returns",
"a",
"callable",
"that",
"accepts",
"keyword",
"arguments",
"that",
"appear",
"as",
"variables",
"in",
"the",
"expression",
".",
"If",
"called",
"it",
"returns",
"the",
"result",
"of",
"the",
"expression",
... | def compile_expression(self, source, undefined_to_none=True):
"""A handy helper method that returns a callable that accepts keyword
arguments that appear as variables in the expression. If called it
returns the result of the expression.
This is useful if applications want to use the sa... | [
"def",
"compile_expression",
"(",
"self",
",",
"source",
",",
"undefined_to_none",
"=",
"True",
")",
":",
"parser",
"=",
"Parser",
"(",
"self",
",",
"source",
",",
"state",
"=",
"\"variable\"",
")",
"try",
":",
"expr",
"=",
"parser",
".",
"parse_expression... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/Jinja2/py2/jinja2/environment.py#L640-L682 | |
jackaudio/jack2 | 21b293dbc37d42446141a08922cdec0d2550c6a0 | waflib/Utils.py | python | lru_cache.__init__ | (self, maxlen=100) | Maximum amount of elements in the cache | Maximum amount of elements in the cache | [
"Maximum",
"amount",
"of",
"elements",
"in",
"the",
"cache"
] | def __init__(self, maxlen=100):
self.maxlen = maxlen
"""
Maximum amount of elements in the cache
"""
self.table = {}
"""
Mapping key-value
"""
self.head = lru_node()
self.head.next = self.head
self.head.prev = self.head | [
"def",
"__init__",
"(",
"self",
",",
"maxlen",
"=",
"100",
")",
":",
"self",
".",
"maxlen",
"=",
"maxlen",
"self",
".",
"table",
"=",
"{",
"}",
"\"\"\"\n\t\tMapping key-value\n\t\t\"\"\"",
"self",
".",
"head",
"=",
"lru_node",
"(",
")",
"self",
".",
"hea... | https://github.com/jackaudio/jack2/blob/21b293dbc37d42446141a08922cdec0d2550c6a0/waflib/Utils.py#L133-L144 | ||
microsoft/ivy | 9f3c7ecc0b2383129fdd0953e10890d98d09a82d | ivy/ivy_dafny_grammar.py | python | p_expr_expr_LE_expr | (p) | expr : expr LE expr | expr : expr LE expr | [
"expr",
":",
"expr",
"LE",
"expr"
] | def p_expr_expr_LE_expr(p):
'expr : expr LE expr'
p[0] = da.App(da.InfixRelation(p[2]),p[1],p[3])
p[0].lineno = p.lineno(2) | [
"def",
"p_expr_expr_LE_expr",
"(",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"da",
".",
"App",
"(",
"da",
".",
"InfixRelation",
"(",
"p",
"[",
"2",
"]",
")",
",",
"p",
"[",
"1",
"]",
",",
"p",
"[",
"3",
"]",
")",
"p",
"[",
"0",
"]",
".",
... | https://github.com/microsoft/ivy/blob/9f3c7ecc0b2383129fdd0953e10890d98d09a82d/ivy/ivy_dafny_grammar.py#L212-L215 | ||
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/contrib/distributions/python/ops/exponential.py | python | Exponential.__init__ | (
self, lam, validate_args=True, allow_nan_stats=False, name="Exponential") | Construct Exponential distribution with parameter `lam`.
Args:
lam: Floating point tensor, the rate of the distribution(s).
`lam` must contain only positive values.
validate_args: Whether to assert that `lam > 0`, and that `x > 0` in the
methods `prob(x)` and `log_prob(x)`. If `validat... | Construct Exponential distribution with parameter `lam`. | [
"Construct",
"Exponential",
"distribution",
"with",
"parameter",
"lam",
"."
] | def __init__(
self, lam, validate_args=True, allow_nan_stats=False, name="Exponential"):
"""Construct Exponential distribution with parameter `lam`.
Args:
lam: Floating point tensor, the rate of the distribution(s).
`lam` must contain only positive values.
validate_args: Whether to as... | [
"def",
"__init__",
"(",
"self",
",",
"lam",
",",
"validate_args",
"=",
"True",
",",
"allow_nan_stats",
"=",
"False",
",",
"name",
"=",
"\"Exponential\"",
")",
":",
"# Even though all statistics of are defined for valid inputs, this is not",
"# true in the parent class \"Gam... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/contrib/distributions/python/ops/exponential.py#L44-L71 | ||
physercoe/starquant | c00cad64d1de2da05081b3dc320ef264c6295e08 | cppsrc/fmt-5.3.0/doc/build.py | python | pip_install | (package, commit=None, **kwargs) | Install package using pip. | Install package using pip. | [
"Install",
"package",
"using",
"pip",
"."
] | def pip_install(package, commit=None, **kwargs):
"Install package using pip."
min_version = kwargs.get('min_version')
if min_version:
from pkg_resources import get_distribution, DistributionNotFound
try:
installed_version = get_distribution(os.path.basename(package)).version
if LooseVersion(in... | [
"def",
"pip_install",
"(",
"package",
",",
"commit",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"min_version",
"=",
"kwargs",
".",
"get",
"(",
"'min_version'",
")",
"if",
"min_version",
":",
"from",
"pkg_resources",
"import",
"get_distribution",
",",
... | https://github.com/physercoe/starquant/blob/c00cad64d1de2da05081b3dc320ef264c6295e08/cppsrc/fmt-5.3.0/doc/build.py#L11-L26 | ||
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/ninja/misc/write_fake_manifests.py | python | FileWriter | (path) | Context manager for a ninja_syntax object writing to a file. | Context manager for a ninja_syntax object writing to a file. | [
"Context",
"manager",
"for",
"a",
"ninja_syntax",
"object",
"writing",
"to",
"a",
"file",
"."
] | def FileWriter(path):
"""Context manager for a ninja_syntax object writing to a file."""
try:
os.makedirs(os.path.dirname(path))
except OSError:
pass
f = open(path, 'w')
yield ninja_syntax.Writer(f)
f.close() | [
"def",
"FileWriter",
"(",
"path",
")",
":",
"try",
":",
"os",
".",
"makedirs",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"path",
")",
")",
"except",
"OSError",
":",
"pass",
"f",
"=",
"open",
"(",
"path",
",",
"'w'",
")",
"yield",
"ninja_syntax",... | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/ninja/misc/write_fake_manifests.py#L215-L223 | ||
stack-of-tasks/pinocchio | 593d4d43fded997bb9aa2421f4e55294dbd233c4 | bindings/python/pinocchio/robot_wrapper.py | python | RobotWrapper.initViewer | (self, *args, **kwargs) | Init the viewer | Init the viewer | [
"Init",
"the",
"viewer"
] | def initViewer(self, *args, **kwargs):
"""Init the viewer"""
# Set viewer to use to gepetto-gui.
if self.viz is None:
from .visualize import GepettoVisualizer
self.viz = GepettoVisualizer(self.model, self.collision_model, self.visual_model)
self.viz.initViewer(*a... | [
"def",
"initViewer",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Set viewer to use to gepetto-gui.",
"if",
"self",
".",
"viz",
"is",
"None",
":",
"from",
".",
"visualize",
"import",
"GepettoVisualizer",
"self",
".",
"viz",
"=",
"Ge... | https://github.com/stack-of-tasks/pinocchio/blob/593d4d43fded997bb9aa2421f4e55294dbd233c4/bindings/python/pinocchio/robot_wrapper.py#L265-L272 | ||
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | src/bindings/python/src/openvino/runtime/opset1/ops.py | python | proposal | (
class_probs: Node,
bbox_deltas: Node,
image_shape: NodeInput,
attrs: dict,
name: Optional[str] = None,
) | return _get_node_factory_opset1().create(
"Proposal", [class_probs, bbox_deltas, as_node(image_shape)], attrs
) | Filter bounding boxes and outputs only those with the highest prediction confidence.
@param class_probs: 4D input floating point tensor with class prediction scores.
@param bbox_deltas: 4D input floating point tensor with box logits.
@param image_shape: The 1D input tensor with 3 o... | Filter bounding boxes and outputs only those with the highest prediction confidence. | [
"Filter",
"bounding",
"boxes",
"and",
"outputs",
"only",
"those",
"with",
"the",
"highest",
"prediction",
"confidence",
"."
] | def proposal(
class_probs: Node,
bbox_deltas: Node,
image_shape: NodeInput,
attrs: dict,
name: Optional[str] = None,
) -> Node:
"""Filter bounding boxes and outputs only those with the highest prediction confidence.
@param class_probs: 4D input floating point tensor with class predi... | [
"def",
"proposal",
"(",
"class_probs",
":",
"Node",
",",
"bbox_deltas",
":",
"Node",
",",
"image_shape",
":",
"NodeInput",
",",
"attrs",
":",
"dict",
",",
"name",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
")",
"->",
"Node",
":",
"requirements... | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/src/bindings/python/src/openvino/runtime/opset1/ops.py#L2043-L2174 | |
cvxpy/cvxpy | 5165b4fb750dfd237de8659383ef24b4b2e33aaf | cvxpy/atoms/affine/diag.py | python | diag_vec.is_atom_log_log_concave | (self) | return True | Is the atom log-log concave? | Is the atom log-log concave? | [
"Is",
"the",
"atom",
"log",
"-",
"log",
"concave?"
] | def is_atom_log_log_concave(self) -> bool:
"""Is the atom log-log concave?
"""
return True | [
"def",
"is_atom_log_log_concave",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"True"
] | https://github.com/cvxpy/cvxpy/blob/5165b4fb750dfd237de8659383ef24b4b2e33aaf/cvxpy/atoms/affine/diag.py#L61-L64 | |
eclipse/sumo | 7132a9b8b6eea734bdec38479026b4d8c4336d03 | tools/contributed/sumopy/coremodules/simulation/wxgui.py | python | WxGui.on_maroute | (self, event=None) | Simulate scenario with Macrosopic router (marouter). | Simulate scenario with Macrosopic router (marouter). | [
"Simulate",
"scenario",
"with",
"Macrosopic",
"router",
"(",
"marouter",
")",
"."
] | def on_maroute(self, event=None):
"""Simulate scenario with Macrosopic router (marouter).
"""
p = routing.MaRouter(self.get_scenario(),
results=self._simulation.results,
logger=self._mainframe.get_logger(),
)... | [
"def",
"on_maroute",
"(",
"self",
",",
"event",
"=",
"None",
")",
":",
"p",
"=",
"routing",
".",
"MaRouter",
"(",
"self",
".",
"get_scenario",
"(",
")",
",",
"results",
"=",
"self",
".",
"_simulation",
".",
"results",
",",
"logger",
"=",
"self",
".",... | https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/contributed/sumopy/coremodules/simulation/wxgui.py#L872-L901 | ||
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | tools/mo/openvino/tools/mo/front/kaldi/loader/utils.py | python | find_end_of_component | (file_desc: io.BufferedReader, component: str, end_tags: tuple = ()) | return next_tag, file_desc.tell() | Find an index and a tag of the ent of the component
:param file_desc: file descriptor
:param component: component from supported_components
:param end_tags: specific end tags
:return: the index and the tag of the end of the component | Find an index and a tag of the ent of the component
:param file_desc: file descriptor
:param component: component from supported_components
:param end_tags: specific end tags
:return: the index and the tag of the end of the component | [
"Find",
"an",
"index",
"and",
"a",
"tag",
"of",
"the",
"ent",
"of",
"the",
"component",
":",
"param",
"file_desc",
":",
"file",
"descriptor",
":",
"param",
"component",
":",
"component",
"from",
"supported_components",
":",
"param",
"end_tags",
":",
"specifi... | def find_end_of_component(file_desc: io.BufferedReader, component: str, end_tags: tuple = ()):
"""
Find an index and a tag of the ent of the component
:param file_desc: file descriptor
:param component: component from supported_components
:param end_tags: specific end tags
:return: the index and... | [
"def",
"find_end_of_component",
"(",
"file_desc",
":",
"io",
".",
"BufferedReader",
",",
"component",
":",
"str",
",",
"end_tags",
":",
"tuple",
"=",
"(",
")",
")",
":",
"end_tags_of_component",
"=",
"[",
"'</{}>'",
".",
"format",
"(",
"component",
")",
",... | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/tools/mo/openvino/tools/mo/front/kaldi/loader/utils.py#L216-L232 | |
llvm-mirror/lldb | d01083a850f577b85501a0902b52fd0930de72c7 | utils/vim-lldb/python-vim-lldb/vim_panes.py | python | BacktracePane.get_selected_line | (self) | Returns the line number in the buffer with the selected frame.
Formula: selected_line = selected_frame_id + 2
FIXME: the above formula hack does not work when the function return
value is printed in the bt window; the wrong line is highlighted. | Returns the line number in the buffer with the selected frame.
Formula: selected_line = selected_frame_id + 2
FIXME: the above formula hack does not work when the function return
value is printed in the bt window; the wrong line is highlighted. | [
"Returns",
"the",
"line",
"number",
"in",
"the",
"buffer",
"with",
"the",
"selected",
"frame",
".",
"Formula",
":",
"selected_line",
"=",
"selected_frame_id",
"+",
"2",
"FIXME",
":",
"the",
"above",
"formula",
"hack",
"does",
"not",
"work",
"when",
"the",
... | def get_selected_line(self):
""" Returns the line number in the buffer with the selected frame.
Formula: selected_line = selected_frame_id + 2
FIXME: the above formula hack does not work when the function return
value is printed in the bt window; the wrong line is high... | [
"def",
"get_selected_line",
"(",
"self",
")",
":",
"(",
"frame",
",",
"err",
")",
"=",
"get_selected_frame",
"(",
"self",
".",
"target",
")",
"if",
"frame",
"is",
"None",
":",
"return",
"None",
"else",
":",
"return",
"frame",
".",
"GetFrameID",
"(",
")... | https://github.com/llvm-mirror/lldb/blob/d01083a850f577b85501a0902b52fd0930de72c7/utils/vim-lldb/python-vim-lldb/vim_panes.py#L645-L656 | ||
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | tools/symsrc/pefile.py | python | PE.dump_info | (self, dump=None) | return dump.get_text() | Dump all the PE header information into human readable string. | Dump all the PE header information into human readable string. | [
"Dump",
"all",
"the",
"PE",
"header",
"information",
"into",
"human",
"readable",
"string",
"."
] | def dump_info(self, dump=None):
"""Dump all the PE header information into human readable string."""
if dump is None:
dump = Dump()
warnings = self.get_warnings()
if warnings:
dump.add_header('Parsing Warnings')
for warning i... | [
"def",
"dump_info",
"(",
"self",
",",
"dump",
"=",
"None",
")",
":",
"if",
"dump",
"is",
"None",
":",
"dump",
"=",
"Dump",
"(",
")",
"warnings",
"=",
"self",
".",
"get_warnings",
"(",
")",
"if",
"warnings",
":",
"dump",
".",
"add_header",
"(",
"'Pa... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/tools/symsrc/pefile.py#L3106-L3378 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/tools/inspector_protocol/jinja2/runtime.py | python | Macro._invoke | (self, arguments, autoescape) | return rv | This method is being swapped out by the async implementation. | This method is being swapped out by the async implementation. | [
"This",
"method",
"is",
"being",
"swapped",
"out",
"by",
"the",
"async",
"implementation",
"."
] | def _invoke(self, arguments, autoescape):
"""This method is being swapped out by the async implementation."""
rv = self._func(*arguments)
if autoescape:
rv = Markup(rv)
return rv | [
"def",
"_invoke",
"(",
"self",
",",
"arguments",
",",
"autoescape",
")",
":",
"rv",
"=",
"self",
".",
"_func",
"(",
"*",
"arguments",
")",
"if",
"autoescape",
":",
"rv",
"=",
"Markup",
"(",
"rv",
")",
"return",
"rv"
] | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/tools/inspector_protocol/jinja2/runtime.py#L577-L582 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/ftplib.py | python | FTP.getwelcome | (self) | return self.welcome | Get the welcome message from the server.
(this is read and squirreled away by connect()) | Get the welcome message from the server.
(this is read and squirreled away by connect()) | [
"Get",
"the",
"welcome",
"message",
"from",
"the",
"server",
".",
"(",
"this",
"is",
"read",
"and",
"squirreled",
"away",
"by",
"connect",
"()",
")"
] | def getwelcome(self):
'''Get the welcome message from the server.
(this is read and squirreled away by connect())'''
if self.debugging:
print '*welcome*', self.sanitize(self.welcome)
return self.welcome | [
"def",
"getwelcome",
"(",
"self",
")",
":",
"if",
"self",
".",
"debugging",
":",
"print",
"'*welcome*'",
",",
"self",
".",
"sanitize",
"(",
"self",
".",
"welcome",
")",
"return",
"self",
".",
"welcome"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/ftplib.py#L138-L143 | |
intel/caffe | 3f494b442ee3f9d17a07b09ecbd5fa2bbda00836 | scripts/cpp_lint.py | python | _NestingState.UpdatePreprocessor | (self, line) | Update preprocessor stack.
We need to handle preprocessors due to classes like this:
#ifdef SWIG
struct ResultDetailsPageElementExtensionPoint {
#else
struct ResultDetailsPageElementExtensionPoint : public Extension {
#endif
We make the following assumptions (good enough for most... | Update preprocessor stack. | [
"Update",
"preprocessor",
"stack",
"."
] | def UpdatePreprocessor(self, line):
"""Update preprocessor stack.
We need to handle preprocessors due to classes like this:
#ifdef SWIG
struct ResultDetailsPageElementExtensionPoint {
#else
struct ResultDetailsPageElementExtensionPoint : public Extension {
#endif
We make the ... | [
"def",
"UpdatePreprocessor",
"(",
"self",
",",
"line",
")",
":",
"if",
"Match",
"(",
"r'^\\s*#\\s*(if|ifdef|ifndef)\\b'",
",",
"line",
")",
":",
"# Beginning of #if block, save the nesting stack here. The saved",
"# stack will allow us to restore the parsing state in the #else cas... | https://github.com/intel/caffe/blob/3f494b442ee3f9d17a07b09ecbd5fa2bbda00836/scripts/cpp_lint.py#L1952-L2006 | ||
microsoft/TSS.MSR | 0f2516fca2cd9929c31d5450e39301c9bde43688 | TSS.Py/src/Tpm.py | python | Tpm.HMAC_Start | (self, handle, auth, hashAlg) | return res.handle if res else None | This command starts an HMAC sequence. The TPM will create and
initialize an HMAC sequence structure, assign a handle to the sequence,
and set the authValue of the sequence object to the value in auth.
Args:
handle (TPM_HANDLE): Handle of an HMAC key
Auth Index: 1
... | This command starts an HMAC sequence. The TPM will create and
initialize an HMAC sequence structure, assign a handle to the sequence,
and set the authValue of the sequence object to the value in auth. | [
"This",
"command",
"starts",
"an",
"HMAC",
"sequence",
".",
"The",
"TPM",
"will",
"create",
"and",
"initialize",
"an",
"HMAC",
"sequence",
"structure",
"assign",
"a",
"handle",
"to",
"the",
"sequence",
"and",
"set",
"the",
"authValue",
"of",
"the",
"sequence... | def HMAC_Start(self, handle, auth, hashAlg):
""" This command starts an HMAC sequence. The TPM will create and
initialize an HMAC sequence structure, assign a handle to the sequence,
and set the authValue of the sequence object to the value in auth.
Args:
handle (TPM_HANDLE)... | [
"def",
"HMAC_Start",
"(",
"self",
",",
"handle",
",",
"auth",
",",
"hashAlg",
")",
":",
"req",
"=",
"TPM2_HMAC_Start_REQUEST",
"(",
"handle",
",",
"auth",
",",
"hashAlg",
")",
"respBuf",
"=",
"self",
".",
"dispatchCommand",
"(",
"TPM_CC",
".",
"HMAC_Start"... | https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/Tpm.py#L805-L823 | |
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/contrib/slim/python/slim/data/tfexample_decoder.py | python | Image.__init__ | (self, image_key=None, format_key=None, shape=None,
channels=3) | Initializes the image.
Args:
image_key: the name of the TF-Example feature in which the encoded image
is stored.
format_key: the name of the TF-Example feature in which the encoded image
is stored.
shape: the output shape of the image. If provided, the image is reshaped
ac... | Initializes the image. | [
"Initializes",
"the",
"image",
"."
] | def __init__(self, image_key=None, format_key=None, shape=None,
channels=3):
"""Initializes the image.
Args:
image_key: the name of the TF-Example feature in which the encoded image
is stored.
format_key: the name of the TF-Example feature in which the encoded image
i... | [
"def",
"__init__",
"(",
"self",
",",
"image_key",
"=",
"None",
",",
"format_key",
"=",
"None",
",",
"shape",
"=",
"None",
",",
"channels",
"=",
"3",
")",
":",
"if",
"not",
"image_key",
":",
"image_key",
"=",
"'image/encoded'",
"if",
"not",
"format_key",
... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/contrib/slim/python/slim/data/tfexample_decoder.py#L222-L245 | ||
eclipse/sumo | 7132a9b8b6eea734bdec38479026b4d8c4336d03 | tools/turn-defs/turndefinitions.py | python | TurnDefinitions.get_turning_probability | (self,
source,
destination) | return self.turn_definitions[source][destination] | Returns the turning probability related to the given
turn definition. The source and destination must have
been added before. | Returns the turning probability related to the given
turn definition. The source and destination must have
been added before. | [
"Returns",
"the",
"turning",
"probability",
"related",
"to",
"the",
"given",
"turn",
"definition",
".",
"The",
"source",
"and",
"destination",
"must",
"have",
"been",
"added",
"before",
"."
] | def get_turning_probability(self,
source,
destination):
""" Returns the turning probability related to the given
turn definition. The source and destination must have
been added before. """
return self.turn_definiti... | [
"def",
"get_turning_probability",
"(",
"self",
",",
"source",
",",
"destination",
")",
":",
"return",
"self",
".",
"turn_definitions",
"[",
"source",
"]",
"[",
"destination",
"]"
] | https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/turn-defs/turndefinitions.py#L85-L92 | |
jeog/TDAmeritradeAPI | 91c738afd7d57b54f6231170bd64c2550fafd34d | python/tdma_api/get.py | python | _APIGetter.get_timeout | (self) | return clib.get_val('APIGetter_GetTimeout_ABI', c_ulonglong, self._obj) | Get transfer timeout in milliseconds(NOT the connection timeout).
0 indicates no timeout(default). | Get transfer timeout in milliseconds(NOT the connection timeout). | [
"Get",
"transfer",
"timeout",
"in",
"milliseconds",
"(",
"NOT",
"the",
"connection",
"timeout",
")",
"."
] | def get_timeout(self):
"""Get transfer timeout in milliseconds(NOT the connection timeout).
0 indicates no timeout(default).
"""
return clib.get_val('APIGetter_GetTimeout_ABI', c_ulonglong, self._obj) | [
"def",
"get_timeout",
"(",
"self",
")",
":",
"return",
"clib",
".",
"get_val",
"(",
"'APIGetter_GetTimeout_ABI'",
",",
"c_ulonglong",
",",
"self",
".",
"_obj",
")"
] | https://github.com/jeog/TDAmeritradeAPI/blob/91c738afd7d57b54f6231170bd64c2550fafd34d/python/tdma_api/get.py#L246-L251 | |
gem5/gem5 | 141cc37c2d4b93959d4c249b8f7e6a8b2ef75338 | src/python/m5/util/fdthelper.py | python | FdtNode.append | (self, subnodes) | Change the behavior of the normal append to override if a node with
the same name already exists or merge if the name exists and is a node
type. Can also take a list of subnodes, that each get appended. | Change the behavior of the normal append to override if a node with
the same name already exists or merge if the name exists and is a node
type. Can also take a list of subnodes, that each get appended. | [
"Change",
"the",
"behavior",
"of",
"the",
"normal",
"append",
"to",
"override",
"if",
"a",
"node",
"with",
"the",
"same",
"name",
"already",
"exists",
"or",
"merge",
"if",
"the",
"name",
"exists",
"and",
"is",
"a",
"node",
"type",
".",
"Can",
"also",
"... | def append(self, subnodes):
"""Change the behavior of the normal append to override if a node with
the same name already exists or merge if the name exists and is a node
type. Can also take a list of subnodes, that each get appended."""
if not hasattr(subnodes, '__iter__'):
s... | [
"def",
"append",
"(",
"self",
",",
"subnodes",
")",
":",
"if",
"not",
"hasattr",
"(",
"subnodes",
",",
"'__iter__'",
")",
":",
"subnodes",
"=",
"[",
"subnodes",
"]",
"for",
"subnode",
"in",
"subnodes",
":",
"try",
":",
"if",
"not",
"issubclass",
"(",
... | https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/src/python/m5/util/fdthelper.py#L179-L201 | ||
google/filament | d21f092645b8e1e312307cbf89f1484891347c63 | third_party/libassimp/port/PyAssimp/scripts/transformations.py | python | projection_matrix | (point, normal, direction=None,
perspective=None, pseudo=False) | return M | Return matrix to project onto plane defined by point and normal.
Using either perspective point, projection direction, or none of both.
If pseudo is True, perspective projections will preserve relative depth
such that Perspective = dot(Orthogonal, PseudoPerspective).
>>> P = projection_matrix((0, 0, ... | Return matrix to project onto plane defined by point and normal. | [
"Return",
"matrix",
"to",
"project",
"onto",
"plane",
"defined",
"by",
"point",
"and",
"normal",
"."
] | def projection_matrix(point, normal, direction=None,
perspective=None, pseudo=False):
"""Return matrix to project onto plane defined by point and normal.
Using either perspective point, projection direction, or none of both.
If pseudo is True, perspective projections will preserve re... | [
"def",
"projection_matrix",
"(",
"point",
",",
"normal",
",",
"direction",
"=",
"None",
",",
"perspective",
"=",
"None",
",",
"pseudo",
"=",
"False",
")",
":",
"M",
"=",
"numpy",
".",
"identity",
"(",
"4",
")",
"point",
"=",
"numpy",
".",
"array",
"(... | https://github.com/google/filament/blob/d21f092645b8e1e312307cbf89f1484891347c63/third_party/libassimp/port/PyAssimp/scripts/transformations.py#L437-L496 | |
shogun-toolbox/shogun | 9b8d856971af5a295dd6ad70623ae45647a6334c | applications/easysvm/esvm/experiment.py | python | create_kernel | (kname,kparam,feats_train) | return kernel | Call the corresponding constructor for the kernel | Call the corresponding constructor for the kernel | [
"Call",
"the",
"corresponding",
"constructor",
"for",
"the",
"kernel"
] | def create_kernel(kname,kparam,feats_train):
"""Call the corresponding constructor for the kernel"""
if kname == 'gauss':
kernel = GaussianKernel(feats_train, feats_train, kparam['width'])
elif kname == 'linear':
kernel = LinearKernel(feats_train, feats_train)
kernel.set_normalizer(... | [
"def",
"create_kernel",
"(",
"kname",
",",
"kparam",
",",
"feats_train",
")",
":",
"if",
"kname",
"==",
"'gauss'",
":",
"kernel",
"=",
"GaussianKernel",
"(",
"feats_train",
",",
"feats_train",
",",
"kparam",
"[",
"'width'",
"]",
")",
"elif",
"kname",
"==",... | https://github.com/shogun-toolbox/shogun/blob/9b8d856971af5a295dd6ad70623ae45647a6334c/applications/easysvm/esvm/experiment.py#L195-L242 | |
alibaba/graph-learn | 54cafee9db3054dc310a28b856be7f97c7d5aee9 | graphlearn/python/sampler/negative_sampler.py | python | NegativeSampler.get | (self, ids) | return neg_nbrs | Get batched negative samples.
Args:
ids (numpy.array): A 1d numpy array of whose negative dst nodes
will be sampled.
Return:
A `Nodes` object, shape=[ids.shape, `expand_factor`]. | Get batched negative samples. | [
"Get",
"batched",
"negative",
"samples",
"."
] | def get(self, ids):
""" Get batched negative samples.
Args:
ids (numpy.array): A 1d numpy array of whose negative dst nodes
will be sampled.
Return:
A `Nodes` object, shape=[ids.shape, `expand_factor`].
"""
ids = np.array(ids).flatten()
req = self._make_req(ids)
res = ... | [
"def",
"get",
"(",
"self",
",",
"ids",
")",
":",
"ids",
"=",
"np",
".",
"array",
"(",
"ids",
")",
".",
"flatten",
"(",
")",
"req",
"=",
"self",
".",
"_make_req",
"(",
"ids",
")",
"res",
"=",
"pywrap",
".",
"new_sampling_response",
"(",
")",
"stat... | https://github.com/alibaba/graph-learn/blob/54cafee9db3054dc310a28b856be7f97c7d5aee9/graphlearn/python/sampler/negative_sampler.py#L64-L87 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/pip/vendor/distlib/_backport/tarfile.py | python | TarInfo._create_pax_generic_header | (cls, pax_headers, type, encoding) | return cls._create_header(info, USTAR_FORMAT, "ascii", "replace") + \
cls._create_payload(records) | Return a POSIX.1-2008 extended or global header sequence
that contains a list of keyword, value pairs. The values
must be strings. | Return a POSIX.1-2008 extended or global header sequence
that contains a list of keyword, value pairs. The values
must be strings. | [
"Return",
"a",
"POSIX",
".",
"1",
"-",
"2008",
"extended",
"or",
"global",
"header",
"sequence",
"that",
"contains",
"a",
"list",
"of",
"keyword",
"value",
"pairs",
".",
"The",
"values",
"must",
"be",
"strings",
"."
] | def _create_pax_generic_header(cls, pax_headers, type, encoding):
"""Return a POSIX.1-2008 extended or global header sequence
that contains a list of keyword, value pairs. The values
must be strings.
"""
# Check if one of the fields contains surrogate characters and thereby... | [
"def",
"_create_pax_generic_header",
"(",
"cls",
",",
"pax_headers",
",",
"type",
",",
"encoding",
")",
":",
"# Check if one of the fields contains surrogate characters and thereby",
"# forces hdrcharset=BINARY, see _proc_pax() for more information.",
"binary",
"=",
"False",
"for",... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/pip/vendor/distlib/_backport/tarfile.py#L1169-L1217 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.