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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
google/fhir | d77f57706c1a168529b0b87ca7ccb1c0113e83c2 | py/setup.py | python | _parse_requirements | (path: str) | Parses a requirements.txt file into a list of strings. | Parses a requirements.txt file into a list of strings. | [
"Parses",
"a",
"requirements",
".",
"txt",
"file",
"into",
"a",
"list",
"of",
"strings",
"."
] | def _parse_requirements(path: str) -> List[str]:
"""Parses a requirements.txt file into a list of strings."""
with open(os.path.join(_HERE, path), 'r') as f:
return [
line.rstrip()
for line in f
if not (line.isspace() or line.startswith('#'))
] | [
"def",
"_parse_requirements",
"(",
"path",
":",
"str",
")",
"->",
"List",
"[",
"str",
"]",
":",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"_HERE",
",",
"path",
")",
",",
"'r'",
")",
"as",
"f",
":",
"return",
"[",
"line",
".",
"r... | https://github.com/google/fhir/blob/d77f57706c1a168529b0b87ca7ccb1c0113e83c2/py/setup.py#L100-L107 | ||
opencv/opencv | 76aff8478883858f0e46746044348ebb16dc3c67 | samples/dnn/person_reid.py | python | normalize | (nparray, order=2, axis=0) | return nparray / (norm + np.finfo(np.float32).eps) | Normalize a N-D numpy array along the specified axis.
:param nparry: the array of vectors to be normalized
:param order: order of the norm
:param axis: the axis of x along which to compute the vector norms | Normalize a N-D numpy array along the specified axis.
:param nparry: the array of vectors to be normalized
:param order: order of the norm
:param axis: the axis of x along which to compute the vector norms | [
"Normalize",
"a",
"N",
"-",
"D",
"numpy",
"array",
"along",
"the",
"specified",
"axis",
".",
":",
"param",
"nparry",
":",
"the",
"array",
"of",
"vectors",
"to",
"be",
"normalized",
":",
"param",
"order",
":",
"order",
"of",
"the",
"norm",
":",
"param",... | def normalize(nparray, order=2, axis=0):
"""
Normalize a N-D numpy array along the specified axis.
:param nparry: the array of vectors to be normalized
:param order: order of the norm
:param axis: the axis of x along which to compute the vector norms
"""
norm = np.linalg.norm(nparray, ord=or... | [
"def",
"normalize",
"(",
"nparray",
",",
"order",
"=",
"2",
",",
"axis",
"=",
"0",
")",
":",
"norm",
"=",
"np",
".",
"linalg",
".",
"norm",
"(",
"nparray",
",",
"ord",
"=",
"order",
",",
"axis",
"=",
"axis",
",",
"keepdims",
"=",
"True",
")",
"... | https://github.com/opencv/opencv/blob/76aff8478883858f0e46746044348ebb16dc3c67/samples/dnn/person_reid.py#L116-L124 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/extern/flatnotebook.py | python | PageContainer.OnMouseEnterWindow | (self, event) | Handles the wx.EVT_ENTER_WINDOW event for L{PageContainer}. | Handles the wx.EVT_ENTER_WINDOW event for L{PageContainer}. | [
"Handles",
"the",
"wx",
".",
"EVT_ENTER_WINDOW",
"event",
"for",
"L",
"{",
"PageContainer",
"}",
"."
] | def OnMouseEnterWindow(self, event):
""" Handles the wx.EVT_ENTER_WINDOW event for L{PageContainer}. """
self._nLeftButtonStatus = FNB_BTN_NONE
self._nXButtonStatus = FNB_BTN_NONE
self._nRightButtonStatus = FNB_BTN_NONE
self._nLeftClickZone = FNB_BTN_NONE
self._nArrowDow... | [
"def",
"OnMouseEnterWindow",
"(",
"self",
",",
"event",
")",
":",
"self",
".",
"_nLeftButtonStatus",
"=",
"FNB_BTN_NONE",
"self",
".",
"_nXButtonStatus",
"=",
"FNB_BTN_NONE",
"self",
".",
"_nRightButtonStatus",
"=",
"FNB_BTN_NONE",
"self",
".",
"_nLeftClickZone",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/flatnotebook.py#L4538-L4547 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/io/json/_json.py | python | JsonReader._get_object_parser | (self, json) | return obj | Parses a json document into a pandas object. | Parses a json document into a pandas object. | [
"Parses",
"a",
"json",
"document",
"into",
"a",
"pandas",
"object",
"."
] | def _get_object_parser(self, json):
"""
Parses a json document into a pandas object.
"""
typ = self.typ
dtype = self.dtype
kwargs = {
"orient": self.orient,
"dtype": self.dtype,
"convert_axes": self.convert_axes,
"convert_da... | [
"def",
"_get_object_parser",
"(",
"self",
",",
"json",
")",
":",
"typ",
"=",
"self",
".",
"typ",
"dtype",
"=",
"self",
".",
"dtype",
"kwargs",
"=",
"{",
"\"orient\"",
":",
"self",
".",
"orient",
",",
"\"dtype\"",
":",
"self",
".",
"dtype",
",",
"\"co... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/io/json/_json.py#L735-L760 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/mutex.py | python | mutex.testandset | (self) | Atomic test-and-set -- grab the lock if it is not set,
return True if it succeeded. | Atomic test-and-set -- grab the lock if it is not set,
return True if it succeeded. | [
"Atomic",
"test",
"-",
"and",
"-",
"set",
"--",
"grab",
"the",
"lock",
"if",
"it",
"is",
"not",
"set",
"return",
"True",
"if",
"it",
"succeeded",
"."
] | def testandset(self):
"""Atomic test-and-set -- grab the lock if it is not set,
return True if it succeeded."""
if not self.locked:
self.locked = 1
return True
else:
return False | [
"def",
"testandset",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"locked",
":",
"self",
".",
"locked",
"=",
"1",
"return",
"True",
"else",
":",
"return",
"False"
] | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/mutex.py#L30-L37 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/Tkinter.py | python | Text.tag_unbind | (self, tagName, sequence, funcid=None) | Unbind for all characters with TAGNAME for event SEQUENCE the
function identified with FUNCID. | Unbind for all characters with TAGNAME for event SEQUENCE the
function identified with FUNCID. | [
"Unbind",
"for",
"all",
"characters",
"with",
"TAGNAME",
"for",
"event",
"SEQUENCE",
"the",
"function",
"identified",
"with",
"FUNCID",
"."
] | def tag_unbind(self, tagName, sequence, funcid=None):
"""Unbind for all characters with TAGNAME for event SEQUENCE the
function identified with FUNCID."""
self.tk.call(self._w, 'tag', 'bind', tagName, sequence, '')
if funcid:
self.deletecommand(funcid) | [
"def",
"tag_unbind",
"(",
"self",
",",
"tagName",
",",
"sequence",
",",
"funcid",
"=",
"None",
")",
":",
"self",
".",
"tk",
".",
"call",
"(",
"self",
".",
"_w",
",",
"'tag'",
",",
"'bind'",
",",
"tagName",
",",
"sequence",
",",
"''",
")",
"if",
"... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/Tkinter.py#L3105-L3110 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/jedi/jedi/api/classes.py | python | BaseDefinition.__init__ | (self, evaluator, name) | An instance of :class:`parso.reprsentation.Name` subclass. | An instance of :class:`parso.reprsentation.Name` subclass. | [
"An",
"instance",
"of",
":",
"class",
":",
"parso",
".",
"reprsentation",
".",
"Name",
"subclass",
"."
] | def __init__(self, evaluator, name):
self._evaluator = evaluator
self._name = name
"""
An instance of :class:`parso.reprsentation.Name` subclass.
"""
self.is_keyword = isinstance(self._name, KeywordName)
# generate a path to the definition
self._module = ... | [
"def",
"__init__",
"(",
"self",
",",
"evaluator",
",",
"name",
")",
":",
"self",
".",
"_evaluator",
"=",
"evaluator",
"self",
".",
"_name",
"=",
"name",
"self",
".",
"is_keyword",
"=",
"isinstance",
"(",
"self",
".",
"_name",
",",
"KeywordName",
")",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/jedi/jedi/api/classes.py#L57-L71 | ||
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | caffe2/python/memonger.py | python | _get_path | (pred_list, dist_list) | return list(reversed(ret)) | Get the path from nx.bellman_ford()'s output | Get the path from nx.bellman_ford()'s output | [
"Get",
"the",
"path",
"from",
"nx",
".",
"bellman_ford",
"()",
"s",
"output"
] | def _get_path(pred_list, dist_list):
''' Get the path from nx.bellman_ford()'s output '''
# distances are negative
assert all(dist_list[x] <= 0 for x in dist_list)
# node with longest distance to source is the target
target = min(dist_list, key=lambda x: dist_list[x])
ret = []
cur = target... | [
"def",
"_get_path",
"(",
"pred_list",
",",
"dist_list",
")",
":",
"# distances are negative",
"assert",
"all",
"(",
"dist_list",
"[",
"x",
"]",
"<=",
"0",
"for",
"x",
"in",
"dist_list",
")",
"# node with longest distance to source is the target",
"target",
"=",
"m... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/caffe2/python/memonger.py#L325-L345 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/reduction_gui/reduction/scripter.py | python | BaseScriptElement.to_xml | (self) | return "" | Return an XML representation of the data / state of the object | Return an XML representation of the data / state of the object | [
"Return",
"an",
"XML",
"representation",
"of",
"the",
"data",
"/",
"state",
"of",
"the",
"object"
] | def to_xml(self):
"""
Return an XML representation of the data / state of the object
"""
return "" | [
"def",
"to_xml",
"(",
"self",
")",
":",
"return",
"\"\""
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/reduction_gui/reduction/scripter.py#L73-L77 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/cuda/api.py | python | close | () | Explicitly clears all contexts in the current thread, and destroys all
contexts if the current thread is the main thread. | Explicitly clears all contexts in the current thread, and destroys all
contexts if the current thread is the main thread. | [
"Explicitly",
"clears",
"all",
"contexts",
"in",
"the",
"current",
"thread",
"and",
"destroys",
"all",
"contexts",
"if",
"the",
"current",
"thread",
"is",
"the",
"main",
"thread",
"."
] | def close():
"""
Explicitly clears all contexts in the current thread, and destroys all
contexts if the current thread is the main thread.
"""
devices.reset() | [
"def",
"close",
"(",
")",
":",
"devices",
".",
"reset",
"(",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/cuda/api.py#L351-L356 | ||
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Code/Tools/waf-1.7.13/waflib/Task.py | python | compile_fun_noshell | (line) | return (funex(fun), dvars) | Create a compiled function to execute a process without the shell
WARNING: this method may disappear anytime, so use compile_fun instead | Create a compiled function to execute a process without the shell
WARNING: this method may disappear anytime, so use compile_fun instead | [
"Create",
"a",
"compiled",
"function",
"to",
"execute",
"a",
"process",
"without",
"the",
"shell",
"WARNING",
":",
"this",
"method",
"may",
"disappear",
"anytime",
"so",
"use",
"compile_fun",
"instead"
] | def compile_fun_noshell(line):
"""
Create a compiled function to execute a process without the shell
WARNING: this method may disappear anytime, so use compile_fun instead
"""
extr = []
def repl(match):
g = match.group
if g('dollar'): return "$"
elif g('subst'): extr.append((g('var'), g('code'))); return "<... | [
"def",
"compile_fun_noshell",
"(",
"line",
")",
":",
"extr",
"=",
"[",
"]",
"def",
"repl",
"(",
"match",
")",
":",
"g",
"=",
"match",
".",
"group",
"if",
"g",
"(",
"'dollar'",
")",
":",
"return",
"\"$\"",
"elif",
"g",
"(",
"'subst'",
")",
":",
"e... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Code/Tools/waf-1.7.13/waflib/Task.py#L1070-L1122 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | third_party/closure_linter/closure_linter/requireprovidesorter.py | python | RequireProvideSorter._GetTokensMap | (self, tokens) | return tokens_map | Gets a map from object name to tokens associated with that object.
Starting from the goog.provide/goog.require token, searches backwards in the
token stream for any lines that start with a comment. These lines are
associated with the goog.provide/goog.require token. Also associates any
tokens on the sa... | Gets a map from object name to tokens associated with that object. | [
"Gets",
"a",
"map",
"from",
"object",
"name",
"to",
"tokens",
"associated",
"with",
"that",
"object",
"."
] | def _GetTokensMap(self, tokens):
"""Gets a map from object name to tokens associated with that object.
Starting from the goog.provide/goog.require token, searches backwards in the
token stream for any lines that start with a comment. These lines are
associated with the goog.provide/goog.require token. ... | [
"def",
"_GetTokensMap",
"(",
"self",
",",
"tokens",
")",
":",
"tokens_map",
"=",
"{",
"}",
"for",
"token",
"in",
"tokens",
":",
"object_name",
"=",
"tokenutil",
".",
"Search",
"(",
"token",
",",
"Type",
".",
"STRING_TEXT",
")",
".",
"string",
"# If the p... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/third_party/closure_linter/closure_linter/requireprovidesorter.py#L200-L247 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/distributed/distributed_c10d.py | python | is_mpi_available | () | return _MPI_AVAILABLE | Checks if the MPI backend is available. | Checks if the MPI backend is available. | [
"Checks",
"if",
"the",
"MPI",
"backend",
"is",
"available",
"."
] | def is_mpi_available():
"""
Checks if the MPI backend is available.
"""
return _MPI_AVAILABLE | [
"def",
"is_mpi_available",
"(",
")",
":",
"return",
"_MPI_AVAILABLE"
] | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/distributed/distributed_c10d.py#L384-L388 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/dataview.py | python | DataViewIconText.__init__ | (self, *args, **kwargs) | __init__(self, String text=wxEmptyString, Icon icon=wxNullIcon) -> DataViewIconText
DataViewIconText is used to hold the data for columns using the
`DataViewIconTextRenderer` | __init__(self, String text=wxEmptyString, Icon icon=wxNullIcon) -> DataViewIconText | [
"__init__",
"(",
"self",
"String",
"text",
"=",
"wxEmptyString",
"Icon",
"icon",
"=",
"wxNullIcon",
")",
"-",
">",
"DataViewIconText"
] | def __init__(self, *args, **kwargs):
"""
__init__(self, String text=wxEmptyString, Icon icon=wxNullIcon) -> DataViewIconText
DataViewIconText is used to hold the data for columns using the
`DataViewIconTextRenderer`
"""
_dataview.DataViewIconText_swiginit(self,_dataview... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_dataview",
".",
"DataViewIconText_swiginit",
"(",
"self",
",",
"_dataview",
".",
"new_DataViewIconText",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/dataview.py#L1293-L1300 | ||
hszhao/PSPNet | cf7e5a99ba37e46118026e96be5821a9bc63bde0 | 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/hszhao/PSPNet/blob/cf7e5a99ba37e46118026e96be5821a9bc63bde0/scripts/cpp_lint.py#L1948-L2002 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/share/gdb/python/gdb/command/frame_filters.py | python | SetFrameFilterPriority.complete | (self, text, word) | Completion function for both frame filter dictionary, and
frame filter name. | Completion function for both frame filter dictionary, and
frame filter name. | [
"Completion",
"function",
"for",
"both",
"frame",
"filter",
"dictionary",
"and",
"frame",
"filter",
"name",
"."
] | def complete(self, text, word):
"""Completion function for both frame filter dictionary, and
frame filter name."""
if text.count(" ") == 0:
return _complete_frame_filter_list(text, word, False)
else:
printer_list = gdb.frames.return_list(text.split()[0].rstrip())
... | [
"def",
"complete",
"(",
"self",
",",
"text",
",",
"word",
")",
":",
"if",
"text",
".",
"count",
"(",
"\" \"",
")",
"==",
"0",
":",
"return",
"_complete_frame_filter_list",
"(",
"text",
",",
"word",
",",
"False",
")",
"else",
":",
"printer_list",
"=",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/share/gdb/python/gdb/command/frame_filters.py#L355-L362 | ||
vslavik/poedit | f7a9daa0a10037e090aa0a86f5ce0f24ececdf6a | deps/boost/libs/metaparse/tools/benchmark/generate.py | python | out_filename | (template, n_val, mode) | return '{0}_{1}_{2}.cpp'.format(template.name, n_val, mode.identifier) | Determine the output filename | Determine the output filename | [
"Determine",
"the",
"output",
"filename"
] | def out_filename(template, n_val, mode):
"""Determine the output filename"""
return '{0}_{1}_{2}.cpp'.format(template.name, n_val, mode.identifier) | [
"def",
"out_filename",
"(",
"template",
",",
"n_val",
",",
"mode",
")",
":",
"return",
"'{0}_{1}_{2}.cpp'",
".",
"format",
"(",
"template",
".",
"name",
",",
"n_val",
",",
"mode",
".",
"identifier",
")"
] | https://github.com/vslavik/poedit/blob/f7a9daa0a10037e090aa0a86f5ce0f24ececdf6a/deps/boost/libs/metaparse/tools/benchmark/generate.py#L233-L235 | |
seladb/PcapPlusPlus | 6a9183ae9c156593fa18d6f78037f4ad236d91f9 | mk/setup_dpdk.py | python | display_devices | (title, dev_list, extra_params=None) | Displays to the user the details of a list of devices given in
"dev_list". The "extra_params" parameter, if given, should contain a string
with %()s fields in it for replacement by the named fields in each
device's dictionary. | Displays to the user the details of a list of devices given in
"dev_list". The "extra_params" parameter, if given, should contain a string
with %()s fields in it for replacement by the named fields in each
device's dictionary. | [
"Displays",
"to",
"the",
"user",
"the",
"details",
"of",
"a",
"list",
"of",
"devices",
"given",
"in",
"dev_list",
".",
"The",
"extra_params",
"parameter",
"if",
"given",
"should",
"contain",
"a",
"string",
"with",
"%",
"()",
"s",
"fields",
"in",
"it",
"f... | def display_devices(title, dev_list, extra_params=None):
"""Displays to the user the details of a list of devices given in
"dev_list". The "extra_params" parameter, if given, should contain a string
with %()s fields in it for replacement by the named fields in each
device's dictionary."""
strings ... | [
"def",
"display_devices",
"(",
"title",
",",
"dev_list",
",",
"extra_params",
"=",
"None",
")",
":",
"strings",
"=",
"[",
"]",
"# this holds the strings to print. We sort before printing",
"print",
"(",
"\"\\n%s\"",
"%",
"title",
")",
"print",
"(",
"\"=\"",
"*",
... | https://github.com/seladb/PcapPlusPlus/blob/6a9183ae9c156593fa18d6f78037f4ad236d91f9/mk/setup_dpdk.py#L583-L609 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/random.py | python | Random.choice | (self, seq) | return seq[int(self.random() * len(seq))] | Choose a random element from a non-empty sequence. | Choose a random element from a non-empty sequence. | [
"Choose",
"a",
"random",
"element",
"from",
"a",
"non",
"-",
"empty",
"sequence",
"."
] | def choice(self, seq):
"""Choose a random element from a non-empty sequence."""
return seq[int(self.random() * len(seq))] | [
"def",
"choice",
"(",
"self",
",",
"seq",
")",
":",
"return",
"seq",
"[",
"int",
"(",
"self",
".",
"random",
"(",
")",
"*",
"len",
"(",
"seq",
")",
")",
"]"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/random.py#L272-L274 | |
simsong/bulk_extractor | 738911df22b7066ca9e1662f4131fb44090a4196 | python/ttable.py | python | ttable.format_cell | (self,value,colNumber) | return (ret[0], self.col_alignment.get(colNumber,ret[1])) | Format a value that appears in a given colNumber. | Format a value that appears in a given colNumber. | [
"Format",
"a",
"value",
"that",
"appears",
"in",
"a",
"given",
"colNumber",
"."
] | def format_cell(self,value,colNumber):
""" Format a value that appears in a given colNumber."""
import decimal
ret = None
if value==None:
return ("",self.LEFT)
if value==0 and self.SUPPRESS_ZERO in self.options:
return ("",self.LEFT)
if is... | [
"def",
"format_cell",
"(",
"self",
",",
"value",
",",
"colNumber",
")",
":",
"import",
"decimal",
"ret",
"=",
"None",
"if",
"value",
"==",
"None",
":",
"return",
"(",
"\"\"",
",",
"self",
".",
"LEFT",
")",
"if",
"value",
"==",
"0",
"and",
"self",
"... | https://github.com/simsong/bulk_extractor/blob/738911df22b7066ca9e1662f4131fb44090a4196/python/ttable.py#L188-L206 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/ast.py | python | iter_fields | (node) | Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields``
that is present on *node*. | Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields``
that is present on *node*. | [
"Yield",
"a",
"tuple",
"of",
"(",
"fieldname",
"value",
")",
"for",
"each",
"field",
"in",
"node",
".",
"_fields",
"that",
"is",
"present",
"on",
"*",
"node",
"*",
"."
] | def iter_fields(node):
"""
Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields``
that is present on *node*.
"""
for field in node._fields:
try:
yield field, getattr(node, field)
except AttributeError:
pass | [
"def",
"iter_fields",
"(",
"node",
")",
":",
"for",
"field",
"in",
"node",
".",
"_fields",
":",
"try",
":",
"yield",
"field",
",",
"getattr",
"(",
"node",
",",
"field",
")",
"except",
"AttributeError",
":",
"pass"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/ast.py#L161-L170 | ||
arangodb/arangodb | 0d658689c7d1b721b314fa3ca27d38303e1570c8 | 3rdParty/V8/gyp/generator/analyzer.py | python | _WriteOutput | (params, **values) | Writes the output, either to stdout or a file is specified. | Writes the output, either to stdout or a file is specified. | [
"Writes",
"the",
"output",
"either",
"to",
"stdout",
"or",
"a",
"file",
"is",
"specified",
"."
] | def _WriteOutput(params, **values):
"""Writes the output, either to stdout or a file is specified."""
if 'error' in values:
print('Error:', values['error'])
if 'status' in values:
print(values['status'])
if 'targets' in values:
values['targets'].sort()
print('Supplied targets that depend on chan... | [
"def",
"_WriteOutput",
"(",
"params",
",",
"*",
"*",
"values",
")",
":",
"if",
"'error'",
"in",
"values",
":",
"print",
"(",
"'Error:'",
",",
"values",
"[",
"'error'",
"]",
")",
"if",
"'status'",
"in",
"values",
":",
"print",
"(",
"values",
"[",
"'st... | https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/V8/gyp/generator/analyzer.py#L509-L551 | ||
apache/qpid-proton | 6bcdfebb55ea3554bc29b1901422532db331a591 | python/proton/_data.py | python | Data.decode | (self, encoded: bytes) | return self._check(pn_data_decode(self._data, encoded)) | Decodes the first value from supplied AMQP data and returns the
number of bytes consumed.
:param encoded: AMQP encoded binary data
:raise: :exc:`DataException` if there is a Proton error. | Decodes the first value from supplied AMQP data and returns the
number of bytes consumed. | [
"Decodes",
"the",
"first",
"value",
"from",
"supplied",
"AMQP",
"data",
"and",
"returns",
"the",
"number",
"of",
"bytes",
"consumed",
"."
] | def decode(self, encoded: bytes) -> int:
"""
Decodes the first value from supplied AMQP data and returns the
number of bytes consumed.
:param encoded: AMQP encoded binary data
:raise: :exc:`DataException` if there is a Proton error.
"""
return self._check(pn_data... | [
"def",
"decode",
"(",
"self",
",",
"encoded",
":",
"bytes",
")",
"->",
"int",
":",
"return",
"self",
".",
"_check",
"(",
"pn_data_decode",
"(",
"self",
".",
"_data",
",",
"encoded",
")",
")"
] | https://github.com/apache/qpid-proton/blob/6bcdfebb55ea3554bc29b1901422532db331a591/python/proton/_data.py#L811-L819 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/pstats.py | python | add_callers | (target, source) | return new_callers | Combine two caller lists in a single list. | Combine two caller lists in a single list. | [
"Combine",
"two",
"caller",
"lists",
"in",
"a",
"single",
"list",
"."
] | def add_callers(target, source):
"""Combine two caller lists in a single list."""
new_callers = {}
for func, caller in target.iteritems():
new_callers[func] = caller
for func, caller in source.iteritems():
if func in new_callers:
new_callers[func] = tuple([i[0] + i[1] for i i... | [
"def",
"add_callers",
"(",
"target",
",",
"source",
")",
":",
"new_callers",
"=",
"{",
"}",
"for",
"func",
",",
"caller",
"in",
"target",
".",
"iteritems",
"(",
")",
":",
"new_callers",
"[",
"func",
"]",
"=",
"caller",
"for",
"func",
",",
"caller",
"... | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/pstats.py#L518-L529 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/symbol/numpy/_symbol.py | python | delete | (arr, obj, axis=None) | Return a new array with sub-arrays along an axis deleted. For a one
dimensional array, this returns those entries not returned by
`arr[obj]`.
Parameters
----------
arr : _Symbol
Input array.
obj : slice, scaler or _Symbol of ints
Indicate indices of sub-arrays to remove along the sp... | Return a new array with sub-arrays along an axis deleted. For a one
dimensional array, this returns those entries not returned by
`arr[obj]`. | [
"Return",
"a",
"new",
"array",
"with",
"sub",
"-",
"arrays",
"along",
"an",
"axis",
"deleted",
".",
"For",
"a",
"one",
"dimensional",
"array",
"this",
"returns",
"those",
"entries",
"not",
"returned",
"by",
"arr",
"[",
"obj",
"]",
"."
] | def delete(arr, obj, axis=None):
"""
Return a new array with sub-arrays along an axis deleted. For a one
dimensional array, this returns those entries not returned by
`arr[obj]`.
Parameters
----------
arr : _Symbol
Input array.
obj : slice, scaler or _Symbol of ints
Indicate... | [
"def",
"delete",
"(",
"arr",
",",
"obj",
",",
"axis",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"arr",
",",
"Symbol",
")",
":",
"raise",
"TypeError",
"(",
"\"'arr' can not support type {}\"",
".",
"format",
"(",
"str",
"(",
"type",
"(",
"a... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/symbol/numpy/_symbol.py#L3908-L3943 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/android/loading/chrome_cache.py | python | PullBrowserCache | (device) | return save_target | Pulls the browser cache from the device and saves it locally.
Cache is saved with the same file structure as on the device. Timestamps are
important to preserve because indexing and eviction depends on them.
Returns:
Temporary directory containing all the browser cache. | Pulls the browser cache from the device and saves it locally. | [
"Pulls",
"the",
"browser",
"cache",
"from",
"the",
"device",
"and",
"saves",
"it",
"locally",
"."
] | def PullBrowserCache(device):
"""Pulls the browser cache from the device and saves it locally.
Cache is saved with the same file structure as on the device. Timestamps are
important to preserve because indexing and eviction depends on them.
Returns:
Temporary directory containing all the browser cache.
... | [
"def",
"PullBrowserCache",
"(",
"device",
")",
":",
"_INDEX_DIRECTORY_NAME",
"=",
"'index-dir'",
"_REAL_INDEX_FILE_NAME",
"=",
"'the-real-index'",
"remote_cache_directory",
"=",
"_RemoteCacheDirectory",
"(",
")",
"save_target",
"=",
"tempfile",
".",
"mkdtemp",
"(",
"suf... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/android/loading/chrome_cache.py#L61-L110 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_core.py | python | BookCtrlBase.CalcSizeFromPage | (*args, **kwargs) | return _core_.BookCtrlBase_CalcSizeFromPage(*args, **kwargs) | CalcSizeFromPage(self, Size sizePage) -> Size | CalcSizeFromPage(self, Size sizePage) -> Size | [
"CalcSizeFromPage",
"(",
"self",
"Size",
"sizePage",
")",
"-",
">",
"Size"
] | def CalcSizeFromPage(*args, **kwargs):
"""CalcSizeFromPage(self, Size sizePage) -> Size"""
return _core_.BookCtrlBase_CalcSizeFromPage(*args, **kwargs) | [
"def",
"CalcSizeFromPage",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"BookCtrlBase_CalcSizeFromPage",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L13574-L13576 | |
etotheipi/BitcoinArmory | 2a6fc5355bb0c6fe26e387ccba30a5baafe8cd98 | urllib3/__init__.py | python | add_stderr_logger | (level=logging.DEBUG) | return handler | Helper for quickly adding a StreamHandler to the logger. Useful for
debugging.
Returns the handler after adding it. | Helper for quickly adding a StreamHandler to the logger. Useful for
debugging. | [
"Helper",
"for",
"quickly",
"adding",
"a",
"StreamHandler",
"to",
"the",
"logger",
".",
"Useful",
"for",
"debugging",
"."
] | def add_stderr_logger(level=logging.DEBUG):
"""
Helper for quickly adding a StreamHandler to the logger. Useful for
debugging.
Returns the handler after adding it.
"""
# This method needs to be in this __init__.py to get the __name__ correct
# even if urllib3 is vendored within another pack... | [
"def",
"add_stderr_logger",
"(",
"level",
"=",
"logging",
".",
"DEBUG",
")",
":",
"# This method needs to be in this __init__.py to get the __name__ correct",
"# even if urllib3 is vendored within another package.",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
"... | https://github.com/etotheipi/BitcoinArmory/blob/2a6fc5355bb0c6fe26e387ccba30a5baafe8cd98/urllib3/__init__.py#L40-L55 | |
lmb-freiburg/ogn | 974f72ef4bf840d6f6693d22d1843a79223e77ce | scripts/cpp_lint.py | python | FindStartOfExpressionInLine | (line, endpos, depth, startchar, endchar) | return (-1, depth) | Find position at the matching startchar.
This is almost the reverse of FindEndOfExpressionInLine, but note
that the input position and returned position differs by 1.
Args:
line: a CleansedLines line.
endpos: start searching at this position.
depth: nesting level at endpos.
startchar: expression... | Find position at the matching startchar. | [
"Find",
"position",
"at",
"the",
"matching",
"startchar",
"."
] | def FindStartOfExpressionInLine(line, endpos, depth, startchar, endchar):
"""Find position at the matching startchar.
This is almost the reverse of FindEndOfExpressionInLine, but note
that the input position and returned position differs by 1.
Args:
line: a CleansedLines line.
endpos: start searching ... | [
"def",
"FindStartOfExpressionInLine",
"(",
"line",
",",
"endpos",
",",
"depth",
",",
"startchar",
",",
"endchar",
")",
":",
"for",
"i",
"in",
"xrange",
"(",
"endpos",
",",
"-",
"1",
",",
"-",
"1",
")",
":",
"if",
"line",
"[",
"i",
"]",
"==",
"endch... | https://github.com/lmb-freiburg/ogn/blob/974f72ef4bf840d6f6693d22d1843a79223e77ce/scripts/cpp_lint.py#L1300-L1324 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/llvmlite/binding/value.py | python | TypeRef.is_pointer | (self) | return ffi.lib.LLVMPY_TypeIsPointer(self) | Returns true is the type is a pointer type. | Returns true is the type is a pointer type. | [
"Returns",
"true",
"is",
"the",
"type",
"is",
"a",
"pointer",
"type",
"."
] | def is_pointer(self):
"""
Returns true is the type is a pointer type.
"""
return ffi.lib.LLVMPY_TypeIsPointer(self) | [
"def",
"is_pointer",
"(",
"self",
")",
":",
"return",
"ffi",
".",
"lib",
".",
"LLVMPY_TypeIsPointer",
"(",
"self",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/llvmlite/binding/value.py#L57-L61 | |
Tencent/CMONGO | c40380caa14e05509f46993aa8b8da966b09b0b5 | src/third_party/mozjs-38/extract/js/src/builtin/make_intl_data.py | python | readRegistry | (registry) | return {"fileDate": fileDate,
"langTagMappings": langTagMappings,
"langSubtagMappings": langSubtagMappings,
"extlangMappings": extlangMappings} | Reads IANA Language Subtag Registry and extracts information for Intl.js.
Information extracted:
- langTagMappings: mappings from complete language tags to preferred
complete language tags
- langSubtagMappings: mappings from subtags to preferred subtags
- extlangMappings: mapp... | Reads IANA Language Subtag Registry and extracts information for Intl.js. | [
"Reads",
"IANA",
"Language",
"Subtag",
"Registry",
"and",
"extracts",
"information",
"for",
"Intl",
".",
"js",
"."
] | def readRegistry(registry):
""" Reads IANA Language Subtag Registry and extracts information for Intl.js.
Information extracted:
- langTagMappings: mappings from complete language tags to preferred
complete language tags
- langSubtagMappings: mappings from subtags to preferred sub... | [
"def",
"readRegistry",
"(",
"registry",
")",
":",
"langTagMappings",
"=",
"{",
"}",
"langSubtagMappings",
"=",
"{",
"}",
"extlangMappings",
"=",
"{",
"}",
"languageSubtags",
"=",
"set",
"(",
")",
"extlangSubtags",
"=",
"set",
"(",
")",
"for",
"record",
"in... | https://github.com/Tencent/CMONGO/blob/c40380caa14e05509f46993aa8b8da966b09b0b5/src/third_party/mozjs-38/extract/js/src/builtin/make_intl_data.py#L44-L133 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/mws/connection.py | python | MWSConnection.get_product_categories_for_asin | (self, request, response, **kw) | return self._post_request(request, kw, response) | Returns the product categories that an ASIN belongs to. | Returns the product categories that an ASIN belongs to. | [
"Returns",
"the",
"product",
"categories",
"that",
"an",
"ASIN",
"belongs",
"to",
"."
] | def get_product_categories_for_asin(self, request, response, **kw):
"""Returns the product categories that an ASIN belongs to.
"""
return self._post_request(request, kw, response) | [
"def",
"get_product_categories_for_asin",
"(",
"self",
",",
"request",
",",
"response",
",",
"*",
"*",
"kw",
")",
":",
"return",
"self",
".",
"_post_request",
"(",
"request",
",",
"kw",
",",
"response",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/mws/connection.py#L845-L848 | |
codilime/veles | e65de5a7c268129acffcdb03034efd8d256d025c | python/veles/dis/core.py | python | Isa.parse | (self, data, base=None, pos=0) | return res | Runs the disassembler on given data, returning an IsaParseResult
instance. ``pos`` is the position in ``data`` to start disassembly
from. ``base`` is a symbol representing the beginning of the
code section passed as data, or None if pos is to be treated as
an absolute number (it affect... | Runs the disassembler on given data, returning an IsaParseResult
instance. ``pos`` is the position in ``data`` to start disassembly
from. ``base`` is a symbol representing the beginning of the
code section passed as data, or None if pos is to be treated as
an absolute number (it affect... | [
"Runs",
"the",
"disassembler",
"on",
"given",
"data",
"returning",
"an",
"IsaParseResult",
"instance",
".",
"pos",
"is",
"the",
"position",
"in",
"data",
"to",
"start",
"disassembly",
"from",
".",
"base",
"is",
"a",
"symbol",
"representing",
"the",
"beginning"... | def parse(self, data, base=None, pos=0):
"""
Runs the disassembler on given data, returning an IsaParseResult
instance. ``pos`` is the position in ``data`` to start disassembly
from. ``base`` is a symbol representing the beginning of the
code section passed as data, or None if ... | [
"def",
"parse",
"(",
"self",
",",
"data",
",",
"base",
"=",
"None",
",",
"pos",
"=",
"0",
")",
":",
"# XXX: the whole thing should use BinData, and support extra offset",
"# to pos.",
"res",
"=",
"IsaParseResult",
"(",
"base",
",",
"pos",
")",
"s",
"=",
"Parse... | https://github.com/codilime/veles/blob/e65de5a7c268129acffcdb03034efd8d256d025c/python/veles/dis/core.py#L76-L91 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/distributed/fleet/base/distributed_strategy.py | python | DistributedStrategy.auto_search | (self) | return self.strategy.auto_search | Indicating whether we are using auto-search parallel function
For details, please reference the following code example
Default Value: False
Examples:
.. code-block:: python
import paddle
paddle.enable_static()
import paddle.distributed.fleet as fleet... | Indicating whether we are using auto-search parallel function
For details, please reference the following code example
Default Value: False
Examples:
.. code-block:: python
import paddle
paddle.enable_static()
import paddle.distributed.fleet as fleet... | [
"Indicating",
"whether",
"we",
"are",
"using",
"auto",
"-",
"search",
"parallel",
"function",
"For",
"details",
"please",
"reference",
"the",
"following",
"code",
"example",
"Default",
"Value",
":",
"False",
"Examples",
":",
"..",
"code",
"-",
"block",
"::",
... | def auto_search(self):
"""
Indicating whether we are using auto-search parallel function
For details, please reference the following code example
Default Value: False
Examples:
.. code-block:: python
import paddle
paddle.enable_static()
... | [
"def",
"auto_search",
"(",
"self",
")",
":",
"return",
"self",
".",
"strategy",
".",
"auto_search"
] | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/distributed/fleet/base/distributed_strategy.py#L1751-L1764 | |
root-project/root | fcd3583bb14852bf2e8cd2415717cbaac0e75896 | main/python/cmdLineUtils.py | python | tupleListSort | (tupleList) | Sort list of tuples by their first elements ignoring the case | Sort list of tuples by their first elements ignoring the case | [
"Sort",
"list",
"of",
"tuples",
"by",
"their",
"first",
"elements",
"ignoring",
"the",
"case"
] | def tupleListSort(tupleList):
"""
Sort list of tuples by their first elements ignoring the case
"""
tupleList.sort(key=lambda x: x[0].lower()) | [
"def",
"tupleListSort",
"(",
"tupleList",
")",
":",
"tupleList",
".",
"sort",
"(",
"key",
"=",
"lambda",
"x",
":",
"x",
"[",
"0",
"]",
".",
"lower",
"(",
")",
")"
] | https://github.com/root-project/root/blob/fcd3583bb14852bf2e8cd2415717cbaac0e75896/main/python/cmdLineUtils.py#L246-L250 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/apply.py | python | FrameRowApply.wrap_results_for_axis | (self) | return result | return the results for the rows | return the results for the rows | [
"return",
"the",
"results",
"for",
"the",
"rows"
] | def wrap_results_for_axis(self):
""" return the results for the rows """
results = self.results
result = self.obj._constructor(data=results)
if not isinstance(results[0], ABCSeries):
try:
result.index = self.res_columns
except ValueError:
... | [
"def",
"wrap_results_for_axis",
"(",
"self",
")",
":",
"results",
"=",
"self",
".",
"results",
"result",
"=",
"self",
".",
"obj",
".",
"_constructor",
"(",
"data",
"=",
"results",
")",
"if",
"not",
"isinstance",
"(",
"results",
"[",
"0",
"]",
",",
"ABC... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/apply.py#L336-L353 | |
cyberbotics/webots | af7fa7d68dcf7b4550f1f2e132092b41e83698fc | projects/samples/robotbenchmark/visual_tracking/controllers/visual_tracking/visual_tracking.py | python | cleanup | () | Remove device image files. | Remove device image files. | [
"Remove",
"device",
"image",
"files",
"."
] | def cleanup():
"""Remove device image files."""
# Ignore errors if file doesn't exist.
try:
os.remove(deviceImagePath + '/display.jpg')
except OSError:
pass
try:
os.remove(deviceImagePath + '/camera.jpg')
except OSError:
pass | [
"def",
"cleanup",
"(",
")",
":",
"# Ignore errors if file doesn't exist.",
"try",
":",
"os",
".",
"remove",
"(",
"deviceImagePath",
"+",
"'/display.jpg'",
")",
"except",
"OSError",
":",
"pass",
"try",
":",
"os",
".",
"remove",
"(",
"deviceImagePath",
"+",
"'/c... | https://github.com/cyberbotics/webots/blob/af7fa7d68dcf7b4550f1f2e132092b41e83698fc/projects/samples/robotbenchmark/visual_tracking/controllers/visual_tracking/visual_tracking.py#L21-L31 | ||
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/util.py | python | set_np_shape | (active) | return bool(prev.value) | Turns on/off NumPy shape semantics, in which `()` represents the shape of scalar tensors,
and tuples with `0` elements, for example, `(0,)`, `(1, 0, 2)`, represent the shapes
of zero-size tensors. This is turned off by default for keeping backward compatibility.
Please note that this is designed as an infr... | Turns on/off NumPy shape semantics, in which `()` represents the shape of scalar tensors,
and tuples with `0` elements, for example, `(0,)`, `(1, 0, 2)`, represent the shapes
of zero-size tensors. This is turned off by default for keeping backward compatibility. | [
"Turns",
"on",
"/",
"off",
"NumPy",
"shape",
"semantics",
"in",
"which",
"()",
"represents",
"the",
"shape",
"of",
"scalar",
"tensors",
"and",
"tuples",
"with",
"0",
"elements",
"for",
"example",
"(",
"0",
")",
"(",
"1",
"0",
"2",
")",
"represent",
"th... | def set_np_shape(active):
"""Turns on/off NumPy shape semantics, in which `()` represents the shape of scalar tensors,
and tuples with `0` elements, for example, `(0,)`, `(1, 0, 2)`, represent the shapes
of zero-size tensors. This is turned off by default for keeping backward compatibility.
Please note... | [
"def",
"set_np_shape",
"(",
"active",
")",
":",
"global",
"_set_np_shape_logged",
"if",
"active",
":",
"if",
"not",
"_set_np_shape_logged",
":",
"import",
"logging",
"logging",
".",
"info",
"(",
"'NumPy-shape semantics has been activated in your code. '",
"'This is requir... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/util.py#L58-L102 | |
rdiankov/openrave | d1a23023fd4b58f077d2ca949ceaf1b91f3f13d7 | sandbox/mobilemanipulation.py | python | MobileManipulationPlanning.moveToNeutral | (self,neutraljointvalues,bounds=None,manipnames=None,ikcollisionbody=None) | moves the robot to a neutral position defined by several manipulators and neutraljointvalues. Can also specify a special collision body to constraint choosing the goals. | moves the robot to a neutral position defined by several manipulators and neutraljointvalues. Can also specify a special collision body to constraint choosing the goals. | [
"moves",
"the",
"robot",
"to",
"a",
"neutral",
"position",
"defined",
"by",
"several",
"manipulators",
"and",
"neutraljointvalues",
".",
"Can",
"also",
"specify",
"a",
"special",
"collision",
"body",
"to",
"constraint",
"choosing",
"the",
"goals",
"."
] | def moveToNeutral(self,neutraljointvalues,bounds=None,manipnames=None,ikcollisionbody=None):
"""moves the robot to a neutral position defined by several manipulators and neutraljointvalues. Can also specify a special collision body to constraint choosing the goals."""
if manipnames is None:
... | [
"def",
"moveToNeutral",
"(",
"self",
",",
"neutraljointvalues",
",",
"bounds",
"=",
"None",
",",
"manipnames",
"=",
"None",
",",
"ikcollisionbody",
"=",
"None",
")",
":",
"if",
"manipnames",
"is",
"None",
":",
"manipnames",
"=",
"[",
"'leftarm'",
",",
"'ri... | https://github.com/rdiankov/openrave/blob/d1a23023fd4b58f077d2ca949ceaf1b91f3f13d7/sandbox/mobilemanipulation.py#L455-L547 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py2/setuptools/__init__.py | python | PackageFinder._find_packages_iter | (cls, where, exclude, include) | All the packages found in 'where' that pass the 'include' filter, but
not the 'exclude' filter. | All the packages found in 'where' that pass the 'include' filter, but
not the 'exclude' filter. | [
"All",
"the",
"packages",
"found",
"in",
"where",
"that",
"pass",
"the",
"include",
"filter",
"but",
"not",
"the",
"exclude",
"filter",
"."
] | def _find_packages_iter(cls, where, exclude, include):
"""
All the packages found in 'where' that pass the 'include' filter, but
not the 'exclude' filter.
"""
for root, dirs, files in os.walk(where, followlinks=True):
# Copy dirs to iterate over it, then empty dirs.
... | [
"def",
"_find_packages_iter",
"(",
"cls",
",",
"where",
",",
"exclude",
",",
"include",
")",
":",
"for",
"root",
",",
"dirs",
",",
"files",
"in",
"os",
".",
"walk",
"(",
"where",
",",
"followlinks",
"=",
"True",
")",
":",
"# Copy dirs to iterate over it, t... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py2/setuptools/__init__.py#L76-L101 | ||
intel/llvm | e6d0547e9d99b5a56430c4749f6c7e328bf221ab | llvm/utils/lit/lit/worker.py | python | execute | (test) | return test | Run one test in a multiprocessing.Pool
Side effects in this function and functions it calls are not visible in the
main lit process.
Arguments and results of this function are pickled, so they should be cheap
to copy. | Run one test in a multiprocessing.Pool | [
"Run",
"one",
"test",
"in",
"a",
"multiprocessing",
".",
"Pool"
] | def execute(test):
"""Run one test in a multiprocessing.Pool
Side effects in this function and functions it calls are not visible in the
main lit process.
Arguments and results of this function are pickled, so they should be cheap
to copy.
"""
with _get_parallelism_semaphore(test):
... | [
"def",
"execute",
"(",
"test",
")",
":",
"with",
"_get_parallelism_semaphore",
"(",
"test",
")",
":",
"result",
"=",
"_execute",
"(",
"test",
",",
"_lit_config",
")",
"test",
".",
"setResult",
"(",
"result",
")",
"return",
"test"
] | https://github.com/intel/llvm/blob/e6d0547e9d99b5a56430c4749f6c7e328bf221ab/llvm/utils/lit/lit/worker.py#L35-L48 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/cond_v2.py | python | _create_none_optionals | (func_graph, n) | Creates `n` `None` optionals in func_graph.
Args:
func_graph: FuncGraph.
n: `int` the number of `None` optionals to make.
Returns:
A list of tensors in func_graph. | Creates `n` `None` optionals in func_graph. | [
"Creates",
"n",
"None",
"optionals",
"in",
"func_graph",
"."
] | def _create_none_optionals(func_graph, n):
"""Creates `n` `None` optionals in func_graph.
Args:
func_graph: FuncGraph.
n: `int` the number of `None` optionals to make.
Returns:
A list of tensors in func_graph.
"""
with func_graph.as_default():
return [gen_dataset_ops.optional_none() for _ in... | [
"def",
"_create_none_optionals",
"(",
"func_graph",
",",
"n",
")",
":",
"with",
"func_graph",
".",
"as_default",
"(",
")",
":",
"return",
"[",
"gen_dataset_ops",
".",
"optional_none",
"(",
")",
"for",
"_",
"in",
"range",
"(",
"n",
")",
"]"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/cond_v2.py#L778-L789 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/eager/backprop.py | python | _get_arg_spec | (f, params, param_args) | The positions of the parameters of f to be differentiated in param_args. | The positions of the parameters of f to be differentiated in param_args. | [
"The",
"positions",
"of",
"the",
"parameters",
"of",
"f",
"to",
"be",
"differentiated",
"in",
"param_args",
"."
] | def _get_arg_spec(f, params, param_args):
"""The positions of the parameters of f to be differentiated in param_args."""
try:
args = tf_inspect.getfullargspec(f).args
except TypeError as e:
# TypeError can happen when f is a callable object.
if params is None:
return range(len(param_args))
e... | [
"def",
"_get_arg_spec",
"(",
"f",
",",
"params",
",",
"param_args",
")",
":",
"try",
":",
"args",
"=",
"tf_inspect",
".",
"getfullargspec",
"(",
"f",
")",
".",
"args",
"except",
"TypeError",
"as",
"e",
":",
"# TypeError can happen when f is a callable object.",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/eager/backprop.py#L275-L298 | ||
LARG/HFO | b8b2a1d462823c6732f4d5581aa7fe2e371d55cb | bin/Trainer.py | python | Trainer.checkLive | (self, necProcesses) | return True | Returns true if each of the necessary processes is still alive and
running. | Returns true if each of the necessary processes is still alive and
running. | [
"Returns",
"true",
"if",
"each",
"of",
"the",
"necessary",
"processes",
"is",
"still",
"alive",
"and",
"running",
"."
] | def checkLive(self, necProcesses):
"""Returns true if each of the necessary processes is still alive and
running.
"""
for p,name in necProcesses:
if p is not None and p.poll() is not None:
print('Something necessary closed (%s), exiting' % name)
return False
return True | [
"def",
"checkLive",
"(",
"self",
",",
"necProcesses",
")",
":",
"for",
"p",
",",
"name",
"in",
"necProcesses",
":",
"if",
"p",
"is",
"not",
"None",
"and",
"p",
".",
"poll",
"(",
")",
"is",
"not",
"None",
":",
"print",
"(",
"'Something necessary closed ... | https://github.com/LARG/HFO/blob/b8b2a1d462823c6732f4d5581aa7fe2e371d55cb/bin/Trainer.py#L370-L379 | |
ideawu/ssdb-rocks | a3cbb322cafb2f493252829c608e2239df98c9ac | deps/cpy/antlr3/recognizers.py | python | Lexer.emit | (self, token=None) | return token | The standard method called to automatically emit a token at the
outermost lexical rule. The token object should point into the
char buffer start..stop. If there is a text override in 'text',
use that to set the token's text. Override this method to emit
custom Token objects.
... | The standard method called to automatically emit a token at the
outermost lexical rule. The token object should point into the
char buffer start..stop. If there is a text override in 'text',
use that to set the token's text. Override this method to emit
custom Token objects. | [
"The",
"standard",
"method",
"called",
"to",
"automatically",
"emit",
"a",
"token",
"at",
"the",
"outermost",
"lexical",
"rule",
".",
"The",
"token",
"object",
"should",
"point",
"into",
"the",
"char",
"buffer",
"start",
"..",
"stop",
".",
"If",
"there",
"... | def emit(self, token=None):
"""
The standard method called to automatically emit a token at the
outermost lexical rule. The token object should point into the
char buffer start..stop. If there is a text override in 'text',
use that to set the token's text. Override this method... | [
"def",
"emit",
"(",
"self",
",",
"token",
"=",
"None",
")",
":",
"if",
"token",
"is",
"None",
":",
"token",
"=",
"CommonToken",
"(",
"input",
"=",
"self",
".",
"input",
",",
"type",
"=",
"self",
".",
"_state",
".",
"type",
",",
"channel",
"=",
"s... | https://github.com/ideawu/ssdb-rocks/blob/a3cbb322cafb2f493252829c608e2239df98c9ac/deps/cpy/antlr3/recognizers.py#L1192-L1218 | |
facebookincubator/BOLT | 88c70afe9d388ad430cc150cc158641701397f70 | mlir/utils/spirv/gen_spirv_dialect.py | python | update_td_op_definitions | (path, instructions, docs, filter_list,
inst_category, capability_mapping, settings) | Updates SPIRVOps.td with newly generated op definition.
Arguments:
- path: path to SPIRVOps.td
- instructions: SPIR-V JSON grammar for all instructions
- docs: SPIR-V HTML doc for all instructions
- filter_list: a list containing new opnames to include
- capability_mapping: mapping from duplicate... | Updates SPIRVOps.td with newly generated op definition. | [
"Updates",
"SPIRVOps",
".",
"td",
"with",
"newly",
"generated",
"op",
"definition",
"."
] | def update_td_op_definitions(path, instructions, docs, filter_list,
inst_category, capability_mapping, settings):
"""Updates SPIRVOps.td with newly generated op definition.
Arguments:
- path: path to SPIRVOps.td
- instructions: SPIR-V JSON grammar for all instructions
- doc... | [
"def",
"update_td_op_definitions",
"(",
"path",
",",
"instructions",
",",
"docs",
",",
"filter_list",
",",
"inst_category",
",",
"capability_mapping",
",",
"settings",
")",
":",
"with",
"open",
"(",
"path",
",",
"'r'",
")",
"as",
"f",
":",
"content",
"=",
... | https://github.com/facebookincubator/BOLT/blob/88c70afe9d388ad430cc150cc158641701397f70/mlir/utils/spirv/gen_spirv_dialect.py#L923-L988 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/site_compare/scrapers/chrome/chrome011010.py | python | Scrape | (urls, outdir, size, pos, timeout=20, **kwargs) | return chromebase.Scrape(urls, outdir, size, pos, timeout, kwargs) | Invoke a browser, send it to a series of URLs, and save its output.
Args:
urls: list of URLs to scrape
outdir: directory to place output
size: size of browser window to use
pos: position of browser window
timeout: amount of time to wait for page to load
kwargs: miscellaneous keyword args
R... | Invoke a browser, send it to a series of URLs, and save its output. | [
"Invoke",
"a",
"browser",
"send",
"it",
"to",
"a",
"series",
"of",
"URLs",
"and",
"save",
"its",
"output",
"."
] | def Scrape(urls, outdir, size, pos, timeout=20, **kwargs):
"""Invoke a browser, send it to a series of URLs, and save its output.
Args:
urls: list of URLs to scrape
outdir: directory to place output
size: size of browser window to use
pos: position of browser window
timeout: amount of time to w... | [
"def",
"Scrape",
"(",
"urls",
",",
"outdir",
",",
"size",
",",
"pos",
",",
"timeout",
"=",
"20",
",",
"*",
"*",
"kwargs",
")",
":",
"chromebase",
".",
"GetChromeRenderPane",
"=",
"GetChromeRenderPane",
"return",
"chromebase",
".",
"Scrape",
"(",
"urls",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/site_compare/scrapers/chrome/chrome011010.py#L19-L35 | |
rdkit/rdkit | ede860ae316d12d8568daf5ee800921c3389c84e | rdkit/Chem/Draw/SimilarityMaps.py | python | GetMorganFingerprint | (mol, atomId=-1, radius=2, fpType='bv', nBits=2048, useFeatures=False,
**kwargs) | return molFp | Calculates the Morgan fingerprint with the environments of atomId removed.
Parameters:
mol -- the molecule of interest
radius -- the maximum radius
fpType -- the type of Morgan fingerprint: 'count' or 'bv'
atomId -- the atom to remove the environments for (if -1, no environments is removed)... | Calculates the Morgan fingerprint with the environments of atomId removed. | [
"Calculates",
"the",
"Morgan",
"fingerprint",
"with",
"the",
"environments",
"of",
"atomId",
"removed",
"."
] | def GetMorganFingerprint(mol, atomId=-1, radius=2, fpType='bv', nBits=2048, useFeatures=False,
**kwargs):
"""
Calculates the Morgan fingerprint with the environments of atomId removed.
Parameters:
mol -- the molecule of interest
radius -- the maximum radius
fpType -... | [
"def",
"GetMorganFingerprint",
"(",
"mol",
",",
"atomId",
"=",
"-",
"1",
",",
"radius",
"=",
"2",
",",
"fpType",
"=",
"'bv'",
",",
"nBits",
"=",
"2048",
",",
"useFeatures",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"fpType",
"not",
"in... | https://github.com/rdkit/rdkit/blob/ede860ae316d12d8568daf5ee800921c3389c84e/rdkit/Chem/Draw/SimilarityMaps.py#L346-L411 | |
rapidsai/cudf | d5b2448fc69f17509304d594f029d0df56984962 | python/cudf/cudf/core/groupby/groupby.py | python | GroupBy.sum | (self) | return self.agg("sum") | Compute the column-wise sum of the values in each group. | Compute the column-wise sum of the values in each group. | [
"Compute",
"the",
"column",
"-",
"wise",
"sum",
"of",
"the",
"values",
"in",
"each",
"group",
"."
] | def sum(self):
"""Compute the column-wise sum of the values in each group."""
return self.agg("sum") | [
"def",
"sum",
"(",
"self",
")",
":",
"return",
"self",
".",
"agg",
"(",
"\"sum\"",
")"
] | https://github.com/rapidsai/cudf/blob/d5b2448fc69f17509304d594f029d0df56984962/python/cudf/cudf/core/groupby/groupby.py#L814-L816 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/trace.py | python | CoverageResults.update | (self, other) | Merge in the data from another CoverageResults | Merge in the data from another CoverageResults | [
"Merge",
"in",
"the",
"data",
"from",
"another",
"CoverageResults"
] | def update(self, other):
"""Merge in the data from another CoverageResults"""
counts = self.counts
calledfuncs = self.calledfuncs
callers = self.callers
other_counts = other.counts
other_calledfuncs = other.calledfuncs
other_callers = other.callers
for ke... | [
"def",
"update",
"(",
"self",
",",
"other",
")",
":",
"counts",
"=",
"self",
".",
"counts",
"calledfuncs",
"=",
"self",
".",
"calledfuncs",
"callers",
"=",
"self",
".",
"callers",
"other_counts",
"=",
"other",
".",
"counts",
"other_calledfuncs",
"=",
"othe... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/trace.py#L187-L203 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/optimize/nonlin.py | python | LowRankMatrix.rmatvec | (self, v) | return LowRankMatrix._matvec(v, np.conj(self.alpha), self.ds, self.cs) | Evaluate w = M^H v | Evaluate w = M^H v | [
"Evaluate",
"w",
"=",
"M^H",
"v"
] | def rmatvec(self, v):
"""Evaluate w = M^H v"""
if self.collapsed is not None:
return np.dot(self.collapsed.T.conj(), v)
return LowRankMatrix._matvec(v, np.conj(self.alpha), self.ds, self.cs) | [
"def",
"rmatvec",
"(",
"self",
",",
"v",
")",
":",
"if",
"self",
".",
"collapsed",
"is",
"not",
"None",
":",
"return",
"np",
".",
"dot",
"(",
"self",
".",
"collapsed",
".",
"T",
".",
"conj",
"(",
")",
",",
"v",
")",
"return",
"LowRankMatrix",
"."... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/optimize/nonlin.py#L754-L758 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_misc.py | python | FileHistory.RemoveFileFromHistory | (*args, **kwargs) | return _misc_.FileHistory_RemoveFileFromHistory(*args, **kwargs) | RemoveFileFromHistory(self, int i) | RemoveFileFromHistory(self, int i) | [
"RemoveFileFromHistory",
"(",
"self",
"int",
"i",
")"
] | def RemoveFileFromHistory(*args, **kwargs):
"""RemoveFileFromHistory(self, int i)"""
return _misc_.FileHistory_RemoveFileFromHistory(*args, **kwargs) | [
"def",
"RemoveFileFromHistory",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"FileHistory_RemoveFileFromHistory",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_misc.py#L918-L920 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/train/train_thor/convert_utils.py | python | ConvertNetUtils.convert_to_thor_net | (self, net) | This interface is used to convert a network to thor layer network, in order to calculate and store the
second-order information matrix.
Note:
This interface is automatically called by the second-order optimizer thor.
Args:
net (Cell): Network to be trained by the second... | This interface is used to convert a network to thor layer network, in order to calculate and store the
second-order information matrix. | [
"This",
"interface",
"is",
"used",
"to",
"convert",
"a",
"network",
"to",
"thor",
"layer",
"network",
"in",
"order",
"to",
"calculate",
"and",
"store",
"the",
"second",
"-",
"order",
"information",
"matrix",
"."
] | def convert_to_thor_net(self, net):
"""
This interface is used to convert a network to thor layer network, in order to calculate and store the
second-order information matrix.
Note:
This interface is automatically called by the second-order optimizer thor.
Args:
... | [
"def",
"convert_to_thor_net",
"(",
"self",
",",
"net",
")",
":",
"net",
".",
"update_cell_prefix",
"(",
")",
"self",
".",
"_convert_to_thor_net",
"(",
"net",
")",
"net",
".",
"update_cell_type",
"(",
"\"second-order\"",
")"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/train/train_thor/convert_utils.py#L152-L173 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/doctools.py | python | DocPositionMgr.__init__ | (self) | Creates the position manager object | Creates the position manager object | [
"Creates",
"the",
"position",
"manager",
"object"
] | def __init__(self):
"""Creates the position manager object"""
super(DocPositionMgr, self).__init__()
# Attributes
self._init = False
self._book = None
self._records = dict() | [
"def",
"__init__",
"(",
"self",
")",
":",
"super",
"(",
"DocPositionMgr",
",",
"self",
")",
".",
"__init__",
"(",
")",
"# Attributes",
"self",
".",
"_init",
"=",
"False",
"self",
".",
"_book",
"=",
"None",
"self",
".",
"_records",
"=",
"dict",
"(",
"... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/doctools.py#L40-L47 | ||
SpenceKonde/megaTinyCore | 1c4a70b18a149fe6bcb551dfa6db11ca50b8997b | megaavr/tools/libs/serial/tools/miniterm.py | python | Miniterm.set_rx_encoding | (self, encoding, errors='replace') | set encoding for received data | set encoding for received data | [
"set",
"encoding",
"for",
"received",
"data"
] | def set_rx_encoding(self, encoding, errors='replace'):
"""set encoding for received data"""
self.input_encoding = encoding
self.rx_decoder = codecs.getincrementaldecoder(encoding)(errors) | [
"def",
"set_rx_encoding",
"(",
"self",
",",
"encoding",
",",
"errors",
"=",
"'replace'",
")",
":",
"self",
".",
"input_encoding",
"=",
"encoding",
"self",
".",
"rx_decoder",
"=",
"codecs",
".",
"getincrementaldecoder",
"(",
"encoding",
")",
"(",
"errors",
")... | https://github.com/SpenceKonde/megaTinyCore/blob/1c4a70b18a149fe6bcb551dfa6db11ca50b8997b/megaavr/tools/libs/serial/tools/miniterm.py#L405-L408 | ||
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/tools/gyp/tools/graphviz.py | python | LoadEdges | (filename, targets) | return target_edges | Load the edges map from the dump file, and filter it to only
show targets in |targets| and their depedendents. | Load the edges map from the dump file, and filter it to only
show targets in |targets| and their depedendents. | [
"Load",
"the",
"edges",
"map",
"from",
"the",
"dump",
"file",
"and",
"filter",
"it",
"to",
"only",
"show",
"targets",
"in",
"|targets|",
"and",
"their",
"depedendents",
"."
] | def LoadEdges(filename, targets):
"""Load the edges map from the dump file, and filter it to only
show targets in |targets| and their depedendents."""
file = open('dump.json')
edges = json.load(file)
file.close()
# Copy out only the edges we're interested in from the full edge list.
target_edges = {}
... | [
"def",
"LoadEdges",
"(",
"filename",
",",
"targets",
")",
":",
"file",
"=",
"open",
"(",
"'dump.json'",
")",
"edges",
"=",
"json",
".",
"load",
"(",
"file",
")",
"file",
".",
"close",
"(",
")",
"# Copy out only the edges we're interested in from the full edge li... | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/tools/gyp/tools/graphviz.py#L22-L40 | |
RamadhanAmizudin/malware | 2c6c53c8b0d556f5d8078d6ca0fc4448f4697cf1 | Fuzzbunch/fuzzbunch/edfplugin.py | python | EDFPlugin.get_runflags | (self, mode, interactive, scripted) | return (waitmode,newconsole) | Return the following boolean flags:
newconsole - the plugin should execute in a new console
waitmode - Execution should wait for the plugin to finish
executing | Return the following boolean flags: | [
"Return",
"the",
"following",
"boolean",
"flags",
":"
] | def get_runflags(self, mode, interactive, scripted):
"""
Return the following boolean flags:
newconsole - the plugin should execute in a new console
waitmode - Execution should wait for the plugin to finish
executing
"""
if int... | [
"def",
"get_runflags",
"(",
"self",
",",
"mode",
",",
"interactive",
",",
"scripted",
")",
":",
"if",
"interactive",
":",
"if",
"not",
"mode",
":",
"# Use the plugin's settings",
"mode",
"=",
"self",
".",
"getConsoleMode",
"(",
")",
"else",
":",
"# Non-inter... | https://github.com/RamadhanAmizudin/malware/blob/2c6c53c8b0d556f5d8078d6ca0fc4448f4697cf1/Fuzzbunch/fuzzbunch/edfplugin.py#L283-L311 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/animate.py | python | AnimationCtrl.__init__ | (self, *args, **kwargs) | __init__(self, Window parent, int id=-1, Animation anim=NullAnimation,
Point pos=DefaultPosition, Size size=DefaultSize,
long style=AC_DEFAULT_STYLE, String name=AnimationCtrlNameStr) -> AnimationCtrl | __init__(self, Window parent, int id=-1, Animation anim=NullAnimation,
Point pos=DefaultPosition, Size size=DefaultSize,
long style=AC_DEFAULT_STYLE, String name=AnimationCtrlNameStr) -> AnimationCtrl | [
"__init__",
"(",
"self",
"Window",
"parent",
"int",
"id",
"=",
"-",
"1",
"Animation",
"anim",
"=",
"NullAnimation",
"Point",
"pos",
"=",
"DefaultPosition",
"Size",
"size",
"=",
"DefaultSize",
"long",
"style",
"=",
"AC_DEFAULT_STYLE",
"String",
"name",
"=",
"... | def __init__(self, *args, **kwargs):
"""
__init__(self, Window parent, int id=-1, Animation anim=NullAnimation,
Point pos=DefaultPosition, Size size=DefaultSize,
long style=AC_DEFAULT_STYLE, String name=AnimationCtrlNameStr) -> AnimationCtrl
"""
_animate.Animat... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_animate",
".",
"AnimationCtrl_swiginit",
"(",
"self",
",",
"_animate",
".",
"new_AnimationCtrl",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")",
"self",
".",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/animate.py#L193-L200 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/training/tracking/resource.py | python | CapturableResource.resource_handle | (self) | return self._resource_handle | Returns the resource handle associated with this Resource. | Returns the resource handle associated with this Resource. | [
"Returns",
"the",
"resource",
"handle",
"associated",
"with",
"this",
"Resource",
"."
] | def resource_handle(self):
"""Returns the resource handle associated with this Resource."""
if self._resource_handle is None:
with ops.device(self._resource_device):
self._resource_handle = self._create_resource()
return self._resource_handle | [
"def",
"resource_handle",
"(",
"self",
")",
":",
"if",
"self",
".",
"_resource_handle",
"is",
"None",
":",
"with",
"ops",
".",
"device",
"(",
"self",
".",
"_resource_device",
")",
":",
"self",
".",
"_resource_handle",
"=",
"self",
".",
"_create_resource",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/training/tracking/resource.py#L171-L176 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/extern/stcspellcheck.py | python | STCSpellCheck.setDefaultLanguage | (cls, lang) | Set the default language for spelling check.
The string should be in language locale format, e.g. en_US, ru, ru_RU,
eo, es_ES, etc. See L{getAvailableLanguages}.
@param lang: text string indicating the language | Set the default language for spelling check.
The string should be in language locale format, e.g. en_US, ru, ru_RU,
eo, es_ES, etc. See L{getAvailableLanguages}. | [
"Set",
"the",
"default",
"language",
"for",
"spelling",
"check",
".",
"The",
"string",
"should",
"be",
"in",
"language",
"locale",
"format",
"e",
".",
"g",
".",
"en_US",
"ru",
"ru_RU",
"eo",
"es_ES",
"etc",
".",
"See",
"L",
"{",
"getAvailableLanguages",
... | def setDefaultLanguage(cls, lang):
"""Set the default language for spelling check.
The string should be in language locale format, e.g. en_US, ru, ru_RU,
eo, es_ES, etc. See L{getAvailableLanguages}.
@param lang: text string indicating the language
"""
... | [
"def",
"setDefaultLanguage",
"(",
"cls",
",",
"lang",
")",
":",
"cls",
".",
"_spelling_lang",
"=",
"lang",
"cls",
".",
"_spelling_dict",
"=",
"cls",
".",
"_getDict",
"(",
"lang",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/stcspellcheck.py#L216-L225 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_misc.py | python | PyTextDataObject.__init__ | (self, *args, **kwargs) | __init__(self, String text=EmptyString) -> PyTextDataObject
wx.PyTextDataObject is a version of `wx.TextDataObject` that is
Python-aware and knows how to reflect calls to its C++ virtual methods
to methods in the Python derived class. You should derive from this
class and overload `Get... | __init__(self, String text=EmptyString) -> PyTextDataObject | [
"__init__",
"(",
"self",
"String",
"text",
"=",
"EmptyString",
")",
"-",
">",
"PyTextDataObject"
] | def __init__(self, *args, **kwargs):
"""
__init__(self, String text=EmptyString) -> PyTextDataObject
wx.PyTextDataObject is a version of `wx.TextDataObject` that is
Python-aware and knows how to reflect calls to its C++ virtual methods
to methods in the Python derived class. Y... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_misc_",
".",
"PyTextDataObject_swiginit",
"(",
"self",
",",
"_misc_",
".",
"new_PyTextDataObject",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")",
"PyTextDataObje... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_misc.py#L5236-L5248 | ||
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | tools/coverage/gcda_clean.py | python | clean | (pull_id) | Clean.
Args:
pull_id (int): Pull id.
Returns:
None. | Clean. | [
"Clean",
"."
] | def clean(pull_id):
"""Clean.
Args:
pull_id (int): Pull id.
Returns:
None.
"""
changed = []
for file in get_files(pull_id):
changed.append('/paddle/build/{}.gcda'.format(file))
for parent, dirs, files in os.walk('/paddle/build/'):
for gcda in files:
... | [
"def",
"clean",
"(",
"pull_id",
")",
":",
"changed",
"=",
"[",
"]",
"for",
"file",
"in",
"get_files",
"(",
"pull_id",
")",
":",
"changed",
".",
"append",
"(",
"'/paddle/build/{}.gcda'",
".",
"format",
"(",
"file",
")",
")",
"for",
"parent",
",",
"dirs"... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/tools/coverage/gcda_clean.py#L69-L101 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/distribute/failure_handling/failure_handling.py | python | CoordinatedCheckpointManager.total_runs | (self) | return self._run_counter | Returns the number of times `CoordinatedCheckpointManager.run` is called.
This value tracks the number of all calls to
`CoordinatedCheckpointManager.run` including those before the program is
restarted and the training is restored. The user can compute their total
number of iterations by:
`coordina... | Returns the number of times `CoordinatedCheckpointManager.run` is called. | [
"Returns",
"the",
"number",
"of",
"times",
"CoordinatedCheckpointManager",
".",
"run",
"is",
"called",
"."
] | def total_runs(self):
"""Returns the number of times `CoordinatedCheckpointManager.run` is called.
This value tracks the number of all calls to
`CoordinatedCheckpointManager.run` including those before the program is
restarted and the training is restored. The user can compute their total
number of... | [
"def",
"total_runs",
"(",
"self",
")",
":",
"return",
"self",
".",
"_run_counter"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/distribute/failure_handling/failure_handling.py#L184-L195 | |
CGRU/cgru | 1881a4128530e3d31ac6c25314c18314fc50c2c7 | plugins/maya/afanasy/meCheckTexturePaths.py | python | meCheckTexturePaths.getTextureName | (self, fileNodeName) | return fileTextureName, attrName | Missing DocString | Missing DocString | [
"Missing",
"DocString"
] | def getTextureName(self, fileNodeName):
"""Missing DocString
"""
fileTextureName = None
attrName = None
fileNodeType = cmds.objectType(fileNodeName)
if fileNodeType == 'file' \
or fileNodeType == 'mentalrayTexture' \
or fileNodeType == 'psdFileTex':
attrName = "fileTextureName"
elif fileNodeTy... | [
"def",
"getTextureName",
"(",
"self",
",",
"fileNodeName",
")",
":",
"fileTextureName",
"=",
"None",
"attrName",
"=",
"None",
"fileNodeType",
"=",
"cmds",
".",
"objectType",
"(",
"fileNodeName",
")",
"if",
"fileNodeType",
"==",
"'file'",
"or",
"fileNodeType",
... | https://github.com/CGRU/cgru/blob/1881a4128530e3d31ac6c25314c18314fc50c2c7/plugins/maya/afanasy/meCheckTexturePaths.py#L336-L356 | |
weolar/miniblink49 | 1c4678db0594a4abde23d3ebbcc7cd13c3170777 | v8_5_1/tools/grokdump.py | python | InspectionShell.do_do_map | (self, address) | Print a descriptor array in a readable format. | Print a descriptor array in a readable format. | [
"Print",
"a",
"descriptor",
"array",
"in",
"a",
"readable",
"format",
"."
] | def do_do_map(self, address):
"""
Print a descriptor array in a readable format.
"""
start = int(address, 16)
if ((start & 1) == 1): start = start - 1
Map(self.heap, None, start).Print(Printer()) | [
"def",
"do_do_map",
"(",
"self",
",",
"address",
")",
":",
"start",
"=",
"int",
"(",
"address",
",",
"16",
")",
"if",
"(",
"(",
"start",
"&",
"1",
")",
"==",
"1",
")",
":",
"start",
"=",
"start",
"-",
"1",
"Map",
"(",
"self",
".",
"heap",
","... | https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/v8_5_1/tools/grokdump.py#L2964-L2970 | ||
facebookresearch/ELF | 1f790173095cd910976d9f651b80beb872ec5d12 | vendor/pybind11/tools/clang/cindex.py | python | CursorKind.is_statement | (self) | return conf.lib.clang_isStatement(self) | Test if this is a statement kind. | Test if this is a statement kind. | [
"Test",
"if",
"this",
"is",
"a",
"statement",
"kind",
"."
] | def is_statement(self):
"""Test if this is a statement kind."""
return conf.lib.clang_isStatement(self) | [
"def",
"is_statement",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_isStatement",
"(",
"self",
")"
] | https://github.com/facebookresearch/ELF/blob/1f790173095cd910976d9f651b80beb872ec5d12/vendor/pybind11/tools/clang/cindex.py#L588-L590 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/popen2.py | python | Popen3.poll | (self, _deadstate=None) | return self.sts | Return the exit status of the child process if it has finished,
or -1 if it hasn't finished yet. | Return the exit status of the child process if it has finished,
or -1 if it hasn't finished yet. | [
"Return",
"the",
"exit",
"status",
"of",
"the",
"child",
"process",
"if",
"it",
"has",
"finished",
"or",
"-",
"1",
"if",
"it",
"hasn",
"t",
"finished",
"yet",
"."
] | def poll(self, _deadstate=None):
"""Return the exit status of the child process if it has finished,
or -1 if it hasn't finished yet."""
if self.sts < 0:
try:
pid, sts = os.waitpid(self.pid, os.WNOHANG)
# pid will be 0 if self.pid hasn't terminated
... | [
"def",
"poll",
"(",
"self",
",",
"_deadstate",
"=",
"None",
")",
":",
"if",
"self",
".",
"sts",
"<",
"0",
":",
"try",
":",
"pid",
",",
"sts",
"=",
"os",
".",
"waitpid",
"(",
"self",
".",
"pid",
",",
"os",
".",
"WNOHANG",
")",
"# pid will be 0 if ... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/popen2.py#L91-L103 | |
MythTV/mythtv | d282a209cb8be85d036f85a62a8ec971b67d45f4 | mythtv/bindings/python/MythTV/services_api/send.py | python | Send.__init__ | (self, host, port=6544) | INPUT:
======
host: Must be set and is the hostname or IP address of the backend
or frontend.
port: Only needed if the backend is using a different port
(unlikely) or set to the frontend port, which is usually
6547. Defaults to 6544... | INPUT:
====== | [
"INPUT",
":",
"======"
] | def __init__(self, host, port=6544):
"""
INPUT:
======
host: Must be set and is the hostname or IP address of the backend
or frontend.
port: Only needed if the backend is using a different port
(unlikely) or set to the frontend port, ... | [
"def",
"__init__",
"(",
"self",
",",
"host",
",",
"port",
"=",
"6544",
")",
":",
"if",
"not",
"host",
":",
"raise",
"RuntimeError",
"(",
"'Missing host argument'",
")",
"self",
".",
"host",
"=",
"host",
"self",
".",
"port",
"=",
"port",
"self",
".",
... | https://github.com/MythTV/mythtv/blob/d282a209cb8be85d036f85a62a8ec971b67d45f4/mythtv/bindings/python/MythTV/services_api/send.py#L35-L61 | ||
llvm/llvm-project | ffa6262cb4e2a335d26416fad39a581b4f98c5f4 | openmp/runtime/tools/summarizeStats.py | python | uselessValues | (l) | return [not p for p in usefulValues(l)] | I.e. values which are null or zero | I.e. values which are null or zero | [
"I",
".",
"e",
".",
"values",
"which",
"are",
"null",
"or",
"zero"
] | def uselessValues(l):
"""I.e. values which are null or zero"""
return [not p for p in usefulValues(l)] | [
"def",
"uselessValues",
"(",
"l",
")",
":",
"return",
"[",
"not",
"p",
"for",
"p",
"in",
"usefulValues",
"(",
"l",
")",
"]"
] | https://github.com/llvm/llvm-project/blob/ffa6262cb4e2a335d26416fad39a581b4f98c5f4/openmp/runtime/tools/summarizeStats.py#L153-L155 | |
weolar/miniblink49 | 1c4678db0594a4abde23d3ebbcc7cd13c3170777 | third_party/skia/tools/skp/webpages_playback.py | python | SkPicturePlayback.__init__ | (self, parse_options) | Constructs a SkPicturePlayback BuildStep instance. | Constructs a SkPicturePlayback BuildStep instance. | [
"Constructs",
"a",
"SkPicturePlayback",
"BuildStep",
"instance",
"."
] | def __init__(self, parse_options):
"""Constructs a SkPicturePlayback BuildStep instance."""
assert parse_options.browser_executable, 'Must specify --browser_executable'
self._browser_executable = parse_options.browser_executable
self._browser_args = '--disable-setuid-sandbox'
if parse_options.browse... | [
"def",
"__init__",
"(",
"self",
",",
"parse_options",
")",
":",
"assert",
"parse_options",
".",
"browser_executable",
",",
"'Must specify --browser_executable'",
"self",
".",
"_browser_executable",
"=",
"parse_options",
".",
"browser_executable",
"self",
".",
"_browser_... | https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/third_party/skia/tools/skp/webpages_playback.py#L137-L171 | ||
gnuradio/gnuradio | 09c3c4fa4bfb1a02caac74cb5334dfe065391e3b | gr-blocks/python/blocks/stream_to_vector_decimator.py | python | stream_to_vector_decimator.set_sample_rate | (self, sample_rate) | Set the new sampling rate and update the decimator.
Args:
sample_rate: the new rate | Set the new sampling rate and update the decimator. | [
"Set",
"the",
"new",
"sampling",
"rate",
"and",
"update",
"the",
"decimator",
"."
] | def set_sample_rate(self, sample_rate):
"""
Set the new sampling rate and update the decimator.
Args:
sample_rate: the new rate
"""
self._sample_rate = sample_rate
self._update_decimator() | [
"def",
"set_sample_rate",
"(",
"self",
",",
"sample_rate",
")",
":",
"self",
".",
"_sample_rate",
"=",
"sample_rate",
"self",
".",
"_update_decimator",
"(",
")"
] | https://github.com/gnuradio/gnuradio/blob/09c3c4fa4bfb1a02caac74cb5334dfe065391e3b/gr-blocks/python/blocks/stream_to_vector_decimator.py#L44-L52 | ||
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py | python | SBProcess.ReadUnsignedFromMemory | (self, *args) | return _lldb.SBProcess_ReadUnsignedFromMemory(self, *args) | Reads an unsigned integer from memory given a byte size and an address.
Returns the unsigned integer that was read. Example:
# Read a 4 byte unsigned integer from address 0x1000
error = lldb.SBError()
uint = ReadUnsignedFromMemory(0x1000, 4, error)
if error.Success():
... | Reads an unsigned integer from memory given a byte size and an address.
Returns the unsigned integer that was read. Example: | [
"Reads",
"an",
"unsigned",
"integer",
"from",
"memory",
"given",
"a",
"byte",
"size",
"and",
"an",
"address",
".",
"Returns",
"the",
"unsigned",
"integer",
"that",
"was",
"read",
".",
"Example",
":"
] | def ReadUnsignedFromMemory(self, *args):
"""
Reads an unsigned integer from memory given a byte size and an address.
Returns the unsigned integer that was read. Example:
# Read a 4 byte unsigned integer from address 0x1000
error = lldb.SBError()
uint = ReadUnsignedFromM... | [
"def",
"ReadUnsignedFromMemory",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_lldb",
".",
"SBProcess_ReadUnsignedFromMemory",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py#L7215-L7229 | |
cocos-creator/engine-native | 984c4c9f5838253313b44ccd429bd8fac4ec8a6a | tools/bindings-generator/clang/cindex.py | python | TranslationUnit.get_tokens | (self, locations=None, extent=None) | return TokenGroup.get_tokens(self, extent) | Obtain tokens in this translation unit.
This is a generator for Token instances. The caller specifies a range
of source code to obtain tokens for. The range can be specified as a
2-tuple of SourceLocation or as a SourceRange. If both are defined,
behavior is undefined. | Obtain tokens in this translation unit. | [
"Obtain",
"tokens",
"in",
"this",
"translation",
"unit",
"."
] | def get_tokens(self, locations=None, extent=None):
"""Obtain tokens in this translation unit.
This is a generator for Token instances. The caller specifies a range
of source code to obtain tokens for. The range can be specified as a
2-tuple of SourceLocation or as a SourceRange. If both... | [
"def",
"get_tokens",
"(",
"self",
",",
"locations",
"=",
"None",
",",
"extent",
"=",
"None",
")",
":",
"if",
"locations",
"is",
"not",
"None",
":",
"extent",
"=",
"SourceRange",
"(",
"start",
"=",
"locations",
"[",
"0",
"]",
",",
"end",
"=",
"locatio... | https://github.com/cocos-creator/engine-native/blob/984c4c9f5838253313b44ccd429bd8fac4ec8a6a/tools/bindings-generator/clang/cindex.py#L3076-L3087 | |
ApolloAuto/apollo | 463fb82f9e979d02dcb25044e60931293ab2dba0 | modules/drivers/lidar/velodyne/parser/scripts/gen_calibration.py | python | addLaserCalibration | (laser_num, key, val) | Define key and corresponding value for laser_num | Define key and corresponding value for laser_num | [
"Define",
"key",
"and",
"corresponding",
"value",
"for",
"laser_num"
] | def addLaserCalibration(laser_num, key, val):
"""Define key and corresponding value for laser_num"""
global calibration
if laser_num < len(calibration['lasers']):
calibration['lasers'][laser_num][key] = val
else:
calibration['lasers'].append({key: val}) | [
"def",
"addLaserCalibration",
"(",
"laser_num",
",",
"key",
",",
"val",
")",
":",
"global",
"calibration",
"if",
"laser_num",
"<",
"len",
"(",
"calibration",
"[",
"'lasers'",
"]",
")",
":",
"calibration",
"[",
"'lasers'",
"]",
"[",
"laser_num",
"]",
"[",
... | https://github.com/ApolloAuto/apollo/blob/463fb82f9e979d02dcb25044e60931293ab2dba0/modules/drivers/lidar/velodyne/parser/scripts/gen_calibration.py#L119-L126 | ||
CaoWGG/TensorRT-CenterNet | f949252e37b51e60f873808f46d3683f15735e79 | onnx-tensorrt/third_party/onnx/third_party/pybind11/tools/clang/cindex.py | python | TranslationUnit.save | (self, filename) | Saves the TranslationUnit to a file.
This is equivalent to passing -emit-ast to the clang frontend. The
saved file can be loaded back into a TranslationUnit. Or, if it
corresponds to a header, it can be used as a pre-compiled header file.
If an error occurs while saving, a TranslationU... | Saves the TranslationUnit to a file. | [
"Saves",
"the",
"TranslationUnit",
"to",
"a",
"file",
"."
] | def save(self, filename):
"""Saves the TranslationUnit to a file.
This is equivalent to passing -emit-ast to the clang frontend. The
saved file can be loaded back into a TranslationUnit. Or, if it
corresponds to a header, it can be used as a pre-compiled header file.
If an erro... | [
"def",
"save",
"(",
"self",
",",
"filename",
")",
":",
"options",
"=",
"conf",
".",
"lib",
".",
"clang_defaultSaveOptions",
"(",
"self",
")",
"result",
"=",
"int",
"(",
"conf",
".",
"lib",
".",
"clang_saveTranslationUnit",
"(",
"self",
",",
"filename",
"... | https://github.com/CaoWGG/TensorRT-CenterNet/blob/f949252e37b51e60f873808f46d3683f15735e79/onnx-tensorrt/third_party/onnx/third_party/pybind11/tools/clang/cindex.py#L2715-L2735 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/saved_model/main_op_impl.py | python | main_op | () | return control_flow_ops.group(init, init_local, init_tables) | Returns a main op to init variables and tables.
Returns the main op including the group of ops that initializes all
variables, initializes local variables and initialize all tables.
Returns:
The set of ops to be run as part of the main op upon the load operation. | Returns a main op to init variables and tables. | [
"Returns",
"a",
"main",
"op",
"to",
"init",
"variables",
"and",
"tables",
"."
] | def main_op():
"""Returns a main op to init variables and tables.
Returns the main op including the group of ops that initializes all
variables, initializes local variables and initialize all tables.
Returns:
The set of ops to be run as part of the main op upon the load operation.
"""
init = variables... | [
"def",
"main_op",
"(",
")",
":",
"init",
"=",
"variables",
".",
"global_variables_initializer",
"(",
")",
"init_local",
"=",
"variables",
".",
"local_variables_initializer",
"(",
")",
"init_tables",
"=",
"lookup_ops",
".",
"tables_initializer",
"(",
")",
"return",... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/saved_model/main_op_impl.py#L27-L39 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/training/monitored_session.py | python | _HookedSession.__init__ | (self, sess, hooks) | Initializes a _HookedSession object.
Args:
sess: A `tf.compat.v1.Session` or a `_WrappedSession` object.
hooks: An iterable of `SessionRunHook' objects. | Initializes a _HookedSession object. | [
"Initializes",
"a",
"_HookedSession",
"object",
"."
] | def __init__(self, sess, hooks):
"""Initializes a _HookedSession object.
Args:
sess: A `tf.compat.v1.Session` or a `_WrappedSession` object.
hooks: An iterable of `SessionRunHook' objects.
"""
_WrappedSession.__init__(self, sess)
self._hooks = hooks
self._should_stop = False | [
"def",
"__init__",
"(",
"self",
",",
"sess",
",",
"hooks",
")",
":",
"_WrappedSession",
".",
"__init__",
"(",
"self",
",",
"sess",
")",
"self",
".",
"_hooks",
"=",
"hooks",
"self",
".",
"_should_stop",
"=",
"False"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/training/monitored_session.py#L1380-L1390 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/distutils/ccompiler.py | python | CCompiler.set_library_dirs | (self, dirs) | Set the list of library search directories to 'dirs' (a list of
strings). This does not affect any standard library search path
that the linker may search by default. | Set the list of library search directories to 'dirs' (a list of
strings). This does not affect any standard library search path
that the linker may search by default. | [
"Set",
"the",
"list",
"of",
"library",
"search",
"directories",
"to",
"dirs",
"(",
"a",
"list",
"of",
"strings",
")",
".",
"This",
"does",
"not",
"affect",
"any",
"standard",
"library",
"search",
"path",
"that",
"the",
"linker",
"may",
"search",
"by",
"d... | def set_library_dirs(self, dirs):
"""Set the list of library search directories to 'dirs' (a list of
strings). This does not affect any standard library search path
that the linker may search by default.
"""
self.library_dirs = dirs[:] | [
"def",
"set_library_dirs",
"(",
"self",
",",
"dirs",
")",
":",
"self",
".",
"library_dirs",
"=",
"dirs",
"[",
":",
"]"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/distutils/ccompiler.py#L280-L285 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/pythonwin/pywin/framework/app.py | python | CApp.LoadMainFrame | (self) | Create the main applications frame | Create the main applications frame | [
"Create",
"the",
"main",
"applications",
"frame"
] | def LoadMainFrame(self):
" Create the main applications frame "
self.frame = self.CreateMainFrame()
self.SetMainFrame(self.frame)
self.frame.LoadFrame(win32ui.IDR_MAINFRAME, win32con.WS_OVERLAPPEDWINDOW)
self.frame.DragAcceptFiles() # we can accept these.
self.frame.ShowWindow(win32ui.GetInitialStateRequest... | [
"def",
"LoadMainFrame",
"(",
"self",
")",
":",
"self",
".",
"frame",
"=",
"self",
".",
"CreateMainFrame",
"(",
")",
"self",
".",
"SetMainFrame",
"(",
"self",
".",
"frame",
")",
"self",
".",
"frame",
".",
"LoadFrame",
"(",
"win32ui",
".",
"IDR_MAINFRAME",... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/pythonwin/pywin/framework/app.py#L190-L198 | ||
Kitt-AI/snowboy | c9ff036e2ef3f9c422a3b8c9a01361dbad7a9bd4 | examples/Python3/snowboydecoder.py | python | HotwordDetector.start | (self, detected_callback=play_audio_file,
interrupt_check=lambda: False,
sleep_time=0.03,
audio_recorder_callback=None,
silent_count_threshold=15,
recording_timeout=100) | Start the voice detector. For every `sleep_time` second it checks the
audio buffer for triggering keywords. If detected, then call
corresponding function in `detected_callback`, which can be a single
function (single model) or a list of callback functions (multiple
models). Every loop it... | Start the voice detector. For every `sleep_time` second it checks the
audio buffer for triggering keywords. If detected, then call
corresponding function in `detected_callback`, which can be a single
function (single model) or a list of callback functions (multiple
models). Every loop it... | [
"Start",
"the",
"voice",
"detector",
".",
"For",
"every",
"sleep_time",
"second",
"it",
"checks",
"the",
"audio",
"buffer",
"for",
"triggering",
"keywords",
".",
"If",
"detected",
"then",
"call",
"corresponding",
"function",
"in",
"detected_callback",
"which",
"... | def start(self, detected_callback=play_audio_file,
interrupt_check=lambda: False,
sleep_time=0.03,
audio_recorder_callback=None,
silent_count_threshold=15,
recording_timeout=100):
"""
Start the voice detector. For every `sleep_time` s... | [
"def",
"start",
"(",
"self",
",",
"detected_callback",
"=",
"play_audio_file",
",",
"interrupt_check",
"=",
"lambda",
":",
"False",
",",
"sleep_time",
"=",
"0.03",
",",
"audio_recorder_callback",
"=",
"None",
",",
"silent_count_threshold",
"=",
"15",
",",
"recor... | https://github.com/Kitt-AI/snowboy/blob/c9ff036e2ef3f9c422a3b8c9a01361dbad7a9bd4/examples/Python3/snowboydecoder.py#L128-L248 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/logging/handlers.py | python | WatchedFileHandler.emit | (self, record) | Emit a record.
If underlying file has changed, reopen the file before emitting the
record to it. | Emit a record. | [
"Emit",
"a",
"record",
"."
] | def emit(self, record):
"""
Emit a record.
If underlying file has changed, reopen the file before emitting the
record to it.
"""
self.reopenIfNeeded()
logging.FileHandler.emit(self, record) | [
"def",
"emit",
"(",
"self",
",",
"record",
")",
":",
"self",
".",
"reopenIfNeeded",
"(",
")",
"logging",
".",
"FileHandler",
".",
"emit",
"(",
"self",
",",
"record",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/logging/handlers.py#L509-L517 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/urllib/request.py | python | URLopener.open_local_file | (self, url) | Use local file. | Use local file. | [
"Use",
"local",
"file",
"."
] | def open_local_file(self, url):
"""Use local file."""
import email.utils
import mimetypes
host, file = splithost(url)
localname = url2pathname(file)
try:
stats = os.stat(localname)
except OSError as e:
raise URLError(e.strerror, e.filename)... | [
"def",
"open_local_file",
"(",
"self",
",",
"url",
")",
":",
"import",
"email",
".",
"utils",
"import",
"mimetypes",
"host",
",",
"file",
"=",
"splithost",
"(",
"url",
")",
"localname",
"=",
"url2pathname",
"(",
"file",
")",
"try",
":",
"stats",
"=",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/urllib/request.py#L2009-L2039 | ||
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/resmokelib/core/pipe.py | python | LoggerPipe.run | (self) | Read the output from 'pipe_out' and logs each line to 'logger'. | Read the output from 'pipe_out' and logs each line to 'logger'. | [
"Read",
"the",
"output",
"from",
"pipe_out",
"and",
"logs",
"each",
"line",
"to",
"logger",
"."
] | def run(self):
"""Read the output from 'pipe_out' and logs each line to 'logger'."""
with self.__lock:
self.__started = True
self.__condition.notify_all()
# Close the pipe when finished reading all of the output.
with self.__pipe_out:
# Avoid bufferi... | [
"def",
"run",
"(",
"self",
")",
":",
"with",
"self",
".",
"__lock",
":",
"self",
".",
"__started",
"=",
"True",
"self",
".",
"__condition",
".",
"notify_all",
"(",
")",
"# Close the pipe when finished reading all of the output.",
"with",
"self",
".",
"__pipe_out... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/resmokelib/core/pipe.py#L42-L67 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/urllib3/packages/six.py | python | ensure_str | (s, encoding="utf-8", errors="strict") | return s | Coerce *s* to `str`.
For Python 2:
- `unicode` -> encoded to `str`
- `str` -> `str`
For Python 3:
- `str` -> `str`
- `bytes` -> decoded to `str` | Coerce *s* to `str`. | [
"Coerce",
"*",
"s",
"*",
"to",
"str",
"."
] | def ensure_str(s, encoding="utf-8", errors="strict"):
"""Coerce *s* to `str`.
For Python 2:
- `unicode` -> encoded to `str`
- `str` -> `str`
For Python 3:
- `str` -> `str`
- `bytes` -> decoded to `str`
"""
if not isinstance(s, (text_type, binary_type)):
raise TypeEr... | [
"def",
"ensure_str",
"(",
"s",
",",
"encoding",
"=",
"\"utf-8\"",
",",
"errors",
"=",
"\"strict\"",
")",
":",
"if",
"not",
"isinstance",
"(",
"s",
",",
"(",
"text_type",
",",
"binary_type",
")",
")",
":",
"raise",
"TypeError",
"(",
"\"not expecting type '%... | 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/urllib3/packages/six.py#L939-L956 | |
Illumina/strelka | d7377443b62319f7c7bd70c241c4b2df3459e29a | scratch/util/mergeScoringModels.py | python | update | (d, u) | return d | recursive merge of u into d | recursive merge of u into d | [
"recursive",
"merge",
"of",
"u",
"into",
"d"
] | def update(d, u):
"""
recursive merge of u into d
"""
for k, v in u.iteritems():
if isinstance(v, collections.Mapping):
r = update(d.get(k, {}), v)
d[k] = r
else:
assert(k not in d)
d[k] = u[k]
return d | [
"def",
"update",
"(",
"d",
",",
"u",
")",
":",
"for",
"k",
",",
"v",
"in",
"u",
".",
"iteritems",
"(",
")",
":",
"if",
"isinstance",
"(",
"v",
",",
"collections",
".",
"Mapping",
")",
":",
"r",
"=",
"update",
"(",
"d",
".",
"get",
"(",
"k",
... | https://github.com/Illumina/strelka/blob/d7377443b62319f7c7bd70c241c4b2df3459e29a/scratch/util/mergeScoringModels.py#L26-L37 | |
GJDuck/LowFat | ecf6a0f0fa1b73a27a626cf493cc39e477b6faea | llvm-4.0.0.src/bindings/python/llvm/common.py | python | LLVMObject.take_ownership | (self, obj) | Take ownership of another object.
When you take ownership of another object, you are responsible for
destroying that object. In addition, a reference to that object is
placed inside this object so the Python garbage collector will not
collect the object while it is still alive in libLLV... | Take ownership of another object. | [
"Take",
"ownership",
"of",
"another",
"object",
"."
] | def take_ownership(self, obj):
"""Take ownership of another object.
When you take ownership of another object, you are responsible for
destroying that object. In addition, a reference to that object is
placed inside this object so the Python garbage collector will not
collect th... | [
"def",
"take_ownership",
"(",
"self",
",",
"obj",
")",
":",
"assert",
"isinstance",
"(",
"obj",
",",
"LLVMObject",
")",
"self",
".",
"_owned_objects",
".",
"append",
"(",
"obj",
")",
"obj",
".",
"_self_owned",
"=",
"False"
] | https://github.com/GJDuck/LowFat/blob/ecf6a0f0fa1b73a27a626cf493cc39e477b6faea/llvm-4.0.0.src/bindings/python/llvm/common.py#L44-L58 | ||
giuspen/cherrytree | 84712f206478fcf9acf30174009ad28c648c6344 | pygtk2/modules/printing.py | python | PrintHandler.on_print_status_changed | (self, operation) | Print Operation Status Changed | Print Operation Status Changed | [
"Print",
"Operation",
"Status",
"Changed"
] | def on_print_status_changed(self, operation):
"""Print Operation Status Changed"""
if operation.is_finished(): active_prints.remove(operation) | [
"def",
"on_print_status_changed",
"(",
"self",
",",
"operation",
")",
":",
"if",
"operation",
".",
"is_finished",
"(",
")",
":",
"active_prints",
".",
"remove",
"(",
"operation",
")"
] | https://github.com/giuspen/cherrytree/blob/84712f206478fcf9acf30174009ad28c648c6344/pygtk2/modules/printing.py#L75-L77 | ||
lyxok1/Tiny-DSOD | 94d15450699bea0dd3720e75e2d273e476174fba | scripts/cpp_lint.py | python | CheckForNewlineAtEOF | (filename, lines, error) | Logs an error if there is no newline char at the end of the file.
Args:
filename: The name of the current file.
lines: An array of strings, each representing a line of the file.
error: The function to call with any errors found. | Logs an error if there is no newline char at the end of the file. | [
"Logs",
"an",
"error",
"if",
"there",
"is",
"no",
"newline",
"char",
"at",
"the",
"end",
"of",
"the",
"file",
"."
] | def CheckForNewlineAtEOF(filename, lines, error):
"""Logs an error if there is no newline char at the end of the file.
Args:
filename: The name of the current file.
lines: An array of strings, each representing a line of the file.
error: The function to call with any errors found.
"""
# The array ... | [
"def",
"CheckForNewlineAtEOF",
"(",
"filename",
",",
"lines",
",",
"error",
")",
":",
"# The array lines() was created by adding two newlines to the",
"# original file (go figure), then splitting on \\n.",
"# To verify that the file ends in \\n, we just have to make sure the",
"# last-but-... | https://github.com/lyxok1/Tiny-DSOD/blob/94d15450699bea0dd3720e75e2d273e476174fba/scripts/cpp_lint.py#L1508-L1523 | ||
psi4/psi4 | be533f7f426b6ccc263904e55122899b16663395 | psi4/driver/qcdb/libmintspointgrp.py | python | SymmetryOperation.__str__ | (self, out=None) | print the matrix | print the matrix | [
"print",
"the",
"matrix"
] | def __str__(self, out=None):
"""print the matrix"""
text = " 1 2 3\n"
text += " 1 "
text += "%10.7f " % (self.d[0][0])
text += "%10.7f " % (self.d[0][1])
text += "%10.7f \n" % (self.d[0][2])
text += " 2 "
text += "%10.7f " % (... | [
"def",
"__str__",
"(",
"self",
",",
"out",
"=",
"None",
")",
":",
"text",
"=",
"\" 1 2 3\\n\"",
"text",
"+=",
"\" 1 \"",
"text",
"+=",
"\"%10.7f \"",
"%",
"(",
"self",
".",
"d",
"[",
"0",
"]",
"[",
"0",
"]",
")",
"text",
"+="... | https://github.com/psi4/psi4/blob/be533f7f426b6ccc263904e55122899b16663395/psi4/driver/qcdb/libmintspointgrp.py#L358-L380 | ||
fatih/subvim | 241b6d170597857105da219c9b7d36059e9f11fb | vim/base/ultisnips/plugin/UltiSnips/_vim.py | python | VimBuffer.current_line_splitted | (self) | return before, after | Returns the text before and after the cursor as a tuple. | Returns the text before and after the cursor as a tuple. | [
"Returns",
"the",
"text",
"before",
"and",
"after",
"the",
"cursor",
"as",
"a",
"tuple",
"."
] | def current_line_splitted(self):
"""Returns the text before and after the cursor as a tuple."""
# Note: we want byte position here
lineno, col = vim.current.window.cursor
line = vim.current.line
before, after = as_unicode(line[:col]), as_unicode(line[col:])
return before... | [
"def",
"current_line_splitted",
"(",
"self",
")",
":",
"# Note: we want byte position here",
"lineno",
",",
"col",
"=",
"vim",
".",
"current",
".",
"window",
".",
"cursor",
"line",
"=",
"vim",
".",
"current",
".",
"line",
"before",
",",
"after",
"=",
"as_uni... | https://github.com/fatih/subvim/blob/241b6d170597857105da219c9b7d36059e9f11fb/vim/base/ultisnips/plugin/UltiSnips/_vim.py#L37-L44 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | gpu/command_buffer/build_gles2_cmd_buffer.py | python | HandWrittenHandler.WriteImmediateFormatTest | (self, func, file) | Overrriden from TypeHandler. | Overrriden from TypeHandler. | [
"Overrriden",
"from",
"TypeHandler",
"."
] | def WriteImmediateFormatTest(self, func, file):
"""Overrriden from TypeHandler."""
file.Write("// TODO(gman): Write test for %s\n" % func.name) | [
"def",
"WriteImmediateFormatTest",
"(",
"self",
",",
"func",
",",
"file",
")",
":",
"file",
".",
"Write",
"(",
"\"// TODO(gman): Write test for %s\\n\"",
"%",
"func",
".",
"name",
")"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/gpu/command_buffer/build_gles2_cmd_buffer.py#L3581-L3583 | ||
apache/trafficserver | 92d238a8fad483c58bc787f784b2ceae73aed532 | plugins/experimental/traffic_dump/post_process.py | python | parse_json | (replay_file) | return parsed_json | Open and parse the replay_file.
Args:
replay_file (string) The file with JSON content to parse.
Return:
The json package parsed JSON file or None if there was a problem
parsing the file. | Open and parse the replay_file. | [
"Open",
"and",
"parse",
"the",
"replay_file",
"."
] | def parse_json(replay_file):
""" Open and parse the replay_file.
Args:
replay_file (string) The file with JSON content to parse.
Return:
The json package parsed JSON file or None if there was a problem
parsing the file.
"""
try:
fd = open(replay_file, 'r')
excep... | [
"def",
"parse_json",
"(",
"replay_file",
")",
":",
"try",
":",
"fd",
"=",
"open",
"(",
"replay_file",
",",
"'r'",
")",
"except",
"Exception",
"as",
"e",
":",
"logging",
".",
"exception",
"(",
"\"Failed to open %s.\"",
",",
"replay_file",
")",
"raise",
"Par... | https://github.com/apache/trafficserver/blob/92d238a8fad483c58bc787f784b2ceae73aed532/plugins/experimental/traffic_dump/post_process.py#L201-L224 | |
apache/singa | 93fd9da72694e68bfe3fb29d0183a65263d238a1 | python/singa/image_tool.py | python | ImageTool.random_crop_resize | (self, patch, inplace=True) | Crop of the image at a random size between 0.08 to 1 of input image
and random aspect ratio between 3/4 to 4/3.
This crop is then resized to the given patch size.
Args:
patch(tuple): width and height of the patch
inplace(Boolean): replace the internal images list... | Crop of the image at a random size between 0.08 to 1 of input image
and random aspect ratio between 3/4 to 4/3.
This crop is then resized to the given patch size. | [
"Crop",
"of",
"the",
"image",
"at",
"a",
"random",
"size",
"between",
"0",
".",
"08",
"to",
"1",
"of",
"input",
"image",
"and",
"random",
"aspect",
"ratio",
"between",
"3",
"/",
"4",
"to",
"4",
"/",
"3",
".",
"This",
"crop",
"is",
"then",
"resized"... | def random_crop_resize(self, patch, inplace=True):
''' Crop of the image at a random size between 0.08 to 1 of input image
and random aspect ratio between 3/4 to 4/3.
This crop is then resized to the given patch size.
Args:
patch(tuple): width and height of the patch... | [
"def",
"random_crop_resize",
"(",
"self",
",",
"patch",
",",
"inplace",
"=",
"True",
")",
":",
"new_imgs",
"=",
"[",
"]",
"for",
"img",
"in",
"self",
".",
"imgs",
":",
"area",
"=",
"img",
".",
"size",
"[",
"0",
"]",
"*",
"img",
".",
"size",
"[",
... | https://github.com/apache/singa/blob/93fd9da72694e68bfe3fb29d0183a65263d238a1/python/singa/image_tool.py#L504-L539 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/email/header.py | python | Header.encode | (self, splitchars=';, \t', maxlinelen=None, linesep='\n') | return value | r"""Encode a message header into an RFC-compliant format.
There are many issues involved in converting a given string for use in
an email header. Only certain character sets are readable in most
email clients, and as header strings can only contain a subset of
7-bit ASCII, care must be... | r"""Encode a message header into an RFC-compliant format. | [
"r",
"Encode",
"a",
"message",
"header",
"into",
"an",
"RFC",
"-",
"compliant",
"format",
"."
] | def encode(self, splitchars=';, \t', maxlinelen=None, linesep='\n'):
r"""Encode a message header into an RFC-compliant format.
There are many issues involved in converting a given string for use in
an email header. Only certain character sets are readable in most
email clients, and as ... | [
"def",
"encode",
"(",
"self",
",",
"splitchars",
"=",
"';, \\t'",
",",
"maxlinelen",
"=",
"None",
",",
"linesep",
"=",
"'\\n'",
")",
":",
"self",
".",
"_normalize",
"(",
")",
"if",
"maxlinelen",
"is",
"None",
":",
"maxlinelen",
"=",
"self",
".",
"_maxl... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/email/header.py#L313-L391 | |
psnonis/FinBERT | c0c555d833a14e2316a3701e59c0b5156f804b4e | bert/tokenization.py | python | convert_to_unicode | (text) | Converts `text` to Unicode (if it's not already), assuming utf-8 input. | Converts `text` to Unicode (if it's not already), assuming utf-8 input. | [
"Converts",
"text",
"to",
"Unicode",
"(",
"if",
"it",
"s",
"not",
"already",
")",
"assuming",
"utf",
"-",
"8",
"input",
"."
] | def convert_to_unicode(text):
"""Converts `text` to Unicode (if it's not already), assuming utf-8 input."""
if six.PY3:
if isinstance(text, str):
return text
elif isinstance(text, bytes):
return text.decode("utf-8", "ignore")
else:
raise ValueError("Unsupported string type: %s" % (type... | [
"def",
"convert_to_unicode",
"(",
"text",
")",
":",
"if",
"six",
".",
"PY3",
":",
"if",
"isinstance",
"(",
"text",
",",
"str",
")",
":",
"return",
"text",
"elif",
"isinstance",
"(",
"text",
",",
"bytes",
")",
":",
"return",
"text",
".",
"decode",
"("... | https://github.com/psnonis/FinBERT/blob/c0c555d833a14e2316a3701e59c0b5156f804b4e/bert/tokenization.py#L78-L95 | ||
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | ppapi/generators/idl_parser.py | python | IDLParser.p_interface_block | (self, p) | interface_block : modifiers INTERFACE SYMBOL '{' interface_list '}' '; | interface_block : modifiers INTERFACE SYMBOL '{' interface_list '}' '; | [
"interface_block",
":",
"modifiers",
"INTERFACE",
"SYMBOL",
"{",
"interface_list",
"}",
";"
] | def p_interface_block(self, p):
"""interface_block : modifiers INTERFACE SYMBOL '{' interface_list '}' ';'"""
p[0] = self.BuildNamed('Interface', p, 3, ListFromConcat(p[1], p[5]))
if self.parse_debug: DumpReduction('interface_block', p) | [
"def",
"p_interface_block",
"(",
"self",
",",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"self",
".",
"BuildNamed",
"(",
"'Interface'",
",",
"p",
",",
"3",
",",
"ListFromConcat",
"(",
"p",
"[",
"1",
"]",
",",
"p",
"[",
"5",
"]",
")",
")",
"if",
... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/ppapi/generators/idl_parser.py#L709-L712 | ||
Kitware/VTK | 5b4df4d90a4f31194d97d3c639dd38ea8f81e8b8 | Wrapping/Python/vtkmodules/gtk/GtkGLExtVTKRenderWindow.py | python | GtkGLExtVTKRenderWindowBase.OnLeave | (self, wid, event) | return gtk.TRUE | Leaving the vtkRenderWindow. | Leaving the vtkRenderWindow. | [
"Leaving",
"the",
"vtkRenderWindow",
"."
] | def OnLeave(self, wid, event):
"""Leaving the vtkRenderWindow."""
return gtk.TRUE | [
"def",
"OnLeave",
"(",
"self",
",",
"wid",
",",
"event",
")",
":",
"return",
"gtk",
".",
"TRUE"
] | https://github.com/Kitware/VTK/blob/5b4df4d90a4f31194d97d3c639dd38ea8f81e8b8/Wrapping/Python/vtkmodules/gtk/GtkGLExtVTKRenderWindow.py#L161-L163 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/apitools/apitools/scripts/oauth2l.py | python | _ValidateToken | (access_token) | return bool(_GetTokenScopes(access_token)) | Return True iff the provided access token is valid. | Return True iff the provided access token is valid. | [
"Return",
"True",
"iff",
"the",
"provided",
"access",
"token",
"is",
"valid",
"."
] | def _ValidateToken(access_token):
"""Return True iff the provided access token is valid."""
return bool(_GetTokenScopes(access_token)) | [
"def",
"_ValidateToken",
"(",
"access_token",
")",
":",
"return",
"bool",
"(",
"_GetTokenScopes",
"(",
"access_token",
")",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/apitools/apitools/scripts/oauth2l.py#L156-L158 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/idlelib/autocomplete.py | python | AutoComplete._delayed_open_completions | (self, args) | Call open_completions if index unchanged. | Call open_completions if index unchanged. | [
"Call",
"open_completions",
"if",
"index",
"unchanged",
"."
] | def _delayed_open_completions(self, args):
"Call open_completions if index unchanged."
self._delayed_completion_id = None
if self.text.index("insert") == self._delayed_completion_index:
self.open_completions(args) | [
"def",
"_delayed_open_completions",
"(",
"self",
",",
"args",
")",
":",
"self",
".",
"_delayed_completion_id",
"=",
"None",
"if",
"self",
".",
"text",
".",
"index",
"(",
"\"insert\"",
")",
"==",
"self",
".",
"_delayed_completion_index",
":",
"self",
".",
"op... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/idlelib/autocomplete.py#L87-L91 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/thumbnailctrl.py | python | ScrolledThumbnail.DeleteFiles | (self) | Deletes the selected thumbnails and their associated files.
.. warning:: This method deletes the original files too. | Deletes the selected thumbnails and their associated files. | [
"Deletes",
"the",
"selected",
"thumbnails",
"and",
"their",
"associated",
"files",
"."
] | def DeleteFiles(self):
"""
Deletes the selected thumbnails and their associated files.
.. warning:: This method deletes the original files too.
"""
dlg = wx.MessageDialog(self, 'Are you sure you want to delete the files?',
'Confirmation',
... | [
"def",
"DeleteFiles",
"(",
"self",
")",
":",
"dlg",
"=",
"wx",
".",
"MessageDialog",
"(",
"self",
",",
"'Are you sure you want to delete the files?'",
",",
"'Confirmation'",
",",
"wx",
".",
"YES_NO",
"|",
"wx",
".",
"NO_DEFAULT",
"|",
"wx",
".",
"ICON_QUESTION... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/thumbnailctrl.py#L2488-L2533 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.