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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/mox3/mox3/mox.py | python | MockAnything.__ne__ | (self, rhs) | return not self == rhs | Provide custom logic to compare objects. | Provide custom logic to compare objects. | [
"Provide",
"custom",
"logic",
"to",
"compare",
"objects",
"."
] | def __ne__(self, rhs):
"""Provide custom logic to compare objects."""
return not self == rhs | [
"def",
"__ne__",
"(",
"self",
",",
"rhs",
")",
":",
"return",
"not",
"self",
"==",
"rhs"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/mox3/mox3/mox.py#L516-L519 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/pip/vcs/subversion.py | python | Subversion.get_info | (self, location) | return url, match.group(1) | Returns (url, revision), where both are strings | Returns (url, revision), where both are strings | [
"Returns",
"(",
"url",
"revision",
")",
"where",
"both",
"are",
"strings"
] | def get_info(self, location):
"""Returns (url, revision), where both are strings"""
assert not location.rstrip('/').endswith(self.dirname), 'Bad directory: %s' % location
output = call_subprocess(
[self.cmd, 'info', location], show_stdout=False, extra_environ={'LANG': 'C'})
m... | [
"def",
"get_info",
"(",
"self",
",",
"location",
")",
":",
"assert",
"not",
"location",
".",
"rstrip",
"(",
"'/'",
")",
".",
"endswith",
"(",
"self",
".",
"dirname",
")",
",",
"'Bad directory: %s'",
"%",
"location",
"output",
"=",
"call_subprocess",
"(",
... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/pip/vcs/subversion.py#L26-L42 | |
scummvm/scummvm | 9c039d027e7ffb9d83ae2e274147e2daf8d57ce2 | devtools/themeparser.py | python | STXBinaryFile.__parseDrawData | (self, ddDom) | return ddBinary | /IsIBBHss/
Section Header (uint32)
Resolution (byte array, word-aligned)
DrawData id hash (uint32)
Cached (byte)
has text section? (byte)
number of DD sections (uint16)
** text segment (4 bytes)
drawstep segments (byte array) | /IsIBBHss/
Section Header (uint32)
Resolution (byte array, word-aligned)
DrawData id hash (uint32)
Cached (byte)
has text section? (byte)
number of DD sections (uint16)
** text segment (4 bytes)
drawstep segments (byte array) | [
"/",
"IsIBBHss",
"/",
"Section",
"Header",
"(",
"uint32",
")",
"Resolution",
"(",
"byte",
"array",
"word",
"-",
"aligned",
")",
"DrawData",
"id",
"hash",
"(",
"uint32",
")",
"Cached",
"(",
"byte",
")",
"has",
"text",
"section?",
"(",
"byte",
")",
"numb... | def __parseDrawData(self, ddDom):
"""
/IsIBBHss/
Section Header (uint32)
Resolution (byte array, word-aligned)
DrawData id hash (uint32)
Cached (byte)
has text section? (byte)
number of DD sections (uint16)
** text segment (4 bytes)
drawstep segments (byte array)
"""
localDefa... | [
"def",
"__parseDrawData",
"(",
"self",
",",
"ddDom",
")",
":",
"localDefaults",
"=",
"ddDom",
".",
"getElementsByTagName",
"(",
"\"defaults\"",
")",
"localDefaults",
"=",
"localDefaults",
"[",
"0",
"]",
"if",
"localDefaults",
"else",
"{",
"}",
"stepList",
"=",... | https://github.com/scummvm/scummvm/blob/9c039d027e7ffb9d83ae2e274147e2daf8d57ce2/devtools/themeparser.py#L438-L487 | |
microsoft/ivy | 9f3c7ecc0b2383129fdd0953e10890d98d09a82d | ivy/ivy_parser.py | python | p_optproofgroup | (p) | optproofgroup : | optproofgroup : | [
"optproofgroup",
":"
] | def p_optproofgroup(p):
'optproofgroup :'
p[0] = None | [
"def",
"p_optproofgroup",
"(",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"None"
] | https://github.com/microsoft/ivy/blob/9f3c7ecc0b2383129fdd0953e10890d98d09a82d/ivy/ivy_parser.py#L1200-L1202 | ||
opencv/opencv_contrib | 7882aea9c9694c921e82812a0b2971f77819b832 | modules/matlab/generator/filters.py | python | cellarray | (items, escape='\'') | return '{' + ', '.join(escape+item+escape for item in items) + '}' | format a list of items as a matlab cell array | format a list of items as a matlab cell array | [
"format",
"a",
"list",
"of",
"items",
"as",
"a",
"matlab",
"cell",
"array"
] | def cellarray(items, escape='\''):
'''format a list of items as a matlab cell array'''
return '{' + ', '.join(escape+item+escape for item in items) + '}' | [
"def",
"cellarray",
"(",
"items",
",",
"escape",
"=",
"'\\''",
")",
":",
"return",
"'{'",
"+",
"', '",
".",
"join",
"(",
"escape",
"+",
"item",
"+",
"escape",
"for",
"item",
"in",
"items",
")",
"+",
"'}'"
] | https://github.com/opencv/opencv_contrib/blob/7882aea9c9694c921e82812a0b2971f77819b832/modules/matlab/generator/filters.py#L147-L149 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/contrib/learn/python/learn/dataframe/transform.py | python | Transform.input_valency | (self) | The number of `Series` that the `Transform` should expect as input.
`None` indicates that the transform can take a variable number of inputs.
This function should depend only on `@parameter`s of this `Transform`.
Returns:
The number of expected inputs. | The number of `Series` that the `Transform` should expect as input. | [
"The",
"number",
"of",
"Series",
"that",
"the",
"Transform",
"should",
"expect",
"as",
"input",
"."
] | def input_valency(self):
"""The number of `Series` that the `Transform` should expect as input.
`None` indicates that the transform can take a variable number of inputs.
This function should depend only on `@parameter`s of this `Transform`.
Returns:
The number of expected inputs.
"""
ra... | [
"def",
"input_valency",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/learn/python/learn/dataframe/transform.py#L129-L139 | ||
brave/muon | 43661f9a8ceefda8e3aba0e8944a72995aa53281 | vendor/native_mate/script/pump.py | python | StartsWith | (lines, pos, string) | return lines[pos.line][pos.column:].startswith(string) | Returns True iff the given position in lines starts with 'string'. | Returns True iff the given position in lines starts with 'string'. | [
"Returns",
"True",
"iff",
"the",
"given",
"position",
"in",
"lines",
"starts",
"with",
"string",
"."
] | def StartsWith(lines, pos, string):
"""Returns True iff the given position in lines starts with 'string'."""
return lines[pos.line][pos.column:].startswith(string) | [
"def",
"StartsWith",
"(",
"lines",
",",
"pos",
",",
"string",
")",
":",
"return",
"lines",
"[",
"pos",
".",
"line",
"]",
"[",
"pos",
".",
"column",
":",
"]",
".",
"startswith",
"(",
"string",
")"
] | https://github.com/brave/muon/blob/43661f9a8ceefda8e3aba0e8944a72995aa53281/vendor/native_mate/script/pump.py#L163-L166 | |
pyne/pyne | 0c2714d7c0d1b5e20be6ae6527da2c660dd6b1b3 | pyne/variancereduction.py | python | cadis | (adj_flux_mesh, adj_flux_tag, q_mesh, q_tag,
ww_mesh, ww_tag, q_bias_mesh, q_bias_tag, beta=5) | This function reads PyNE Mesh objects tagged with adjoint fluxes and
unbiased source densities and outputs PyNE Meshes of weight window lower
bounds and biased source densities as computed by the Consistant
Adjoint-Driven Importance Sampling (CADIS) method [1]. Note that values can
be stored on the same... | This function reads PyNE Mesh objects tagged with adjoint fluxes and
unbiased source densities and outputs PyNE Meshes of weight window lower
bounds and biased source densities as computed by the Consistant
Adjoint-Driven Importance Sampling (CADIS) method [1]. Note that values can
be stored on the same... | [
"This",
"function",
"reads",
"PyNE",
"Mesh",
"objects",
"tagged",
"with",
"adjoint",
"fluxes",
"and",
"unbiased",
"source",
"densities",
"and",
"outputs",
"PyNE",
"Meshes",
"of",
"weight",
"window",
"lower",
"bounds",
"and",
"biased",
"source",
"densities",
"as"... | def cadis(adj_flux_mesh, adj_flux_tag, q_mesh, q_tag,
ww_mesh, ww_tag, q_bias_mesh, q_bias_tag, beta=5):
"""This function reads PyNE Mesh objects tagged with adjoint fluxes and
unbiased source densities and outputs PyNE Meshes of weight window lower
bounds and biased source densities as computed b... | [
"def",
"cadis",
"(",
"adj_flux_mesh",
",",
"adj_flux_tag",
",",
"q_mesh",
",",
"q_tag",
",",
"ww_mesh",
",",
"ww_tag",
",",
"q_bias_mesh",
",",
"q_bias_tag",
",",
"beta",
"=",
"5",
")",
":",
"# find number of energy groups",
"e_groups",
"=",
"adj_flux_mesh",
"... | https://github.com/pyne/pyne/blob/0c2714d7c0d1b5e20be6ae6527da2c660dd6b1b3/pyne/variancereduction.py#L32-L138 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/extern/aui/framemanager.py | python | AuiManager.OnPaneButton | (self, event) | Handles the ``EVT_AUI_PANE_BUTTON`` event for :class:`AuiManager`.
:param `event`: a :class:`AuiManagerEvent` event to be processed. | Handles the ``EVT_AUI_PANE_BUTTON`` event for :class:`AuiManager`. | [
"Handles",
"the",
"EVT_AUI_PANE_BUTTON",
"event",
"for",
":",
"class",
":",
"AuiManager",
"."
] | def OnPaneButton(self, event):
"""
Handles the ``EVT_AUI_PANE_BUTTON`` event for :class:`AuiManager`.
:param `event`: a :class:`AuiManagerEvent` event to be processed.
"""
if not event.pane:
raise Exception("Pane Info passed to AuiManager.OnPaneButton must be non-nu... | [
"def",
"OnPaneButton",
"(",
"self",
",",
"event",
")",
":",
"if",
"not",
"event",
".",
"pane",
":",
"raise",
"Exception",
"(",
"\"Pane Info passed to AuiManager.OnPaneButton must be non-null\"",
")",
"pane",
"=",
"event",
".",
"pane",
"if",
"event",
".",
"button... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/aui/framemanager.py#L9923-L10010 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/thumbnailctrl.py | python | ScrolledThumbnail.IsVideo | (self, fname) | return os.path.splitext(fname)[1].lower() in \
[".m1v", ".m2v"] | Returns ``True`` if a file contains video data.
Currently unused as :class:`ThumbnailCtrl` recognizes only image files.
:param `fname`: a file name.
.. todo:: Find a way to create thumbnails of video, audio and other formats. | Returns ``True`` if a file contains video data.
Currently unused as :class:`ThumbnailCtrl` recognizes only image files. | [
"Returns",
"True",
"if",
"a",
"file",
"contains",
"video",
"data",
".",
"Currently",
"unused",
"as",
":",
"class",
":",
"ThumbnailCtrl",
"recognizes",
"only",
"image",
"files",
"."
] | def IsVideo(self, fname):
"""
Returns ``True`` if a file contains video data.
Currently unused as :class:`ThumbnailCtrl` recognizes only image files.
:param `fname`: a file name.
.. todo:: Find a way to create thumbnails of video, audio and other formats.
"""
r... | [
"def",
"IsVideo",
"(",
"self",
",",
"fname",
")",
":",
"return",
"os",
".",
"path",
".",
"splitext",
"(",
"fname",
")",
"[",
"1",
"]",
".",
"lower",
"(",
")",
"in",
"[",
"\".m1v\"",
",",
"\".m2v\"",
"]"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/thumbnailctrl.py#L1673-L1684 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/client/session_benchmark.py | python | SessionBenchmark._benchmarkRunOp | (self, name, target, iters) | Runs a microbenchmark to measure the cost of running an op.
Reports the median cost of running a trivial (Variable) op.
Args:
name: A human-readable name for logging the output.
target: The session target to use for the benchmark.
iters: The number of iterations to perform. | Runs a microbenchmark to measure the cost of running an op. | [
"Runs",
"a",
"microbenchmark",
"to",
"measure",
"the",
"cost",
"of",
"running",
"an",
"op",
"."
] | def _benchmarkRunOp(self, name, target, iters):
"""Runs a microbenchmark to measure the cost of running an op.
Reports the median cost of running a trivial (Variable) op.
Args:
name: A human-readable name for logging the output.
target: The session target to use for the benchmark.
iters:... | [
"def",
"_benchmarkRunOp",
"(",
"self",
",",
"name",
",",
"target",
",",
"iters",
")",
":",
"times",
"=",
"[",
"]",
"with",
"ops",
".",
"Graph",
"(",
")",
".",
"as_default",
"(",
")",
":",
"# Define the op to be run as a variable, to avoid",
"# constant-folding... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/client/session_benchmark.py#L120-L144 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_core.py | python | Window.ScrollPages | (*args, **kwargs) | return _core_.Window_ScrollPages(*args, **kwargs) | ScrollPages(self, int pages) -> bool
If the platform and window class supports it, scrolls the window by
the given number of pages down, if pages is positive, or up if pages
is negative. Returns True if the window was scrolled, False if it was
already on top/bottom and nothing was done... | ScrollPages(self, int pages) -> bool | [
"ScrollPages",
"(",
"self",
"int",
"pages",
")",
"-",
">",
"bool"
] | def ScrollPages(*args, **kwargs):
"""
ScrollPages(self, int pages) -> bool
If the platform and window class supports it, scrolls the window by
the given number of pages down, if pages is positive, or up if pages
is negative. Returns True if the window was scrolled, False if it ... | [
"def",
"ScrollPages",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Window_ScrollPages",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L11282-L11291 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/model/robotinfo.py | python | RobotInfo._instance_load | (self, f : Union[str,TextIO]) | Loads the info from a JSON file. f is a file name or file object. | Loads the info from a JSON file. f is a file name or file object. | [
"Loads",
"the",
"info",
"from",
"a",
"JSON",
"file",
".",
"f",
"is",
"a",
"file",
"name",
"or",
"file",
"object",
"."
] | def _instance_load(self, f : Union[str,TextIO]) -> None:
"""Loads the info from a JSON file. f is a file name or file object."""
from ..io import loader
if isinstance(f,str):
with open(f,'r') as file:
jsonobj = json.load(file)
else:
jsonobj = json.... | [
"def",
"_instance_load",
"(",
"self",
",",
"f",
":",
"Union",
"[",
"str",
",",
"TextIO",
"]",
")",
"->",
"None",
":",
"from",
".",
".",
"io",
"import",
"loader",
"if",
"isinstance",
"(",
"f",
",",
"str",
")",
":",
"with",
"open",
"(",
"f",
",",
... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/model/robotinfo.py#L413-L442 | ||
intel/caffe | 3f494b442ee3f9d17a07b09ecbd5fa2bbda00836 | examples/faster-rcnn/tools/reval.py | python | parse_args | () | return args | Parse input arguments | Parse input arguments | [
"Parse",
"input",
"arguments"
] | def parse_args():
"""
Parse input arguments
"""
parser = argparse.ArgumentParser(description='Re-evaluate results')
parser.add_argument('output_dir', nargs=1, help='results directory',
type=str)
parser.add_argument('--imdb', dest='imdb_name',
help=... | [
"def",
"parse_args",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"'Re-evaluate results'",
")",
"parser",
".",
"add_argument",
"(",
"'output_dir'",
",",
"nargs",
"=",
"1",
",",
"help",
"=",
"'results directory'",
",... | https://github.com/intel/caffe/blob/3f494b442ee3f9d17a07b09ecbd5fa2bbda00836/examples/faster-rcnn/tools/reval.py#L20-L43 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/statistics.py | python | median_grouped | (data, interval=1) | return L + interval*(n/2 - cf)/f | Return the 50th percentile (median) of grouped continuous data.
>>> median_grouped([1, 2, 2, 3, 4, 4, 4, 4, 4, 5])
3.7
>>> median_grouped([52, 52, 53, 54])
52.5
This calculates the median as the 50th percentile, and should be
used when your data is continuous and grouped. In the above example,... | Return the 50th percentile (median) of grouped continuous data. | [
"Return",
"the",
"50th",
"percentile",
"(",
"median",
")",
"of",
"grouped",
"continuous",
"data",
"."
] | def median_grouped(data, interval=1):
"""Return the 50th percentile (median) of grouped continuous data.
>>> median_grouped([1, 2, 2, 3, 4, 4, 4, 4, 4, 5])
3.7
>>> median_grouped([52, 52, 53, 54])
52.5
This calculates the median as the 50th percentile, and should be
used when your data is ... | [
"def",
"median_grouped",
"(",
"data",
",",
"interval",
"=",
"1",
")",
":",
"data",
"=",
"sorted",
"(",
"data",
")",
"n",
"=",
"len",
"(",
"data",
")",
"if",
"n",
"==",
"0",
":",
"raise",
"StatisticsError",
"(",
"\"no median for empty data\"",
")",
"eli... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/statistics.py#L428-L480 | |
hakuna-m/wubiuefi | caec1af0a09c78fd5a345180ada1fe45e0c63493 | src/urlgrabber/byterange.py | python | range_tuple_to_header | (range_tup) | Convert a range tuple to a Range header value.
Return a string of the form "bytes=<firstbyte>-<lastbyte>" or None
if no range is needed. | Convert a range tuple to a Range header value.
Return a string of the form "bytes=<firstbyte>-<lastbyte>" or None
if no range is needed. | [
"Convert",
"a",
"range",
"tuple",
"to",
"a",
"Range",
"header",
"value",
".",
"Return",
"a",
"string",
"of",
"the",
"form",
"bytes",
"=",
"<firstbyte",
">",
"-",
"<lastbyte",
">",
"or",
"None",
"if",
"no",
"range",
"is",
"needed",
"."
] | def range_tuple_to_header(range_tup):
"""Convert a range tuple to a Range header value.
Return a string of the form "bytes=<firstbyte>-<lastbyte>" or None
if no range is needed.
"""
if range_tup is None: return None
range_tup = range_tuple_normalize(range_tup)
if range_tup:
if range_... | [
"def",
"range_tuple_to_header",
"(",
"range_tup",
")",
":",
"if",
"range_tup",
"is",
"None",
":",
"return",
"None",
"range_tup",
"=",
"range_tuple_normalize",
"(",
"range_tup",
")",
"if",
"range_tup",
":",
"if",
"range_tup",
"[",
"1",
"]",
":",
"range_tup",
... | https://github.com/hakuna-m/wubiuefi/blob/caec1af0a09c78fd5a345180ada1fe45e0c63493/src/urlgrabber/byterange.py#L428-L438 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/scipy/integrate/quadpack.py | python | dblquad | (func, a, b, gfun, hfun, args=(), epsabs=1.49e-8, epsrel=1.49e-8) | return nquad(func, [temp_ranges, [a, b]], args=args) | Compute a double integral.
Return the double (definite) integral of ``func(y, x)`` from ``x = a..b``
and ``y = gfun(x)..hfun(x)``.
Parameters
----------
func : callable
A Python function or method of at least two variables: y must be the
first argument and x the second argument.
... | Compute a double integral. | [
"Compute",
"a",
"double",
"integral",
"."
] | def dblquad(func, a, b, gfun, hfun, args=(), epsabs=1.49e-8, epsrel=1.49e-8):
"""
Compute a double integral.
Return the double (definite) integral of ``func(y, x)`` from ``x = a..b``
and ``y = gfun(x)..hfun(x)``.
Parameters
----------
func : callable
A Python function or method of ... | [
"def",
"dblquad",
"(",
"func",
",",
"a",
",",
"b",
",",
"gfun",
",",
"hfun",
",",
"args",
"=",
"(",
")",
",",
"epsabs",
"=",
"1.49e-8",
",",
"epsrel",
"=",
"1.49e-8",
")",
":",
"def",
"temp_ranges",
"(",
"*",
"args",
")",
":",
"return",
"[",
"g... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/integrate/quadpack.py#L446-L497 | |
netket/netket | 0d534e54ecbf25b677ea72af6b85947979420652 | netket/models/utils.py | python | update_GCNN_parity | (params) | return unflatten_dict(params) | Adds biases of parity-flip layers to the corresponding no-flip layers.
Corrects for changes in GCNN_parity due to PR #1030 in NetKet 3.3.
Args:
params: a parameter pytree | Adds biases of parity-flip layers to the corresponding no-flip layers.
Corrects for changes in GCNN_parity due to PR #1030 in NetKet 3.3. | [
"Adds",
"biases",
"of",
"parity",
"-",
"flip",
"layers",
"to",
"the",
"corresponding",
"no",
"-",
"flip",
"layers",
".",
"Corrects",
"for",
"changes",
"in",
"GCNN_parity",
"due",
"to",
"PR",
"#1030",
"in",
"NetKet",
"3",
".",
"3",
"."
] | def update_GCNN_parity(params):
"""Adds biases of parity-flip layers to the corresponding no-flip layers.
Corrects for changes in GCNN_parity due to PR #1030 in NetKet 3.3.
Args:
params: a parameter pytree
"""
# unfreeze just in case, doesn't break with a plain dict
params = flatten_dic... | [
"def",
"update_GCNN_parity",
"(",
"params",
")",
":",
"# unfreeze just in case, doesn't break with a plain dict",
"params",
"=",
"flatten_dict",
"(",
"unfreeze",
"(",
"params",
")",
")",
"to_remove",
"=",
"[",
"]",
"for",
"path",
"in",
"params",
":",
"if",
"(",
... | https://github.com/netket/netket/blob/0d534e54ecbf25b677ea72af6b85947979420652/netket/models/utils.py#L6-L31 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/urllib.py | python | URLopener.open_unknown_proxy | (self, proxy, fullurl, data=None) | Overridable interface to open unknown URL type. | Overridable interface to open unknown URL type. | [
"Overridable",
"interface",
"to",
"open",
"unknown",
"URL",
"type",
"."
] | def open_unknown_proxy(self, proxy, fullurl, data=None):
"""Overridable interface to open unknown URL type."""
type, url = splittype(fullurl)
raise IOError, ('url error', 'invalid proxy for %s' % type, proxy) | [
"def",
"open_unknown_proxy",
"(",
"self",
",",
"proxy",
",",
"fullurl",
",",
"data",
"=",
"None",
")",
":",
"type",
",",
"url",
"=",
"splittype",
"(",
"fullurl",
")",
"raise",
"IOError",
",",
"(",
"'url error'",
",",
"'invalid proxy for %s'",
"%",
"type",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/urllib.py#L219-L222 | ||
google/nucleus | 68d3947fafba1337f294c0668a6e1c7f3f1273e3 | nucleus/util/vis.py | python | alt_bases_from_indices | (alt_allele_indices, alternate_bases) | return '-'.join(alleles) | Get alt allele bases based on their indices.
e.g. one alt allele: [0], ["C"] => "C"
or with two alt alleles: [0,2], ["C", "TT", "A"] => "C-A"
Args:
alt_allele_indices: list of integers. Indices of the alt alleles for a
particular example.
alternate_bases: list of strings. All alternate alleles for... | Get alt allele bases based on their indices. | [
"Get",
"alt",
"allele",
"bases",
"based",
"on",
"their",
"indices",
"."
] | def alt_bases_from_indices(alt_allele_indices, alternate_bases):
"""Get alt allele bases based on their indices.
e.g. one alt allele: [0], ["C"] => "C"
or with two alt alleles: [0,2], ["C", "TT", "A"] => "C-A"
Args:
alt_allele_indices: list of integers. Indices of the alt alleles for a
particular ex... | [
"def",
"alt_bases_from_indices",
"(",
"alt_allele_indices",
",",
"alternate_bases",
")",
":",
"alleles",
"=",
"[",
"alternate_bases",
"[",
"i",
"]",
"for",
"i",
"in",
"alt_allele_indices",
"]",
"# Avoiding '/' to support use in file paths.",
"return",
"'-'",
".",
"joi... | https://github.com/google/nucleus/blob/68d3947fafba1337f294c0668a6e1c7f3f1273e3/nucleus/util/vis.py#L514-L530 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/mailbox.py | python | _mboxMMDF.get_string | (self, key, from_=False) | return string.replace(os.linesep, '\n') | Return a string representation or raise a KeyError. | Return a string representation or raise a KeyError. | [
"Return",
"a",
"string",
"representation",
"or",
"raise",
"a",
"KeyError",
"."
] | def get_string(self, key, from_=False):
"""Return a string representation or raise a KeyError."""
start, stop = self._lookup(key)
self._file.seek(start)
if not from_:
self._file.readline()
string = self._file.read(stop - self._file.tell())
return string.replac... | [
"def",
"get_string",
"(",
"self",
",",
"key",
",",
"from_",
"=",
"False",
")",
":",
"start",
",",
"stop",
"=",
"self",
".",
"_lookup",
"(",
"key",
")",
"self",
".",
"_file",
".",
"seek",
"(",
"start",
")",
"if",
"not",
"from_",
":",
"self",
".",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/mailbox.py#L779-L786 | |
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | src/pybind/mgr/mgr_module.py | python | MgrModule.shutdown | (self) | Called by the ceph-mgr service to request that this
module drop out of its serve() function. You do not
need to implement this if you do not implement serve()
:return: None | Called by the ceph-mgr service to request that this
module drop out of its serve() function. You do not
need to implement this if you do not implement serve() | [
"Called",
"by",
"the",
"ceph",
"-",
"mgr",
"service",
"to",
"request",
"that",
"this",
"module",
"drop",
"out",
"of",
"its",
"serve",
"()",
"function",
".",
"You",
"do",
"not",
"need",
"to",
"implement",
"this",
"if",
"you",
"do",
"not",
"implement",
"... | def shutdown(self) -> None:
"""
Called by the ceph-mgr service to request that this
module drop out of its serve() function. You do not
need to implement this if you do not implement serve()
:return: None
"""
if self._rados:
addrs = self._rados.get_a... | [
"def",
"shutdown",
"(",
"self",
")",
"->",
"None",
":",
"if",
"self",
".",
"_rados",
":",
"addrs",
"=",
"self",
".",
"_rados",
".",
"get_addrs",
"(",
")",
"self",
".",
"_rados",
".",
"shutdown",
"(",
")",
"self",
".",
"_ceph_unregister_client",
"(",
... | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/src/pybind/mgr/mgr_module.py#L1286-L1297 | ||
tuttleofx/TuttleOFX | 36fc4cae15092a84ea8c29b9c6658c7cabfadb6e | applications/sam/common/samDoUtils.py | python | SplitCmdNode.getFilename | (self) | return '' | If not found, return an empty string.
Used for reader/writer nodes. | If not found, return an empty string.
Used for reader/writer nodes. | [
"If",
"not",
"found",
"return",
"an",
"empty",
"string",
".",
"Used",
"for",
"reader",
"/",
"writer",
"nodes",
"."
] | def getFilename(self):
"""
If not found, return an empty string.
Used for reader/writer nodes.
"""
for argName, argvalue in self._arguments:
if argName == 'filename':
return argvalue
# get first arg if it has no name
if len(self._argume... | [
"def",
"getFilename",
"(",
"self",
")",
":",
"for",
"argName",
",",
"argvalue",
"in",
"self",
".",
"_arguments",
":",
"if",
"argName",
"==",
"'filename'",
":",
"return",
"argvalue",
"# get first arg if it has no name",
"if",
"len",
"(",
"self",
".",
"_argument... | https://github.com/tuttleofx/TuttleOFX/blob/36fc4cae15092a84ea8c29b9c6658c7cabfadb6e/applications/sam/common/samDoUtils.py#L301-L312 | |
francinexue/xuefu | b6ff79747a42e020588c0c0a921048e08fe4680c | ctpx/ctp3/ctptd.py | python | CtpTd.onRtnInstrumentStatus | (self, InstrumentStatusField) | 合约交易状态通知 | 合约交易状态通知 | [
"合约交易状态通知"
] | def onRtnInstrumentStatus(self, InstrumentStatusField):
"""合约交易状态通知"""
pass | [
"def",
"onRtnInstrumentStatus",
"(",
"self",
",",
"InstrumentStatusField",
")",
":",
"pass"
] | https://github.com/francinexue/xuefu/blob/b6ff79747a42e020588c0c0a921048e08fe4680c/ctpx/ctp3/ctptd.py#L367-L369 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/learn/python/learn/estimators/run_config.py | python | ClusterConfig.__init__ | (self, master=None, evaluation_master=None) | Constructor.
Sets the properties `cluster_spec`, `is_chief`, `master` (if `None` in the
args), `num_ps_replicas`, `task_id`, and `task_type` based on the
`TF_CONFIG` environment variable, if the pertinent information is
present. The `TF_CONFIG` environment variable is a JSON object with
attributes:... | Constructor. | [
"Constructor",
"."
] | def __init__(self, master=None, evaluation_master=None):
"""Constructor.
Sets the properties `cluster_spec`, `is_chief`, `master` (if `None` in the
args), `num_ps_replicas`, `task_id`, and `task_type` based on the
`TF_CONFIG` environment variable, if the pertinent information is
present. The `TF_CO... | [
"def",
"__init__",
"(",
"self",
",",
"master",
"=",
"None",
",",
"evaluation_master",
"=",
"None",
")",
":",
"# If not explicitly specified in the constructor and the TF_CONFIG",
"# environment variable is present, load cluster_spec from TF_CONFIG.",
"config",
"=",
"json",
".",... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/learn/python/learn/estimators/run_config.py#L71-L156 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/devil/devil/android/sdk/adb_wrapper.py | python | AdbWrapper.Emu | (self, cmd, timeout=DEFAULT_TIMEOUT,
retries=DEFAULT_RETRIES) | return self._RunDeviceAdbCmd(['emu'] + cmd, timeout, retries) | Runs an emulator console command.
See http://developer.android.com/tools/devices/emulator.html#console
Args:
cmd: The command to run on the emulator console.
timeout: (optional) Timeout per try in seconds.
retries: (optional) Number of retries to attempt.
Returns:
The output of th... | Runs an emulator console command. | [
"Runs",
"an",
"emulator",
"console",
"command",
"."
] | def Emu(self, cmd, timeout=DEFAULT_TIMEOUT,
retries=DEFAULT_RETRIES):
"""Runs an emulator console command.
See http://developer.android.com/tools/devices/emulator.html#console
Args:
cmd: The command to run on the emulator console.
timeout: (optional) Timeout per try in seconds.
... | [
"def",
"Emu",
"(",
"self",
",",
"cmd",
",",
"timeout",
"=",
"DEFAULT_TIMEOUT",
",",
"retries",
"=",
"DEFAULT_RETRIES",
")",
":",
"if",
"isinstance",
"(",
"cmd",
",",
"basestring",
")",
":",
"cmd",
"=",
"[",
"cmd",
"]",
"return",
"self",
".",
"_RunDevic... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/devil/devil/android/sdk/adb_wrapper.py#L851-L867 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/symbol/numpy/_symbol.py | python | tril | (m, k=0) | return _npi.tril(m, k) | r"""
Lower triangle of an array.
Return a copy of an array with elements above the `k`-th diagonal zeroed.
Parameters
----------
m : _Symbol, shape (M, N)
Input array.
k : int, optional
Diagonal above which to zero elements. `k = 0` (the default) is the
main diagonal, ... | r"""
Lower triangle of an array. | [
"r",
"Lower",
"triangle",
"of",
"an",
"array",
"."
] | def tril(m, k=0):
r"""
Lower triangle of an array.
Return a copy of an array with elements above the `k`-th diagonal zeroed.
Parameters
----------
m : _Symbol, shape (M, N)
Input array.
k : int, optional
Diagonal above which to zero elements. `k = 0` (the default) is the
... | [
"def",
"tril",
"(",
"m",
",",
"k",
"=",
"0",
")",
":",
"return",
"_npi",
".",
"tril",
"(",
"m",
",",
"k",
")"
] | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/symbol/numpy/_symbol.py#L2309-L2332 | |
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Node/__init__.py | python | NodeInfoBase.__setstate__ | (self, state) | Restore the attributes from a pickled state. The version is discarded. | Restore the attributes from a pickled state. The version is discarded. | [
"Restore",
"the",
"attributes",
"from",
"a",
"pickled",
"state",
".",
"The",
"version",
"is",
"discarded",
"."
] | def __setstate__(self, state):
"""
Restore the attributes from a pickled state. The version is discarded.
"""
# TODO check or discard version
del state['_version_id']
for key, value in state.items():
if key not in ('__weakref__',):
setattr... | [
"def",
"__setstate__",
"(",
"self",
",",
"state",
")",
":",
"# TODO check or discard version",
"del",
"state",
"[",
"'_version_id'",
"]",
"for",
"key",
",",
"value",
"in",
"state",
".",
"items",
"(",
")",
":",
"if",
"key",
"not",
"in",
"(",
"'__weakref__'"... | https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Node/__init__.py#L418-L427 | ||
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | syzygy/build/get_syzygy_binaries.py | python | _StatesAreConsistent | (stored, actual) | return True | Validates whether two state dictionaries are consistent. Both must be valid
state dictionaries. Additional entries in |actual| are ignored. | Validates whether two state dictionaries are consistent. Both must be valid
state dictionaries. Additional entries in |actual| are ignored. | [
"Validates",
"whether",
"two",
"state",
"dictionaries",
"are",
"consistent",
".",
"Both",
"must",
"be",
"valid",
"state",
"dictionaries",
".",
"Additional",
"entries",
"in",
"|actual|",
"are",
"ignored",
"."
] | def _StatesAreConsistent(stored, actual):
"""Validates whether two state dictionaries are consistent. Both must be valid
state dictionaries. Additional entries in |actual| are ignored.
"""
if stored['revision'] != actual['revision']:
_LOGGER.debug('Mismatched revision number.')
return False
cont_store... | [
"def",
"_StatesAreConsistent",
"(",
"stored",
",",
"actual",
")",
":",
"if",
"stored",
"[",
"'revision'",
"]",
"!=",
"actual",
"[",
"'revision'",
"]",
":",
"_LOGGER",
".",
"debug",
"(",
"'Mismatched revision number.'",
")",
"return",
"False",
"cont_stored",
"=... | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/syzygy/build/get_syzygy_binaries.py#L133-L149 | |
CanalTP/navitia | cb84ce9859070187e708818b058e6a7e0b7f891b | source/tyr/tyr/binarisation.py | python | bano2mimir | (self, autocomplete_instance, filename, job_id, dataset_uid, autocomplete_version) | launch bano2mimir | launch bano2mimir | [
"launch",
"bano2mimir"
] | def bano2mimir(self, autocomplete_instance, filename, job_id, dataset_uid, autocomplete_version):
""" launch bano2mimir """
executable = "bano2mimir" if autocomplete_version == 2 else "bano2mimir7"
autocomplete_instance = models.db.session.merge(autocomplete_instance) # reatache the object
logger = get... | [
"def",
"bano2mimir",
"(",
"self",
",",
"autocomplete_instance",
",",
"filename",
",",
"job_id",
",",
"dataset_uid",
",",
"autocomplete_version",
")",
":",
"executable",
"=",
"\"bano2mimir\"",
"if",
"autocomplete_version",
"==",
"2",
"else",
"\"bano2mimir7\"",
"autoc... | https://github.com/CanalTP/navitia/blob/cb84ce9859070187e708818b058e6a7e0b7f891b/source/tyr/tyr/binarisation.py#L684-L708 | ||
CNugteren/CLBlast | 4500a03440e2cc54998c0edab366babf5e504d67 | scripts/generator/generator/routine.py | python | Routine.buffer_def_vector | (self, name, flavour) | return [] | As above but as vectors | As above but as vectors | [
"As",
"above",
"but",
"as",
"vectors"
] | def buffer_def_vector(self, name, flavour):
"""As above but as vectors"""
prefix = "const " if name in self.inputs else ""
if name in self.inputs or name in self.outputs:
a = [prefix + "std::vector<" + flavour.buffer_type + ">& " + name + "_buffer"]
b = ["const size_t " +... | [
"def",
"buffer_def_vector",
"(",
"self",
",",
"name",
",",
"flavour",
")",
":",
"prefix",
"=",
"\"const \"",
"if",
"name",
"in",
"self",
".",
"inputs",
"else",
"\"\"",
"if",
"name",
"in",
"self",
".",
"inputs",
"or",
"name",
"in",
"self",
".",
"outputs... | https://github.com/CNugteren/CLBlast/blob/4500a03440e2cc54998c0edab366babf5e504d67/scripts/generator/generator/routine.py#L301-L309 | |
psi4/psi4 | be533f7f426b6ccc263904e55122899b16663395 | psi4/driver/qcdb/libmintsbasisset.py | python | BasisSet.refresh | (self) | Refresh internal basis set data. Useful if someone has pushed
to shells. Pushing to shells happens in the BasisSetParsers, so
the parsers will call refresh(). This function is now defunct. | Refresh internal basis set data. Useful if someone has pushed
to shells. Pushing to shells happens in the BasisSetParsers, so
the parsers will call refresh(). This function is now defunct. | [
"Refresh",
"internal",
"basis",
"set",
"data",
".",
"Useful",
"if",
"someone",
"has",
"pushed",
"to",
"shells",
".",
"Pushing",
"to",
"shells",
"happens",
"in",
"the",
"BasisSetParsers",
"so",
"the",
"parsers",
"will",
"call",
"refresh",
"()",
".",
"This",
... | def refresh(self):
"""Refresh internal basis set data. Useful if someone has pushed
to shells. Pushing to shells happens in the BasisSetParsers, so
the parsers will call refresh(). This function is now defunct.
"""
raise FeatureNotImplemented('BasisSet::refresh') | [
"def",
"refresh",
"(",
"self",
")",
":",
"raise",
"FeatureNotImplemented",
"(",
"'BasisSet::refresh'",
")"
] | https://github.com/psi4/psi4/blob/be533f7f426b6ccc263904e55122899b16663395/psi4/driver/qcdb/libmintsbasisset.py#L1399-L1405 | ||
kevin-ssy/Optical-Flow-Guided-Feature | 07d4501a29002ee7821c38c1820e4a64c1acf6e8 | lib/caffe-action/scripts/cpp_lint.py | python | FileInfo.RepositoryName | (self) | return fullname | FullName after removing the local path to the repository.
If we have a real absolute path name here we can try to do something smart:
detecting the root of the checkout and truncating /path/to/checkout from
the name so that we get header guards that don't include things like
"C:\Documents and Settings\... | FullName after removing the local path to the repository. | [
"FullName",
"after",
"removing",
"the",
"local",
"path",
"to",
"the",
"repository",
"."
] | def RepositoryName(self):
"""FullName after removing the local path to the repository.
If we have a real absolute path name here we can try to do something smart:
detecting the root of the checkout and truncating /path/to/checkout from
the name so that we get header guards that don't include things lik... | [
"def",
"RepositoryName",
"(",
"self",
")",
":",
"fullname",
"=",
"self",
".",
"FullName",
"(",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"fullname",
")",
":",
"project_dir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"fullname",
")",
"if",
... | https://github.com/kevin-ssy/Optical-Flow-Guided-Feature/blob/07d4501a29002ee7821c38c1820e4a64c1acf6e8/lib/caffe-action/scripts/cpp_lint.py#L885-L928 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/mantid/plots/mantidaxes.py | python | MantidAxes3D.plot_surface | (self, *args, **kwargs) | return poly_c | If the **mantid3d** projection is chosen, it can be
used the same as :py:meth:`matplotlib.axes.Axes3D.plot_surface` for arrays,
or it can be used to plot :class:`mantid.api.MatrixWorkspace`
or :class:`mantid.api.IMDHistoWorkspace`. You can have something like::
import matplotlib.pyp... | If the **mantid3d** projection is chosen, it can be
used the same as :py:meth:`matplotlib.axes.Axes3D.plot_surface` for arrays,
or it can be used to plot :class:`mantid.api.MatrixWorkspace`
or :class:`mantid.api.IMDHistoWorkspace`. You can have something like:: | [
"If",
"the",
"**",
"mantid3d",
"**",
"projection",
"is",
"chosen",
"it",
"can",
"be",
"used",
"the",
"same",
"as",
":",
"py",
":",
"meth",
":",
"matplotlib",
".",
"axes",
".",
"Axes3D",
".",
"plot_surface",
"for",
"arrays",
"or",
"it",
"can",
"be",
"... | def plot_surface(self, *args, **kwargs):
"""
If the **mantid3d** projection is chosen, it can be
used the same as :py:meth:`matplotlib.axes.Axes3D.plot_surface` for arrays,
or it can be used to plot :class:`mantid.api.MatrixWorkspace`
or :class:`mantid.api.IMDHistoWorkspace`. You... | [
"def",
"plot_surface",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"datafunctions",
".",
"validate_args",
"(",
"*",
"args",
")",
":",
"logger",
".",
"debug",
"(",
"'using plotfunctions3D'",
")",
"poly_c",
"=",
"axesfunctions3D",... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/mantid/plots/mantidaxes.py#L1437-L1469 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py | python | get_supported_platform | () | return plat | Return this platform's maximum compatible version.
distutils.util.get_platform() normally reports the minimum version
of macOS that would be required to *use* extensions produced by
distutils. But what we want when checking compatibility is to know the
version of macOS that we are *running*. To allow... | Return this platform's maximum compatible version. | [
"Return",
"this",
"platform",
"s",
"maximum",
"compatible",
"version",
"."
] | def get_supported_platform():
"""Return this platform's maximum compatible version.
distutils.util.get_platform() normally reports the minimum version
of macOS that would be required to *use* extensions produced by
distutils. But what we want when checking compatibility is to know the
version of m... | [
"def",
"get_supported_platform",
"(",
")",
":",
"plat",
"=",
"get_build_platform",
"(",
")",
"m",
"=",
"macosVersionString",
".",
"match",
"(",
"plat",
")",
"if",
"m",
"is",
"not",
"None",
"and",
"sys",
".",
"platform",
"==",
"\"darwin\"",
":",
"try",
":... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py#L178-L199 | |
happynear/caffe-windows | 967eedf25009e334b7f6f933bb5e17aaaff5bef6 | scripts/cpp_lint.py | python | _NestingState.InNamespaceBody | (self) | return self.stack and isinstance(self.stack[-1], _NamespaceInfo) | Check if we are currently one level inside a namespace body.
Returns:
True if top of the stack is a namespace block, False otherwise. | Check if we are currently one level inside a namespace body. | [
"Check",
"if",
"we",
"are",
"currently",
"one",
"level",
"inside",
"a",
"namespace",
"body",
"."
] | def InNamespaceBody(self):
"""Check if we are currently one level inside a namespace body.
Returns:
True if top of the stack is a namespace block, False otherwise.
"""
return self.stack and isinstance(self.stack[-1], _NamespaceInfo) | [
"def",
"InNamespaceBody",
"(",
"self",
")",
":",
"return",
"self",
".",
"stack",
"and",
"isinstance",
"(",
"self",
".",
"stack",
"[",
"-",
"1",
"]",
",",
"_NamespaceInfo",
")"
] | https://github.com/happynear/caffe-windows/blob/967eedf25009e334b7f6f933bb5e17aaaff5bef6/scripts/cpp_lint.py#L1944-L1950 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | gpu/command_buffer/build_gles2_cmd_buffer.py | python | GLcharHandler.WriteImmediateCmdSetHeader | (self, func, file) | Overrriden from TypeHandler. | Overrriden from TypeHandler. | [
"Overrriden",
"from",
"TypeHandler",
"."
] | def WriteImmediateCmdSetHeader(self, func, file):
"""Overrriden from TypeHandler."""
code = """
void SetHeader(uint32 data_size) {
header.SetCmdBySize<ValueType>(data_size);
}
"""
file.Write(code) | [
"def",
"WriteImmediateCmdSetHeader",
"(",
"self",
",",
"func",
",",
"file",
")",
":",
"code",
"=",
"\"\"\"\n void SetHeader(uint32 data_size) {\n header.SetCmdBySize<ValueType>(data_size);\n }\n\"\"\"",
"file",
".",
"Write",
"(",
"code",
")"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/gpu/command_buffer/build_gles2_cmd_buffer.py#L5312-L5319 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/eager/context.py | python | is_async | () | return context().is_async() | Returns true if current thread is in async mode. | Returns true if current thread is in async mode. | [
"Returns",
"true",
"if",
"current",
"thread",
"is",
"in",
"async",
"mode",
"."
] | def is_async():
"""Returns true if current thread is in async mode."""
return context().is_async() | [
"def",
"is_async",
"(",
")",
":",
"return",
"context",
"(",
")",
".",
"is_async",
"(",
")"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/eager/context.py#L2471-L2473 | |
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | python/chigger/base/ChiggerSourceBase.py | python | ChiggerSourceBase.getVTKActor | (self) | return self._vtkactor | Return the constructed vtk actor object. (public)
Returns:
An object derived from vtk.vtkProp. | Return the constructed vtk actor object. (public) | [
"Return",
"the",
"constructed",
"vtk",
"actor",
"object",
".",
"(",
"public",
")"
] | def getVTKActor(self):
"""
Return the constructed vtk actor object. (public)
Returns:
An object derived from vtk.vtkProp.
"""
return self._vtkactor | [
"def",
"getVTKActor",
"(",
"self",
")",
":",
"return",
"self",
".",
"_vtkactor"
] | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/chigger/base/ChiggerSourceBase.py#L67-L74 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/cachecontrol/heuristics.py | python | BaseHeuristic.update_headers | (self, response) | return {} | Update the response headers with any new headers.
NOTE: This SHOULD always include some Warning header to
signify that the response was cached by the client, not
by way of the provided headers. | Update the response headers with any new headers. | [
"Update",
"the",
"response",
"headers",
"with",
"any",
"new",
"headers",
"."
] | def update_headers(self, response):
"""Update the response headers with any new headers.
NOTE: This SHOULD always include some Warning header to
signify that the response was cached by the client, not
by way of the provided headers.
"""
return {} | [
"def",
"update_headers",
"(",
"self",
",",
"response",
")",
":",
"return",
"{",
"}"
] | 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/cachecontrol/heuristics.py#L33-L40 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/shlex.py | python | shlex.pop_source | (self) | Pop the input source stack. | Pop the input source stack. | [
"Pop",
"the",
"input",
"source",
"stack",
"."
] | def pop_source(self):
"Pop the input source stack."
self.instream.close()
(self.infile, self.instream, self.lineno) = self.filestack.popleft()
if self.debug:
print('shlex: popping to %s, line %d' \
% (self.instream, self.lineno))
self.state = ' ' | [
"def",
"pop_source",
"(",
"self",
")",
":",
"self",
".",
"instream",
".",
"close",
"(",
")",
"(",
"self",
".",
"infile",
",",
"self",
".",
"instream",
",",
"self",
".",
"lineno",
")",
"=",
"self",
".",
"filestack",
".",
"popleft",
"(",
")",
"if",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/shlex.py#L92-L99 | ||
wy1iu/LargeMargin_Softmax_Loss | c3e9f20e4f16e2b4daf7d358a614366b9b39a6ec | tools/extra/extract_seconds.py | python | get_log_created_year | (input_file) | return log_created_year | Get year from log file system timestamp | Get year from log file system timestamp | [
"Get",
"year",
"from",
"log",
"file",
"system",
"timestamp"
] | def get_log_created_year(input_file):
"""Get year from log file system timestamp
"""
log_created_time = os.path.getctime(input_file)
log_created_year = datetime.datetime.fromtimestamp(log_created_time).year
return log_created_year | [
"def",
"get_log_created_year",
"(",
"input_file",
")",
":",
"log_created_time",
"=",
"os",
".",
"path",
".",
"getctime",
"(",
"input_file",
")",
"log_created_year",
"=",
"datetime",
".",
"datetime",
".",
"fromtimestamp",
"(",
"log_created_time",
")",
".",
"year"... | https://github.com/wy1iu/LargeMargin_Softmax_Loss/blob/c3e9f20e4f16e2b4daf7d358a614366b9b39a6ec/tools/extra/extract_seconds.py#L22-L28 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/resource_variable_ops.py | python | BaseResourceVariable.gather_nd | (self, indices, name=None) | return array_ops.identity(value) | Reads the value of this variable sparsely, using `gather_nd`. | Reads the value of this variable sparsely, using `gather_nd`. | [
"Reads",
"the",
"value",
"of",
"this",
"variable",
"sparsely",
"using",
"gather_nd",
"."
] | def gather_nd(self, indices, name=None):
"""Reads the value of this variable sparsely, using `gather_nd`."""
with ops.name_scope("GatherNd" if name is None else name) as name:
if self.trainable:
variable_accessed(self)
value = gen_resource_variable_ops.resource_gather_nd(
self._han... | [
"def",
"gather_nd",
"(",
"self",
",",
"indices",
",",
"name",
"=",
"None",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"\"GatherNd\"",
"if",
"name",
"is",
"None",
"else",
"name",
")",
"as",
"name",
":",
"if",
"self",
".",
"trainable",
":",
"vari... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/resource_variable_ops.py#L654-L662 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/persist/persistencemanager.py | python | PersistenceManager.SetManagerStyle | (self, style) | Sets the :class:`PersistenceManager` style.
:param `style`: a combination of the following values:
======================================== ==================================
Flag name Description
======================================== =================... | Sets the :class:`PersistenceManager` style. | [
"Sets",
"the",
":",
"class",
":",
"PersistenceManager",
"style",
"."
] | def SetManagerStyle(self, style):
"""
Sets the :class:`PersistenceManager` style.
:param `style`: a combination of the following values:
======================================== ==================================
Flag name Description
====... | [
"def",
"SetManagerStyle",
"(",
"self",
",",
"style",
")",
":",
"self",
".",
"_style",
"=",
"style"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/persist/persistencemanager.py#L312-L328 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/data_flow_ops.py | python | BaseStagingArea.names | (self) | return self._names | The list of names for each component of a staging area element. | The list of names for each component of a staging area element. | [
"The",
"list",
"of",
"names",
"for",
"each",
"component",
"of",
"a",
"staging",
"area",
"element",
"."
] | def names(self):
"""The list of names for each component of a staging area element."""
return self._names | [
"def",
"names",
"(",
"self",
")",
":",
"return",
"self",
".",
"_names"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/data_flow_ops.py#L1616-L1618 | |
apache/arrow | af33dd1157eb8d7d9bfac25ebf61445b793b7943 | python/pyarrow/fs.py | python | _resolve_filesystem_and_path | (
path, filesystem=None, allow_legacy_filesystem=False
) | return filesystem, path | Return filesystem/path from path which could be an URI or a plain
filesystem path. | Return filesystem/path from path which could be an URI or a plain
filesystem path. | [
"Return",
"filesystem",
"/",
"path",
"from",
"path",
"which",
"could",
"be",
"an",
"URI",
"or",
"a",
"plain",
"filesystem",
"path",
"."
] | def _resolve_filesystem_and_path(
path, filesystem=None, allow_legacy_filesystem=False
):
"""
Return filesystem/path from path which could be an URI or a plain
filesystem path.
"""
if not _is_path_like(path):
if filesystem is not None:
raise ValueError(
"'file... | [
"def",
"_resolve_filesystem_and_path",
"(",
"path",
",",
"filesystem",
"=",
"None",
",",
"allow_legacy_filesystem",
"=",
"False",
")",
":",
"if",
"not",
"_is_path_like",
"(",
"path",
")",
":",
"if",
"filesystem",
"is",
"not",
"None",
":",
"raise",
"ValueError"... | https://github.com/apache/arrow/blob/af33dd1157eb8d7d9bfac25ebf61445b793b7943/python/pyarrow/fs.py#L131-L189 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/boost/boost_1_68_0/tools/build/src/build/virtual_target.py | python | clone_action | (action, new_project, new_action_name, new_properties) | return cloned_action | Takes an 'action' instances and creates new instance of it
and all produced target. The rule-name and properties are set
to 'new-rule-name' and 'new-properties', if those are specified.
Returns the cloned action. | Takes an 'action' instances and creates new instance of it
and all produced target. The rule-name and properties are set
to 'new-rule-name' and 'new-properties', if those are specified.
Returns the cloned action. | [
"Takes",
"an",
"action",
"instances",
"and",
"creates",
"new",
"instance",
"of",
"it",
"and",
"all",
"produced",
"target",
".",
"The",
"rule",
"-",
"name",
"and",
"properties",
"are",
"set",
"to",
"new",
"-",
"rule",
"-",
"name",
"and",
"new",
"-",
"pr... | def clone_action (action, new_project, new_action_name, new_properties):
"""Takes an 'action' instances and creates new instance of it
and all produced target. The rule-name and properties are set
to 'new-rule-name' and 'new-properties', if those are specified.
Returns the cloned action."""
if __deb... | [
"def",
"clone_action",
"(",
"action",
",",
"new_project",
",",
"new_action_name",
",",
"new_properties",
")",
":",
"if",
"__debug__",
":",
"from",
".",
"targets",
"import",
"ProjectTarget",
"assert",
"isinstance",
"(",
"action",
",",
"Action",
")",
"assert",
"... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/boost/boost_1_68_0/tools/build/src/build/virtual_target.py#L998-L1034 | |
cms-sw/cmssw | fd9de012d503d3405420bcbeec0ec879baa57cf2 | Documentation/DataFormats/python/dataformats.py | python | indent | (rows, hasHeader=False, headerChar='-', delim=' | ', justify='left',
separateRows=False, prefix='', postfix='', wrapfunc=lambda x:x) | return output.getvalue() | Indents a table by column.
- rows: A sequence of sequences of items, one sequence per row.
- hasHeader: True if the first row consists of the columns' names.
- headerChar: Character to be used for the row separator line
(if hasHeader==True or separateRows==True).
- delim: The column... | Indents a table by column.
- rows: A sequence of sequences of items, one sequence per row.
- hasHeader: True if the first row consists of the columns' names.
- headerChar: Character to be used for the row separator line
(if hasHeader==True or separateRows==True).
- delim: The column... | [
"Indents",
"a",
"table",
"by",
"column",
".",
"-",
"rows",
":",
"A",
"sequence",
"of",
"sequences",
"of",
"items",
"one",
"sequence",
"per",
"row",
".",
"-",
"hasHeader",
":",
"True",
"if",
"the",
"first",
"row",
"consists",
"of",
"the",
"columns",
"na... | def indent(rows, hasHeader=False, headerChar='-', delim=' | ', justify='left',
separateRows=False, prefix='', postfix='', wrapfunc=lambda x:x):
"""Indents a table by column.
- rows: A sequence of sequences of items, one sequence per row.
- hasHeader: True if the first row consists of the co... | [
"def",
"indent",
"(",
"rows",
",",
"hasHeader",
"=",
"False",
",",
"headerChar",
"=",
"'-'",
",",
"delim",
"=",
"' | '",
",",
"justify",
"=",
"'left'",
",",
"separateRows",
"=",
"False",
",",
"prefix",
"=",
"''",
",",
"postfix",
"=",
"''",
",",
"wrap... | https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/Documentation/DataFormats/python/dataformats.py#L6-L44 | |
etternagame/etterna | 8775f74ac9c353320128609d4b4150672e9a6d04 | extern/fmt/support/manage.py | python | create_build_env | () | return env | Create a build environment. | Create a build environment. | [
"Create",
"a",
"build",
"environment",
"."
] | def create_build_env():
"""Create a build environment."""
class Env:
pass
env = Env()
# Import the documentation build module.
env.fmt_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, os.path.join(env.fmt_dir, 'doc'))
import build
env.build_d... | [
"def",
"create_build_env",
"(",
")",
":",
"class",
"Env",
":",
"pass",
"env",
"=",
"Env",
"(",
")",
"# Import the documentation build module.",
"env",
".",
"fmt_dir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"o... | https://github.com/etternagame/etterna/blob/8775f74ac9c353320128609d4b4150672e9a6d04/extern/fmt/support/manage.py#L74-L92 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/Inelastic/Direct/RunDescriptor.py | python | RunList.get_fext | (self,index=0) | Get file extension for file with run number
Should be used on defined Run_list only(which should be always true) | Get file extension for file with run number
Should be used on defined Run_list only(which should be always true) | [
"Get",
"file",
"extension",
"for",
"file",
"with",
"run",
"number",
"Should",
"be",
"used",
"on",
"defined",
"Run_list",
"only",
"(",
"which",
"should",
"be",
"always",
"true",
")"
] | def get_fext(self,index=0):
"""Get file extension for file with run number
Should be used on defined Run_list only(which should be always true)
"""
fext_given =self._fext[index]
if fext_given is None:
#pylint: disable=protected-access
return self._theRun._holder.da... | [
"def",
"get_fext",
"(",
"self",
",",
"index",
"=",
"0",
")",
":",
"fext_given",
"=",
"self",
".",
"_fext",
"[",
"index",
"]",
"if",
"fext_given",
"is",
"None",
":",
"#pylint: disable=protected-access",
"return",
"self",
".",
"_theRun",
".",
"_holder",
".",... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/Inelastic/Direct/RunDescriptor.py#L160-L169 | ||
tiny-dnn/tiny-dnn | c0f576f5cb7b35893f62127cb7aec18f77a3bcc5 | third_party/cpplint.py | python | _CppLintState.AddFilters | (self, filters) | Adds more filters to the existing list of error-message filters. | Adds more filters to the existing list of error-message filters. | [
"Adds",
"more",
"filters",
"to",
"the",
"existing",
"list",
"of",
"error",
"-",
"message",
"filters",
"."
] | def AddFilters(self, filters):
""" Adds more filters to the existing list of error-message filters. """
for filt in filters.split(','):
clean_filt = filt.strip()
if clean_filt:
self.filters.append(clean_filt)
for filt in self.filters:
if not (filt.startswith('+') or filt.startswith... | [
"def",
"AddFilters",
"(",
"self",
",",
"filters",
")",
":",
"for",
"filt",
"in",
"filters",
".",
"split",
"(",
"','",
")",
":",
"clean_filt",
"=",
"filt",
".",
"strip",
"(",
")",
"if",
"clean_filt",
":",
"self",
".",
"filters",
".",
"append",
"(",
... | https://github.com/tiny-dnn/tiny-dnn/blob/c0f576f5cb7b35893f62127cb7aec18f77a3bcc5/third_party/cpplint.py#L1021-L1030 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/distributions/transformed_distribution.py | python | _pick_scalar_condition | (pred, cond_true, cond_false) | return cond_true if pred_ else cond_false | Convenience function which chooses the condition based on the predicate. | Convenience function which chooses the condition based on the predicate. | [
"Convenience",
"function",
"which",
"chooses",
"the",
"condition",
"based",
"on",
"the",
"predicate",
"."
] | def _pick_scalar_condition(pred, cond_true, cond_false):
"""Convenience function which chooses the condition based on the predicate."""
# Note: This function is only valid if all of pred, cond_true, and cond_false
# are scalars. This means its semantics are arguably more like tf.cond than
# tf.select even thoug... | [
"def",
"_pick_scalar_condition",
"(",
"pred",
",",
"cond_true",
",",
"cond_false",
")",
":",
"# Note: This function is only valid if all of pred, cond_true, and cond_false",
"# are scalars. This means its semantics are arguably more like tf.cond than",
"# tf.select even though we use tf.sele... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/distributions/transformed_distribution.py#L89-L97 | |
sdhash/sdhash | b9eff63e4e5867e910f41fd69032bbb1c94a2a5e | external/tools/build/v2/util/set.py | python | intersection | (set1, set2) | return result | Removes from set1 any items which don't appear in set2 and returns the result. | Removes from set1 any items which don't appear in set2 and returns the result. | [
"Removes",
"from",
"set1",
"any",
"items",
"which",
"don",
"t",
"appear",
"in",
"set2",
"and",
"returns",
"the",
"result",
"."
] | def intersection (set1, set2):
""" Removes from set1 any items which don't appear in set2 and returns the result.
"""
result = []
for v in set1:
if v in set2:
result.append (v)
return result | [
"def",
"intersection",
"(",
"set1",
",",
"set2",
")",
":",
"result",
"=",
"[",
"]",
"for",
"v",
"in",
"set1",
":",
"if",
"v",
"in",
"set2",
":",
"result",
".",
"append",
"(",
"v",
")",
"return",
"result"
] | https://github.com/sdhash/sdhash/blob/b9eff63e4e5867e910f41fd69032bbb1c94a2a5e/external/tools/build/v2/util/set.py#L18-L25 | |
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | scripts/Python/static-binding/lldb.py | python | SBExpressionOptions.SetLanguage | (self, language) | return _lldb.SBExpressionOptions_SetLanguage(self, language) | SetLanguage(SBExpressionOptions self, lldb::LanguageType language)
Sets the language that LLDB should assume the expression is written in | SetLanguage(SBExpressionOptions self, lldb::LanguageType language) | [
"SetLanguage",
"(",
"SBExpressionOptions",
"self",
"lldb",
"::",
"LanguageType",
"language",
")"
] | def SetLanguage(self, language):
"""
SetLanguage(SBExpressionOptions self, lldb::LanguageType language)
Sets the language that LLDB should assume the expression is written in
"""
return _lldb.SBExpressionOptions_SetLanguage(self, language) | [
"def",
"SetLanguage",
"(",
"self",
",",
"language",
")",
":",
"return",
"_lldb",
".",
"SBExpressionOptions_SetLanguage",
"(",
"self",
",",
"language",
")"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L5073-L5079 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/decimal.py | python | Decimal.is_zero | (self) | return not self._is_special and self._int == '0' | Return True if self is a zero; otherwise return False. | Return True if self is a zero; otherwise return False. | [
"Return",
"True",
"if",
"self",
"is",
"a",
"zero",
";",
"otherwise",
"return",
"False",
"."
] | def is_zero(self):
"""Return True if self is a zero; otherwise return False."""
return not self._is_special and self._int == '0' | [
"def",
"is_zero",
"(",
"self",
")",
":",
"return",
"not",
"self",
".",
"_is_special",
"and",
"self",
".",
"_int",
"==",
"'0'"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/decimal.py#L3059-L3061 | |
Tencent/Pebble | 68315f176d9e328a233ace29b7579a829f89879f | tools/blade/src/blade/console.py | python | info | (msg, prefix=True) | dump info message. | dump info message. | [
"dump",
"info",
"message",
"."
] | def info(msg, prefix=True):
"""dump info message. """
if prefix:
msg = 'Blade(info): ' + msg
if color_enabled:
msg = _colors['cyan'] + msg + _colors['end']
print >>sys.stderr, msg | [
"def",
"info",
"(",
"msg",
",",
"prefix",
"=",
"True",
")",
":",
"if",
"prefix",
":",
"msg",
"=",
"'Blade(info): '",
"+",
"msg",
"if",
"color_enabled",
":",
"msg",
"=",
"_colors",
"[",
"'cyan'",
"]",
"+",
"msg",
"+",
"_colors",
"[",
"'end'",
"]",
"... | https://github.com/Tencent/Pebble/blob/68315f176d9e328a233ace29b7579a829f89879f/tools/blade/src/blade/console.py#L58-L64 | ||
ARM-software/armnn | 5e9965cae1cc6162649910f423ebd86001fc1931 | python/pyarmnn/examples/object_detection/run_video_file.py | python | get_model_processing | (model_name: str, video: cv2.VideoCapture, input_binding_info: tuple) | Gets model-specific information such as model labels and decoding and processing functions.
The user can include their own network and functions by adding another statement.
Args:
model_name: Name of type of supported model.
video: Video capture object, contains information about data source.
... | Gets model-specific information such as model labels and decoding and processing functions.
The user can include their own network and functions by adding another statement. | [
"Gets",
"model",
"-",
"specific",
"information",
"such",
"as",
"model",
"labels",
"and",
"decoding",
"and",
"processing",
"functions",
".",
"The",
"user",
"can",
"include",
"their",
"own",
"network",
"and",
"functions",
"by",
"adding",
"another",
"statement",
... | def get_model_processing(model_name: str, video: cv2.VideoCapture, input_binding_info: tuple):
"""
Gets model-specific information such as model labels and decoding and processing functions.
The user can include their own network and functions by adding another statement.
Args:
model_name: Name... | [
"def",
"get_model_processing",
"(",
"model_name",
":",
"str",
",",
"video",
":",
"cv2",
".",
"VideoCapture",
",",
"input_binding_info",
":",
"tuple",
")",
":",
"if",
"model_name",
"==",
"'ssd_mobilenet_v1'",
":",
"return",
"ssd_processing",
",",
"ssd_resize_factor... | https://github.com/ARM-software/armnn/blob/5e9965cae1cc6162649910f423ebd86001fc1931/python/pyarmnn/examples/object_detection/run_video_file.py#L25-L43 | ||
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/python/tools/freeze_graph.py | python | freeze_graph | (input_graph, input_saver, input_binary, input_checkpoint,
output_node_names, restore_op_name, filename_tensor_name,
output_graph, clear_devices, initializer_nodes) | Converts all variables in a graph and checkpoint into constants. | Converts all variables in a graph and checkpoint into constants. | [
"Converts",
"all",
"variables",
"in",
"a",
"graph",
"and",
"checkpoint",
"into",
"constants",
"."
] | def freeze_graph(input_graph, input_saver, input_binary, input_checkpoint,
output_node_names, restore_op_name, filename_tensor_name,
output_graph, clear_devices, initializer_nodes):
"""Converts all variables in a graph and checkpoint into constants."""
if not tf.gfile.Exists(input... | [
"def",
"freeze_graph",
"(",
"input_graph",
",",
"input_saver",
",",
"input_binary",
",",
"input_checkpoint",
",",
"output_node_names",
",",
"restore_op_name",
",",
"filename_tensor_name",
",",
"output_graph",
",",
"clear_devices",
",",
"initializer_nodes",
")",
":",
"... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/tools/freeze_graph.py#L70-L124 | ||
plumonito/dtslam | 5994bb9cf7a11981b830370db206bceb654c085d | 3rdparty/opencv-git/3rdparty/jinja2/utils.py | python | is_undefined | (obj) | return isinstance(obj, Undefined) | Check if the object passed is undefined. This does nothing more than
performing an instance check against :class:`Undefined` but looks nicer.
This can be used for custom filters or tests that want to react to
undefined variables. For example a custom default filter can look like
this::
def de... | Check if the object passed is undefined. This does nothing more than
performing an instance check against :class:`Undefined` but looks nicer.
This can be used for custom filters or tests that want to react to
undefined variables. For example a custom default filter can look like
this:: | [
"Check",
"if",
"the",
"object",
"passed",
"is",
"undefined",
".",
"This",
"does",
"nothing",
"more",
"than",
"performing",
"an",
"instance",
"check",
"against",
":",
"class",
":",
"Undefined",
"but",
"looks",
"nicer",
".",
"This",
"can",
"be",
"used",
"for... | def is_undefined(obj):
"""Check if the object passed is undefined. This does nothing more than
performing an instance check against :class:`Undefined` but looks nicer.
This can be used for custom filters or tests that want to react to
undefined variables. For example a custom default filter can look l... | [
"def",
"is_undefined",
"(",
"obj",
")",
":",
"from",
"jinja2",
".",
"runtime",
"import",
"Undefined",
"return",
"isinstance",
"(",
"obj",
",",
"Undefined",
")"
] | https://github.com/plumonito/dtslam/blob/5994bb9cf7a11981b830370db206bceb654c085d/3rdparty/opencv-git/3rdparty/jinja2/utils.py#L85-L98 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/timeseries/python/timeseries/input_pipeline.py | python | CSVReader._process_records | (self, lines) | return features | Parse `lines` as CSV records. | Parse `lines` as CSV records. | [
"Parse",
"lines",
"as",
"CSV",
"records",
"."
] | def _process_records(self, lines):
"""Parse `lines` as CSV records."""
if self._column_dtypes is None:
default_values = [(array_ops.zeros([], dtypes.int64),)
if column_name == feature_keys.TrainEvalFeatures.TIMES
else () for column_name in self._column_names... | [
"def",
"_process_records",
"(",
"self",
",",
"lines",
")",
":",
"if",
"self",
".",
"_column_dtypes",
"is",
"None",
":",
"default_values",
"=",
"[",
"(",
"array_ops",
".",
"zeros",
"(",
"[",
"]",
",",
"dtypes",
".",
"int64",
")",
",",
")",
"if",
"colu... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/timeseries/python/timeseries/input_pipeline.py#L480-L500 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/losses/losses_impl.py | python | softmax_cross_entropy | (
onehot_labels, logits, weights=1.0, label_smoothing=0, scope=None,
loss_collection=ops.GraphKeys.LOSSES,
reduction=Reduction.SUM_BY_NONZERO_WEIGHTS) | Creates a cross-entropy loss using tf.nn.softmax_cross_entropy_with_logits_v2.
`weights` acts as a coefficient for the loss. If a scalar is provided,
then the loss is simply scaled by the given value. If `weights` is a
tensor of shape `[batch_size]`, then the loss weights apply to each
corresponding sample.
... | Creates a cross-entropy loss using tf.nn.softmax_cross_entropy_with_logits_v2. | [
"Creates",
"a",
"cross",
"-",
"entropy",
"loss",
"using",
"tf",
".",
"nn",
".",
"softmax_cross_entropy_with_logits_v2",
"."
] | def softmax_cross_entropy(
onehot_labels, logits, weights=1.0, label_smoothing=0, scope=None,
loss_collection=ops.GraphKeys.LOSSES,
reduction=Reduction.SUM_BY_NONZERO_WEIGHTS):
"""Creates a cross-entropy loss using tf.nn.softmax_cross_entropy_with_logits_v2.
`weights` acts as a coefficient for the loss... | [
"def",
"softmax_cross_entropy",
"(",
"onehot_labels",
",",
"logits",
",",
"weights",
"=",
"1.0",
",",
"label_smoothing",
"=",
"0",
",",
"scope",
"=",
"None",
",",
"loss_collection",
"=",
"ops",
".",
"GraphKeys",
".",
"LOSSES",
",",
"reduction",
"=",
"Reducti... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/losses/losses_impl.py#L714-L781 | ||
mapnik/mapnik | f3da900c355e1d15059c4a91b00203dcc9d9f0ef | scons/scons-local-4.1.0/SCons/Executor.py | python | Executor.get_implicit_deps | (self) | return result | Return the executor's implicit dependencies, i.e. the nodes of
the commands to be executed. | Return the executor's implicit dependencies, i.e. the nodes of
the commands to be executed. | [
"Return",
"the",
"executor",
"s",
"implicit",
"dependencies",
"i",
".",
"e",
".",
"the",
"nodes",
"of",
"the",
"commands",
"to",
"be",
"executed",
"."
] | def get_implicit_deps(self):
"""Return the executor's implicit dependencies, i.e. the nodes of
the commands to be executed."""
result = []
build_env = self.get_build_env()
for act in self.get_action_list():
deps = act.get_implicit_deps(self.get_all_targets(),
... | [
"def",
"get_implicit_deps",
"(",
"self",
")",
":",
"result",
"=",
"[",
"]",
"build_env",
"=",
"self",
".",
"get_build_env",
"(",
")",
"for",
"act",
"in",
"self",
".",
"get_action_list",
"(",
")",
":",
"deps",
"=",
"act",
".",
"get_implicit_deps",
"(",
... | https://github.com/mapnik/mapnik/blob/f3da900c355e1d15059c4a91b00203dcc9d9f0ef/scons/scons-local-4.1.0/SCons/Executor.py#L543-L553 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/common.py | python | flatten | (l) | Flatten an arbitrarily nested sequence.
Parameters
----------
l : sequence
The non string sequence to flatten
Notes
-----
This doesn't consider strings sequences.
Returns
-------
flattened : generator | Flatten an arbitrarily nested sequence. | [
"Flatten",
"an",
"arbitrarily",
"nested",
"sequence",
"."
] | def flatten(l):
"""
Flatten an arbitrarily nested sequence.
Parameters
----------
l : sequence
The non string sequence to flatten
Notes
-----
This doesn't consider strings sequences.
Returns
-------
flattened : generator
"""
for el in l:
if _iterabl... | [
"def",
"flatten",
"(",
"l",
")",
":",
"for",
"el",
"in",
"l",
":",
"if",
"_iterable_not_string",
"(",
"el",
")",
":",
"for",
"s",
"in",
"flatten",
"(",
"el",
")",
":",
"yield",
"s",
"else",
":",
"yield",
"el"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/common.py#L39-L61 | ||
ZintrulCre/LeetCode_Archiver | de23e16ead29336b5ee7aa1898a392a5d6463d27 | LeetCode/python3/974.py | python | Solution.subarraysDivByK | (self, A, K) | return ret | :type A: List[int]
:type K: int
:rtype: int | :type A: List[int]
:type K: int
:rtype: int | [
":",
"type",
"A",
":",
"List",
"[",
"int",
"]",
":",
"type",
"K",
":",
"int",
":",
"rtype",
":",
"int"
] | def subarraysDivByK(self, A, K):
"""
:type A: List[int]
:type K: int
:rtype: int
"""
count = {0: 1}
prefix, ret = 0, 0
for a in A:
prefix = (prefix + a) % K
if prefix < 0:
prefix += K
if prefix in count:
... | [
"def",
"subarraysDivByK",
"(",
"self",
",",
"A",
",",
"K",
")",
":",
"count",
"=",
"{",
"0",
":",
"1",
"}",
"prefix",
",",
"ret",
"=",
"0",
",",
"0",
"for",
"a",
"in",
"A",
":",
"prefix",
"=",
"(",
"prefix",
"+",
"a",
")",
"%",
"K",
"if",
... | https://github.com/ZintrulCre/LeetCode_Archiver/blob/de23e16ead29336b5ee7aa1898a392a5d6463d27/LeetCode/python3/974.py#L2-L19 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/index/collector.py | python | _get_encoding_from_headers | (headers) | return None | Determine if we have any encoding information in our headers. | Determine if we have any encoding information in our headers. | [
"Determine",
"if",
"we",
"have",
"any",
"encoding",
"information",
"in",
"our",
"headers",
"."
] | def _get_encoding_from_headers(headers):
# type: (ResponseHeaders) -> Optional[str]
"""Determine if we have any encoding information in our headers.
"""
if headers and "Content-Type" in headers:
content_type, params = cgi.parse_header(headers["Content-Type"])
if "charset" in params:
... | [
"def",
"_get_encoding_from_headers",
"(",
"headers",
")",
":",
"# type: (ResponseHeaders) -> Optional[str]",
"if",
"headers",
"and",
"\"Content-Type\"",
"in",
"headers",
":",
"content_type",
",",
"params",
"=",
"cgi",
".",
"parse_header",
"(",
"headers",
"[",
"\"Conte... | 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/_internal/index/collector.py#L158-L166 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/eager/execute.py | python | make_shape | (v, arg_name) | Convert v into a list. | Convert v into a list. | [
"Convert",
"v",
"into",
"a",
"list",
"."
] | def make_shape(v, arg_name):
"""Convert v into a list."""
# Args:
# v: A TensorShapeProto, a list of ints, or a tensor_shape.TensorShape.
# arg_name: String, for error messages.
# Returns:
# None if the rank is unknown, otherwise a list of ints (or Nones in the
# position where the dimension is u... | [
"def",
"make_shape",
"(",
"v",
",",
"arg_name",
")",
":",
"# Args:",
"# v: A TensorShapeProto, a list of ints, or a tensor_shape.TensorShape.",
"# arg_name: String, for error messages.",
"# Returns:",
"# None if the rank is unknown, otherwise a list of ints (or Nones in the",
"# po... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/eager/execute.py#L134-L153 | ||
pyne/pyne | 0c2714d7c0d1b5e20be6ae6527da2c660dd6b1b3 | pyne/alara.py | python | read_decay_times | (line) | return decay_times | This function reads a line contian decay times information from alara
output file and return the decay times list.
Parameters
----------
line : string
A line from ALARA output.txt
Returns
-------
decay_times : array of string
Array of decay times. | This function reads a line contian decay times information from alara
output file and return the decay times list. | [
"This",
"function",
"reads",
"a",
"line",
"contian",
"decay",
"times",
"information",
"from",
"alara",
"output",
"file",
"and",
"return",
"the",
"decay",
"times",
"list",
"."
] | def read_decay_times(line):
"""
This function reads a line contian decay times information from alara
output file and return the decay times list.
Parameters
----------
line : string
A line from ALARA output.txt
Returns
-------
decay_times : array of string
Array of... | [
"def",
"read_decay_times",
"(",
"line",
")",
":",
"tokens",
"=",
"line",
".",
"strip",
"(",
")",
".",
"split",
"(",
")",
"decay_times",
"=",
"[",
"'shutdown'",
"]",
"for",
"i",
"in",
"range",
"(",
"2",
",",
"len",
"(",
"tokens",
")",
",",
"2",
")... | https://github.com/pyne/pyne/blob/0c2714d7c0d1b5e20be6ae6527da2c660dd6b1b3/pyne/alara.py#L1194-L1213 | |
arangodb/arangodb | 0d658689c7d1b721b314fa3ca27d38303e1570c8 | 3rdParty/V8/gyp/generator/msvs.py | python | _EscapeVCProjCommandLineArgListItem | (s) | return s | Escapes command line arguments for MSVS.
The VCProj format stores string lists in a single string using commas and
semi-colons as separators, which must be quoted if they are to be
interpreted literally. However, command-line arguments may already have
quotes, and the VCProj parser is ignorant of the backslash... | Escapes command line arguments for MSVS. | [
"Escapes",
"command",
"line",
"arguments",
"for",
"MSVS",
"."
] | def _EscapeVCProjCommandLineArgListItem(s):
"""Escapes command line arguments for MSVS.
The VCProj format stores string lists in a single string using commas and
semi-colons as separators, which must be quoted if they are to be
interpreted literally. However, command-line arguments may already have
quotes, a... | [
"def",
"_EscapeVCProjCommandLineArgListItem",
"(",
"s",
")",
":",
"def",
"_Replace",
"(",
"match",
")",
":",
"# For a non-literal quote, CommandLineToArgv requires an even number of",
"# backslashes preceding it, and it produces half as many literal",
"# backslashes. So we need to produc... | https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/V8/gyp/generator/msvs.py#L685-L729 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/mantid/api/_workspaceops.py | python | attach_func_as_method | (name, func_obj, self_param_name, algm_name, workspace_types=None) | Adds a method to the given type that calls an algorithm
using the calling object as the input workspace
:param name: The name of the new method as it should appear on the type
:param func_obj: A free function object that defines the implementation of the call
:param self_param_name: The... | Adds a method to the given type that calls an algorithm
using the calling object as the input workspace | [
"Adds",
"a",
"method",
"to",
"the",
"given",
"type",
"that",
"calls",
"an",
"algorithm",
"using",
"the",
"calling",
"object",
"as",
"the",
"input",
"workspace"
] | def attach_func_as_method(name, func_obj, self_param_name, algm_name, workspace_types=None):
"""
Adds a method to the given type that calls an algorithm
using the calling object as the input workspace
:param name: The name of the new method as it should appear on the type
:param fun... | [
"def",
"attach_func_as_method",
"(",
"name",
",",
"func_obj",
",",
"self_param_name",
",",
"algm_name",
",",
"workspace_types",
"=",
"None",
")",
":",
"def",
"_method_impl",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Map the calling... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/mantid/api/_workspaceops.py#L221-L253 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/imagebrowser.py | python | GetCheckeredBitmap | (blocksize=8,ntiles=4,rgb0='\xFF', rgb1='\xCC') | return wx.BitmapFromBuffer(size, size, data) | Creates a square RGB checkered bitmap using the two specified colors.
Inputs:
- blocksize: the number of pixels in each solid color square
- ntiles: the number of tiles along width and height. Each tile is 2x2 blocks.
- rbg0, rgb1: the first and second colors, as 3-byte strings.
If only ... | Creates a square RGB checkered bitmap using the two specified colors. | [
"Creates",
"a",
"square",
"RGB",
"checkered",
"bitmap",
"using",
"the",
"two",
"specified",
"colors",
"."
] | def GetCheckeredBitmap(blocksize=8,ntiles=4,rgb0='\xFF', rgb1='\xCC'):
"""Creates a square RGB checkered bitmap using the two specified colors.
Inputs:
- blocksize: the number of pixels in each solid color square
- ntiles: the number of tiles along width and height. Each tile is 2x2 blocks.
... | [
"def",
"GetCheckeredBitmap",
"(",
"blocksize",
"=",
"8",
",",
"ntiles",
"=",
"4",
",",
"rgb0",
"=",
"'\\xFF'",
",",
"rgb1",
"=",
"'\\xCC'",
")",
":",
"size",
"=",
"blocksize",
"*",
"ntiles",
"*",
"2",
"if",
"len",
"(",
"rgb0",
")",
"==",
"1",
":",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/imagebrowser.py#L79-L102 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/parfor.py | python | ParforPass._find_mask | (self, arr_def) | check if an array is of B[...M...], where M is a
boolean array, and other indices (if available) are ints.
If found, return B, M, M's type, and a tuple representing mask indices.
Otherwise, raise GuardException. | check if an array is of B[...M...], where M is a
boolean array, and other indices (if available) are ints.
If found, return B, M, M's type, and a tuple representing mask indices.
Otherwise, raise GuardException. | [
"check",
"if",
"an",
"array",
"is",
"of",
"B",
"[",
"...",
"M",
"...",
"]",
"where",
"M",
"is",
"a",
"boolean",
"array",
"and",
"other",
"indices",
"(",
"if",
"available",
")",
"are",
"ints",
".",
"If",
"found",
"return",
"B",
"M",
"M",
"s",
"typ... | def _find_mask(self, arr_def):
"""check if an array is of B[...M...], where M is a
boolean array, and other indices (if available) are ints.
If found, return B, M, M's type, and a tuple representing mask indices.
Otherwise, raise GuardException.
"""
require(isinstance(arr... | [
"def",
"_find_mask",
"(",
"self",
",",
"arr_def",
")",
":",
"require",
"(",
"isinstance",
"(",
"arr_def",
",",
"ir",
".",
"Expr",
")",
"and",
"arr_def",
".",
"op",
"==",
"'getitem'",
")",
"value",
"=",
"arr_def",
".",
"value",
"index",
"=",
"arr_def",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/parfor.py#L2038-L2080 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/media.py | python | MediaCtrl.GetDownloadTotal | (*args, **kwargs) | return _media.MediaCtrl_GetDownloadTotal(*args, **kwargs) | GetDownloadTotal(self) -> wxFileOffset | GetDownloadTotal(self) -> wxFileOffset | [
"GetDownloadTotal",
"(",
"self",
")",
"-",
">",
"wxFileOffset"
] | def GetDownloadTotal(*args, **kwargs):
"""GetDownloadTotal(self) -> wxFileOffset"""
return _media.MediaCtrl_GetDownloadTotal(*args, **kwargs) | [
"def",
"GetDownloadTotal",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_media",
".",
"MediaCtrl_GetDownloadTotal",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/media.py#L174-L176 | |
Tencent/Pebble | 68315f176d9e328a233ace29b7579a829f89879f | tools/blade/src/blade/cc_targets.py | python | CcBinary._cc_binary | (self) | _cc_binary rules. | _cc_binary rules. | [
"_cc_binary",
"rules",
"."
] | def _cc_binary(self):
"""_cc_binary rules. """
env_name = self._env_name()
var_name = self._generate_variable_name(self.path, self.name)
"""
platform = self.blade.get_scons_platform()
if platform.get_gcc_version() > '4.5':
link_flag_list = ['-static-libgcc', ... | [
"def",
"_cc_binary",
"(",
"self",
")",
":",
"env_name",
"=",
"self",
".",
"_env_name",
"(",
")",
"var_name",
"=",
"self",
".",
"_generate_variable_name",
"(",
"self",
".",
"path",
",",
"self",
".",
"name",
")",
"\"\"\"\n platform = self.blade.get_scons_pl... | https://github.com/Tencent/Pebble/blob/68315f176d9e328a233ace29b7579a829f89879f/tools/blade/src/blade/cc_targets.py#L776-L820 | ||
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | scripts/Python/static-binding/lldb.py | python | SBStructuredData.GetStringValue | (self, dst) | return _lldb.SBStructuredData_GetStringValue(self, dst) | GetStringValue(SBStructuredData self, char * dst) -> size_t | GetStringValue(SBStructuredData self, char * dst) -> size_t | [
"GetStringValue",
"(",
"SBStructuredData",
"self",
"char",
"*",
"dst",
")",
"-",
">",
"size_t"
] | def GetStringValue(self, dst):
"""GetStringValue(SBStructuredData self, char * dst) -> size_t"""
return _lldb.SBStructuredData_GetStringValue(self, dst) | [
"def",
"GetStringValue",
"(",
"self",
",",
"dst",
")",
":",
"return",
"_lldb",
".",
"SBStructuredData_GetStringValue",
"(",
"self",
",",
"dst",
")"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L9747-L9749 | |
CGRU/cgru | 1881a4128530e3d31ac6c25314c18314fc50c2c7 | afanasy/python/af.py | python | Job.setFolder | (self, i_name, i_folder, i_transferToServer=True) | Missing DocString
:param i_name:
:param i_folder:
:param i_transferToServer:
:return: | Missing DocString | [
"Missing",
"DocString"
] | def setFolder(self, i_name, i_folder, i_transferToServer=True):
"""Missing DocString
:param i_name:
:param i_folder:
:param i_transferToServer:
:return:
"""
if i_transferToServer:
i_folder = Pathmap.toServer(i_folder)
if "folders" not in self... | [
"def",
"setFolder",
"(",
"self",
",",
"i_name",
",",
"i_folder",
",",
"i_transferToServer",
"=",
"True",
")",
":",
"if",
"i_transferToServer",
":",
"i_folder",
"=",
"Pathmap",
".",
"toServer",
"(",
"i_folder",
")",
"if",
"\"folders\"",
"not",
"in",
"self",
... | https://github.com/CGRU/cgru/blob/1881a4128530e3d31ac6c25314c18314fc50c2c7/afanasy/python/af.py#L649-L663 | ||
vgvassilev/cling | acfb99818878eeb02687790874adad3147df7ef7 | tools/Jupyter/kernel/clingkernel.py | python | ClingKernel.forward_streams | (self) | Put the forwarding pipes in place for stdout, stderr. | Put the forwarding pipes in place for stdout, stderr. | [
"Put",
"the",
"forwarding",
"pipes",
"in",
"place",
"for",
"stdout",
"stderr",
"."
] | def forward_streams(self):
"""Put the forwarding pipes in place for stdout, stderr."""
self.replaced_streams = [FdReplacer("stdout"), FdReplacer("stderr")] | [
"def",
"forward_streams",
"(",
"self",
")",
":",
"self",
".",
"replaced_streams",
"=",
"[",
"FdReplacer",
"(",
"\"stdout\"",
")",
",",
"FdReplacer",
"(",
"\"stderr\"",
")",
"]"
] | https://github.com/vgvassilev/cling/blob/acfb99818878eeb02687790874adad3147df7ef7/tools/Jupyter/kernel/clingkernel.py#L224-L226 | ||
nvdla/sw | 79538ba1b52b040a4a4645f630e457fa01839e90 | umd/external/protobuf-2.6/python/google/protobuf/service_reflection.py | python | _ServiceBuilder._GenerateNonImplementedMethod | (self, method) | return lambda inst, rpc_controller, request, callback: (
self._NonImplementedMethod(method.name, rpc_controller, callback)) | Generates and returns a method that can be set for a service methods.
Args:
method: Descriptor of the service method for which a method is to be
generated.
Returns:
A method that can be added to the service class. | Generates and returns a method that can be set for a service methods. | [
"Generates",
"and",
"returns",
"a",
"method",
"that",
"can",
"be",
"set",
"for",
"a",
"service",
"methods",
"."
] | def _GenerateNonImplementedMethod(self, method):
"""Generates and returns a method that can be set for a service methods.
Args:
method: Descriptor of the service method for which a method is to be
generated.
Returns:
A method that can be added to the service class.
"""
return l... | [
"def",
"_GenerateNonImplementedMethod",
"(",
"self",
",",
"method",
")",
":",
"return",
"lambda",
"inst",
",",
"rpc_controller",
",",
"request",
",",
"callback",
":",
"(",
"self",
".",
"_NonImplementedMethod",
"(",
"method",
".",
"name",
",",
"rpc_controller",
... | https://github.com/nvdla/sw/blob/79538ba1b52b040a4a4645f630e457fa01839e90/umd/external/protobuf-2.6/python/google/protobuf/service_reflection.py#L205-L216 | |
esa/pykep | b410363653623730b577de257c04b0e0289f2014 | pykep/examples/_ex11.py | python | run_example11 | (n_seg=30) | This example demonstrates the use of the class lt_margo developed for the internal ESA CDF study on the
interplanetary mission named MARGO. The class was used to produce the preliminary traget selection
for the mission resulting in 88 selected possible targets
(http://www.esa.int/spaceinimages/Images/2017... | This example demonstrates the use of the class lt_margo developed for the internal ESA CDF study on the
interplanetary mission named MARGO. The class was used to produce the preliminary traget selection
for the mission resulting in 88 selected possible targets
(http://www.esa.int/spaceinimages/Images/2017... | [
"This",
"example",
"demonstrates",
"the",
"use",
"of",
"the",
"class",
"lt_margo",
"developed",
"for",
"the",
"internal",
"ESA",
"CDF",
"study",
"on",
"the",
"interplanetary",
"mission",
"named",
"MARGO",
".",
"The",
"class",
"was",
"used",
"to",
"produce",
... | def run_example11(n_seg=30):
"""
This example demonstrates the use of the class lt_margo developed for the internal ESA CDF study on the
interplanetary mission named MARGO. The class was used to produce the preliminary traget selection
for the mission resulting in 88 selected possible targets
(htt... | [
"def",
"run_example11",
"(",
"n_seg",
"=",
"30",
")",
":",
"import",
"pykep",
"as",
"pk",
"import",
"pygmo",
"as",
"pg",
"import",
"numpy",
"as",
"np",
"from",
"matplotlib",
"import",
"pyplot",
"as",
"plt",
"from",
"pykep",
".",
"examples",
"import",
"ad... | https://github.com/esa/pykep/blob/b410363653623730b577de257c04b0e0289f2014/pykep/examples/_ex11.py#L1-L59 | ||
Sigil-Ebook/Sigil | 0d145d3a4874b4a26f7aabd68dbd9d18a2402e52 | src/Resource_Files/plugin_launchers/python/sigil_bs4/element.py | python | Tag.has_key | (self, key) | return self.has_attr(key) | This was kind of misleading because has_key() (attributes)
was different from __in__ (contents). has_key() is gone in
Python 3, anyway. | This was kind of misleading because has_key() (attributes)
was different from __in__ (contents). has_key() is gone in
Python 3, anyway. | [
"This",
"was",
"kind",
"of",
"misleading",
"because",
"has_key",
"()",
"(",
"attributes",
")",
"was",
"different",
"from",
"__in__",
"(",
"contents",
")",
".",
"has_key",
"()",
"is",
"gone",
"in",
"Python",
"3",
"anyway",
"."
] | def has_key(self, key):
"""This was kind of misleading because has_key() (attributes)
was different from __in__ (contents). has_key() is gone in
Python 3, anyway."""
warnings.warn('has_key is deprecated. Use has_attr("%s") instead.' % (
key))
return self.has_attr(... | [
"def",
"has_key",
"(",
"self",
",",
"key",
")",
":",
"warnings",
".",
"warn",
"(",
"'has_key is deprecated. Use has_attr(\"%s\") instead.'",
"%",
"(",
"key",
")",
")",
"return",
"self",
".",
"has_attr",
"(",
"key",
")"
] | https://github.com/Sigil-Ebook/Sigil/blob/0d145d3a4874b4a26f7aabd68dbd9d18a2402e52/src/Resource_Files/plugin_launchers/python/sigil_bs4/element.py#L1905-L1911 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_windows.py | python | PyPanel.DoSetSize | (*args, **kwargs) | return _windows_.PyPanel_DoSetSize(*args, **kwargs) | DoSetSize(self, int x, int y, int width, int height, int sizeFlags=SIZE_AUTO) | DoSetSize(self, int x, int y, int width, int height, int sizeFlags=SIZE_AUTO) | [
"DoSetSize",
"(",
"self",
"int",
"x",
"int",
"y",
"int",
"width",
"int",
"height",
"int",
"sizeFlags",
"=",
"SIZE_AUTO",
")"
] | def DoSetSize(*args, **kwargs):
"""DoSetSize(self, int x, int y, int width, int height, int sizeFlags=SIZE_AUTO)"""
return _windows_.PyPanel_DoSetSize(*args, **kwargs) | [
"def",
"DoSetSize",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"PyPanel_DoSetSize",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_windows.py#L4341-L4343 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/framework/tensor_util.py | python | maybe_set_static_shape | (tensor, shape) | Sets the shape of `tensor` to the `shape`'s constant value, if inferrable.
This is a temporary workaround to fix shape inference across functional op
boundaries. E.g.
```python
shape = tf.constant([3])
@tf.function
def f():
u = tf.random_uniform(shape)
return u
```
If we were to rely solely o... | Sets the shape of `tensor` to the `shape`'s constant value, if inferrable. | [
"Sets",
"the",
"shape",
"of",
"tensor",
"to",
"the",
"shape",
"s",
"constant",
"value",
"if",
"inferrable",
"."
] | def maybe_set_static_shape(tensor, shape): # pylint: disable=invalid-name
"""Sets the shape of `tensor` to the `shape`'s constant value, if inferrable.
This is a temporary workaround to fix shape inference across functional op
boundaries. E.g.
```python
shape = tf.constant([3])
@tf.function
def f():
... | [
"def",
"maybe_set_static_shape",
"(",
"tensor",
",",
"shape",
")",
":",
"# pylint: disable=invalid-name",
"if",
"(",
"_ENABLE_MAYBE_SET_STATIC_SHAPE",
"and",
"not",
"context",
".",
"executing_eagerly",
"(",
")",
"and",
"ops",
".",
"get_default_graph",
"(",
")",
".",... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/framework/tensor_util.py#L971-L1003 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/src/robotsim.py | python | VolumeGrid.__init__ | (self) | r"""
__init__(VolumeGrid self) -> VolumeGrid | r"""
__init__(VolumeGrid self) -> VolumeGrid | [
"r",
"__init__",
"(",
"VolumeGrid",
"self",
")",
"-",
">",
"VolumeGrid"
] | def __init__(self):
r"""
__init__(VolumeGrid self) -> VolumeGrid
"""
_robotsim.VolumeGrid_swiginit(self, _robotsim.new_VolumeGrid()) | [
"def",
"__init__",
"(",
"self",
")",
":",
"_robotsim",
".",
"VolumeGrid_swiginit",
"(",
"self",
",",
"_robotsim",
".",
"new_VolumeGrid",
"(",
")",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/src/robotsim.py#L1718-L1724 | ||
MVIG-SJTU/RMPE | 5188c230ec800c12be7369c3619615bc9b020aa4 | scripts/cpp_lint.py | python | _IsTestFilename | (filename) | Determines if the given filename has a suffix that identifies it as a test.
Args:
filename: The input filename.
Returns:
True if 'filename' looks like a test, False otherwise. | Determines if the given filename has a suffix that identifies it as a test. | [
"Determines",
"if",
"the",
"given",
"filename",
"has",
"a",
"suffix",
"that",
"identifies",
"it",
"as",
"a",
"test",
"."
] | def _IsTestFilename(filename):
"""Determines if the given filename has a suffix that identifies it as a test.
Args:
filename: The input filename.
Returns:
True if 'filename' looks like a test, False otherwise.
"""
if (filename.endswith('_test.cc') or
filename.endswith('_unittest.cc') or
... | [
"def",
"_IsTestFilename",
"(",
"filename",
")",
":",
"if",
"(",
"filename",
".",
"endswith",
"(",
"'_test.cc'",
")",
"or",
"filename",
".",
"endswith",
"(",
"'_unittest.cc'",
")",
"or",
"filename",
".",
"endswith",
"(",
"'_regtest.cc'",
")",
")",
":",
"ret... | https://github.com/MVIG-SJTU/RMPE/blob/5188c230ec800c12be7369c3619615bc9b020aa4/scripts/cpp_lint.py#L3607-L3621 | ||
albertz/openlierox | d316c14a8eb57848ef56e9bfa7b23a56f694a51b | tools/DedicatedServerVideo/gdata/tlslite/utils/RSAKey.py | python | RSAKey.hasPrivateKey | (self) | Return whether or not this key has a private component.
@rtype: bool | Return whether or not this key has a private component. | [
"Return",
"whether",
"or",
"not",
"this",
"key",
"has",
"a",
"private",
"component",
"."
] | def hasPrivateKey(self):
"""Return whether or not this key has a private component.
@rtype: bool
"""
raise NotImplementedError() | [
"def",
"hasPrivateKey",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/albertz/openlierox/blob/d316c14a8eb57848ef56e9bfa7b23a56f694a51b/tools/DedicatedServerVideo/gdata/tlslite/utils/RSAKey.py#L40-L45 | ||
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/tensor/manipulation.py | python | fill_diagonal_ | (x, value, offset=0, wrap=False, name=None) | return _C_ops.fill_diagonal_(x, 'value', value, 'offset', offset, 'wrap',
True) | **Notes**:
**This API is ONLY available in Dygraph mode**
This function fill the value into the x Tensor's diagonal inplace.
Args:
x(Tensor): ``x`` is the original Tensor
value(Scale): ``value`` is the value to filled in x
offset(int,optional): the offset to the main diagonal. De... | **Notes**:
**This API is ONLY available in Dygraph mode**
This function fill the value into the x Tensor's diagonal inplace.
Args:
x(Tensor): ``x`` is the original Tensor
value(Scale): ``value`` is the value to filled in x
offset(int,optional): the offset to the main diagonal. De... | [
"**",
"Notes",
"**",
":",
"**",
"This",
"API",
"is",
"ONLY",
"available",
"in",
"Dygraph",
"mode",
"**",
"This",
"function",
"fill",
"the",
"value",
"into",
"the",
"x",
"Tensor",
"s",
"diagonal",
"inplace",
".",
"Args",
":",
"x",
"(",
"Tensor",
")",
... | def fill_diagonal_(x, value, offset=0, wrap=False, name=None):
"""
**Notes**:
**This API is ONLY available in Dygraph mode**
This function fill the value into the x Tensor's diagonal inplace.
Args:
x(Tensor): ``x`` is the original Tensor
value(Scale): ``value`` is the value to fi... | [
"def",
"fill_diagonal_",
"(",
"x",
",",
"value",
",",
"offset",
"=",
"0",
",",
"wrap",
"=",
"False",
",",
"name",
"=",
"None",
")",
":",
"helper",
"=",
"LayerHelper",
"(",
"\"fill_diagonal_\"",
",",
"*",
"*",
"locals",
"(",
")",
")",
"check_type",
"(... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/tensor/manipulation.py#L112-L154 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/profile.py | python | runctx | (statement, globals, locals, filename=None, sort=-1) | return _Utils(Profile).runctx(statement, globals, locals, filename, sort) | Run statement under profiler, supplying your own globals and locals,
optionally saving results in filename.
statement and filename have the same semantics as profile.run | Run statement under profiler, supplying your own globals and locals,
optionally saving results in filename. | [
"Run",
"statement",
"under",
"profiler",
"supplying",
"your",
"own",
"globals",
"and",
"locals",
"optionally",
"saving",
"results",
"in",
"filename",
"."
] | def runctx(statement, globals, locals, filename=None, sort=-1):
"""Run statement under profiler, supplying your own globals and locals,
optionally saving results in filename.
statement and filename have the same semantics as profile.run
"""
return _Utils(Profile).runctx(statement, globals, locals, ... | [
"def",
"runctx",
"(",
"statement",
",",
"globals",
",",
"locals",
",",
"filename",
"=",
"None",
",",
"sort",
"=",
"-",
"1",
")",
":",
"return",
"_Utils",
"(",
"Profile",
")",
".",
"runctx",
"(",
"statement",
",",
"globals",
",",
"locals",
",",
"filen... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/profile.py#L93-L99 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/pip/vendor/distlib/util.py | python | path_to_cache_dir | (path) | return d + p + '.cache' | Convert an absolute path to a directory name for use in a cache.
The algorithm used is:
#. On Windows, any ``':'`` in the drive is replaced with ``'---'``.
#. Any occurrence of ``os.sep`` is replaced with ``'--'``.
#. ``'.cache'`` is appended. | Convert an absolute path to a directory name for use in a cache. | [
"Convert",
"an",
"absolute",
"path",
"to",
"a",
"directory",
"name",
"for",
"use",
"in",
"a",
"cache",
"."
] | def path_to_cache_dir(path):
"""
Convert an absolute path to a directory name for use in a cache.
The algorithm used is:
#. On Windows, any ``':'`` in the drive is replaced with ``'---'``.
#. Any occurrence of ``os.sep`` is replaced with ``'--'``.
#. ``'.cache'`` is appended.
"""
d, p ... | [
"def",
"path_to_cache_dir",
"(",
"path",
")",
":",
"d",
",",
"p",
"=",
"os",
".",
"path",
".",
"splitdrive",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"path",
")",
")",
"if",
"d",
":",
"d",
"=",
"d",
".",
"replace",
"(",
"':'",
",",
"'---'",... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/pip/vendor/distlib/util.py#L530-L544 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/numpy/multiarray.py | python | copy | (a) | return _mx_nd_np.copy(a) | Return an array copy of the given object.
Parameters
----------
a : _Symbol
Input array.
Returns
-------
arr : _Symbol
Array interpretation of a.
-----
Examples
--------
>>> x = np.array([1, 2, 3])
>>> y = x
>>> z = np.copy(x)
>>> x[0] = 10
>>> ... | Return an array copy of the given object. | [
"Return",
"an",
"array",
"copy",
"of",
"the",
"given",
"object",
"."
] | def copy(a): # pylint: disable=redefined-outer-name
"""
Return an array copy of the given object.
Parameters
----------
a : _Symbol
Input array.
Returns
-------
arr : _Symbol
Array interpretation of a.
-----
Examples
--------
>>> x = np.array([1, 2, 3])... | [
"def",
"copy",
"(",
"a",
")",
":",
"# pylint: disable=redefined-outer-name",
"return",
"_mx_nd_np",
".",
"copy",
"(",
"a",
")"
] | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/numpy/multiarray.py#L12934-L12960 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/setuptools/config.py | python | ConfigHandler.parse_section | (self, section_options) | Parses configuration file section.
:param dict section_options: | Parses configuration file section. | [
"Parses",
"configuration",
"file",
"section",
"."
] | def parse_section(self, section_options):
"""Parses configuration file section.
:param dict section_options:
"""
for (name, (_, value)) in section_options.items():
try:
self[name] = value
except KeyError:
pass | [
"def",
"parse_section",
"(",
"self",
",",
"section_options",
")",
":",
"for",
"(",
"name",
",",
"(",
"_",
",",
"value",
")",
")",
"in",
"section_options",
".",
"items",
"(",
")",
":",
"try",
":",
"self",
"[",
"name",
"]",
"=",
"value",
"except",
"K... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/setuptools/config.py#L392-L402 | ||
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | src/bindings/python/src/compatibility/ngraph/opset1/ops.py | python | sqrt | (node: NodeInput, name: Optional[str] = None) | return _get_node_factory_opset1().create("Sqrt", [node]) | Return node which applies square root to the input node element-wise.
:param node: One of: input node, array or scalar.
:param name: Optional new name for output node.
:return: The new node with sqrt operation applied element-wise. | Return node which applies square root to the input node element-wise. | [
"Return",
"node",
"which",
"applies",
"square",
"root",
"to",
"the",
"input",
"node",
"element",
"-",
"wise",
"."
] | def sqrt(node: NodeInput, name: Optional[str] = None) -> Node:
"""Return node which applies square root to the input node element-wise.
:param node: One of: input node, array or scalar.
:param name: Optional new name for output node.
:return: The new node with sqrt operation applied element-wise.
"... | [
"def",
"sqrt",
"(",
"node",
":",
"NodeInput",
",",
"name",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
")",
"->",
"Node",
":",
"return",
"_get_node_factory_opset1",
"(",
")",
".",
"create",
"(",
"\"Sqrt\"",
",",
"[",
"node",
"]",
")"
] | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/src/bindings/python/src/compatibility/ngraph/opset1/ops.py#L2621-L2628 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/client/timeline.py | python | _ChromeTraceFormatter.emit_pid | (self, name, pid) | Adds a process metadata event to the trace.
Args:
name: The process name as a string.
pid: Identifier of the process as an integer. | Adds a process metadata event to the trace. | [
"Adds",
"a",
"process",
"metadata",
"event",
"to",
"the",
"trace",
"."
] | def emit_pid(self, name, pid):
"""Adds a process metadata event to the trace.
Args:
name: The process name as a string.
pid: Identifier of the process as an integer.
"""
event = {}
event['name'] = 'process_name'
event['ph'] = 'M'
event['pid'] = pid
event['args'] = {'name':... | [
"def",
"emit_pid",
"(",
"self",
",",
"name",
",",
"pid",
")",
":",
"event",
"=",
"{",
"}",
"event",
"[",
"'name'",
"]",
"=",
"'process_name'",
"event",
"[",
"'ph'",
"]",
"=",
"'M'",
"event",
"[",
"'pid'",
"]",
"=",
"pid",
"event",
"[",
"'args'",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/client/timeline.py#L87-L99 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/pycc/cc.py | python | CC.target_cpu | (self) | return self._target_cpu | The target CPU model for code generation. | The target CPU model for code generation. | [
"The",
"target",
"CPU",
"model",
"for",
"code",
"generation",
"."
] | def target_cpu(self):
"""
The target CPU model for code generation.
"""
return self._target_cpu | [
"def",
"target_cpu",
"(",
"self",
")",
":",
"return",
"self",
".",
"_target_cpu"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/pycc/cc.py#L113-L117 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | SizerItem.DetachSizer | (*args, **kwargs) | return _core_.SizerItem_DetachSizer(*args, **kwargs) | DetachSizer(self)
Enable deleting the SizerItem without destroying the contained sizer. | DetachSizer(self) | [
"DetachSizer",
"(",
"self",
")"
] | def DetachSizer(*args, **kwargs):
"""
DetachSizer(self)
Enable deleting the SizerItem without destroying the contained sizer.
"""
return _core_.SizerItem_DetachSizer(*args, **kwargs) | [
"def",
"DetachSizer",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"SizerItem_DetachSizer",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L14052-L14058 | |
wesnoth/wesnoth | 6ccac5a5e8ff75303c9190c0da60580925cb32c0 | data/tools/wesnoth/libgithub.py | python | GitHub.__init__ | (self, directory, version, authorization=None) | Initializes a GitHub object.
directory: Directory in which the git repos for this wesnoth branch live.
version: The version of this wesnoth branch. | Initializes a GitHub object. | [
"Initializes",
"a",
"GitHub",
"object",
"."
] | def __init__(self, directory, version, authorization=None):
"""Initializes a GitHub object.
directory: Directory in which the git repos for this wesnoth branch live.
version: The version of this wesnoth branch.
"""
logging.debug("GitHub created with directory {0} and version {1}... | [
"def",
"__init__",
"(",
"self",
",",
"directory",
",",
"version",
",",
"authorization",
"=",
"None",
")",
":",
"logging",
".",
"debug",
"(",
"\"GitHub created with directory {0} and version {1}, {2} authentication data\"",
".",
"format",
"(",
"directory",
",",
"versio... | https://github.com/wesnoth/wesnoth/blob/6ccac5a5e8ff75303c9190c0da60580925cb32c0/data/tools/wesnoth/libgithub.py#L299-L308 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/ed_tab.py | python | EdTabBase.SetTabIndex | (self, idx) | Set the tab index
@param idx: int | Set the tab index
@param idx: int | [
"Set",
"the",
"tab",
"index",
"@param",
"idx",
":",
"int"
] | def SetTabIndex(self, idx):
"""Set the tab index
@param idx: int
"""
self._idx = idx | [
"def",
"SetTabIndex",
"(",
"self",
",",
"idx",
")",
":",
"self",
".",
"_idx",
"=",
"idx"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/ed_tab.py#L129-L134 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/compression/export/quant_export.py | python | ExportToQuantInferNetwork.run | (self) | return network | Start to convert. | Start to convert. | [
"Start",
"to",
"convert",
"."
] | def run(self):
"""Start to convert."""
self.network.update_cell_prefix()
network = self.network
if isinstance(network, _AddFakeQuantInput):
network = network.network
network = self._convert_quant2deploy(network)
return network | [
"def",
"run",
"(",
"self",
")",
":",
"self",
".",
"network",
".",
"update_cell_prefix",
"(",
")",
"network",
"=",
"self",
".",
"network",
"if",
"isinstance",
"(",
"network",
",",
"_AddFakeQuantInput",
")",
":",
"network",
"=",
"network",
".",
"network",
... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/compression/export/quant_export.py#L219-L226 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/prompt-toolkit/py2/prompt_toolkit/interface.py | python | CommandLineInterface.print_tokens | (self, tokens, style=None) | Print a list of (Token, text) tuples to the output.
(When the UI is running, this method has to be called through
`run_in_terminal`, otherwise it will destroy the UI.)
:param style: Style class to use. Defaults to the active style in the CLI. | Print a list of (Token, text) tuples to the output.
(When the UI is running, this method has to be called through
`run_in_terminal`, otherwise it will destroy the UI.) | [
"Print",
"a",
"list",
"of",
"(",
"Token",
"text",
")",
"tuples",
"to",
"the",
"output",
".",
"(",
"When",
"the",
"UI",
"is",
"running",
"this",
"method",
"has",
"to",
"be",
"called",
"through",
"run_in_terminal",
"otherwise",
"it",
"will",
"destroy",
"th... | def print_tokens(self, tokens, style=None):
"""
Print a list of (Token, text) tuples to the output.
(When the UI is running, this method has to be called through
`run_in_terminal`, otherwise it will destroy the UI.)
:param style: Style class to use. Defaults to the active style ... | [
"def",
"print_tokens",
"(",
"self",
",",
"tokens",
",",
"style",
"=",
"None",
")",
":",
"print_tokens",
"(",
"self",
".",
"output",
",",
"tokens",
",",
"style",
"or",
"self",
".",
"application",
".",
"style",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/prompt-toolkit/py2/prompt_toolkit/interface.py#L787-L795 | ||
intel/llvm | e6d0547e9d99b5a56430c4749f6c7e328bf221ab | mlir/python/mlir/dialects/_pdl_ops_ext.py | python | _get_array_attr | (attrs: Union[ArrayAttr, Sequence[Attribute]]) | Converts the given value to array attribute. | Converts the given value to array attribute. | [
"Converts",
"the",
"given",
"value",
"to",
"array",
"attribute",
"."
] | def _get_array_attr(attrs: Union[ArrayAttr, Sequence[Attribute]]) -> ArrayAttr:
"""Converts the given value to array attribute."""
if isinstance(attrs, ArrayAttr):
return attrs
else:
return ArrayAttr.get(list(attrs)) | [
"def",
"_get_array_attr",
"(",
"attrs",
":",
"Union",
"[",
"ArrayAttr",
",",
"Sequence",
"[",
"Attribute",
"]",
"]",
")",
"->",
"ArrayAttr",
":",
"if",
"isinstance",
"(",
"attrs",
",",
"ArrayAttr",
")",
":",
"return",
"attrs",
"else",
":",
"return",
"Arr... | https://github.com/intel/llvm/blob/e6d0547e9d99b5a56430c4749f6c7e328bf221ab/mlir/python/mlir/dialects/_pdl_ops_ext.py#L24-L29 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/distribute/cross_device_utils.py | python | CollectiveReplicaLauncher.all_gather | (
self,
input_tensor: core.TensorLike,
axis: core.TensorLike,
options: Optional[collective_util.Options] = None) | All-gather a dense tensor.
This method must be called inside a tf.function.
Args:
input_tensor: a dense tensor. It must have the same rank on all replicas,
and dimensions other than `axis` need to be the same as well.
axis: 0-D int32 Tensor. Dimension along which to gather. Must be in the
... | All-gather a dense tensor. | [
"All",
"-",
"gather",
"a",
"dense",
"tensor",
"."
] | def all_gather(
self,
input_tensor: core.TensorLike,
axis: core.TensorLike,
options: Optional[collective_util.Options] = None) -> core.Tensor:
"""All-gather a dense tensor.
This method must be called inside a tf.function.
Args:
input_tensor: a dense tensor. It must have the s... | [
"def",
"all_gather",
"(",
"self",
",",
"input_tensor",
":",
"core",
".",
"TensorLike",
",",
"axis",
":",
"core",
".",
"TensorLike",
",",
"options",
":",
"Optional",
"[",
"collective_util",
".",
"Options",
"]",
"=",
"None",
")",
"->",
"core",
".",
"Tensor... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/distribute/cross_device_utils.py#L434-L495 | ||
envoyproxy/envoy-wasm | ab5d9381fdf92a1efa0b87cff80036b5b3e81198 | tools/protoxform/protoprint.py | python | FormatComments | (comments) | return FormatBlock(comments) | Format a list of comment blocks from SourceCodeInfo.
Prefixes // to each line, separates blocks by spaces.
Args:
comments: a list of blocks, each block is a list of strings representing
lines in each block.
Returns:
A string reprenting the formatted comment blocks. | Format a list of comment blocks from SourceCodeInfo. | [
"Format",
"a",
"list",
"of",
"comment",
"blocks",
"from",
"SourceCodeInfo",
"."
] | def FormatComments(comments):
"""Format a list of comment blocks from SourceCodeInfo.
Prefixes // to each line, separates blocks by spaces.
Args:
comments: a list of blocks, each block is a list of strings representing
lines in each block.
Returns:
A string reprenting the formatted comment bloc... | [
"def",
"FormatComments",
"(",
"comments",
")",
":",
"# TODO(htuch): not sure why this is needed, but clang-format does some weird",
"# stuff with // comment indents when we have these trailing \\",
"def",
"FixupTrailingBackslash",
"(",
"s",
")",
":",
"return",
"s",
"[",
":",
"-",... | https://github.com/envoyproxy/envoy-wasm/blob/ab5d9381fdf92a1efa0b87cff80036b5b3e81198/tools/protoxform/protoprint.py#L112-L134 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.