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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/media/webrtc/trunk/tools/gyp/pylib/gyp/generator/ninja.py | python | OpenOutput | (path, mode='w') | return open(path, mode) | Open |path| for writing, creating directories if necessary. | Open |path| for writing, creating directories if necessary. | [
"Open",
"|path|",
"for",
"writing",
"creating",
"directories",
"if",
"necessary",
"."
] | def OpenOutput(path, mode='w'):
"""Open |path| for writing, creating directories if necessary."""
try:
os.makedirs(os.path.dirname(path))
except OSError:
pass
return open(path, mode) | [
"def",
"OpenOutput",
"(",
"path",
",",
"mode",
"=",
"'w'",
")",
":",
"try",
":",
"os",
".",
"makedirs",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"path",
")",
")",
"except",
"OSError",
":",
"pass",
"return",
"open",
"(",
"path",
",",
"mode",
"... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/media/webrtc/trunk/tools/gyp/pylib/gyp/generator/ninja.py#L1295-L1301 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/dateutil/dateutil/utils.py | python | today | (tzinfo=None) | return datetime.combine(dt.date(), time(0, tzinfo=tzinfo)) | Returns a :py:class:`datetime` representing the current day at midnight
:param tzinfo:
The time zone to attach (also used to determine the current day).
:return:
A :py:class:`datetime.datetime` object representing the current day
at midnight. | Returns a :py:class:`datetime` representing the current day at midnight | [
"Returns",
"a",
":",
"py",
":",
"class",
":",
"datetime",
"representing",
"the",
"current",
"day",
"at",
"midnight"
] | def today(tzinfo=None):
"""
Returns a :py:class:`datetime` representing the current day at midnight
:param tzinfo:
The time zone to attach (also used to determine the current day).
:return:
A :py:class:`datetime.datetime` object representing the current day
at midnight.
"""... | [
"def",
"today",
"(",
"tzinfo",
"=",
"None",
")",
":",
"dt",
"=",
"datetime",
".",
"now",
"(",
"tzinfo",
")",
"return",
"datetime",
".",
"combine",
"(",
"dt",
".",
"date",
"(",
")",
",",
"time",
"(",
"0",
",",
"tzinfo",
"=",
"tzinfo",
")",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/dateutil/dateutil/utils.py#L13-L26 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | third_party/re2/lib/codereview/codereview.py | python | change | (ui, repo, *pats, **opts) | return | create, edit or delete a change list
Create, edit or delete a change list.
A change list is a group of files to be reviewed and submitted together,
plus a textual description of the change.
Change lists are referred to by simple alphanumeric names.
Changes must be reviewed before they can be submitted.
In the ... | create, edit or delete a change list | [
"create",
"edit",
"or",
"delete",
"a",
"change",
"list"
] | def change(ui, repo, *pats, **opts):
"""create, edit or delete a change list
Create, edit or delete a change list.
A change list is a group of files to be reviewed and submitted together,
plus a textual description of the change.
Change lists are referred to by simple alphanumeric names.
Changes must be reviewe... | [
"def",
"change",
"(",
"ui",
",",
"repo",
",",
"*",
"pats",
",",
"*",
"*",
"opts",
")",
":",
"if",
"codereview_disabled",
":",
"return",
"codereview_disabled",
"dirty",
"=",
"{",
"}",
"if",
"len",
"(",
"pats",
")",
">",
"0",
"and",
"GoodCLName",
"(",
... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/third_party/re2/lib/codereview/codereview.py#L1273-L1381 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/importlib/_bootstrap_external.py | python | spec_from_file_location | (name, location=None, *, loader=None,
submodule_search_locations=_POPULATE) | return spec | Return a module spec based on a file location.
To indicate that the module is a package, set
submodule_search_locations to a list of directory paths. An
empty list is sufficient, though its not otherwise useful to the
import system.
The loader must take a spec as its only __init__() arg. | Return a module spec based on a file location. | [
"Return",
"a",
"module",
"spec",
"based",
"on",
"a",
"file",
"location",
"."
] | def spec_from_file_location(name, location=None, *, loader=None,
submodule_search_locations=_POPULATE):
"""Return a module spec based on a file location.
To indicate that the module is a package, set
submodule_search_locations to a list of directory paths. An
empty list is ... | [
"def",
"spec_from_file_location",
"(",
"name",
",",
"location",
"=",
"None",
",",
"*",
",",
"loader",
"=",
"None",
",",
"submodule_search_locations",
"=",
"_POPULATE",
")",
":",
"if",
"location",
"is",
"None",
":",
"# The caller may simply want a partially populated... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/importlib/_bootstrap_external.py#L574-L637 | |
verilog-to-routing/vtr-verilog-to-routing | d9719cf7374821156c3cee31d66991cb85578562 | vtr_flow/scripts/python_libs/vtr/log_parse.py | python | RangeAbsPassRequirement.abs_threshold | (self) | return self._abs_threshold | Get absolute threshold | Get absolute threshold | [
"Get",
"absolute",
"threshold"
] | def abs_threshold(self):
"""Get absolute threshold"""
return self._abs_threshold | [
"def",
"abs_threshold",
"(",
"self",
")",
":",
"return",
"self",
".",
"_abs_threshold"
] | https://github.com/verilog-to-routing/vtr-verilog-to-routing/blob/d9719cf7374821156c3cee31d66991cb85578562/vtr_flow/scripts/python_libs/vtr/log_parse.py#L192-L194 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/image_ops_impl.py | python | per_image_standardization | (image) | return image | Linearly scales `image` to have zero mean and unit norm.
This op computes `(x - mean) / adjusted_stddev`, where `mean` is the average
of all values in image, and
`adjusted_stddev = max(stddev, 1.0/sqrt(image.NumElements()))`.
`stddev` is the standard deviation of all values in `image`. It is capped
away fro... | Linearly scales `image` to have zero mean and unit norm. | [
"Linearly",
"scales",
"image",
"to",
"have",
"zero",
"mean",
"and",
"unit",
"norm",
"."
] | def per_image_standardization(image):
"""Linearly scales `image` to have zero mean and unit norm.
This op computes `(x - mean) / adjusted_stddev`, where `mean` is the average
of all values in image, and
`adjusted_stddev = max(stddev, 1.0/sqrt(image.NumElements()))`.
`stddev` is the standard deviation of all... | [
"def",
"per_image_standardization",
"(",
"image",
")",
":",
"image",
"=",
"ops",
".",
"convert_to_tensor",
"(",
"image",
",",
"name",
"=",
"'image'",
")",
"image",
"=",
"control_flow_ops",
".",
"with_dependencies",
"(",
"_Check3DImage",
"(",
"image",
",",
"req... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/image_ops_impl.py#L793-L832 | |
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/python/configobj/configobj.py | python | Section.itervalues | (self) | return iter(self.values()) | D.itervalues() -> an iterator over the values of D | D.itervalues() -> an iterator over the values of D | [
"D",
".",
"itervalues",
"()",
"-",
">",
"an",
"iterator",
"over",
"the",
"values",
"of",
"D"
] | def itervalues(self):
"""D.itervalues() -> an iterator over the values of D"""
return iter(self.values()) | [
"def",
"itervalues",
"(",
"self",
")",
":",
"return",
"iter",
"(",
"self",
".",
"values",
"(",
")",
")"
] | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/configobj/configobj.py#L749-L751 | |
rapidsai/cudf | d5b2448fc69f17509304d594f029d0df56984962 | python/cudf/cudf/api/extensions/accessor.py | python | register_dataframe_accessor | (name) | return _register_accessor(name, cudf.DataFrame) | {docstring} | {docstring} | [
"{",
"docstring",
"}"
] | def register_dataframe_accessor(name):
"""{docstring}"""
return _register_accessor(name, cudf.DataFrame) | [
"def",
"register_dataframe_accessor",
"(",
"name",
")",
":",
"return",
"_register_accessor",
"(",
"name",
",",
"cudf",
".",
"DataFrame",
")"
] | https://github.com/rapidsai/cudf/blob/d5b2448fc69f17509304d594f029d0df56984962/python/cudf/cudf/api/extensions/accessor.py#L147-L149 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_controls.py | python | FontPickerEvent.__init__ | (self, *args, **kwargs) | __init__(self, Object generator, int id, Font f) -> FontPickerEvent | __init__(self, Object generator, int id, Font f) -> FontPickerEvent | [
"__init__",
"(",
"self",
"Object",
"generator",
"int",
"id",
"Font",
"f",
")",
"-",
">",
"FontPickerEvent"
] | def __init__(self, *args, **kwargs):
"""__init__(self, Object generator, int id, Font f) -> FontPickerEvent"""
_controls_.FontPickerEvent_swiginit(self,_controls_.new_FontPickerEvent(*args, **kwargs)) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_controls_",
".",
"FontPickerEvent_swiginit",
"(",
"self",
",",
"_controls_",
".",
"new_FontPickerEvent",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_controls.py#L7281-L7283 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/numbers.py | python | Real.__floordiv__ | (self, other) | self // other: The floor() of self/other. | self // other: The floor() of self/other. | [
"self",
"//",
"other",
":",
"The",
"floor",
"()",
"of",
"self",
"/",
"other",
"."
] | def __floordiv__(self, other):
"""self // other: The floor() of self/other."""
raise NotImplementedError | [
"def",
"__floordiv__",
"(",
"self",
",",
"other",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/numbers.py#L217-L219 | ||
s9xie/DSN | 065e49898d239f5c96be558616b2556eabc50351 | scripts/cpp_lint.py | python | CheckForMultilineCommentsAndStrings | (filename, clean_lines, linenum, error) | Logs an error if we see /* ... */ or "..." that extend past one line.
/* ... */ comments are legit inside macros, for one line.
Otherwise, we prefer // comments, so it's ok to warn about the
other. Likewise, it's ok for strings to extend across multiple
lines, as long as a line continuation character (backsla... | Logs an error if we see /* ... */ or "..." that extend past one line. | [
"Logs",
"an",
"error",
"if",
"we",
"see",
"/",
"*",
"...",
"*",
"/",
"or",
"...",
"that",
"extend",
"past",
"one",
"line",
"."
] | def CheckForMultilineCommentsAndStrings(filename, clean_lines, linenum, error):
"""Logs an error if we see /* ... */ or "..." that extend past one line.
/* ... */ comments are legit inside macros, for one line.
Otherwise, we prefer // comments, so it's ok to warn about the
other. Likewise, it's ok for strings... | [
"def",
"CheckForMultilineCommentsAndStrings",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"# Remove all \\\\ (escaped backslashes) from the line. They are OK, and the",
"# secon... | https://github.com/s9xie/DSN/blob/065e49898d239f5c96be558616b2556eabc50351/scripts/cpp_lint.py#L1522-L1557 | ||
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/symbol/random.py | python | _random_helper | (random, sampler, params, shape, dtype, kwargs) | Helper function for random generators. | Helper function for random generators. | [
"Helper",
"function",
"for",
"random",
"generators",
"."
] | def _random_helper(random, sampler, params, shape, dtype, kwargs):
"""Helper function for random generators."""
if isinstance(params[0], Symbol):
for i in params[1:]:
assert isinstance(i, Symbol), \
"Distribution parameters must all have the same type, but got " \
... | [
"def",
"_random_helper",
"(",
"random",
",",
"sampler",
",",
"params",
",",
"shape",
",",
"dtype",
",",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"params",
"[",
"0",
"]",
",",
"Symbol",
")",
":",
"for",
"i",
"in",
"params",
"[",
"1",
":",
"]",
... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/symbol/random.py#L29-L45 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/pydoc.py | python | HTMLDoc.namelink | (self, name, *dicts) | return name | Make a link for an identifier, given name-to-URL mappings. | Make a link for an identifier, given name-to-URL mappings. | [
"Make",
"a",
"link",
"for",
"an",
"identifier",
"given",
"name",
"-",
"to",
"-",
"URL",
"mappings",
"."
] | def namelink(self, name, *dicts):
"""Make a link for an identifier, given name-to-URL mappings."""
for dict in dicts:
if name in dict:
return '<a href="%s">%s</a>' % (dict[name], name)
return name | [
"def",
"namelink",
"(",
"self",
",",
"name",
",",
"*",
"dicts",
")",
":",
"for",
"dict",
"in",
"dicts",
":",
"if",
"name",
"in",
"dict",
":",
"return",
"'<a href=\"%s\">%s</a>'",
"%",
"(",
"dict",
"[",
"name",
"]",
",",
"name",
")",
"return",
"name"
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/pydoc.py#L526-L531 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/client/timeline.py | python | _TensorTracker.last_unref | (self) | return max(self._unref_times) | Last unreference timestamp of this tensor (long integer). | Last unreference timestamp of this tensor (long integer). | [
"Last",
"unreference",
"timestamp",
"of",
"this",
"tensor",
"(",
"long",
"integer",
")",
"."
] | def last_unref(self):
"""Last unreference timestamp of this tensor (long integer)."""
return max(self._unref_times) | [
"def",
"last_unref",
"(",
"self",
")",
":",
"return",
"max",
"(",
"self",
".",
"_unref_times",
")"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/client/timeline.py#L325-L327 | |
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/python/psutil/psutil/__init__.py | python | Process.nice | (self, value=None) | Get or set process niceness (priority). | Get or set process niceness (priority). | [
"Get",
"or",
"set",
"process",
"niceness",
"(",
"priority",
")",
"."
] | def nice(self, value=None):
"""Get or set process niceness (priority)."""
if value is None:
return self._proc.nice_get()
else:
if not self.is_running():
raise NoSuchProcess(self.pid, self._name)
self._proc.nice_set(value) | [
"def",
"nice",
"(",
"self",
",",
"value",
"=",
"None",
")",
":",
"if",
"value",
"is",
"None",
":",
"return",
"self",
".",
"_proc",
".",
"nice_get",
"(",
")",
"else",
":",
"if",
"not",
"self",
".",
"is_running",
"(",
")",
":",
"raise",
"NoSuchProces... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/psutil/psutil/__init__.py#L583-L590 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/grid.py | python | Grid.EnableCellEditControl | (*args, **kwargs) | return _grid.Grid_EnableCellEditControl(*args, **kwargs) | EnableCellEditControl(self, bool enable=True) | EnableCellEditControl(self, bool enable=True) | [
"EnableCellEditControl",
"(",
"self",
"bool",
"enable",
"=",
"True",
")"
] | def EnableCellEditControl(*args, **kwargs):
"""EnableCellEditControl(self, bool enable=True)"""
return _grid.Grid_EnableCellEditControl(*args, **kwargs) | [
"def",
"EnableCellEditControl",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_grid",
".",
"Grid_EnableCellEditControl",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/grid.py#L1346-L1348 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_windows.py | python | Dialog.DoLayoutAdaptation | (*args, **kwargs) | return _windows_.Dialog_DoLayoutAdaptation(*args, **kwargs) | DoLayoutAdaptation(self) -> bool | DoLayoutAdaptation(self) -> bool | [
"DoLayoutAdaptation",
"(",
"self",
")",
"-",
">",
"bool"
] | def DoLayoutAdaptation(*args, **kwargs):
"""DoLayoutAdaptation(self) -> bool"""
return _windows_.Dialog_DoLayoutAdaptation(*args, **kwargs) | [
"def",
"DoLayoutAdaptation",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"Dialog_DoLayoutAdaptation",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_windows.py#L819-L821 | |
llvm/llvm-project | ffa6262cb4e2a335d26416fad39a581b4f98c5f4 | clang/bindings/python/clang/cindex.py | python | Type.get_align | (self) | return conf.lib.clang_Type_getAlignOf(self) | Retrieve the alignment of the record. | Retrieve the alignment of the record. | [
"Retrieve",
"the",
"alignment",
"of",
"the",
"record",
"."
] | def get_align(self):
"""
Retrieve the alignment of the record.
"""
return conf.lib.clang_Type_getAlignOf(self) | [
"def",
"get_align",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_Type_getAlignOf",
"(",
"self",
")"
] | https://github.com/llvm/llvm-project/blob/ffa6262cb4e2a335d26416fad39a581b4f98c5f4/clang/bindings/python/clang/cindex.py#L2379-L2383 | |
apache/kudu | 90895ce76590f10730ad7aac3613b69d89ff5422 | build-support/iwyu/fix_includes.py | python | _CalculateReorderSpans | (file_lines) | Fills each input_line's reorder_span field.
A 'reorder span' is a range of lines (from file_lines) that only has
#includes and forward-declares in it (and maybe blank lines, and
comments associated with #includes or forward-declares). In
particular, it does not include any "real code" besides #includes
and ... | Fills each input_line's reorder_span field. | [
"Fills",
"each",
"input_line",
"s",
"reorder_span",
"field",
"."
] | def _CalculateReorderSpans(file_lines):
"""Fills each input_line's reorder_span field.
A 'reorder span' is a range of lines (from file_lines) that only has
#includes and forward-declares in it (and maybe blank lines, and
comments associated with #includes or forward-declares). In
particular, it does not inc... | [
"def",
"_CalculateReorderSpans",
"(",
"file_lines",
")",
":",
"# Happily, move_spans are disjoint. Just make sure they're sorted and unique.",
"move_spans",
"=",
"[",
"s",
".",
"move_span",
"for",
"s",
"in",
"file_lines",
"if",
"s",
".",
"move_span",
"is",
"not",
"None"... | https://github.com/apache/kudu/blob/90895ce76590f10730ad7aac3613b69d89ff5422/build-support/iwyu/fix_includes.py#L910-L966 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/signal/windows/windows.py | python | boxcar | (M, sym=True) | return _truncate(w, needs_trunc) | Return a boxcar or rectangular window.
Also known as a rectangular window or Dirichlet window, this is equivalent
to no window at all.
Parameters
----------
M : int
Number of points in the output window. If zero or less, an empty
array is returned.
sym : bool, optional
... | Return a boxcar or rectangular window. | [
"Return",
"a",
"boxcar",
"or",
"rectangular",
"window",
"."
] | def boxcar(M, sym=True):
"""Return a boxcar or rectangular window.
Also known as a rectangular window or Dirichlet window, this is equivalent
to no window at all.
Parameters
----------
M : int
Number of points in the output window. If zero or less, an empty
array is returned.
... | [
"def",
"boxcar",
"(",
"M",
",",
"sym",
"=",
"True",
")",
":",
"if",
"_len_guards",
"(",
"M",
")",
":",
"return",
"np",
".",
"ones",
"(",
"M",
")",
"M",
",",
"needs_trunc",
"=",
"_extend",
"(",
"M",
",",
"sym",
")",
"w",
"=",
"np",
".",
"ones"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/signal/windows/windows.py#L123-L173 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py3/IPython/utils/coloransi.py | python | ColorSchemeTable.set_active_scheme | (self,scheme,case_sensitive=0) | Set the currently active scheme.
Names are by default compared in a case-insensitive way, but this can
be changed by setting the parameter case_sensitive to true. | Set the currently active scheme. | [
"Set",
"the",
"currently",
"active",
"scheme",
"."
] | def set_active_scheme(self,scheme,case_sensitive=0):
"""Set the currently active scheme.
Names are by default compared in a case-insensitive way, but this can
be changed by setting the parameter case_sensitive to true."""
scheme_names = list(self.keys())
if case_sensitive:
... | [
"def",
"set_active_scheme",
"(",
"self",
",",
"scheme",
",",
"case_sensitive",
"=",
"0",
")",
":",
"scheme_names",
"=",
"list",
"(",
"self",
".",
"keys",
"(",
")",
")",
"if",
"case_sensitive",
":",
"valid_schemes",
"=",
"scheme_names",
"scheme_test",
"=",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py3/IPython/utils/coloransi.py#L164-L187 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/control_flow_ops.py | python | ControlFlowContext.ExitResult | (self, result) | Make a list of tensors available in the outer context. | Make a list of tensors available in the outer context. | [
"Make",
"a",
"list",
"of",
"tensors",
"available",
"in",
"the",
"outer",
"context",
"."
] | def ExitResult(self, result):
"""Make a list of tensors available in the outer context."""
if self._outer_context:
def fn(x):
self._outer_context.AddName(x.name)
return x
nest.map_structure(fn, result, expand_composites=True) | [
"def",
"ExitResult",
"(",
"self",
",",
"result",
")",
":",
"if",
"self",
".",
"_outer_context",
":",
"def",
"fn",
"(",
"x",
")",
":",
"self",
".",
"_outer_context",
".",
"AddName",
"(",
"x",
".",
"name",
")",
"return",
"x",
"nest",
".",
"map_structur... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/control_flow_ops.py#L766-L772 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/linalg/linear_operator_algebra.py | python | RegisterCholesky.__call__ | (self, cholesky_fn) | return cholesky_fn | Perform the Cholesky registration.
Args:
cholesky_fn: The function to use for the Cholesky.
Returns:
cholesky_fn
Raises:
TypeError: if cholesky_fn is not a callable.
ValueError: if a Cholesky function has already been registered for
the given argument classes. | Perform the Cholesky registration. | [
"Perform",
"the",
"Cholesky",
"registration",
"."
] | def __call__(self, cholesky_fn):
"""Perform the Cholesky registration.
Args:
cholesky_fn: The function to use for the Cholesky.
Returns:
cholesky_fn
Raises:
TypeError: if cholesky_fn is not a callable.
ValueError: if a Cholesky function has already been registered for
... | [
"def",
"__call__",
"(",
"self",
",",
"cholesky_fn",
")",
":",
"if",
"not",
"callable",
"(",
"cholesky_fn",
")",
":",
"raise",
"TypeError",
"(",
"\"cholesky_fn must be callable, received: {}\"",
".",
"format",
"(",
"cholesky_fn",
")",
")",
"if",
"self",
".",
"_... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/linalg/linear_operator_algebra.py#L251-L272 | |
macchina-io/macchina.io | ef24ba0e18379c3dd48fb84e6dbf991101cb8db0 | platform/JS/V8/tools/gyp/pylib/gyp/generator/ninja.py | python | ComputeOutputDir | (params) | return os.path.normpath(os.path.join(generator_dir, output_dir)) | Returns the path from the toplevel_dir to the build output directory. | Returns the path from the toplevel_dir to the build output directory. | [
"Returns",
"the",
"path",
"from",
"the",
"toplevel_dir",
"to",
"the",
"build",
"output",
"directory",
"."
] | def ComputeOutputDir(params):
"""Returns the path from the toplevel_dir to the build output directory."""
# generator_dir: relative path from pwd to where make puts build files.
# Makes migrating from make to ninja easier, ninja doesn't put anything here.
generator_dir = os.path.relpath(params['options'].genera... | [
"def",
"ComputeOutputDir",
"(",
"params",
")",
":",
"# generator_dir: relative path from pwd to where make puts build files.",
"# Makes migrating from make to ninja easier, ninja doesn't put anything here.",
"generator_dir",
"=",
"os",
".",
"path",
".",
"relpath",
"(",
"params",
"[... | https://github.com/macchina-io/macchina.io/blob/ef24ba0e18379c3dd48fb84e6dbf991101cb8db0/platform/JS/V8/tools/gyp/pylib/gyp/generator/ninja.py#L1704-L1714 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/compiler/pyassem.py | python | PyFlowGraph.flattenGraph | (self) | Arrange the blocks in order and resolve jumps | Arrange the blocks in order and resolve jumps | [
"Arrange",
"the",
"blocks",
"in",
"order",
"and",
"resolve",
"jumps"
] | def flattenGraph(self):
"""Arrange the blocks in order and resolve jumps"""
assert self.stage == RAW
self.insts = insts = []
pc = 0
begin = {}
end = {}
for b in self.getBlocksInOrder():
begin[b] = pc
for inst in b.getInstructions():
... | [
"def",
"flattenGraph",
"(",
"self",
")",
":",
"assert",
"self",
".",
"stage",
"==",
"RAW",
"self",
".",
"insts",
"=",
"insts",
"=",
"[",
"]",
"pc",
"=",
"0",
"begin",
"=",
"{",
"}",
"end",
"=",
"{",
"}",
"for",
"b",
"in",
"self",
".",
"getBlock... | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/compiler/pyassem.py#L424-L455 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/arrays/datetimelike.py | python | DatetimeLikeArrayMixin._box_values | (self, values) | return lib.map_infer(values, self._box_func) | apply box func to passed values | apply box func to passed values | [
"apply",
"box",
"func",
"to",
"passed",
"values"
] | def _box_values(self, values):
"""
apply box func to passed values
"""
return lib.map_infer(values, self._box_func) | [
"def",
"_box_values",
"(",
"self",
",",
"values",
")",
":",
"return",
"lib",
".",
"map_infer",
"(",
"values",
",",
"self",
".",
"_box_func",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/arrays/datetimelike.py#L342-L346 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/urllib3/connection.py | python | HTTPConnection._new_conn | (self) | return conn | Establish a socket connection and set nodelay settings on it.
:return: New socket connection. | Establish a socket connection and set nodelay settings on it. | [
"Establish",
"a",
"socket",
"connection",
"and",
"set",
"nodelay",
"settings",
"on",
"it",
"."
] | def _new_conn(self):
""" Establish a socket connection and set nodelay settings on it.
:return: New socket connection.
"""
extra_kw = {}
if self.source_address:
extra_kw['source_address'] = self.source_address
if self.socket_options:
extra_kw['so... | [
"def",
"_new_conn",
"(",
"self",
")",
":",
"extra_kw",
"=",
"{",
"}",
"if",
"self",
".",
"source_address",
":",
"extra_kw",
"[",
"'source_address'",
"]",
"=",
"self",
".",
"source_address",
"if",
"self",
".",
"socket_options",
":",
"extra_kw",
"[",
"'socke... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/urllib3/connection.py#L127-L152 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/datamodel/packer.py | python | ArgPacker.from_arguments | (self, builder, args) | return values | Unflatten all argument values | Unflatten all argument values | [
"Unflatten",
"all",
"argument",
"values"
] | def from_arguments(self, builder, args):
"""Unflatten all argument values
"""
valtree = self._unflattener.unflatten(args)
values = [dm.from_argument(builder, val)
for dm, val in zip(self._dm_args, valtree)
]
return values | [
"def",
"from_arguments",
"(",
"self",
",",
"builder",
",",
"args",
")",
":",
"valtree",
"=",
"self",
".",
"_unflattener",
".",
"unflatten",
"(",
"args",
")",
"values",
"=",
"[",
"dm",
".",
"from_argument",
"(",
"builder",
",",
"val",
")",
"for",
"dm",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/datamodel/packer.py#L106-L115 | |
mickem/nscp | 79f89fdbb6da63f91bc9dedb7aea202fe938f237 | scripts/python/lib/google/protobuf/internal/containers.py | python | RepeatedScalarFieldContainer.__delitem__ | (self, key) | Deletes the item at the specified position. | Deletes the item at the specified position. | [
"Deletes",
"the",
"item",
"at",
"the",
"specified",
"position",
"."
] | def __delitem__(self, key):
"""Deletes the item at the specified position."""
del self._values[key]
self._message_listener.Modified() | [
"def",
"__delitem__",
"(",
"self",
",",
"key",
")",
":",
"del",
"self",
".",
"_values",
"[",
"key",
"]",
"self",
".",
"_message_listener",
".",
"Modified",
"(",
")"
] | https://github.com/mickem/nscp/blob/79f89fdbb6da63f91bc9dedb7aea202fe938f237/scripts/python/lib/google/protobuf/internal/containers.py#L161-L164 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/jsonschema/exceptions.py | python | ErrorTree.__setitem__ | (self, index, value) | Add an error to the tree at the given ``index``. | Add an error to the tree at the given ``index``. | [
"Add",
"an",
"error",
"to",
"the",
"tree",
"at",
"the",
"given",
"index",
"."
] | def __setitem__(self, index, value):
"""
Add an error to the tree at the given ``index``.
"""
self._contents[index] = value | [
"def",
"__setitem__",
"(",
"self",
",",
"index",
",",
"value",
")",
":",
"self",
".",
"_contents",
"[",
"index",
"]",
"=",
"value"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/jsonschema/exceptions.py#L271-L275 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/calendar.py | python | GenericCalendarCtrl.EnableYearChange | (*args, **kwargs) | return _calendar.GenericCalendarCtrl_EnableYearChange(*args, **kwargs) | EnableYearChange(self, bool enable=True)
This function should be used instead of changing CAL_NO_YEAR_CHANGE
style bit directly. It allows or disallows the user to change the year
interactively. | EnableYearChange(self, bool enable=True) | [
"EnableYearChange",
"(",
"self",
"bool",
"enable",
"=",
"True",
")"
] | def EnableYearChange(*args, **kwargs):
"""
EnableYearChange(self, bool enable=True)
This function should be used instead of changing CAL_NO_YEAR_CHANGE
style bit directly. It allows or disallows the user to change the year
interactively.
"""
return _calendar.Gene... | [
"def",
"EnableYearChange",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_calendar",
".",
"GenericCalendarCtrl_EnableYearChange",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/calendar.py#L547-L555 | |
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/clangxx.py | python | generate | (env) | Add Builders and construction variables for clang++ to an Environment. | Add Builders and construction variables for clang++ to an Environment. | [
"Add",
"Builders",
"and",
"construction",
"variables",
"for",
"clang",
"++",
"to",
"an",
"Environment",
"."
] | def generate(env):
"""Add Builders and construction variables for clang++ to an Environment."""
static_obj, shared_obj = SCons.Tool.createObjBuilders(env)
SCons.Tool.cxx.generate(env)
env['CXX'] = env.Detect(compilers) or 'clang++'
# platform specific settings
if env['PLATFORM'] == 'ai... | [
"def",
"generate",
"(",
"env",
")",
":",
"static_obj",
",",
"shared_obj",
"=",
"SCons",
".",
"Tool",
".",
"createObjBuilders",
"(",
"env",
")",
"SCons",
".",
"Tool",
".",
"cxx",
".",
"generate",
"(",
"env",
")",
"env",
"[",
"'CXX'",
"]",
"=",
"env",
... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/clangxx.py#L54-L94 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_windows.py | python | Dialog.CanDoLayoutAdaptation | (*args, **kwargs) | return _windows_.Dialog_CanDoLayoutAdaptation(*args, **kwargs) | CanDoLayoutAdaptation(self) -> bool | CanDoLayoutAdaptation(self) -> bool | [
"CanDoLayoutAdaptation",
"(",
"self",
")",
"-",
">",
"bool"
] | def CanDoLayoutAdaptation(*args, **kwargs):
"""CanDoLayoutAdaptation(self) -> bool"""
return _windows_.Dialog_CanDoLayoutAdaptation(*args, **kwargs) | [
"def",
"CanDoLayoutAdaptation",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"Dialog_CanDoLayoutAdaptation",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_windows.py#L823-L825 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/pickletools.py | python | dis | (pickle, out=None, memo=None, indentlevel=4) | Produce a symbolic disassembly of a pickle.
'pickle' is a file-like object, or string, containing a (at least one)
pickle. The pickle is disassembled from the current position, through
the first STOP opcode encountered.
Optional arg 'out' is a file-like object to which the disassembly is
printed.... | Produce a symbolic disassembly of a pickle. | [
"Produce",
"a",
"symbolic",
"disassembly",
"of",
"a",
"pickle",
"."
] | def dis(pickle, out=None, memo=None, indentlevel=4):
"""Produce a symbolic disassembly of a pickle.
'pickle' is a file-like object, or string, containing a (at least one)
pickle. The pickle is disassembled from the current position, through
the first STOP opcode encountered.
Optional arg 'out' is... | [
"def",
"dis",
"(",
"pickle",
",",
"out",
"=",
"None",
",",
"memo",
"=",
"None",
",",
"indentlevel",
"=",
"4",
")",
":",
"# Most of the hair here is for sanity checks, but most of it is needed",
"# anyway to detect when a protocol 0 POP takes a MARK off the stack",
"# (which i... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/pickletools.py#L1887-L2021 | ||
microsoft/checkedc-clang | a173fefde5d7877b7750e7ce96dd08cf18baebf2 | compiler-rt/lib/sanitizer_common/scripts/cpplint.py | python | _CppLintState.ResetErrorCounts | (self) | Sets the module's error statistic back to zero. | Sets the module's error statistic back to zero. | [
"Sets",
"the",
"module",
"s",
"error",
"statistic",
"back",
"to",
"zero",
"."
] | def ResetErrorCounts(self):
"""Sets the module's error statistic back to zero."""
self.error_count = 0
self.errors_by_category = {} | [
"def",
"ResetErrorCounts",
"(",
"self",
")",
":",
"self",
".",
"error_count",
"=",
"0",
"self",
".",
"errors_by_category",
"=",
"{",
"}"
] | https://github.com/microsoft/checkedc-clang/blob/a173fefde5d7877b7750e7ce96dd08cf18baebf2/compiler-rt/lib/sanitizer_common/scripts/cpplint.py#L938-L941 | ||
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | scripts/Python/static-binding/lldb.py | python | SBSymbolContextList.Clear | (self) | return _lldb.SBSymbolContextList_Clear(self) | Clear(SBSymbolContextList self) | Clear(SBSymbolContextList self) | [
"Clear",
"(",
"SBSymbolContextList",
"self",
")"
] | def Clear(self):
"""Clear(SBSymbolContextList self)"""
return _lldb.SBSymbolContextList_Clear(self) | [
"def",
"Clear",
"(",
"self",
")",
":",
"return",
"_lldb",
".",
"SBSymbolContextList_Clear",
"(",
"self",
")"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L10139-L10141 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/stc.py | python | StyledTextCtrl.RegisterImage | (*args, **kwargs) | return _stc.StyledTextCtrl_RegisterImage(*args, **kwargs) | RegisterImage(self, int type, Bitmap bmp)
Register an image for use in autocompletion lists. | RegisterImage(self, int type, Bitmap bmp) | [
"RegisterImage",
"(",
"self",
"int",
"type",
"Bitmap",
"bmp",
")"
] | def RegisterImage(*args, **kwargs):
"""
RegisterImage(self, int type, Bitmap bmp)
Register an image for use in autocompletion lists.
"""
return _stc.StyledTextCtrl_RegisterImage(*args, **kwargs) | [
"def",
"RegisterImage",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_RegisterImage",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/stc.py#L3203-L3209 | |
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/build/checksums.py | python | setup_logging | (level=logging.DEBUG) | This function sets up the logging module using a speficiable logging
module logging level. The default log level is DEBUG.
The output is in the format:
<level> - <message>
Example:
DEBUG - Finished reading in file | This function sets up the logging module using a speficiable logging
module logging level. The default log level is DEBUG. | [
"This",
"function",
"sets",
"up",
"the",
"logging",
"module",
"using",
"a",
"speficiable",
"logging",
"module",
"logging",
"level",
".",
"The",
"default",
"log",
"level",
"is",
"DEBUG",
"."
] | def setup_logging(level=logging.DEBUG):
'''This function sets up the logging module using a speficiable logging
module logging level. The default log level is DEBUG.
The output is in the format:
<level> - <message>
Example:
DEBUG - Finished reading in file
'''
logger = logging.get... | [
"def",
"setup_logging",
"(",
"level",
"=",
"logging",
".",
"DEBUG",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"'checksums.py'",
")",
"logger",
".",
"setLevel",
"(",
"logging",
".",
"DEBUG",
")",
"handler",
"=",
"logging",
".",
"StreamHandl... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/build/checksums.py#L88-L104 | ||
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py | python | xmlDoc.htmlIsAutoClosed | (self, elem) | return ret | The HTML DTD allows a tag to implicitly close other tags.
The list is kept in htmlStartClose array. This function
checks if a tag is autoclosed by one of it's child | The HTML DTD allows a tag to implicitly close other tags.
The list is kept in htmlStartClose array. This function
checks if a tag is autoclosed by one of it's child | [
"The",
"HTML",
"DTD",
"allows",
"a",
"tag",
"to",
"implicitly",
"close",
"other",
"tags",
".",
"The",
"list",
"is",
"kept",
"in",
"htmlStartClose",
"array",
".",
"This",
"function",
"checks",
"if",
"a",
"tag",
"is",
"autoclosed",
"by",
"one",
"of",
"it",... | def htmlIsAutoClosed(self, elem):
"""The HTML DTD allows a tag to implicitly close other tags.
The list is kept in htmlStartClose array. This function
checks if a tag is autoclosed by one of it's child """
ret = libxml2mod.htmlIsAutoClosed(self._o, elem)
return ret | [
"def",
"htmlIsAutoClosed",
"(",
"self",
",",
"elem",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"htmlIsAutoClosed",
"(",
"self",
".",
"_o",
",",
"elem",
")",
"return",
"ret"
] | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py#L3984-L3989 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/xml/dom/minidom.py | python | parseString | (string, parser=None) | Parse a file into a DOM from a string. | Parse a file into a DOM from a string. | [
"Parse",
"a",
"file",
"into",
"a",
"DOM",
"from",
"a",
"string",
"."
] | def parseString(string, parser=None):
"""Parse a file into a DOM from a string."""
if parser is None:
from xml.dom import expatbuilder
return expatbuilder.parseString(string)
else:
from xml.dom import pulldom
return _do_pulldom_parse(pulldom.parseString, (string,),
... | [
"def",
"parseString",
"(",
"string",
",",
"parser",
"=",
"None",
")",
":",
"if",
"parser",
"is",
"None",
":",
"from",
"xml",
".",
"dom",
"import",
"expatbuilder",
"return",
"expatbuilder",
".",
"parseString",
"(",
"string",
")",
"else",
":",
"from",
"xml... | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/xml/dom/minidom.py#L1924-L1932 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/composite/base.py | python | _Tail.__init__ | (self, name) | Initialize _Tail. | Initialize _Tail. | [
"Initialize",
"_Tail",
"."
] | def __init__(self, name):
"""Initialize _Tail."""
Tail_.__init__(self, name) | [
"def",
"__init__",
"(",
"self",
",",
"name",
")",
":",
"Tail_",
".",
"__init__",
"(",
"self",
",",
"name",
")"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/composite/base.py#L830-L832 | ||
sdhash/sdhash | b9eff63e4e5867e910f41fd69032bbb1c94a2a5e | external/tools/build/v2/build/virtual_target.py | python | VirtualTarget.depends | (self, d) | Adds additional instances of 'VirtualTarget' that this
one depends on. | Adds additional instances of 'VirtualTarget' that this
one depends on. | [
"Adds",
"additional",
"instances",
"of",
"VirtualTarget",
"that",
"this",
"one",
"depends",
"on",
"."
] | def depends (self, d):
""" Adds additional instances of 'VirtualTarget' that this
one depends on.
"""
self.dependencies_ = unique (self.dependencies_ + d).sort () | [
"def",
"depends",
"(",
"self",
",",
"d",
")",
":",
"self",
".",
"dependencies_",
"=",
"unique",
"(",
"self",
".",
"dependencies_",
"+",
"d",
")",
".",
"sort",
"(",
")"
] | https://github.com/sdhash/sdhash/blob/b9eff63e4e5867e910f41fd69032bbb1c94a2a5e/external/tools/build/v2/build/virtual_target.py#L281-L285 | ||
yuxng/PoseCNN | 9f3dd7b7bce21dcafc05e8f18ccc90da3caabd04 | lib/datasets/rgbd_scene.py | python | rgbd_scene.depth_path_at | (self, i) | return self.depth_path_from_index(self.image_index[i]) | Return the absolute path to depth i in the image sequence. | Return the absolute path to depth i in the image sequence. | [
"Return",
"the",
"absolute",
"path",
"to",
"depth",
"i",
"in",
"the",
"image",
"sequence",
"."
] | def depth_path_at(self, i):
"""
Return the absolute path to depth i in the image sequence.
"""
return self.depth_path_from_index(self.image_index[i]) | [
"def",
"depth_path_at",
"(",
"self",
",",
"i",
")",
":",
"return",
"self",
".",
"depth_path_from_index",
"(",
"self",
".",
"image_index",
"[",
"i",
"]",
")"
] | https://github.com/yuxng/PoseCNN/blob/9f3dd7b7bce21dcafc05e8f18ccc90da3caabd04/lib/datasets/rgbd_scene.py#L50-L54 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/slim/python/slim/nets/inception_v3.py | python | _reduced_kernel_size_for_small_input | (input_tensor, kernel_size) | return kernel_size_out | Define kernel size which is automatically reduced for small input.
If the shape of the input images is unknown at graph construction time this
function assumes that the input images are is large enough.
Args:
input_tensor: input tensor of size [batch_size, height, width, channels].
kernel_size: desired ... | Define kernel size which is automatically reduced for small input. | [
"Define",
"kernel",
"size",
"which",
"is",
"automatically",
"reduced",
"for",
"small",
"input",
"."
] | def _reduced_kernel_size_for_small_input(input_tensor, kernel_size):
"""Define kernel size which is automatically reduced for small input.
If the shape of the input images is unknown at graph construction time this
function assumes that the input images are is large enough.
Args:
input_tensor: input tenso... | [
"def",
"_reduced_kernel_size_for_small_input",
"(",
"input_tensor",
",",
"kernel_size",
")",
":",
"shape",
"=",
"input_tensor",
".",
"get_shape",
"(",
")",
".",
"as_list",
"(",
")",
"if",
"shape",
"[",
"1",
"]",
"is",
"None",
"or",
"shape",
"[",
"2",
"]",
... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/slim/python/slim/nets/inception_v3.py#L644-L674 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/macpath.py | python | abspath | (path) | return normpath(path) | Return an absolute path. | Return an absolute path. | [
"Return",
"an",
"absolute",
"path",
"."
] | def abspath(path):
"""Return an absolute path."""
if not isabs(path):
if isinstance(path, _unicode):
cwd = os.getcwdu()
else:
cwd = os.getcwd()
path = join(cwd, path)
return normpath(path) | [
"def",
"abspath",
"(",
"path",
")",
":",
"if",
"not",
"isabs",
"(",
"path",
")",
":",
"if",
"isinstance",
"(",
"path",
",",
"_unicode",
")",
":",
"cwd",
"=",
"os",
".",
"getcwdu",
"(",
")",
"else",
":",
"cwd",
"=",
"os",
".",
"getcwd",
"(",
")"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/macpath.py#L187-L195 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/platebtn.py | python | PlateButton.__PostEvent | (self) | Post a button event to parent of this control | Post a button event to parent of this control | [
"Post",
"a",
"button",
"event",
"to",
"parent",
"of",
"this",
"control"
] | def __PostEvent(self):
"""Post a button event to parent of this control"""
if self._style & PB_STYLE_TOGGLE:
etype = wx.wxEVT_COMMAND_TOGGLEBUTTON_CLICKED
else:
etype = wx.wxEVT_COMMAND_BUTTON_CLICKED
bevt = wx.CommandEvent(etype, self.GetId())
bevt.SetEve... | [
"def",
"__PostEvent",
"(",
"self",
")",
":",
"if",
"self",
".",
"_style",
"&",
"PB_STYLE_TOGGLE",
":",
"etype",
"=",
"wx",
".",
"wxEVT_COMMAND_TOGGLEBUTTON_CLICKED",
"else",
":",
"etype",
"=",
"wx",
".",
"wxEVT_COMMAND_BUTTON_CLICKED",
"bevt",
"=",
"wx",
".",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/platebtn.py#L248-L257 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/plat-mac/PixMapWrapper.py | python | PixMapWrapper.fromstring | (self,s,width,height,format=imgformat.macrgb) | Stuff this pixmap with raw pixel data from a string.
Supply width, height, and one of the imgformat specifiers. | Stuff this pixmap with raw pixel data from a string.
Supply width, height, and one of the imgformat specifiers. | [
"Stuff",
"this",
"pixmap",
"with",
"raw",
"pixel",
"data",
"from",
"a",
"string",
".",
"Supply",
"width",
"height",
"and",
"one",
"of",
"the",
"imgformat",
"specifiers",
"."
] | def fromstring(self,s,width,height,format=imgformat.macrgb):
"""Stuff this pixmap with raw pixel data from a string.
Supply width, height, and one of the imgformat specifiers."""
# we only support 16- and 32-bit mac rgb...
# so convert if necessary
if format != imgformat.macrgb a... | [
"def",
"fromstring",
"(",
"self",
",",
"s",
",",
"width",
",",
"height",
",",
"format",
"=",
"imgformat",
".",
"macrgb",
")",
":",
"# we only support 16- and 32-bit mac rgb...",
"# so convert if necessary",
"if",
"format",
"!=",
"imgformat",
".",
"macrgb",
"and",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/plat-mac/PixMapWrapper.py#L161-L179 | ||
infinidb/infinidb | 6c9f5dfdabc41ad80e81ba9e1a4eb0d7271a5d23 | writeengine/bulk/bulkload.py | python | find_paths | () | return (bulk_dir, data_dir) | Find DBRoot and BulkRoot. | Find DBRoot and BulkRoot. | [
"Find",
"DBRoot",
"and",
"BulkRoot",
"."
] | def find_paths():
"""Find DBRoot and BulkRoot."""
try:
config_file = os.environ['CALPONT_CONFIG_FILE']
except KeyError:
try:
logger.info("Environment variable CALPONT_CONFIG_FILE not set, looking for system Calpont.xml")
config_file = '/usr/local/Calpont/etc/Calpont.xml'
os.lsta... | [
"def",
"find_paths",
"(",
")",
":",
"try",
":",
"config_file",
"=",
"os",
".",
"environ",
"[",
"'CALPONT_CONFIG_FILE'",
"]",
"except",
"KeyError",
":",
"try",
":",
"logger",
".",
"info",
"(",
"\"Environment variable CALPONT_CONFIG_FILE not set, looking for system Calp... | https://github.com/infinidb/infinidb/blob/6c9f5dfdabc41ad80e81ba9e1a4eb0d7271a5d23/writeengine/bulk/bulkload.py#L51-L76 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/sched.py | python | scheduler.queue | (self) | return map(heapq.heappop, [events]*len(events)) | An ordered list of upcoming events.
Events are named tuples with fields for:
time, priority, action, arguments | An ordered list of upcoming events. | [
"An",
"ordered",
"list",
"of",
"upcoming",
"events",
"."
] | def queue(self):
"""An ordered list of upcoming events.
Events are named tuples with fields for:
time, priority, action, arguments
"""
# Use heapq to sort the queue rather than using 'sorted(self._queue)'.
# With heapq, two events scheduled at the same time will sho... | [
"def",
"queue",
"(",
"self",
")",
":",
"# Use heapq to sort the queue rather than using 'sorted(self._queue)'.",
"# With heapq, two events scheduled at the same time will show in",
"# the actual order they would be retrieved.",
"events",
"=",
"self",
".",
"_queue",
"[",
":",
"]",
"... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/sched.py#L123-L134 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/training/evaluation.py | python | _get_or_create_eval_step | () | Gets or creates the eval step `Tensor`.
Returns:
A `Tensor` representing a counter for the evaluation step.
Raises:
ValueError: If multiple `Tensors` have been added to the
`tf.GraphKeys.EVAL_STEP` collection. | Gets or creates the eval step `Tensor`. | [
"Gets",
"or",
"creates",
"the",
"eval",
"step",
"Tensor",
"."
] | def _get_or_create_eval_step():
"""Gets or creates the eval step `Tensor`.
Returns:
A `Tensor` representing a counter for the evaluation step.
Raises:
ValueError: If multiple `Tensors` have been added to the
`tf.GraphKeys.EVAL_STEP` collection.
"""
graph = ops.get_default_graph()
eval_steps ... | [
"def",
"_get_or_create_eval_step",
"(",
")",
":",
"graph",
"=",
"ops",
".",
"get_default_graph",
"(",
")",
"eval_steps",
"=",
"graph",
".",
"get_collection",
"(",
"ops",
".",
"GraphKeys",
".",
"EVAL_STEP",
")",
"if",
"len",
"(",
"eval_steps",
")",
"==",
"1... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/training/evaluation.py#L37-L61 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/WebOb/webob/response.py | python | Response.unset_cookie | (self, name, strict=True) | Unset a cookie with the given name (remove it from the
response). | Unset a cookie with the given name (remove it from the
response). | [
"Unset",
"a",
"cookie",
"with",
"the",
"given",
"name",
"(",
"remove",
"it",
"from",
"the",
"response",
")",
"."
] | def unset_cookie(self, name, strict=True):
"""
Unset a cookie with the given name (remove it from the
response).
"""
existing = self.headers.getall('Set-Cookie')
if not existing and not strict:
return
cookies = Cookie()
for header in existing:
... | [
"def",
"unset_cookie",
"(",
"self",
",",
"name",
",",
"strict",
"=",
"True",
")",
":",
"existing",
"=",
"self",
".",
"headers",
".",
"getall",
"(",
"'Set-Cookie'",
")",
"if",
"not",
"existing",
"and",
"not",
"strict",
":",
"return",
"cookies",
"=",
"Co... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/WebOb/webob/response.py#L800-L819 | ||
google/fhir | d77f57706c1a168529b0b87ca7ccb1c0113e83c2 | go/generate_go_protos.py | python | move_generated_go_protos | (tmp_dir: str) | Responsible for moving the generated go protos to their final destination.
Args:
tmp_dir: the temporary directory where the proto building and
transformations occur. | Responsible for moving the generated go protos to their final destination. | [
"Responsible",
"for",
"moving",
"the",
"generated",
"go",
"protos",
"to",
"their",
"final",
"destination",
"."
] | def move_generated_go_protos(tmp_dir: str):
"""Responsible for moving the generated go protos to their final destination.
Args:
tmp_dir: the temporary directory where the proto building and
transformations occur.
"""
dest_root = _REPO_PATH.value
proto_dest_dir = os.path.join(dest_root, "go/proto")
... | [
"def",
"move_generated_go_protos",
"(",
"tmp_dir",
":",
"str",
")",
":",
"dest_root",
"=",
"_REPO_PATH",
".",
"value",
"proto_dest_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"dest_root",
",",
"\"go/proto\"",
")",
"shutil",
".",
"rmtree",
"(",
"proto_des... | https://github.com/google/fhir/blob/d77f57706c1a168529b0b87ca7ccb1c0113e83c2/go/generate_go_protos.py#L37-L67 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/stc.py | python | StyledTextCtrl.AutoCompComplete | (*args, **kwargs) | return _stc.StyledTextCtrl_AutoCompComplete(*args, **kwargs) | AutoCompComplete(self)
User has selected an item so remove the list and insert the selection. | AutoCompComplete(self) | [
"AutoCompComplete",
"(",
"self",
")"
] | def AutoCompComplete(*args, **kwargs):
"""
AutoCompComplete(self)
User has selected an item so remove the list and insert the selection.
"""
return _stc.StyledTextCtrl_AutoCompComplete(*args, **kwargs) | [
"def",
"AutoCompComplete",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_AutoCompComplete",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/stc.py#L3062-L3068 | |
deepmind/open_spiel | 4ca53bea32bb2875c7385d215424048ae92f78c8 | open_spiel/python/algorithms/psro_v2/psro_v2.py | python | PSROSolver.get_and_update_non_marginalized_meta_strategies | (self, update=True) | return self._non_marginalized_probabilities | Returns the Nash Equilibrium distribution on meta game matrix. | Returns the Nash Equilibrium distribution on meta game matrix. | [
"Returns",
"the",
"Nash",
"Equilibrium",
"distribution",
"on",
"meta",
"game",
"matrix",
"."
] | def get_and_update_non_marginalized_meta_strategies(self, update=True):
"""Returns the Nash Equilibrium distribution on meta game matrix."""
if update:
self.update_meta_strategies()
return self._non_marginalized_probabilities | [
"def",
"get_and_update_non_marginalized_meta_strategies",
"(",
"self",
",",
"update",
"=",
"True",
")",
":",
"if",
"update",
":",
"self",
".",
"update_meta_strategies",
"(",
")",
"return",
"self",
".",
"_non_marginalized_probabilities"
] | https://github.com/deepmind/open_spiel/blob/4ca53bea32bb2875c7385d215424048ae92f78c8/open_spiel/python/algorithms/psro_v2/psro_v2.py#L478-L482 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/share/gdb/python/gdb/command/frame_filters.py | python | InfoFrameFilter.enabled_string | (state) | Return "Yes" if filter is enabled, otherwise "No". | Return "Yes" if filter is enabled, otherwise "No". | [
"Return",
"Yes",
"if",
"filter",
"is",
"enabled",
"otherwise",
"No",
"."
] | def enabled_string(state):
"""Return "Yes" if filter is enabled, otherwise "No"."""
if state:
return "Yes"
else:
return "No" | [
"def",
"enabled_string",
"(",
"state",
")",
":",
"if",
"state",
":",
"return",
"\"Yes\"",
"else",
":",
"return",
"\"No\""
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/share/gdb/python/gdb/command/frame_filters.py#L52-L57 | ||
MegEngine/MegEngine | ce9ad07a27ec909fb8db4dd67943d24ba98fb93a | imperative/python/megengine/module/qat/module.py | python | QATModule.get_activation_dtype | (self) | return self._get_method_result(
"get_quantized_dtype", self.act_fake_quant, self.act_observer
) | r"""Get activation's quantization dtype as the method from ``qconfig``. | r"""Get activation's quantization dtype as the method from ``qconfig``. | [
"r",
"Get",
"activation",
"s",
"quantization",
"dtype",
"as",
"the",
"method",
"from",
"qconfig",
"."
] | def get_activation_dtype(self):
r"""Get activation's quantization dtype as the method from ``qconfig``."""
return self._get_method_result(
"get_quantized_dtype", self.act_fake_quant, self.act_observer
) | [
"def",
"get_activation_dtype",
"(",
"self",
")",
":",
"return",
"self",
".",
"_get_method_result",
"(",
"\"get_quantized_dtype\"",
",",
"self",
".",
"act_fake_quant",
",",
"self",
".",
"act_observer",
")"
] | https://github.com/MegEngine/MegEngine/blob/ce9ad07a27ec909fb8db4dd67943d24ba98fb93a/imperative/python/megengine/module/qat/module.py#L140-L144 | |
wanderine/BROCCOLI | ff7613de40d97429ba76ee2948cb5e1d7dd991d0 | code/bids/fslinstaller.py | python | FslInstall.install_tar | (self, targz_file) | return FslIResult('', FslIResult.SUCCESS, '') | Install given tar.gz file, use sudo where required | Install given tar.gz file, use sudo where required | [
"Install",
"given",
"tar",
".",
"gz",
"file",
"use",
"sudo",
"where",
"required"
] | def install_tar(self, targz_file):
'''Install given tar.gz file, use sudo where required'''
#import tarfile
from os import getpid,path
from time import time
# Check if install location is writable
MsgUser.debug("Checking %s is writeable." % (self.location))
if is_... | [
"def",
"install_tar",
"(",
"self",
",",
"targz_file",
")",
":",
"#import tarfile",
"from",
"os",
"import",
"getpid",
",",
"path",
"from",
"time",
"import",
"time",
"# Check if install location is writable",
"MsgUser",
".",
"debug",
"(",
"\"Checking %s is writeable.\""... | https://github.com/wanderine/BROCCOLI/blob/ff7613de40d97429ba76ee2948cb5e1d7dd991d0/code/bids/fslinstaller.py#L1419-L1520 | |
KratosMultiphysics/Kratos | 0000833054ed0503424eb28205d6508d9ca6cbbc | applications/MultilevelMonteCarloApplication/external_libraries/XMC/xmc/methodDefs_randomGeneratorWrapper/generator.py | python | returnRayleighAndUniform | (*args) | return [rayleigh_rv, uniform_rv] | Return one rayleigh and uniformly distributed random variables
with given parameters | Return one rayleigh and uniformly distributed random variables
with given parameters | [
"Return",
"one",
"rayleigh",
"and",
"uniformly",
"distributed",
"random",
"variables",
"with",
"given",
"parameters"
] | def returnRayleighAndUniform(*args):
"""
Return one rayleigh and uniformly distributed random variables
with given parameters
"""
rayleigh_rv = np.random.rayleigh(args[0],size=1)[0]
uniform_rv = np.random.uniform(args[1], args[2], 1)
return [rayleigh_rv, uniform_rv] | [
"def",
"returnRayleighAndUniform",
"(",
"*",
"args",
")",
":",
"rayleigh_rv",
"=",
"np",
".",
"random",
".",
"rayleigh",
"(",
"args",
"[",
"0",
"]",
",",
"size",
"=",
"1",
")",
"[",
"0",
"]",
"uniform_rv",
"=",
"np",
".",
"random",
".",
"uniform",
... | https://github.com/KratosMultiphysics/Kratos/blob/0000833054ed0503424eb28205d6508d9ca6cbbc/applications/MultilevelMonteCarloApplication/external_libraries/XMC/xmc/methodDefs_randomGeneratorWrapper/generator.py#L65-L72 | |
GSORF/Visual-GPS-SLAM | 9e327108d6be3fd8dc80c8f3bcc329237bacf230 | 03_Application/video2bag/img2bag.py | python | CreateBag | (args) | Creates the actual bag file by successively adding images | Creates the actual bag file by successively adding images | [
"Creates",
"the",
"actual",
"bag",
"file",
"by",
"successively",
"adding",
"images"
] | def CreateBag(args):
'''Creates the actual bag file by successively adding images'''
all_imgs, left_imgs, right_imgs = GetFilesFromDir(args[0])
if len(all_imgs) <= 0:
print("No images found in %s" % args[0])
exit()
if len(left_imgs) > 0 and len(right_imgs) > 0:
# create bagfile ... | [
"def",
"CreateBag",
"(",
"args",
")",
":",
"all_imgs",
",",
"left_imgs",
",",
"right_imgs",
"=",
"GetFilesFromDir",
"(",
"args",
"[",
"0",
"]",
")",
"if",
"len",
"(",
"all_imgs",
")",
"<=",
"0",
":",
"print",
"(",
"\"No images found in %s\"",
"%",
"args"... | https://github.com/GSORF/Visual-GPS-SLAM/blob/9e327108d6be3fd8dc80c8f3bcc329237bacf230/03_Application/video2bag/img2bag.py#L128-L140 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/locale.py | python | currency | (val, symbol=True, grouping=False, international=False) | return s.replace('<', '').replace('>', '') | Formats val according to the currency settings
in the current locale. | Formats val according to the currency settings
in the current locale. | [
"Formats",
"val",
"according",
"to",
"the",
"currency",
"settings",
"in",
"the",
"current",
"locale",
"."
] | def currency(val, symbol=True, grouping=False, international=False):
"""Formats val according to the currency settings
in the current locale."""
conv = localeconv()
# check for illegal values
digits = conv[international and 'int_frac_digits' or 'frac_digits']
if digits == 127:
raise Val... | [
"def",
"currency",
"(",
"val",
",",
"symbol",
"=",
"True",
",",
"grouping",
"=",
"False",
",",
"international",
"=",
"False",
")",
":",
"conv",
"=",
"localeconv",
"(",
")",
"# check for illegal values",
"digits",
"=",
"conv",
"[",
"international",
"and",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/locale.py#L258-L301 | |
PaddlePaddle/PaddleOCR | b756bf5f8c90142e0d89d3db0163965c686b6ffe | ppocr/postprocess/locality_aware_nms.py | python | weighted_merge | (g, p) | return g | Weighted merge. | Weighted merge. | [
"Weighted",
"merge",
"."
] | def weighted_merge(g, p):
"""
Weighted merge.
"""
g[:8] = (g[8] * g[:8] + p[8] * p[:8]) / (g[8] + p[8])
g[8] = (g[8] + p[8])
return g | [
"def",
"weighted_merge",
"(",
"g",
",",
"p",
")",
":",
"g",
"[",
":",
"8",
"]",
"=",
"(",
"g",
"[",
"8",
"]",
"*",
"g",
"[",
":",
"8",
"]",
"+",
"p",
"[",
"8",
"]",
"*",
"p",
"[",
":",
"8",
"]",
")",
"/",
"(",
"g",
"[",
"8",
"]",
... | https://github.com/PaddlePaddle/PaddleOCR/blob/b756bf5f8c90142e0d89d3db0163965c686b6ffe/ppocr/postprocess/locality_aware_nms.py#L46-L52 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | deps/src/libxml2-2.9.1/python/libxml2.py | python | xmlNode.nodePath | (self) | return ret | Build a structure based Path for the given node | Build a structure based Path for the given node | [
"Build",
"a",
"structure",
"based",
"Path",
"for",
"the",
"given",
"node"
] | def nodePath(self):
"""Build a structure based Path for the given node """
ret = libxml2mod.xmlGetNodePath(self._o)
return ret | [
"def",
"nodePath",
"(",
"self",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlGetNodePath",
"(",
"self",
".",
"_o",
")",
"return",
"ret"
] | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2.py#L3440-L3443 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/training/tracking/layer_utils.py | python | gather_non_trainable_weights | (trainable, sub_layers, extra_variables) | return weights + non_trainable_extra_variables | Lists the non-trainable weights for an object with sub-layers.
Args:
trainable: Whether the object collecting the variables is trainable.
sub_layers: A flat list of Layer objects owned by this object, to collect
variables from.
extra_variables: Any extra variables to include. Their `.trainable` pro... | Lists the non-trainable weights for an object with sub-layers. | [
"Lists",
"the",
"non",
"-",
"trainable",
"weights",
"for",
"an",
"object",
"with",
"sub",
"-",
"layers",
"."
] | def gather_non_trainable_weights(trainable, sub_layers, extra_variables):
"""Lists the non-trainable weights for an object with sub-layers.
Args:
trainable: Whether the object collecting the variables is trainable.
sub_layers: A flat list of Layer objects owned by this object, to collect
variables fr... | [
"def",
"gather_non_trainable_weights",
"(",
"trainable",
",",
"sub_layers",
",",
"extra_variables",
")",
":",
"trainable_extra_variables",
"=",
"[",
"]",
"non_trainable_extra_variables",
"=",
"[",
"]",
"for",
"v",
"in",
"extra_variables",
":",
"if",
"v",
".",
"tra... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/training/tracking/layer_utils.py#L85-L114 | |
NVIDIA/TensorRT | 42805f078052daad1a98bc5965974fcffaad0960 | tools/pytorch-quantization/pytorch_quantization/quant_modules.py | python | QuantModuleReplacementHelper.restore_float_modules | (self) | Reverse the effect of monkey patch by using the orginal_func_map to replace back the
original modules. | Reverse the effect of monkey patch by using the orginal_func_map to replace back the
original modules. | [
"Reverse",
"the",
"effect",
"of",
"monkey",
"patch",
"by",
"using",
"the",
"orginal_func_map",
"to",
"replace",
"back",
"the",
"original",
"modules",
"."
] | def restore_float_modules(self):
"""
Reverse the effect of monkey patch by using the orginal_func_map to replace back the
original modules.
"""
for entry in self.orginal_func_map:
setattr(entry.orig_mod, entry.mod_name, entry.replace_mod) | [
"def",
"restore_float_modules",
"(",
"self",
")",
":",
"for",
"entry",
"in",
"self",
".",
"orginal_func_map",
":",
"setattr",
"(",
"entry",
".",
"orig_mod",
",",
"entry",
".",
"mod_name",
",",
"entry",
".",
"replace_mod",
")"
] | https://github.com/NVIDIA/TensorRT/blob/42805f078052daad1a98bc5965974fcffaad0960/tools/pytorch-quantization/pytorch_quantization/quant_modules.py#L108-L114 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/plan/robotcspace.py | python | EmbeddedRobotCSpace.sendPathToController | (self,path,controller) | Sends a planned path so that it is executed correctly by the
controller (assumes a fully actuated robot).
Args:
path (list of Configs): a path in the embedded space or the
ambient space, as returned by a planner.
controller (SimRobotController): the robot's contr... | Sends a planned path so that it is executed correctly by the
controller (assumes a fully actuated robot). | [
"Sends",
"a",
"planned",
"path",
"so",
"that",
"it",
"is",
"executed",
"correctly",
"by",
"the",
"controller",
"(",
"assumes",
"a",
"fully",
"actuated",
"robot",
")",
"."
] | def sendPathToController(self,path,controller):
"""Sends a planned path so that it is executed correctly by the
controller (assumes a fully actuated robot).
Args:
path (list of Configs): a path in the embedded space or the
ambient space, as returned by a planner.
... | [
"def",
"sendPathToController",
"(",
"self",
",",
"path",
",",
"controller",
")",
":",
"if",
"len",
"(",
"path",
"[",
"0",
"]",
")",
"==",
"len",
"(",
"self",
".",
"mapping",
")",
":",
"path",
"=",
"self",
".",
"liftPath",
"(",
"path",
")",
"if",
... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/plan/robotcspace.py#L405-L418 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/training/learning_rate_decay.py | python | natural_exp_decay | (learning_rate, global_step, decay_steps, decay_rate,
staircase=False, name=None) | Applies natural exponential decay to the initial learning rate.
When training a model, it is often recommended to lower the learning rate as
the training progresses. This function applies an exponential decay function
to a provided initial learning rate. It requires an `global_step` value to
compute the deca... | Applies natural exponential decay to the initial learning rate. | [
"Applies",
"natural",
"exponential",
"decay",
"to",
"the",
"initial",
"learning",
"rate",
"."
] | def natural_exp_decay(learning_rate, global_step, decay_steps, decay_rate,
staircase=False, name=None):
"""Applies natural exponential decay to the initial learning rate.
When training a model, it is often recommended to lower the learning rate as
the training progresses. This function app... | [
"def",
"natural_exp_decay",
"(",
"learning_rate",
",",
"global_step",
",",
"decay_steps",
",",
"decay_rate",
",",
"staircase",
"=",
"False",
",",
"name",
"=",
"None",
")",
":",
"if",
"global_step",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"global_step ... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/training/learning_rate_decay.py#L282-L346 | ||
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/tensorboard/backend/handler.py | python | TensorboardHandler.do_GET | (self) | Handler for all get requests. | Handler for all get requests. | [
"Handler",
"for",
"all",
"get",
"requests",
"."
] | def do_GET(self): # pylint: disable=invalid-name
"""Handler for all get requests."""
parsed_url = urlparse.urlparse(self.path)
# Remove a trailing slash, if present.
clean_path = parsed_url.path
if clean_path.endswith('/'):
clean_path = clean_path[:-1]
data_handlers = {
DATA_PRE... | [
"def",
"do_GET",
"(",
"self",
")",
":",
"# pylint: disable=invalid-name",
"parsed_url",
"=",
"urlparse",
".",
"urlparse",
"(",
"self",
".",
"path",
")",
"# Remove a trailing slash, if present.",
"clean_path",
"=",
"parsed_url",
".",
"path",
"if",
"clean_path",
".",
... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/tensorboard/backend/handler.py#L549-L590 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/variable_scope.py | python | VariableScope.__init__ | (self,
reuse,
name="",
initializer=None,
regularizer=None,
caching_device=None,
partitioner=None,
custom_getter=None,
name_scope="",
dtype=dtypes.float32,
use_resource=No... | Creates a new VariableScope with the given properties. | Creates a new VariableScope with the given properties. | [
"Creates",
"a",
"new",
"VariableScope",
"with",
"the",
"given",
"properties",
"."
] | def __init__(self,
reuse,
name="",
initializer=None,
regularizer=None,
caching_device=None,
partitioner=None,
custom_getter=None,
name_scope="",
dtype=dtypes.float32,
use... | [
"def",
"__init__",
"(",
"self",
",",
"reuse",
",",
"name",
"=",
"\"\"",
",",
"initializer",
"=",
"None",
",",
"regularizer",
"=",
"None",
",",
"caching_device",
"=",
"None",
",",
"partitioner",
"=",
"None",
",",
"custom_getter",
"=",
"None",
",",
"name_s... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/variable_scope.py#L803-L824 | ||
kevin-ssy/Optical-Flow-Guided-Feature | 07d4501a29002ee7821c38c1820e4a64c1acf6e8 | lib/caffe-action/scripts/cpp_lint.py | python | FilesBelongToSameModule | (filename_cc, filename_h) | return files_belong_to_same_module, common_path | Check if these two filenames belong to the same module.
The concept of a 'module' here is a as follows:
foo.h, foo-inl.h, foo.cc, foo_test.cc and foo_unittest.cc belong to the
same 'module' if they are in the same directory.
some/path/public/xyzzy and some/path/internal/xyzzy are also considered
to belong to... | Check if these two filenames belong to the same module. | [
"Check",
"if",
"these",
"two",
"filenames",
"belong",
"to",
"the",
"same",
"module",
"."
] | def FilesBelongToSameModule(filename_cc, filename_h):
"""Check if these two filenames belong to the same module.
The concept of a 'module' here is a as follows:
foo.h, foo-inl.h, foo.cc, foo_test.cc and foo_unittest.cc belong to the
same 'module' if they are in the same directory.
some/path/public/xyzzy and ... | [
"def",
"FilesBelongToSameModule",
"(",
"filename_cc",
",",
"filename_h",
")",
":",
"if",
"not",
"filename_cc",
".",
"endswith",
"(",
"'.cc'",
")",
":",
"return",
"(",
"False",
",",
"''",
")",
"filename_cc",
"=",
"filename_cc",
"[",
":",
"-",
"len",
"(",
... | https://github.com/kevin-ssy/Optical-Flow-Guided-Feature/blob/07d4501a29002ee7821c38c1820e4a64c1acf6e8/lib/caffe-action/scripts/cpp_lint.py#L4399-L4451 | |
dscharrer/innoextract | 5519d364cc8898f906f6285d81a87ab8c5469cde | cmake/cpplint.py | python | CleanseComments | (line) | return _RE_PATTERN_CLEANSE_LINE_C_COMMENTS.sub('', line) | Removes //-comments and single-line C-style /* */ comments.
Args:
line: A line of C++ source.
Returns:
The line with single-line comments removed. | Removes //-comments and single-line C-style /* */ comments. | [
"Removes",
"//",
"-",
"comments",
"and",
"single",
"-",
"line",
"C",
"-",
"style",
"/",
"*",
"*",
"/",
"comments",
"."
] | def CleanseComments(line):
"""Removes //-comments and single-line C-style /* */ comments.
Args:
line: A line of C++ source.
Returns:
The line with single-line comments removed.
"""
commentpos = line.find('//')
if commentpos != -1 and not IsCppString(line[:commentpos]):
line = line[:commentpos]... | [
"def",
"CleanseComments",
"(",
"line",
")",
":",
"commentpos",
"=",
"line",
".",
"find",
"(",
"'//'",
")",
"if",
"commentpos",
"!=",
"-",
"1",
"and",
"not",
"IsCppString",
"(",
"line",
"[",
":",
"commentpos",
"]",
")",
":",
"line",
"=",
"line",
"[",
... | https://github.com/dscharrer/innoextract/blob/5519d364cc8898f906f6285d81a87ab8c5469cde/cmake/cpplint.py#L970-L983 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/pydoc.py | python | HTMLDoc.formatvalue | (self, object) | return self.grey('=' + self.repr(object)) | Format an argument default value as text. | Format an argument default value as text. | [
"Format",
"an",
"argument",
"default",
"value",
"as",
"text",
"."
] | def formatvalue(self, object):
"""Format an argument default value as text."""
return self.grey('=' + self.repr(object)) | [
"def",
"formatvalue",
"(",
"self",
",",
"object",
")",
":",
"return",
"self",
".",
"grey",
"(",
"'='",
"+",
"self",
".",
"repr",
"(",
"object",
")",
")"
] | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/pydoc.py#L843-L845 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/Tkinter.py | python | Canvas.itemconfigure | (self, tagOrId, cnf=None, **kw) | return self._configure(('itemconfigure', tagOrId), cnf, kw) | Configure resources of an item TAGORID.
The values for resources are specified as keyword
arguments. To get an overview about
the allowed keyword arguments call the method without arguments. | Configure resources of an item TAGORID. | [
"Configure",
"resources",
"of",
"an",
"item",
"TAGORID",
"."
] | def itemconfigure(self, tagOrId, cnf=None, **kw):
"""Configure resources of an item TAGORID.
The values for resources are specified as keyword
arguments. To get an overview about
the allowed keyword arguments call the method without arguments.
"""
return self._configure(... | [
"def",
"itemconfigure",
"(",
"self",
",",
"tagOrId",
",",
"cnf",
"=",
"None",
",",
"*",
"*",
"kw",
")",
":",
"return",
"self",
".",
"_configure",
"(",
"(",
"'itemconfigure'",
",",
"tagOrId",
")",
",",
"cnf",
",",
"kw",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/Tkinter.py#L2342-L2349 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_misc.py | python | Clipboard.Close | (*args, **kwargs) | return _misc_.Clipboard_Close(*args, **kwargs) | Close(self)
Closes the clipboard. | Close(self) | [
"Close",
"(",
"self",
")"
] | def Close(*args, **kwargs):
"""
Close(self)
Closes the clipboard.
"""
return _misc_.Clipboard_Close(*args, **kwargs) | [
"def",
"Close",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"Clipboard_Close",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_misc.py#L5803-L5809 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/symbol/numpy/linalg.py | python | qr | (a, mode='reduced') | return _npi.qr(a) | r"""
Compute the qr factorization of a matrix a.
Factor the matrix a as qr, where q is orthonormal and r is upper-triangular.
Parameters
----------
a : (..., M, N) _Symbol
Matrix or stack of matrices to be qr factored.
mode: {‘reduced’, ‘complete’, ‘r’, ‘raw’, ‘full’, ‘economic’}, optio... | r"""
Compute the qr factorization of a matrix a.
Factor the matrix a as qr, where q is orthonormal and r is upper-triangular. | [
"r",
"Compute",
"the",
"qr",
"factorization",
"of",
"a",
"matrix",
"a",
".",
"Factor",
"the",
"matrix",
"a",
"as",
"qr",
"where",
"q",
"is",
"orthonormal",
"and",
"r",
"is",
"upper",
"-",
"triangular",
"."
] | def qr(a, mode='reduced'):
r"""
Compute the qr factorization of a matrix a.
Factor the matrix a as qr, where q is orthonormal and r is upper-triangular.
Parameters
----------
a : (..., M, N) _Symbol
Matrix or stack of matrices to be qr factored.
mode: {‘reduced’, ‘complete’, ‘r’, ‘r... | [
"def",
"qr",
"(",
"a",
",",
"mode",
"=",
"'reduced'",
")",
":",
"if",
"mode",
"is",
"not",
"None",
"and",
"mode",
"!=",
"'reduced'",
":",
"raise",
"NotImplementedError",
"(",
"\"Only default mode='reduced' is implemented.\"",
")",
"return",
"_npi",
".",
"qr",
... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/symbol/numpy/linalg.py#L484-L540 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/contrib/graph_editor/select.py | python | select_ops_and_ts | (*args, **kwargs) | return ops, ts | Helper to select operations and tensors.
Args:
*args: list of 1) regular expressions (compiled or not) or 2) (array of)
`tf.Operation` 3) (array of) tf.Tensor. Regular expressions matching
tensors must start with the comment `"(?#ts)"`, for instance:
`"(?#ts)^foo/.*"`.
**kwargs: 'graph': `... | Helper to select operations and tensors. | [
"Helper",
"to",
"select",
"operations",
"and",
"tensors",
"."
] | def select_ops_and_ts(*args, **kwargs):
"""Helper to select operations and tensors.
Args:
*args: list of 1) regular expressions (compiled or not) or 2) (array of)
`tf.Operation` 3) (array of) tf.Tensor. Regular expressions matching
tensors must start with the comment `"(?#ts)"`, for instance:
... | [
"def",
"select_ops_and_ts",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"ops",
"=",
"select_ops",
"(",
"*",
"args",
",",
"restrict_ops_regex",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
"ts",
"=",
"select_ts",
"(",
"*",
"args",
",",
"restri... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/graph_editor/select.py#L746-L771 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/ragged/row_partition.py | python | RowPartition.offsets_in_rows | (self) | return gen_ragged_math_ops.ragged_range(
starts=constant_op.constant(0, self.dtype),
limits=self.row_lengths(),
deltas=constant_op.constant(1, self.dtype)).rt_dense_values | Return the offset of each value.
RowPartition takes an array x and converts it into sublists.
offsets[i] is the index of x[i] in its sublist.
Given a shape, such as:
[*,*,*],[*,*],[],[*,*]
This returns:
0,1,2,0,1,0,1
Returns:
an offset for every value. | Return the offset of each value. | [
"Return",
"the",
"offset",
"of",
"each",
"value",
"."
] | def offsets_in_rows(self):
"""Return the offset of each value.
RowPartition takes an array x and converts it into sublists.
offsets[i] is the index of x[i] in its sublist.
Given a shape, such as:
[*,*,*],[*,*],[],[*,*]
This returns:
0,1,2,0,1,0,1
Returns:
an offset for every valu... | [
"def",
"offsets_in_rows",
"(",
"self",
")",
":",
"return",
"gen_ragged_math_ops",
".",
"ragged_range",
"(",
"starts",
"=",
"constant_op",
".",
"constant",
"(",
"0",
",",
"self",
".",
"dtype",
")",
",",
"limits",
"=",
"self",
".",
"row_lengths",
"(",
")",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/ragged/row_partition.py#L928-L944 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/coverage/coverage/control.py | python | Coverage.get_data | (self) | return self.data | Get the collected data and reset the collector.
Also warn about various problems collecting data.
Returns a :class:`coverage.CoverageData`, the collected coverage data.
.. versionadded:: 4.0 | Get the collected data and reset the collector. | [
"Get",
"the",
"collected",
"data",
"and",
"reset",
"the",
"collector",
"."
] | def get_data(self):
"""Get the collected data and reset the collector.
Also warn about various problems collecting data.
Returns a :class:`coverage.CoverageData`, the collected coverage data.
.. versionadded:: 4.0
"""
self._init()
if not self._measured:
... | [
"def",
"get_data",
"(",
"self",
")",
":",
"self",
".",
"_init",
"(",
")",
"if",
"not",
"self",
".",
"_measured",
":",
"return",
"self",
".",
"data",
"self",
".",
"collector",
".",
"save_data",
"(",
"self",
".",
"data",
")",
"# If there are still entries ... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/coverage/coverage/control.py#L796-L846 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/core/computation/pytables.py | python | BinOp.metadata | (self) | return getattr(self.queryables.get(self.lhs), "metadata", None) | the metadata of my field | the metadata of my field | [
"the",
"metadata",
"of",
"my",
"field"
] | def metadata(self):
"""the metadata of my field"""
return getattr(self.queryables.get(self.lhs), "metadata", None) | [
"def",
"metadata",
"(",
"self",
")",
":",
"return",
"getattr",
"(",
"self",
".",
"queryables",
".",
"get",
"(",
"self",
".",
"lhs",
")",
",",
"\"metadata\"",
",",
"None",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/computation/pytables.py#L188-L190 | |
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/deps/v8/PRESUBMIT.py | python | _CheckNoInlineHeaderIncludesInNormalHeaders | (input_api, output_api) | Attempts to prevent inclusion of inline headers into normal header
files. This tries to establish a layering where inline headers can be
included by other inline headers or compilation units only. | Attempts to prevent inclusion of inline headers into normal header
files. This tries to establish a layering where inline headers can be
included by other inline headers or compilation units only. | [
"Attempts",
"to",
"prevent",
"inclusion",
"of",
"inline",
"headers",
"into",
"normal",
"header",
"files",
".",
"This",
"tries",
"to",
"establish",
"a",
"layering",
"where",
"inline",
"headers",
"can",
"be",
"included",
"by",
"other",
"inline",
"headers",
"or",... | def _CheckNoInlineHeaderIncludesInNormalHeaders(input_api, output_api):
"""Attempts to prevent inclusion of inline headers into normal header
files. This tries to establish a layering where inline headers can be
included by other inline headers or compilation units only."""
file_inclusion_pattern = r'(?!.+-inl\... | [
"def",
"_CheckNoInlineHeaderIncludesInNormalHeaders",
"(",
"input_api",
",",
"output_api",
")",
":",
"file_inclusion_pattern",
"=",
"r'(?!.+-inl\\.h).+\\.h'",
"include_directive_pattern",
"=",
"input_api",
".",
"re",
".",
"compile",
"(",
"r'#include \".+-inl.h\"'",
")",
"in... | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/deps/v8/PRESUBMIT.py#L214-L243 | ||
luliyucoordinate/Leetcode | 96afcdc54807d1d184e881a075d1dbf3371e31fb | src/0945-Minimum-Increment-to-Make-Array-Unique/0945.py | python | Solution.minIncrementForUnique | (self, A) | return result | :type A: List[int]
:rtype: int | :type A: List[int]
:rtype: int | [
":",
"type",
"A",
":",
"List",
"[",
"int",
"]",
":",
"rtype",
":",
"int"
] | def minIncrementForUnique(self, A):
"""
:type A: List[int]
:rtype: int
"""
box, result, max_A = [0]*40000, 0, 0
for a in A:
box[a] += 1
if max_A < a:
max_A = a
for i in range(max_A):
if box[i] <=... | [
"def",
"minIncrementForUnique",
"(",
"self",
",",
"A",
")",
":",
"box",
",",
"result",
",",
"max_A",
"=",
"[",
"0",
"]",
"*",
"40000",
",",
"0",
",",
"0",
"for",
"a",
"in",
"A",
":",
"box",
"[",
"a",
"]",
"+=",
"1",
"if",
"max_A",
"<",
"a",
... | https://github.com/luliyucoordinate/Leetcode/blob/96afcdc54807d1d184e881a075d1dbf3371e31fb/src/0945-Minimum-Increment-to-Make-Array-Unique/0945.py#L2-L23 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Path/PathScripts/PathJob.py | python | ObjectJob.baseCandidates | (cls) | return sorted(
[obj for obj in FreeCAD.ActiveDocument.Objects if cls.isBaseCandidate(obj)],
key=lambda o: o.Label,
) | Answer all objects in the current document which could serve as a Base for a job. | Answer all objects in the current document which could serve as a Base for a job. | [
"Answer",
"all",
"objects",
"in",
"the",
"current",
"document",
"which",
"could",
"serve",
"as",
"a",
"Base",
"for",
"a",
"job",
"."
] | def baseCandidates(cls):
"""Answer all objects in the current document which could serve as a Base for a job."""
return sorted(
[obj for obj in FreeCAD.ActiveDocument.Objects if cls.isBaseCandidate(obj)],
key=lambda o: o.Label,
) | [
"def",
"baseCandidates",
"(",
"cls",
")",
":",
"return",
"sorted",
"(",
"[",
"obj",
"for",
"obj",
"in",
"FreeCAD",
".",
"ActiveDocument",
".",
"Objects",
"if",
"cls",
".",
"isBaseCandidate",
"(",
"obj",
")",
"]",
",",
"key",
"=",
"lambda",
"o",
":",
... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Path/PathScripts/PathJob.py#L818-L823 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/tools/inspector_protocol/jinja2/ext.py | python | babel_extract | (fileobj, keywords, comment_tags, options) | Babel extraction method for Jinja templates.
.. versionchanged:: 2.3
Basic support for translation comments was added. If `comment_tags`
is now set to a list of keywords for extraction, the extractor will
try to find the best preceeding comment that begins with one of the
keywords. Fo... | Babel extraction method for Jinja templates. | [
"Babel",
"extraction",
"method",
"for",
"Jinja",
"templates",
"."
] | def babel_extract(fileobj, keywords, comment_tags, options):
"""Babel extraction method for Jinja templates.
.. versionchanged:: 2.3
Basic support for translation comments was added. If `comment_tags`
is now set to a list of keywords for extraction, the extractor will
try to find the best... | [
"def",
"babel_extract",
"(",
"fileobj",
",",
"keywords",
",",
"comment_tags",
",",
"options",
")",
":",
"extensions",
"=",
"set",
"(",
")",
"for",
"extension",
"in",
"options",
".",
"get",
"(",
"'extensions'",
",",
"''",
")",
".",
"split",
"(",
"','",
... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/tools/inspector_protocol/jinja2/ext.py#L542-L619 | ||
forkineye/ESPixelStick | 22926f1c0d1131f1369fc7cad405689a095ae3cb | dist/bin/pyserial/serial/tools/hexlify_codec.py | python | hex_decode | (data, errors='strict') | return (unicode(''.join('{:02X} '.format(ord(b)) for b in serial.iterbytes(data))), len(data)) | b'@ab' -> '40 41 42 | b' | [
"b"
] | def hex_decode(data, errors='strict'):
"""b'@ab' -> '40 41 42'"""
return (unicode(''.join('{:02X} '.format(ord(b)) for b in serial.iterbytes(data))), len(data)) | [
"def",
"hex_decode",
"(",
"data",
",",
"errors",
"=",
"'strict'",
")",
":",
"return",
"(",
"unicode",
"(",
"''",
".",
"join",
"(",
"'{:02X} '",
".",
"format",
"(",
"ord",
"(",
"b",
")",
")",
"for",
"b",
"in",
"serial",
".",
"iterbytes",
"(",
"data"... | https://github.com/forkineye/ESPixelStick/blob/22926f1c0d1131f1369fc7cad405689a095ae3cb/dist/bin/pyserial/serial/tools/hexlify_codec.py#L41-L43 | |
SpenceKonde/megaTinyCore | 1c4a70b18a149fe6bcb551dfa6db11ca50b8997b | megaavr/tools/libs/serial/tools/miniterm.py | python | Miniterm.update_transformations | (self) | take list of transformation classes and instantiate them for rx and tx | take list of transformation classes and instantiate them for rx and tx | [
"take",
"list",
"of",
"transformation",
"classes",
"and",
"instantiate",
"them",
"for",
"rx",
"and",
"tx"
] | def update_transformations(self):
"""take list of transformation classes and instantiate them for rx and tx"""
transformations = [EOL_TRANSFORMATIONS[self.eol]] + [TRANSFORMATIONS[f]
for f in self.filters]
self.tx_transformations = [t(... | [
"def",
"update_transformations",
"(",
"self",
")",
":",
"transformations",
"=",
"[",
"EOL_TRANSFORMATIONS",
"[",
"self",
".",
"eol",
"]",
"]",
"+",
"[",
"TRANSFORMATIONS",
"[",
"f",
"]",
"for",
"f",
"in",
"self",
".",
"filters",
"]",
"self",
".",
"tx_tra... | https://github.com/SpenceKonde/megaTinyCore/blob/1c4a70b18a149fe6bcb551dfa6db11ca50b8997b/megaavr/tools/libs/serial/tools/miniterm.py#L398-L403 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqt/mantidqt/widgets/sliceviewer/lineplots.py | python | PixelLinePlot.handle_key | (self, key) | Called by KeyHandler if a key was accepted to perform a region
extraction | Called by KeyHandler if a key was accepted to perform a region
extraction | [
"Called",
"by",
"KeyHandler",
"if",
"a",
"key",
"was",
"accepted",
"to",
"perform",
"a",
"region",
"extraction"
] | def handle_key(self, key):
"""
Called by KeyHandler if a key was accepted to perform a region
extraction
"""
if self._cursor_pos is None:
return None
pixel_transforms = self.PIXEL_TRANSFORM_CLS
if key in pixel_transforms:
to_next_pixel = p... | [
"def",
"handle_key",
"(",
"self",
",",
"key",
")",
":",
"if",
"self",
".",
"_cursor_pos",
"is",
"None",
":",
"return",
"None",
"pixel_transforms",
"=",
"self",
".",
"PIXEL_TRANSFORM_CLS",
"if",
"key",
"in",
"pixel_transforms",
":",
"to_next_pixel",
"=",
"pix... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqt/mantidqt/widgets/sliceviewer/lineplots.py#L300-L313 | ||
Constellation/iv | 64c3a9c7c517063f29d90d449180ea8f6f4d946f | tools/cpplint.py | python | CleanseComments | (line) | return _RE_PATTERN_CLEANSE_LINE_C_COMMENTS.sub('', line) | Removes //-comments and single-line C-style /* */ comments.
Args:
line: A line of C++ source.
Returns:
The line with single-line comments removed. | Removes //-comments and single-line C-style /* */ comments. | [
"Removes",
"//",
"-",
"comments",
"and",
"single",
"-",
"line",
"C",
"-",
"style",
"/",
"*",
"*",
"/",
"comments",
"."
] | def CleanseComments(line):
"""Removes //-comments and single-line C-style /* */ comments.
Args:
line: A line of C++ source.
Returns:
The line with single-line comments removed.
"""
commentpos = line.find('//')
if commentpos != -1 and not IsCppString(line[:commentpos]):
line = line[:commentpos]... | [
"def",
"CleanseComments",
"(",
"line",
")",
":",
"commentpos",
"=",
"line",
".",
"find",
"(",
"'//'",
")",
"if",
"commentpos",
"!=",
"-",
"1",
"and",
"not",
"IsCppString",
"(",
"line",
"[",
":",
"commentpos",
"]",
")",
":",
"line",
"=",
"line",
"[",
... | https://github.com/Constellation/iv/blob/64c3a9c7c517063f29d90d449180ea8f6f4d946f/tools/cpplint.py#L1155-L1168 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/chunk.py | python | Chunk.getsize | (self) | return self.chunksize | Return the size of the current chunk. | Return the size of the current chunk. | [
"Return",
"the",
"size",
"of",
"the",
"current",
"chunk",
"."
] | def getsize(self):
"""Return the size of the current chunk."""
return self.chunksize | [
"def",
"getsize",
"(",
"self",
")",
":",
"return",
"self",
".",
"chunksize"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/chunk.py#L82-L84 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_gdi.py | python | Font_SetDefaultEncoding | (*args, **kwargs) | return _gdi_.Font_SetDefaultEncoding(*args, **kwargs) | Font_SetDefaultEncoding(int encoding)
Sets the default font encoding. | Font_SetDefaultEncoding(int encoding) | [
"Font_SetDefaultEncoding",
"(",
"int",
"encoding",
")"
] | def Font_SetDefaultEncoding(*args, **kwargs):
"""
Font_SetDefaultEncoding(int encoding)
Sets the default font encoding.
"""
return _gdi_.Font_SetDefaultEncoding(*args, **kwargs) | [
"def",
"Font_SetDefaultEncoding",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"Font_SetDefaultEncoding",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_gdi.py#L2627-L2633 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pexpect/pexpect/pty_spawn.py | python | spawn.waitnoecho | (self, timeout=-1) | This waits until the terminal ECHO flag is set False. This returns
True if the echo mode is off. This returns False if the ECHO flag was
not set False before the timeout. This can be used to detect when the
child is waiting for a password. Usually a child application will turn
off echo m... | This waits until the terminal ECHO flag is set False. This returns
True if the echo mode is off. This returns False if the ECHO flag was
not set False before the timeout. This can be used to detect when the
child is waiting for a password. Usually a child application will turn
off echo m... | [
"This",
"waits",
"until",
"the",
"terminal",
"ECHO",
"flag",
"is",
"set",
"False",
".",
"This",
"returns",
"True",
"if",
"the",
"echo",
"mode",
"is",
"off",
".",
"This",
"returns",
"False",
"if",
"the",
"ECHO",
"flag",
"was",
"not",
"set",
"False",
"be... | def waitnoecho(self, timeout=-1):
'''This waits until the terminal ECHO flag is set False. This returns
True if the echo mode is off. This returns False if the ECHO flag was
not set False before the timeout. This can be used to detect when the
child is waiting for a password. Usually a c... | [
"def",
"waitnoecho",
"(",
"self",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"if",
"timeout",
"==",
"-",
"1",
":",
"timeout",
"=",
"self",
".",
"timeout",
"if",
"timeout",
"is",
"not",
"None",
":",
"end_time",
"=",
"time",
".",
"time",
"(",
")",
"+... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pexpect/pexpect/pty_spawn.py#L344-L372 | ||
mapnik/mapnik | f3da900c355e1d15059c4a91b00203dcc9d9f0ef | scons/scons-local-4.1.0/SCons/Node/FS.py | python | RootDir._lookup_abs | (self, p, klass, create=1) | return result | Fast (?) lookup of a *normalized* absolute path.
This method is intended for use by internal lookups with
already-normalized path data. For general-purpose lookups,
use the FS.Entry(), FS.Dir() or FS.File() methods.
The caller is responsible for making sure we're passed a
norm... | Fast (?) lookup of a *normalized* absolute path. | [
"Fast",
"(",
"?",
")",
"lookup",
"of",
"a",
"*",
"normalized",
"*",
"absolute",
"path",
"."
] | def _lookup_abs(self, p, klass, create=1):
"""
Fast (?) lookup of a *normalized* absolute path.
This method is intended for use by internal lookups with
already-normalized path data. For general-purpose lookups,
use the FS.Entry(), FS.Dir() or FS.File() methods.
The ca... | [
"def",
"_lookup_abs",
"(",
"self",
",",
"p",
",",
"klass",
",",
"create",
"=",
"1",
")",
":",
"k",
"=",
"_my_normcase",
"(",
"p",
")",
"try",
":",
"result",
"=",
"self",
".",
"_lookupDict",
"[",
"k",
"]",
"except",
"KeyError",
":",
"if",
"not",
"... | https://github.com/mapnik/mapnik/blob/f3da900c355e1d15059c4a91b00203dcc9d9f0ef/scons/scons-local-4.1.0/SCons/Node/FS.py#L2372-L2412 | |
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | src/pybind/mgr/telemetry/module.py | python | Module.diff | (self) | return 0, r, '' | Show the diff between opted-in collection and available collection | Show the diff between opted-in collection and available collection | [
"Show",
"the",
"diff",
"between",
"opted",
"-",
"in",
"collection",
"and",
"available",
"collection"
] | def diff(self) -> Tuple[int, str, str]:
'''
Show the diff between opted-in collection and available collection
'''
diff = []
keys = ['nag']
for c in MODULE_COLLECTION:
if not self.is_enabled_collection(c['name']):
diff.append({key: val for key... | [
"def",
"diff",
"(",
"self",
")",
"->",
"Tuple",
"[",
"int",
",",
"str",
",",
"str",
"]",
":",
"diff",
"=",
"[",
"]",
"keys",
"=",
"[",
"'nag'",
"]",
"for",
"c",
"in",
"MODULE_COLLECTION",
":",
"if",
"not",
"self",
".",
"is_enabled_collection",
"(",... | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/src/pybind/mgr/telemetry/module.py#L1358-L1375 | |
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | snapx/snapx/classes/coreviews.py | python | AtlasView.__init__ | (self, g, n) | Initialize with the input node and graph | Initialize with the input node and graph | [
"Initialize",
"with",
"the",
"input",
"node",
"and",
"graph"
] | def __init__(self, g, n):
"""Initialize with the input node and graph"""
self._graph = g
self._node = n
if not isinstance(n, int):
raise TypeError("Node ID must be int.")
if n not in g:
raise KeyError("Node must be present in graph.") | [
"def",
"__init__",
"(",
"self",
",",
"g",
",",
"n",
")",
":",
"self",
".",
"_graph",
"=",
"g",
"self",
".",
"_node",
"=",
"n",
"if",
"not",
"isinstance",
"(",
"n",
",",
"int",
")",
":",
"raise",
"TypeError",
"(",
"\"Node ID must be int.\"",
")",
"i... | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/snapx/snapx/classes/coreviews.py#L23-L31 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/plat-mac/pimp.py | python | PimpPackage.downloadPackageOnly | (self, output=None) | Download a single package, if needed.
An MD5 signature is used to determine whether download is needed,
and to test that we actually downloaded what we expected.
If output is given it is a file-like object that will receive a log
of what happens.
If anything unforeseen happened... | Download a single package, if needed. | [
"Download",
"a",
"single",
"package",
"if",
"needed",
"."
] | def downloadPackageOnly(self, output=None):
"""Download a single package, if needed.
An MD5 signature is used to determine whether download is needed,
and to test that we actually downloaded what we expected.
If output is given it is a file-like object that will receive a log
of... | [
"def",
"downloadPackageOnly",
"(",
"self",
",",
"output",
"=",
"None",
")",
":",
"scheme",
",",
"loc",
",",
"path",
",",
"query",
",",
"frag",
"=",
"urlparse",
".",
"urlsplit",
"(",
"self",
".",
"_dict",
"[",
"'Download-URL'",
"]",
")",
"path",
"=",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/plat-mac/pimp.py#L663-L690 | ||
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/rosdep2/rep3.py | python | download_targets_data | (targets_url=None) | return targets_data | Download REP 3 targets file and unmarshal from YAML.
DEPRECATED: this function is deprecated. List of targets should be obtained
from the rosdistro module.
The body of this function is an example.
:param target_url: override URL of platform targets file. Defaults
to ``REP3... | Download REP 3 targets file and unmarshal from YAML.
DEPRECATED: this function is deprecated. List of targets should be obtained
from the rosdistro module.
The body of this function is an example. | [
"Download",
"REP",
"3",
"targets",
"file",
"and",
"unmarshal",
"from",
"YAML",
".",
"DEPRECATED",
":",
"this",
"function",
"is",
"deprecated",
".",
"List",
"of",
"targets",
"should",
"be",
"obtained",
"from",
"the",
"rosdistro",
"module",
".",
"The",
"body",... | def download_targets_data(targets_url=None):
"""
Download REP 3 targets file and unmarshal from YAML.
DEPRECATED: this function is deprecated. List of targets should be obtained
from the rosdistro module.
The body of this function is an example.
:param target_url: overri... | [
"def",
"download_targets_data",
"(",
"targets_url",
"=",
"None",
")",
":",
"warnings",
".",
"warn",
"(",
"\"deprecated, use rosdistro instead\"",
",",
"PreRep137Warning",
")",
"if",
"targets_url",
"is",
"None",
":",
"targets_url",
"=",
"REP3_TARGETS_URL",
"try",
":"... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/rosdep2/rep3.py#L44-L74 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/window/rolling.py | python | Rolling._validate_monotonic | (self) | Validate monotonic (increasing or decreasing). | Validate monotonic (increasing or decreasing). | [
"Validate",
"monotonic",
"(",
"increasing",
"or",
"decreasing",
")",
"."
] | def _validate_monotonic(self):
"""
Validate monotonic (increasing or decreasing).
"""
if not (self._on.is_monotonic_increasing or self._on.is_monotonic_decreasing):
formatted = self.on
if self.on is None:
formatted = "index"
raise Value... | [
"def",
"_validate_monotonic",
"(",
"self",
")",
":",
"if",
"not",
"(",
"self",
".",
"_on",
".",
"is_monotonic_increasing",
"or",
"self",
".",
"_on",
".",
"is_monotonic_decreasing",
")",
":",
"formatted",
"=",
"self",
".",
"on",
"if",
"self",
".",
"on",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/window/rolling.py#L1869-L1877 | ||
eclipse/sumo | 7132a9b8b6eea734bdec38479026b4d8c4336d03 | tools/contributed/sumopy/plugins/mapmatching/mapmatching.py | python | MobikeImporter.calc_seconds | (self, t_data,
sep_date_clock = ' ', sep_date = '/', sep_clock = ':',
) | Returns time in seconds after 1/1/1970.
Time format for time data string used:
01/07/2018 06:00, SUNTRACTING 7h to meet chinese time | Returns time in seconds after 1/1/1970.
Time format for time data string used:
01/07/2018 06:00, SUNTRACTING 7h to meet chinese time | [
"Returns",
"time",
"in",
"seconds",
"after",
"1",
"/",
"1",
"/",
"1970",
".",
"Time",
"format",
"for",
"time",
"data",
"string",
"used",
":",
"01",
"/",
"07",
"/",
"2018",
"06",
":",
"00",
"SUNTRACTING",
"7h",
"to",
"meet",
"chinese",
"time"
] | def calc_seconds(self, t_data,
sep_date_clock = ' ', sep_date = '/', sep_clock = ':',
):
"""
Returns time in seconds after 1/1/1970.
Time format for time data string used:
01/07/2018 06:00, SUNTRACTING 7h to meet chinese time
"""
... | [
"def",
"calc_seconds",
"(",
"self",
",",
"t_data",
",",
"sep_date_clock",
"=",
"' '",
",",
"sep_date",
"=",
"'/'",
",",
"sep_clock",
"=",
"':'",
",",
")",
":",
"#",
"if",
"len",
"(",
"t_data",
".",
"split",
"(",
"sep_date_clock",
")",
")",
"!=",
"2",... | https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/contributed/sumopy/plugins/mapmatching/mapmatching.py#L4673-L4703 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/tarfile.py | python | TarInfo.__init__ | (self, name="") | Construct a TarInfo object. name is the optional name
of the member. | Construct a TarInfo object. name is the optional name
of the member. | [
"Construct",
"a",
"TarInfo",
"object",
".",
"name",
"is",
"the",
"optional",
"name",
"of",
"the",
"member",
"."
] | def __init__(self, name=""):
"""Construct a TarInfo object. name is the optional name
of the member.
"""
self.name = name # member name
self.mode = 0o644 # file permissions
self.uid = 0 # user id
self.gid = 0 # group id
... | [
"def",
"__init__",
"(",
"self",
",",
"name",
"=",
"\"\"",
")",
":",
"self",
".",
"name",
"=",
"name",
"# member name",
"self",
".",
"mode",
"=",
"0o644",
"# file permissions",
"self",
".",
"uid",
"=",
"0",
"# user id",
"self",
".",
"gid",
"=",
"0",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/tarfile.py#L739-L761 | ||
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | third_party/numpy/files/numpy/polynomial/polynomial.py | python | polydiv | (c1, c2) | Divide one polynomial by another.
Returns the quotient-with-remainder of two polynomials `c1` / `c2`.
The arguments are sequences of coefficients, from lowest order term
to highest, e.g., [1,2,3] represents ``1 + 2*x + 3*x**2``.
Parameters
----------
c1, c2 : array_like
1-d arrays of p... | Divide one polynomial by another. | [
"Divide",
"one",
"polynomial",
"by",
"another",
"."
] | def polydiv(c1, c2):
"""
Divide one polynomial by another.
Returns the quotient-with-remainder of two polynomials `c1` / `c2`.
The arguments are sequences of coefficients, from lowest order term
to highest, e.g., [1,2,3] represents ``1 + 2*x + 3*x**2``.
Parameters
----------
c1, c2 : a... | [
"def",
"polydiv",
"(",
"c1",
",",
"c2",
")",
":",
"# c1, c2 are trimmed copies",
"[",
"c1",
",",
"c2",
"]",
"=",
"pu",
".",
"as_series",
"(",
"[",
"c1",
",",
"c2",
"]",
")",
"if",
"c2",
"[",
"-",
"1",
"]",
"==",
"0",
":",
"raise",
"ZeroDivisionEr... | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/polynomial/polynomial.py#L341-L395 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/python/turicreate/toolkits/_mps_utils.py | python | MpsFloatArray.asnumpy | (self) | return _numpy_array_from_ctypes(data_ptr, shape_ptr, dim) | Copy the data from TCMPS into a new numpy ndarray | Copy the data from TCMPS into a new numpy ndarray | [
"Copy",
"the",
"data",
"from",
"TCMPS",
"into",
"a",
"new",
"numpy",
"ndarray"
] | def asnumpy(self):
"""Copy the data from TCMPS into a new numpy ndarray"""
# Create C variables that will serve as out parameters for TCMPS.
data_ptr = _ctypes.POINTER(_ctypes.c_float)() # float* data_ptr
shape_ptr = _ctypes.POINTER(_ctypes.c_size_t)() # size_t* shape_ptr
dim ... | [
"def",
"asnumpy",
"(",
"self",
")",
":",
"# Create C variables that will serve as out parameters for TCMPS.",
"data_ptr",
"=",
"_ctypes",
".",
"POINTER",
"(",
"_ctypes",
".",
"c_float",
")",
"(",
")",
"# float* data_ptr",
"shape_ptr",
"=",
"_ctypes",
".",
"POINTER",
... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/python/turicreate/toolkits/_mps_utils.py#L276-L295 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/layers/nn.py | python | hard_sigmoid | (x, slope=0.2, offset=0.5, name=None) | return out | ${comment}
Parameters:
x (${x_type}): ${x_comment}
slope (float, optional): ${slope_comment}
offset (float, optional): ${offset_comment}
name (str, optional): The default value is None. Normally there is no
need for user to set this property. For more information, please
... | ${comment}
Parameters:
x (${x_type}): ${x_comment}
slope (float, optional): ${slope_comment}
offset (float, optional): ${offset_comment}
name (str, optional): The default value is None. Normally there is no
need for user to set this property. For more information, please
... | [
"$",
"{",
"comment",
"}",
"Parameters",
":",
"x",
"(",
"$",
"{",
"x_type",
"}",
")",
":",
"$",
"{",
"x_comment",
"}",
"slope",
"(",
"float",
"optional",
")",
":",
"$",
"{",
"slope_comment",
"}",
"offset",
"(",
"float",
"optional",
")",
":",
"$",
... | def hard_sigmoid(x, slope=0.2, offset=0.5, name=None):
"""
${comment}
Parameters:
x (${x_type}): ${x_comment}
slope (float, optional): ${slope_comment}
offset (float, optional): ${offset_comment}
name (str, optional): The default value is None. Normally there is no
... | [
"def",
"hard_sigmoid",
"(",
"x",
",",
"slope",
"=",
"0.2",
",",
"offset",
"=",
"0.5",
",",
"name",
"=",
"None",
")",
":",
"if",
"in_dygraph_mode",
"(",
")",
":",
"return",
"_C_ops",
".",
"hard_sigmoid",
"(",
"x",
",",
"'slope'",
",",
"slope",
",",
... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/layers/nn.py#L9729-L9768 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.