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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pkg_resources/__init__.py | python | _always_object | (classes) | return classes | Ensure object appears in the mro even
for old-style classes. | Ensure object appears in the mro even
for old-style classes. | [
"Ensure",
"object",
"appears",
"in",
"the",
"mro",
"even",
"for",
"old",
"-",
"style",
"classes",
"."
] | def _always_object(classes):
"""
Ensure object appears in the mro even
for old-style classes.
"""
if object not in classes:
return classes + (object,)
return classes | [
"def",
"_always_object",
"(",
"classes",
")",
":",
"if",
"object",
"not",
"in",
"classes",
":",
"return",
"classes",
"+",
"(",
"object",
",",
")",
"return",
"classes"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pkg_resources/__init__.py#L3162-L3169 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/ResourceManager/lib/Crypto/PublicKey/DSA.py | python | import_key | (extern_key, passphrase=None) | Import a DSA key.
Args:
extern_key (string or byte string):
The DSA key to import.
The following formats are supported for a DSA **public** key:
- X.509 certificate (binary DER or PEM)
- X.509 ``subjectPublicKeyInfo`` (binary DER or PEM)
- OpenSSH (ASCII one-liner, s... | Import a DSA key. | [
"Import",
"a",
"DSA",
"key",
"."
] | def import_key(extern_key, passphrase=None):
"""Import a DSA key.
Args:
extern_key (string or byte string):
The DSA key to import.
The following formats are supported for a DSA **public** key:
- X.509 certificate (binary DER or PEM)
- X.509 ``subjectPublicKeyInfo`` (bina... | [
"def",
"import_key",
"(",
"extern_key",
",",
"passphrase",
"=",
"None",
")",
":",
"extern_key",
"=",
"tobytes",
"(",
"extern_key",
")",
"if",
"passphrase",
"is",
"not",
"None",
":",
"passphrase",
"=",
"tobytes",
"(",
"passphrase",
")",
"if",
"extern_key",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/ResourceManager/lib/Crypto/PublicKey/DSA.py#L601-L668 | ||
kushview/Element | 1cc16380caa2ab79461246ba758b9de1f46db2a5 | waflib/extras/review.py | python | ReviewContext.load_review_set | (self) | return ConfigSet.ConfigSet() | Load and return the review set from the cache if it exists.
Otherwise, return an empty set. | Load and return the review set from the cache if it exists.
Otherwise, return an empty set. | [
"Load",
"and",
"return",
"the",
"review",
"set",
"from",
"the",
"cache",
"if",
"it",
"exists",
".",
"Otherwise",
"return",
"an",
"empty",
"set",
"."
] | def load_review_set(self):
"""
Load and return the review set from the cache if it exists.
Otherwise, return an empty set.
"""
if os.path.isfile(self.review_path):
return ConfigSet.ConfigSet(self.review_path)
return ConfigSet.ConfigSet() | [
"def",
"load_review_set",
"(",
"self",
")",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"self",
".",
"review_path",
")",
":",
"return",
"ConfigSet",
".",
"ConfigSet",
"(",
"self",
".",
"review_path",
")",
"return",
"ConfigSet",
".",
"ConfigSet",
"(... | https://github.com/kushview/Element/blob/1cc16380caa2ab79461246ba758b9de1f46db2a5/waflib/extras/review.py#L183-L190 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py3/IPython/core/alias.py | python | default_aliases | () | return default_aliases | Return list of shell aliases to auto-define. | Return list of shell aliases to auto-define. | [
"Return",
"list",
"of",
"shell",
"aliases",
"to",
"auto",
"-",
"define",
"."
] | def default_aliases():
"""Return list of shell aliases to auto-define.
"""
# Note: the aliases defined here should be safe to use on a kernel
# regardless of what frontend it is attached to. Frontends that use a
# kernel in-process can define additional aliases that will only work in
# their ca... | [
"def",
"default_aliases",
"(",
")",
":",
"# Note: the aliases defined here should be safe to use on a kernel",
"# regardless of what frontend it is attached to. Frontends that use a",
"# kernel in-process can define additional aliases that will only work in",
"# their case. For example, things lik... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py3/IPython/core/alias.py#L40-L110 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/dataset/vision/py_transforms_util.py | python | rgb_to_bgr | (np_rgb_img, is_hwc) | return np_bgr_img | Convert RGB img to BGR img.
Args:
np_rgb_img (numpy.ndarray): NumPy RGB image array of shape (H, W, C) or (C, H, W) to be converted.
is_hwc (Bool): If True, the shape of np_hsv_img is (H, W, C), otherwise must be (C, H, W).
Returns:
np_bgr_img (numpy.ndarray), NumPy BGR image with same... | Convert RGB img to BGR img. | [
"Convert",
"RGB",
"img",
"to",
"BGR",
"img",
"."
] | def rgb_to_bgr(np_rgb_img, is_hwc):
"""
Convert RGB img to BGR img.
Args:
np_rgb_img (numpy.ndarray): NumPy RGB image array of shape (H, W, C) or (C, H, W) to be converted.
is_hwc (Bool): If True, the shape of np_hsv_img is (H, W, C), otherwise must be (C, H, W).
Returns:
np_bg... | [
"def",
"rgb_to_bgr",
"(",
"np_rgb_img",
",",
"is_hwc",
")",
":",
"if",
"is_hwc",
":",
"np_bgr_img",
"=",
"np_rgb_img",
"[",
":",
",",
":",
",",
":",
":",
"-",
"1",
"]",
"else",
":",
"np_bgr_img",
"=",
"np_rgb_img",
"[",
":",
":",
"-",
"1",
",",
"... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/dataset/vision/py_transforms_util.py#L1264-L1279 | |
CGRU/cgru | 1881a4128530e3d31ac6c25314c18314fc50c2c7 | plugins/maya/afanasy/meArnoldRender.py | python | meArnoldRender.get_assgen_options | ( self, layer=None ) | return assgen_cmd | get_assgen_options
:param layer:
:return: | get_assgen_options | [
"get_assgen_options"
] | def get_assgen_options ( self, layer=None ) :
"""get_assgen_options
:param layer:
:return:
"""
animation = self.job_param['job_animation']
start = self.job_param['job_start']
stop = self.job_param['job_end']
step = self.job_param['job_step']
ass_reuse = self.ass_param['ass_reuse']
ass_selection = s... | [
"def",
"get_assgen_options",
"(",
"self",
",",
"layer",
"=",
"None",
")",
":",
"animation",
"=",
"self",
".",
"job_param",
"[",
"'job_animation'",
"]",
"start",
"=",
"self",
".",
"job_param",
"[",
"'job_start'",
"]",
"stop",
"=",
"self",
".",
"job_param",
... | https://github.com/CGRU/cgru/blob/1881a4128530e3d31ac6c25314c18314fc50c2c7/plugins/maya/afanasy/meArnoldRender.py#L441-L521 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | build/mac_toolchain.py | python | LoadPlist | (path) | Loads Plist at |path| and returns it as a dictionary. | Loads Plist at |path| and returns it as a dictionary. | [
"Loads",
"Plist",
"at",
"|path|",
"and",
"returns",
"it",
"as",
"a",
"dictionary",
"."
] | def LoadPlist(path):
"""Loads Plist at |path| and returns it as a dictionary."""
fd, name = tempfile.mkstemp()
try:
subprocess.check_call(['plutil', '-convert', 'xml1', '-o', name, path])
with os.fdopen(fd, 'r') as f:
return plistlib.readPlist(f)
finally:
os.unlink(name) | [
"def",
"LoadPlist",
"(",
"path",
")",
":",
"fd",
",",
"name",
"=",
"tempfile",
".",
"mkstemp",
"(",
")",
"try",
":",
"subprocess",
".",
"check_call",
"(",
"[",
"'plutil'",
",",
"'-convert'",
",",
"'xml1'",
",",
"'-o'",
",",
"name",
",",
"path",
"]",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/build/mac_toolchain.py#L101-L109 | ||
SoarGroup/Soar | a1c5e249499137a27da60533c72969eef3b8ab6b | scons/scons-local-4.1.0/SCons/Job.py | python | Jobs.__init__ | (self, num, taskmaster) | Create 'num' jobs using the given taskmaster.
If 'num' is 1 or less, then a serial job will be used,
otherwise a parallel job with 'num' worker threads will
be used.
The 'num_jobs' attribute will be set to the actual number of jobs
allocated. If more than one job is requested ... | Create 'num' jobs using the given taskmaster. | [
"Create",
"num",
"jobs",
"using",
"the",
"given",
"taskmaster",
"."
] | def __init__(self, num, taskmaster):
"""
Create 'num' jobs using the given taskmaster.
If 'num' is 1 or less, then a serial job will be used,
otherwise a parallel job with 'num' worker threads will
be used.
The 'num_jobs' attribute will be set to the actual number of jo... | [
"def",
"__init__",
"(",
"self",
",",
"num",
",",
"taskmaster",
")",
":",
"self",
".",
"job",
"=",
"None",
"if",
"num",
">",
"1",
":",
"stack_size",
"=",
"explicit_stack_size",
"if",
"stack_size",
"is",
"None",
":",
"stack_size",
"=",
"default_stack_size",
... | https://github.com/SoarGroup/Soar/blob/a1c5e249499137a27da60533c72969eef3b8ab6b/scons/scons-local-4.1.0/SCons/Job.py#L67-L94 | ||
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/tools/inspector_protocol/jinja2/filters.py | python | do_forceescape | (value) | return escape(text_type(value)) | Enforce HTML escaping. This will probably double escape variables. | Enforce HTML escaping. This will probably double escape variables. | [
"Enforce",
"HTML",
"escaping",
".",
"This",
"will",
"probably",
"double",
"escape",
"variables",
"."
] | def do_forceescape(value):
"""Enforce HTML escaping. This will probably double escape variables."""
if hasattr(value, '__html__'):
value = value.__html__()
return escape(text_type(value)) | [
"def",
"do_forceescape",
"(",
"value",
")",
":",
"if",
"hasattr",
"(",
"value",
",",
"'__html__'",
")",
":",
"value",
"=",
"value",
".",
"__html__",
"(",
")",
"return",
"escape",
"(",
"text_type",
"(",
"value",
")",
")"
] | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/tools/inspector_protocol/jinja2/filters.py#L87-L91 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pluggy/py2/pluggy/hooks.py | python | _HookCaller.call_historic | (self, result_callback=None, kwargs=None, proc=None) | Call the hook with given ``kwargs`` for all registered plugins and
for all plugins which will be registered afterwards.
If ``result_callback`` is not ``None`` it will be called for for each
non-``None`` result obtained from a hook implementation.
.. note::
The ``proc`` argu... | Call the hook with given ``kwargs`` for all registered plugins and
for all plugins which will be registered afterwards. | [
"Call",
"the",
"hook",
"with",
"given",
"kwargs",
"for",
"all",
"registered",
"plugins",
"and",
"for",
"all",
"plugins",
"which",
"will",
"be",
"registered",
"afterwards",
"."
] | def call_historic(self, result_callback=None, kwargs=None, proc=None):
"""Call the hook with given ``kwargs`` for all registered plugins and
for all plugins which will be registered afterwards.
If ``result_callback`` is not ``None`` it will be called for for each
non-``None`` result obt... | [
"def",
"call_historic",
"(",
"self",
",",
"result_callback",
"=",
"None",
",",
"kwargs",
"=",
"None",
",",
"proc",
"=",
"None",
")",
":",
"if",
"proc",
"is",
"not",
"None",
":",
"warnings",
".",
"warn",
"(",
"\"Support for `proc` argument is now deprecated and... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pluggy/py2/pluggy/hooks.py#L288-L313 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_gdi.py | python | GraphicsObject.GetRenderer | (*args, **kwargs) | return _gdi_.GraphicsObject_GetRenderer(*args, **kwargs) | GetRenderer(self) -> GraphicsRenderer
Returns the renderer that was used to create this instance, or
``None`` if it has not been initialized yet. | GetRenderer(self) -> GraphicsRenderer | [
"GetRenderer",
"(",
"self",
")",
"-",
">",
"GraphicsRenderer"
] | def GetRenderer(*args, **kwargs):
"""
GetRenderer(self) -> GraphicsRenderer
Returns the renderer that was used to create this instance, or
``None`` if it has not been initialized yet.
"""
return _gdi_.GraphicsObject_GetRenderer(*args, **kwargs) | [
"def",
"GetRenderer",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"GraphicsObject_GetRenderer",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_gdi.py#L5477-L5484 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/_pyio.py | python | BufferedIOBase.read | (self, n=None) | Read and return up to n bytes.
If the argument is omitted, None, or negative, reads and
returns all data until EOF.
If the argument is positive, and the underlying raw stream is
not 'interactive', multiple raw reads may be issued to satisfy
the byte count (unless EOF is reached... | Read and return up to n bytes. | [
"Read",
"and",
"return",
"up",
"to",
"n",
"bytes",
"."
] | def read(self, n=None):
"""Read and return up to n bytes.
If the argument is omitted, None, or negative, reads and
returns all data until EOF.
If the argument is positive, and the underlying raw stream is
not 'interactive', multiple raw reads may be issued to satisfy
th... | [
"def",
"read",
"(",
"self",
",",
"n",
"=",
"None",
")",
":",
"self",
".",
"_unsupported",
"(",
"\"read\"",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/_pyio.py#L618-L636 | ||
mapnik/mapnik | f3da900c355e1d15059c4a91b00203dcc9d9f0ef | scons/scons-local-4.1.0/SCons/Subst.py | python | quote_spaces | (arg) | Generic function for putting double quotes around any string that
has white space in it. | Generic function for putting double quotes around any string that
has white space in it. | [
"Generic",
"function",
"for",
"putting",
"double",
"quotes",
"around",
"any",
"string",
"that",
"has",
"white",
"space",
"in",
"it",
"."
] | def quote_spaces(arg):
"""Generic function for putting double quotes around any string that
has white space in it."""
if ' ' in arg or '\t' in arg:
return '"%s"' % arg
else:
return str(arg) | [
"def",
"quote_spaces",
"(",
"arg",
")",
":",
"if",
"' '",
"in",
"arg",
"or",
"'\\t'",
"in",
"arg",
":",
"return",
"'\"%s\"'",
"%",
"arg",
"else",
":",
"return",
"str",
"(",
"arg",
")"
] | https://github.com/mapnik/mapnik/blob/f3da900c355e1d15059c4a91b00203dcc9d9f0ef/scons/scons-local-4.1.0/SCons/Subst.py#L119-L125 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/richtext.py | python | RichTextEvent.__init__ | (self, *args, **kwargs) | __init__(self, EventType commandType=wxEVT_NULL, int winid=0) -> RichTextEvent | __init__(self, EventType commandType=wxEVT_NULL, int winid=0) -> RichTextEvent | [
"__init__",
"(",
"self",
"EventType",
"commandType",
"=",
"wxEVT_NULL",
"int",
"winid",
"=",
"0",
")",
"-",
">",
"RichTextEvent"
] | def __init__(self, *args, **kwargs):
"""__init__(self, EventType commandType=wxEVT_NULL, int winid=0) -> RichTextEvent"""
_richtext.RichTextEvent_swiginit(self,_richtext.new_RichTextEvent(*args, **kwargs)) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_richtext",
".",
"RichTextEvent_swiginit",
"(",
"self",
",",
"_richtext",
".",
"new_RichTextEvent",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/richtext.py#L4263-L4265 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/asyncio/locks.py | python | Lock._wake_up_first | (self) | Wake up the first waiter if it isn't done. | Wake up the first waiter if it isn't done. | [
"Wake",
"up",
"the",
"first",
"waiter",
"if",
"it",
"isn",
"t",
"done",
"."
] | def _wake_up_first(self):
"""Wake up the first waiter if it isn't done."""
try:
fut = next(iter(self._waiters))
except StopIteration:
return
# .done() necessarily means that a waiter will wake up later on and
# either take the lock, or, if it was cancelle... | [
"def",
"_wake_up_first",
"(",
"self",
")",
":",
"try",
":",
"fut",
"=",
"next",
"(",
"iter",
"(",
"self",
".",
"_waiters",
")",
")",
"except",
"StopIteration",
":",
"return",
"# .done() necessarily means that a waiter will wake up later on and",
"# either take the loc... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/asyncio/locks.py#L220-L231 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/python/turicreate/toolkits/_private_utils.py | python | _check_elements_equal | (lst) | return not lst or lst.count(lst[0]) == len(lst) | Returns true if all of the elements in the list are equal. | Returns true if all of the elements in the list are equal. | [
"Returns",
"true",
"if",
"all",
"of",
"the",
"elements",
"in",
"the",
"list",
"are",
"equal",
"."
] | def _check_elements_equal(lst):
"""
Returns true if all of the elements in the list are equal.
"""
assert isinstance(lst, list), "Input value must be a list."
return not lst or lst.count(lst[0]) == len(lst) | [
"def",
"_check_elements_equal",
"(",
"lst",
")",
":",
"assert",
"isinstance",
"(",
"lst",
",",
"list",
")",
",",
"\"Input value must be a list.\"",
"return",
"not",
"lst",
"or",
"lst",
".",
"count",
"(",
"lst",
"[",
"0",
"]",
")",
"==",
"len",
"(",
"lst"... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/python/turicreate/toolkits/_private_utils.py#L157-L162 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | build/android/pylib/perf/surface_stats_collector.py | python | SurfaceStatsCollector._GetSurfaceStatsLegacy | (self) | return {
'page_flip_count': cur_surface,
'timestamp': datetime.datetime.now(),
} | Legacy method (before JellyBean), returns the current Surface index
and timestamp.
Calculate FPS by measuring the difference of Surface index returned by
SurfaceFlinger in a period of time.
Returns:
Dict of {page_flip_count (or 0 if there was an error), timestamp}. | Legacy method (before JellyBean), returns the current Surface index
and timestamp. | [
"Legacy",
"method",
"(",
"before",
"JellyBean",
")",
"returns",
"the",
"current",
"Surface",
"index",
"and",
"timestamp",
"."
] | def _GetSurfaceStatsLegacy(self):
"""Legacy method (before JellyBean), returns the current Surface index
and timestamp.
Calculate FPS by measuring the difference of Surface index returned by
SurfaceFlinger in a period of time.
Returns:
Dict of {page_flip_count (or 0 if there was an error)... | [
"def",
"_GetSurfaceStatsLegacy",
"(",
"self",
")",
":",
"results",
"=",
"self",
".",
"_adb",
".",
"RunShellCommand",
"(",
"'service call SurfaceFlinger 1013'",
")",
"assert",
"len",
"(",
"results",
")",
"==",
"1",
"match",
"=",
"re",
".",
"search",
"(",
"'^R... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/build/android/pylib/perf/surface_stats_collector.py#L283-L307 | |
named-data/NFD | b98aa3aca6b583ef34df7ee2f317321358f42dd0 | .waf-tools/boost.py | python | boost_get_libs | (self, *k, **kw) | return path.abspath(), match_libs(kw.get('lib', None), False), match_libs(kw.get('stlib', None), True) | return the lib path and the required libs
according to the parameters | return the lib path and the required libs
according to the parameters | [
"return",
"the",
"lib",
"path",
"and",
"the",
"required",
"libs",
"according",
"to",
"the",
"parameters"
] | def boost_get_libs(self, *k, **kw):
'''
return the lib path and the required libs
according to the parameters
'''
path, files = self.__boost_get_libs_path(**kw)
files = sorted(files, key=lambda f: (len(f.name), f.name), reverse=True)
toolset = self.boost_get_toolset(kw.get('toolset', ''))
toolset_pat = '(-%s[0-... | [
"def",
"boost_get_libs",
"(",
"self",
",",
"*",
"k",
",",
"*",
"*",
"kw",
")",
":",
"path",
",",
"files",
"=",
"self",
".",
"__boost_get_libs_path",
"(",
"*",
"*",
"kw",
")",
"files",
"=",
"sorted",
"(",
"files",
",",
"key",
"=",
"lambda",
"f",
"... | https://github.com/named-data/NFD/blob/b98aa3aca6b583ef34df7ee2f317321358f42dd0/.waf-tools/boost.py#L261-L326 | |
sdhash/sdhash | b9eff63e4e5867e910f41fd69032bbb1c94a2a5e | sdhash-ui/jinja2/environment.py | python | Environment.preprocess | (self, source, name=None, filename=None) | return reduce(lambda s, e: e.preprocess(s, name, filename),
self.iter_extensions(), unicode(source)) | Preprocesses the source with all extensions. This is automatically
called for all parsing and compiling methods but *not* for :meth:`lex`
because there you usually only want the actual source tokenized. | Preprocesses the source with all extensions. This is automatically
called for all parsing and compiling methods but *not* for :meth:`lex`
because there you usually only want the actual source tokenized. | [
"Preprocesses",
"the",
"source",
"with",
"all",
"extensions",
".",
"This",
"is",
"automatically",
"called",
"for",
"all",
"parsing",
"and",
"compiling",
"methods",
"but",
"*",
"not",
"*",
"for",
":",
"meth",
":",
"lex",
"because",
"there",
"you",
"usually",
... | def preprocess(self, source, name=None, filename=None):
"""Preprocesses the source with all extensions. This is automatically
called for all parsing and compiling methods but *not* for :meth:`lex`
because there you usually only want the actual source tokenized.
"""
return reduce... | [
"def",
"preprocess",
"(",
"self",
",",
"source",
",",
"name",
"=",
"None",
",",
"filename",
"=",
"None",
")",
":",
"return",
"reduce",
"(",
"lambda",
"s",
",",
"e",
":",
"e",
".",
"preprocess",
"(",
"s",
",",
"name",
",",
"filename",
")",
",",
"s... | https://github.com/sdhash/sdhash/blob/b9eff63e4e5867e910f41fd69032bbb1c94a2a5e/sdhash-ui/jinja2/environment.py#L417-L423 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/lib/financial.py | python | pv | (rate, nper, pmt, fv=0.0, when='end') | return -(fv + pmt*fact)/temp | Compute the present value.
Given:
* a future value, `fv`
* an interest `rate` compounded once per period, of which
there are
* `nper` total
* a (fixed) payment, `pmt`, paid either
* at the beginning (`when` = {'begin', 1}) or the end
(`when` = {'end', 0}) of each period
... | Compute the present value. | [
"Compute",
"the",
"present",
"value",
"."
] | def pv(rate, nper, pmt, fv=0.0, when='end'):
"""
Compute the present value.
Given:
* a future value, `fv`
* an interest `rate` compounded once per period, of which
there are
* `nper` total
* a (fixed) payment, `pmt`, paid either
* at the beginning (`when` = {'begin', 1}) or ... | [
"def",
"pv",
"(",
"rate",
",",
"nper",
",",
"pmt",
",",
"fv",
"=",
"0.0",
",",
"when",
"=",
"'end'",
")",
":",
"when",
"=",
"_convert_when",
"(",
"when",
")",
"(",
"rate",
",",
"nper",
",",
"pmt",
",",
"fv",
",",
"when",
")",
"=",
"map",
"(",... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/lib/financial.py#L415-L507 | |
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/boost_1_66_0/tools/build/src/build/feature.py | python | subfeature | (feature_name, value_string, subfeature, subvalues, attributes = []) | Declares a subfeature.
feature_name: Root feature that is not a subfeature.
value_string: An optional value-string specifying which feature or
subfeature values this subfeature is specific to,
if any.
subfeature: The name of the subfeature ... | Declares a subfeature.
feature_name: Root feature that is not a subfeature.
value_string: An optional value-string specifying which feature or
subfeature values this subfeature is specific to,
if any.
subfeature: The name of the subfeature ... | [
"Declares",
"a",
"subfeature",
".",
"feature_name",
":",
"Root",
"feature",
"that",
"is",
"not",
"a",
"subfeature",
".",
"value_string",
":",
"An",
"optional",
"value",
"-",
"string",
"specifying",
"which",
"feature",
"or",
"subfeature",
"values",
"this",
"sub... | def subfeature (feature_name, value_string, subfeature, subvalues, attributes = []):
""" Declares a subfeature.
feature_name: Root feature that is not a subfeature.
value_string: An optional value-string specifying which feature or
subfeature values this subfeature is spe... | [
"def",
"subfeature",
"(",
"feature_name",
",",
"value_string",
",",
"subfeature",
",",
"subvalues",
",",
"attributes",
"=",
"[",
"]",
")",
":",
"parent_feature",
"=",
"validate_feature",
"(",
"feature_name",
")",
"# Add grist to the subfeature name if a value-string was... | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/boost_1_66_0/tools/build/src/build/feature.py#L482-L509 | ||
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/lib/_datasource.py | python | open | (path, mode='r', destpath=os.curdir) | return ds.open(path, mode) | Open `path` with `mode` and return the file object.
If ``path`` is an URL, it will be downloaded, stored in the `DataSource`
`destpath` directory and opened from there.
Parameters
----------
path : str
Local file path or URL to open.
mode : str, optional
Mode to open `path`. Mo... | Open `path` with `mode` and return the file object. | [
"Open",
"path",
"with",
"mode",
"and",
"return",
"the",
"file",
"object",
"."
] | def open(path, mode='r', destpath=os.curdir):
"""
Open `path` with `mode` and return the file object.
If ``path`` is an URL, it will be downloaded, stored in the `DataSource`
`destpath` directory and opened from there.
Parameters
----------
path : str
Local file path or URL to open... | [
"def",
"open",
"(",
"path",
",",
"mode",
"=",
"'r'",
",",
"destpath",
"=",
"os",
".",
"curdir",
")",
":",
"ds",
"=",
"DataSource",
"(",
"destpath",
")",
"return",
"ds",
".",
"open",
"(",
"path",
",",
"mode",
")"
] | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/lib/_datasource.py#L114-L147 | |
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | syzygy/scripts/asan/minidump_symbolizer.py | python | PrintASanReport | (report, file_handle=sys.stdout) | Print a crash report.
Args:
report: The report to print.
file_handle: A handle to the out stream, by default we print the report to
stdout. | Print a crash report. | [
"Print",
"a",
"crash",
"report",
"."
] | def PrintASanReport(report, file_handle=sys.stdout):
"""Print a crash report.
Args:
report: The report to print.
file_handle: A handle to the out stream, by default we print the report to
stdout.
"""
file_handle.write('Bad access information:\n')
for key in report.bad_access_info:
file_ha... | [
"def",
"PrintASanReport",
"(",
"report",
",",
"file_handle",
"=",
"sys",
".",
"stdout",
")",
":",
"file_handle",
".",
"write",
"(",
"'Bad access information:\\n'",
")",
"for",
"key",
"in",
"report",
".",
"bad_access_info",
":",
"file_handle",
".",
"write",
"("... | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/syzygy/scripts/asan/minidump_symbolizer.py#L568-L623 | ||
alexgkendall/caffe-segnet | 344c113bf1832886f1cbe9f33ffe28a3beeaf412 | scripts/cpp_lint.py | python | IsBlankLine | (line) | return not line or line.isspace() | Returns true if the given line is blank.
We consider a line to be blank if the line is empty or consists of
only white spaces.
Args:
line: A line of a string.
Returns:
True, if the given line is blank. | Returns true if the given line is blank. | [
"Returns",
"true",
"if",
"the",
"given",
"line",
"is",
"blank",
"."
] | def IsBlankLine(line):
"""Returns true if the given line is blank.
We consider a line to be blank if the line is empty or consists of
only white spaces.
Args:
line: A line of a string.
Returns:
True, if the given line is blank.
"""
return not line or line.isspace() | [
"def",
"IsBlankLine",
"(",
"line",
")",
":",
"return",
"not",
"line",
"or",
"line",
".",
"isspace",
"(",
")"
] | https://github.com/alexgkendall/caffe-segnet/blob/344c113bf1832886f1cbe9f33ffe28a3beeaf412/scripts/cpp_lint.py#L2369-L2381 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py3/sklearn/utils/sparsefuncs.py | python | inplace_csr_row_scale | (X, scale) | Inplace row scaling of a CSR matrix.
Scale each sample of the data matrix by multiplying with specific scale
provided by the caller assuming a (n_samples, n_features) shape.
Parameters
----------
X : CSR sparse matrix, shape (n_samples, n_features)
Matrix to be scaled.
scale : float a... | Inplace row scaling of a CSR matrix. | [
"Inplace",
"row",
"scaling",
"of",
"a",
"CSR",
"matrix",
"."
] | def inplace_csr_row_scale(X, scale):
""" Inplace row scaling of a CSR matrix.
Scale each sample of the data matrix by multiplying with specific scale
provided by the caller assuming a (n_samples, n_features) shape.
Parameters
----------
X : CSR sparse matrix, shape (n_samples, n_features)
... | [
"def",
"inplace_csr_row_scale",
"(",
"X",
",",
"scale",
")",
":",
"assert",
"scale",
".",
"shape",
"[",
"0",
"]",
"==",
"X",
".",
"shape",
"[",
"0",
"]",
"X",
".",
"data",
"*=",
"np",
".",
"repeat",
"(",
"scale",
",",
"np",
".",
"diff",
"(",
"X... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/utils/sparsefuncs.py#L46-L61 | ||
generalized-intelligence/GAAS | 29ab17d3e8a4ba18edef3a57c36d8db6329fac73 | deprecated/algorithms/sfm/OpenSfM/opensfm/types.py | python | Reconstruction.get_point | (self, id) | return self.points.get(id) | Return a point by id.
:return: If exists returns the point, otherwise None. | Return a point by id. | [
"Return",
"a",
"point",
"by",
"id",
"."
] | def get_point(self, id):
"""Return a point by id.
:return: If exists returns the point, otherwise None.
"""
return self.points.get(id) | [
"def",
"get_point",
"(",
"self",
",",
"id",
")",
":",
"return",
"self",
".",
"points",
".",
"get",
"(",
"id",
")"
] | https://github.com/generalized-intelligence/GAAS/blob/29ab17d3e8a4ba18edef3a57c36d8db6329fac73/deprecated/algorithms/sfm/OpenSfM/opensfm/types.py#L733-L738 | |
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TIntV.GetPivotValN | (self, *args) | return _snap.TIntV_GetPivotValN(self, *args) | GetPivotValN(TIntV self, int const & LValN, int const & RValN) -> int
Parameters:
LValN: int const &
RValN: int const & | GetPivotValN(TIntV self, int const & LValN, int const & RValN) -> int | [
"GetPivotValN",
"(",
"TIntV",
"self",
"int",
"const",
"&",
"LValN",
"int",
"const",
"&",
"RValN",
")",
"-",
">",
"int"
] | def GetPivotValN(self, *args):
"""
GetPivotValN(TIntV self, int const & LValN, int const & RValN) -> int
Parameters:
LValN: int const &
RValN: int const &
"""
return _snap.TIntV_GetPivotValN(self, *args) | [
"def",
"GetPivotValN",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_snap",
".",
"TIntV_GetPivotValN",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L15889-L15898 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_internal/commands/completion.py | python | CompletionCommand.run | (self, options, args) | Prints the completion code of the given shell | Prints the completion code of the given shell | [
"Prints",
"the",
"completion",
"code",
"of",
"the",
"given",
"shell"
] | def run(self, options, args):
# type: (Values, List[str]) -> int
"""Prints the completion code of the given shell"""
shells = COMPLETION_SCRIPTS.keys()
shell_options = ['--' + shell for shell in sorted(shells)]
if options.shell in shells:
script = textwrap.dedent(
... | [
"def",
"run",
"(",
"self",
",",
"options",
",",
"args",
")",
":",
"# type: (Values, List[str]) -> int",
"shells",
"=",
"COMPLETION_SCRIPTS",
".",
"keys",
"(",
")",
"shell_options",
"=",
"[",
"'--'",
"+",
"shell",
"for",
"shell",
"in",
"sorted",
"(",
"shells... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_internal/commands/completion.py#L80-L96 | ||
quarnster/SublimeClang | 6823e7f0904e60680ac9f898108e301582ec5505 | internals/clang/cindex.py | python | CursorKind.is_reference | (self) | return CursorKind_is_ref(self) | Test if this is a reference kind. | Test if this is a reference kind. | [
"Test",
"if",
"this",
"is",
"a",
"reference",
"kind",
"."
] | def is_reference(self):
"""Test if this is a reference kind."""
return CursorKind_is_ref(self) | [
"def",
"is_reference",
"(",
"self",
")",
":",
"return",
"CursorKind_is_ref",
"(",
"self",
")"
] | https://github.com/quarnster/SublimeClang/blob/6823e7f0904e60680ac9f898108e301582ec5505/internals/clang/cindex.py#L361-L363 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/setuptools/msvc.py | python | EnvironmentInfo.HTMLHelpWorkshop | (self) | return [join(self.si.ProgramFilesx86, 'HTML Help Workshop')] | Microsoft HTML Help Workshop.
Return
------
list of str
paths | Microsoft HTML Help Workshop. | [
"Microsoft",
"HTML",
"Help",
"Workshop",
"."
] | def HTMLHelpWorkshop(self):
"""
Microsoft HTML Help Workshop.
Return
------
list of str
paths
"""
if self.vs_ver < 11.0:
return []
return [join(self.si.ProgramFilesx86, 'HTML Help Workshop')] | [
"def",
"HTMLHelpWorkshop",
"(",
"self",
")",
":",
"if",
"self",
".",
"vs_ver",
"<",
"11.0",
":",
"return",
"[",
"]",
"return",
"[",
"join",
"(",
"self",
".",
"si",
".",
"ProgramFilesx86",
",",
"'HTML Help Workshop'",
")",
"]"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/setuptools/msvc.py#L1609-L1621 | |
carla-simulator/carla | 8854804f4d7748e14d937ec763a2912823a7e5f5 | Co-Simulation/Sumo/sumo_integration/carla_simulation.py | python | CarlaSimulation.get_traffic_light_state | (self, landmark_id) | return self._tls[landmark_id].state | Accessor for traffic light state.
If the traffic ligth does not exist, returns None. | Accessor for traffic light state. | [
"Accessor",
"for",
"traffic",
"light",
"state",
"."
] | def get_traffic_light_state(self, landmark_id):
"""
Accessor for traffic light state.
If the traffic ligth does not exist, returns None.
"""
if landmark_id not in self._tls:
return None
return self._tls[landmark_id].state | [
"def",
"get_traffic_light_state",
"(",
"self",
",",
"landmark_id",
")",
":",
"if",
"landmark_id",
"not",
"in",
"self",
".",
"_tls",
":",
"return",
"None",
"return",
"self",
".",
"_tls",
"[",
"landmark_id",
"]",
".",
"state"
] | https://github.com/carla-simulator/carla/blob/8854804f4d7748e14d937ec763a2912823a7e5f5/Co-Simulation/Sumo/sumo_integration/carla_simulation.py#L79-L87 | |
SeisSol/SeisSol | 955fbeb8c5d40d3363a2da0edc611259aebe1653 | postprocessing/science/GroundMotionParametersMaps/ComputeGroundMotionParametersFromSurfaceOutput_Hybrid.py | python | compute_cav_gmrot | (acceleration_x, time_step_x, acceleration_y, time_step_y, angles, percentile) | return np.percentile(cav_theta, percentile) | compute the cumulative velocity using gmrot | compute the cumulative velocity using gmrot | [
"compute",
"the",
"cumulative",
"velocity",
"using",
"gmrot"
] | def compute_cav_gmrot(acceleration_x, time_step_x, acceleration_y, time_step_y, angles, percentile):
""" compute the cumulative velocity using gmrot """
from smtk.intensity_measures import get_cav, rotate_horizontal
cav_theta = np.zeros(len(angles), dtype=float)
for iloc, theta in enumerate(angles):
... | [
"def",
"compute_cav_gmrot",
"(",
"acceleration_x",
",",
"time_step_x",
",",
"acceleration_y",
",",
"time_step_y",
",",
"angles",
",",
"percentile",
")",
":",
"from",
"smtk",
".",
"intensity_measures",
"import",
"get_cav",
",",
"rotate_horizontal",
"cav_theta",
"=",
... | https://github.com/SeisSol/SeisSol/blob/955fbeb8c5d40d3363a2da0edc611259aebe1653/postprocessing/science/GroundMotionParametersMaps/ComputeGroundMotionParametersFromSurfaceOutput_Hybrid.py#L82-L94 | |
hyperledger-archives/iroha | ed579f85126d0e86532a1f4f1f6ce5681bbcd3a9 | example/python/irohalib.py | python | IrohaCrypto.derive_public_key | (private_key) | return hex_public_key | Calculate public key from private key
:param private_key: hex encoded private key
:return: hex encoded public key | Calculate public key from private key
:param private_key: hex encoded private key
:return: hex encoded public key | [
"Calculate",
"public",
"key",
"from",
"private",
"key",
":",
"param",
"private_key",
":",
"hex",
"encoded",
"private",
"key",
":",
"return",
":",
"hex",
"encoded",
"public",
"key"
] | def derive_public_key(private_key):
"""
Calculate public key from private key
:param private_key: hex encoded private key
:return: hex encoded public key
"""
secret = binascii.unhexlify(private_key)
public_key = ed25519.publickey_unsafe(secret)
hex_public_... | [
"def",
"derive_public_key",
"(",
"private_key",
")",
":",
"secret",
"=",
"binascii",
".",
"unhexlify",
"(",
"private_key",
")",
"public_key",
"=",
"ed25519",
".",
"publickey_unsafe",
"(",
"secret",
")",
"hex_public_key",
"=",
"binascii",
".",
"hexlify",
"(",
"... | https://github.com/hyperledger-archives/iroha/blob/ed579f85126d0e86532a1f4f1f6ce5681bbcd3a9/example/python/irohalib.py#L29-L38 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/distributed/fleet/dataset/dataset.py | python | QueueDataset.init | (self, **kwargs) | :api_attr: Static Graph
should be called only once in user's python scripts to initialize setings of dataset instance | :api_attr: Static Graph | [
":",
"api_attr",
":",
"Static",
"Graph"
] | def init(self, **kwargs):
"""
:api_attr: Static Graph
should be called only once in user's python scripts to initialize setings of dataset instance
"""
super(QueueDataset, self).init(**kwargs) | [
"def",
"init",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"QueueDataset",
",",
"self",
")",
".",
"init",
"(",
"*",
"*",
"kwargs",
")"
] | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/distributed/fleet/dataset/dataset.py#L1261-L1267 | ||
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py | python | SBSymbol.IsExternal | (self) | return _lldb.SBSymbol_IsExternal(self) | IsExternal(self) -> bool | IsExternal(self) -> bool | [
"IsExternal",
"(",
"self",
")",
"-",
">",
"bool"
] | def IsExternal(self):
"""IsExternal(self) -> bool"""
return _lldb.SBSymbol_IsExternal(self) | [
"def",
"IsExternal",
"(",
"self",
")",
":",
"return",
"_lldb",
".",
"SBSymbol_IsExternal",
"(",
"self",
")"
] | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py#L8135-L8137 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/pathlib.py | python | Path.samefile | (self, other_path) | return os.path.samestat(st, other_st) | Return whether other_path is the same or not as this file
(as returned by os.path.samefile()). | Return whether other_path is the same or not as this file
(as returned by os.path.samefile()). | [
"Return",
"whether",
"other_path",
"is",
"the",
"same",
"or",
"not",
"as",
"this",
"file",
"(",
"as",
"returned",
"by",
"os",
".",
"path",
".",
"samefile",
"()",
")",
"."
] | def samefile(self, other_path):
"""Return whether other_path is the same or not as this file
(as returned by os.path.samefile()).
"""
st = self.stat()
try:
other_st = other_path.stat()
except AttributeError:
other_st = os.stat(other_path)
r... | [
"def",
"samefile",
"(",
"self",
",",
"other_path",
")",
":",
"st",
"=",
"self",
".",
"stat",
"(",
")",
"try",
":",
"other_st",
"=",
"other_path",
".",
"stat",
"(",
")",
"except",
"AttributeError",
":",
"other_st",
"=",
"os",
".",
"stat",
"(",
"other_... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/pathlib.py#L1090-L1099 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/xmlrpc/server.py | python | SimpleXMLRPCDispatcher.system_multicall | (self, call_list) | return results | system.multicall([{'methodName': 'add', 'params': [2, 2]}, ...]) => \
[[4], ...]
Allows the caller to package multiple XML-RPC calls into a single
request.
See http://www.xmlrpc.com/discuss/msgReader$1208 | system.multicall([{'methodName': 'add', 'params': [2, 2]}, ...]) => \
[[4], ...] | [
"system",
".",
"multicall",
"(",
"[",
"{",
"methodName",
":",
"add",
"params",
":",
"[",
"2",
"2",
"]",
"}",
"...",
"]",
")",
"=",
">",
"\\",
"[[",
"4",
"]",
"...",
"]"
] | def system_multicall(self, call_list):
"""system.multicall([{'methodName': 'add', 'params': [2, 2]}, ...]) => \
[[4], ...]
Allows the caller to package multiple XML-RPC calls into a single
request.
See http://www.xmlrpc.com/discuss/msgReader$1208
"""
results = []
... | [
"def",
"system_multicall",
"(",
"self",
",",
"call_list",
")",
":",
"results",
"=",
"[",
"]",
"for",
"call",
"in",
"call_list",
":",
"method_name",
"=",
"call",
"[",
"'methodName'",
"]",
"params",
"=",
"call",
"[",
"'params'",
"]",
"try",
":",
"# XXX A m... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/xmlrpc/server.py#L347-L381 | |
Slicer/Slicer | ba9fadf332cb0303515b68d8d06a344c82e3e3e5 | Modules/Scripted/DICOMLib/DICOMUtils.py | python | importFromDICOMWeb | (dicomWebEndpoint, studyInstanceUID, seriesInstanceUID=None, accessToken=None) | return seriesImported | Downloads and imports DICOM series from a DICOMweb instance.
Progress is displayed and if errors occur then they are displayed in a popup window in the end.
If all the instances in a series are already imported then the series will not be retrieved and imported again.
:param dicomWebEndpoint: Endpoint URL for re... | Downloads and imports DICOM series from a DICOMweb instance.
Progress is displayed and if errors occur then they are displayed in a popup window in the end.
If all the instances in a series are already imported then the series will not be retrieved and imported again. | [
"Downloads",
"and",
"imports",
"DICOM",
"series",
"from",
"a",
"DICOMweb",
"instance",
".",
"Progress",
"is",
"displayed",
"and",
"if",
"errors",
"occur",
"then",
"they",
"are",
"displayed",
"in",
"a",
"popup",
"window",
"in",
"the",
"end",
".",
"If",
"all... | def importFromDICOMWeb(dicomWebEndpoint, studyInstanceUID, seriesInstanceUID=None, accessToken=None):
"""
Downloads and imports DICOM series from a DICOMweb instance.
Progress is displayed and if errors occur then they are displayed in a popup window in the end.
If all the instances in a series are already impo... | [
"def",
"importFromDICOMWeb",
"(",
"dicomWebEndpoint",
",",
"studyInstanceUID",
",",
"seriesInstanceUID",
"=",
"None",
",",
"accessToken",
"=",
"None",
")",
":",
"from",
"dicomweb_client",
".",
"api",
"import",
"DICOMwebClient",
"import",
"random",
"seriesImported",
... | https://github.com/Slicer/Slicer/blob/ba9fadf332cb0303515b68d8d06a344c82e3e3e5/Modules/Scripted/DICOMLib/DICOMUtils.py#L788-L920 | |
root-project/root | fcd3583bb14852bf2e8cd2415717cbaac0e75896 | bindings/pyroot/pythonizations/python/ROOT/_pythonization/_rtensor.py | python | RTensorGetitem | (self, idx) | return self(idxVec) | Implementation of the __getitem__ special function for RTensor
Parameters:
self: RTensor object
idx: Indices passed to RTensor[indices] operator
Returns:
New RTensor object if indices represent a slice or the requested element | Implementation of the __getitem__ special function for RTensor | [
"Implementation",
"of",
"the",
"__getitem__",
"special",
"function",
"for",
"RTensor"
] | def RTensorGetitem(self, idx):
"""
Implementation of the __getitem__ special function for RTensor
Parameters:
self: RTensor object
idx: Indices passed to RTensor[indices] operator
Returns:
New RTensor object if indices represent a slice or the requested element
"""
# Mak... | [
"def",
"RTensorGetitem",
"(",
"self",
",",
"idx",
")",
":",
"# Make single index iterable and convert to list",
"if",
"not",
"hasattr",
"(",
"idx",
",",
"\"__len__\"",
")",
":",
"idx",
"=",
"[",
"idx",
"]",
"idx",
"=",
"list",
"(",
"idx",
")",
"# Check shape... | https://github.com/root-project/root/blob/fcd3583bb14852bf2e8cd2415717cbaac0e75896/bindings/pyroot/pythonizations/python/ROOT/_pythonization/_rtensor.py#L64-L117 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/ultimatelistctrl.py | python | to_list | (input) | Converts the input data into a Python list.
:param `input`: can be an integer or a Python list (in which case nothing will
be done to `input`. | Converts the input data into a Python list. | [
"Converts",
"the",
"input",
"data",
"into",
"a",
"Python",
"list",
"."
] | def to_list(input):
"""
Converts the input data into a Python list.
:param `input`: can be an integer or a Python list (in which case nothing will
be done to `input`.
"""
if isinstance(input, types.ListType):
return input
elif isinstance(input, types.IntType):
return [inpu... | [
"def",
"to_list",
"(",
"input",
")",
":",
"if",
"isinstance",
"(",
"input",
",",
"types",
".",
"ListType",
")",
":",
"return",
"input",
"elif",
"isinstance",
"(",
"input",
",",
"types",
".",
"IntType",
")",
":",
"return",
"[",
"input",
"]",
"else",
"... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/ultimatelistctrl.py#L563-L576 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/email/utils.py | python | decode_params | (params) | return new_params | Decode parameters list according to RFC 2231.
params is a sequence of 2-tuples containing (param name, string value). | Decode parameters list according to RFC 2231. | [
"Decode",
"parameters",
"list",
"according",
"to",
"RFC",
"2231",
"."
] | def decode_params(params):
"""Decode parameters list according to RFC 2231.
params is a sequence of 2-tuples containing (param name, string value).
"""
new_params = [params[0]]
# Map parameter's name to a list of continuations. The values are a
# 3-tuple of the continuation number, the string ... | [
"def",
"decode_params",
"(",
"params",
")",
":",
"new_params",
"=",
"[",
"params",
"[",
"0",
"]",
"]",
"# Map parameter's name to a list of continuations. The values are a",
"# 3-tuple of the continuation number, the string value, and a flag",
"# specifying whether a particular segm... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/email/utils.py#L257-L303 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/pydoc.py | python | HTMLDoc.classlink | (self, object, modname) | return classname(object, modname) | Make a link for a class. | Make a link for a class. | [
"Make",
"a",
"link",
"for",
"a",
"class",
"."
] | def classlink(self, object, modname):
"""Make a link for a class."""
name, module = object.__name__, sys.modules.get(object.__module__)
if hasattr(module, name) and getattr(module, name) is object:
return '<a href="%s.html#%s">%s</a>' % (
module.__name__, name, classn... | [
"def",
"classlink",
"(",
"self",
",",
"object",
",",
"modname",
")",
":",
"name",
",",
"module",
"=",
"object",
".",
"__name__",
",",
"sys",
".",
"modules",
".",
"get",
"(",
"object",
".",
"__module__",
")",
"if",
"hasattr",
"(",
"module",
",",
"name... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/pydoc.py#L556-L562 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | current/deps/v8/tools/clusterfuzz/v8_suppressions.py | python | diff_output | (output1, output2, allowed, ignore1, ignore2) | return None, source | Returns a tuple (difference, source).
The difference is None if there's no difference, otherwise a string
with a readable diff.
The source is the last source output within the test case, or None if no
such output existed. | Returns a tuple (difference, source). | [
"Returns",
"a",
"tuple",
"(",
"difference",
"source",
")",
"."
] | def diff_output(output1, output2, allowed, ignore1, ignore2):
"""Returns a tuple (difference, source).
The difference is None if there's no difference, otherwise a string
with a readable diff.
The source is the last source output within the test case, or None if no
such output existed.
"""
def useful_li... | [
"def",
"diff_output",
"(",
"output1",
",",
"output2",
",",
"allowed",
",",
"ignore1",
",",
"ignore2",
")",
":",
"def",
"useful_line",
"(",
"ignore",
")",
":",
"def",
"fun",
"(",
"line",
")",
":",
"return",
"all",
"(",
"not",
"e",
".",
"match",
"(",
... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/current/deps/v8/tools/clusterfuzz/v8_suppressions.py#L179-L236 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_controls.py | python | SearchCtrl.ShowCancelButton | (*args, **kwargs) | return _controls_.SearchCtrl_ShowCancelButton(*args, **kwargs) | ShowCancelButton(self, bool show)
Shows or hides the cancel button. | ShowCancelButton(self, bool show) | [
"ShowCancelButton",
"(",
"self",
"bool",
"show",
")"
] | def ShowCancelButton(*args, **kwargs):
"""
ShowCancelButton(self, bool show)
Shows or hides the cancel button.
"""
return _controls_.SearchCtrl_ShowCancelButton(*args, **kwargs) | [
"def",
"ShowCancelButton",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"SearchCtrl_ShowCancelButton",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_controls.py#L7457-L7463 | |
MRPT/mrpt | b0be3557a4cded6bafff03feb28f7fa1f75762a3 | scripts/clang_git_format/clang_git_format/repo.py | python | Repo.get_candidate_files | (self) | return self._git_ls_files(["ls-files", "--cached"]) | Query git to get a list of all files in the repo to consider for
analysis | Query git to get a list of all files in the repo to consider for
analysis | [
"Query",
"git",
"to",
"get",
"a",
"list",
"of",
"all",
"files",
"in",
"the",
"repo",
"to",
"consider",
"for",
"analysis"
] | def get_candidate_files(self):
"""Query git to get a list of all files in the repo to consider for
analysis
"""
return self._git_ls_files(["ls-files", "--cached"]) | [
"def",
"get_candidate_files",
"(",
"self",
")",
":",
"return",
"self",
".",
"_git_ls_files",
"(",
"[",
"\"ls-files\"",
",",
"\"--cached\"",
"]",
")"
] | https://github.com/MRPT/mrpt/blob/b0be3557a4cded6bafff03feb28f7fa1f75762a3/scripts/clang_git_format/clang_git_format/repo.py#L220-L224 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/stats/mstats_basic.py | python | winsorize | (a, limits=None, inclusive=(True, True), inplace=False,
axis=None) | Returns a Winsorized version of the input array.
The (limits[0])th lowest values are set to the (limits[0])th percentile,
and the (limits[1])th highest values are set to the (1 - limits[1])th
percentile.
Masked values are skipped.
Parameters
----------
a : sequence
Input array.
... | Returns a Winsorized version of the input array. | [
"Returns",
"a",
"Winsorized",
"version",
"of",
"the",
"input",
"array",
"."
] | def winsorize(a, limits=None, inclusive=(True, True), inplace=False,
axis=None):
"""Returns a Winsorized version of the input array.
The (limits[0])th lowest values are set to the (limits[0])th percentile,
and the (limits[1])th highest values are set to the (1 - limits[1])th
percentile.
... | [
"def",
"winsorize",
"(",
"a",
",",
"limits",
"=",
"None",
",",
"inclusive",
"=",
"(",
"True",
",",
"True",
")",
",",
"inplace",
"=",
"False",
",",
"axis",
"=",
"None",
")",
":",
"def",
"_winsorize1D",
"(",
"a",
",",
"low_limit",
",",
"up_limit",
",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/stats/mstats_basic.py#L1963-L2042 | ||
PX4/PX4-Autopilot | 0b9f60a0370be53d683352c63fd92db3d6586e18 | Tools/mavlink_px4.py | python | MAVLink.data_stream_send | (self, stream_id, message_rate, on_off) | return self.send(self.data_stream_encode(stream_id, message_rate, on_off)) | stream_id : The ID of the requested data stream (uint8_t)
message_rate : The requested interval between two messages of this type (uint16_t)
on_off : 1 stream is enabled, 0 stream is stopped. (uint8_t) | [] | def data_stream_send(self, stream_id, message_rate, on_off):
'''
stream_id : The ID of the requested data stream (uint8_t)
message_rate : The requested interval between two messages of this type (uint16_t)
on_... | [
"def",
"data_stream_send",
"(",
"self",
",",
"stream_id",
",",
"message_rate",
",",
"on_off",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"data_stream_encode",
"(",
"stream_id",
",",
"message_rate",
",",
"on_off",
")",
")"
] | https://github.com/PX4/PX4-Autopilot/blob/0b9f60a0370be53d683352c63fd92db3d6586e18/Tools/mavlink_px4.py#L4262-L4271 | ||
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/base.py | python | _get_op_submodule_name | (op_name, op_name_prefix, submodule_name_list) | return "" | Get the submodule name of a specific op | Get the submodule name of a specific op | [
"Get",
"the",
"submodule",
"name",
"of",
"a",
"specific",
"op"
] | def _get_op_submodule_name(op_name, op_name_prefix, submodule_name_list):
"""Get the submodule name of a specific op"""
assert op_name.startswith(op_name_prefix)
for submodule_name in submodule_name_list:
if op_name[len(op_name_prefix):].startswith(submodule_name):
return submodule_name
... | [
"def",
"_get_op_submodule_name",
"(",
"op_name",
",",
"op_name_prefix",
",",
"submodule_name_list",
")",
":",
"assert",
"op_name",
".",
"startswith",
"(",
"op_name_prefix",
")",
"for",
"submodule_name",
"in",
"submodule_name_list",
":",
"if",
"op_name",
"[",
"len",
... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/base.py#L860-L866 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/servicelib/service.py | python | Service.service | (self) | Request for the service task.
Servicing is disabled if it is disabled thourght the "enabled"
attribute. When the task is executing, the service is disabled to
avoid recursion. | Request for the service task.
Servicing is disabled if it is disabled thourght the "enabled"
attribute. When the task is executing, the service is disabled to
avoid recursion. | [
"Request",
"for",
"the",
"service",
"task",
".",
"Servicing",
"is",
"disabled",
"if",
"it",
"is",
"disabled",
"thourght",
"the",
"enabled",
"attribute",
".",
"When",
"the",
"task",
"is",
"executing",
"the",
"service",
"is",
"disabled",
"to",
"avoid",
"recurs... | def service(self):
"""
Request for the service task.
Servicing is disabled if it is disabled thourght the "enabled"
attribute. When the task is executing, the service is disabled to
avoid recursion.
"""
if self.enabled:
enable = self.enabled
... | [
"def",
"service",
"(",
"self",
")",
":",
"if",
"self",
".",
"enabled",
":",
"enable",
"=",
"self",
".",
"enabled",
"try",
":",
"# Prevent recursion",
"self",
".",
"enabled",
"=",
"False",
"next",
"(",
"self",
".",
"_task",
")",
"finally",
":",
"self",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/servicelib/service.py#L18-L32 | ||
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py | python | copyCharMultiByte | (out, val) | return ret | append the char value in the array | append the char value in the array | [
"append",
"the",
"char",
"value",
"in",
"the",
"array"
] | def copyCharMultiByte(out, val):
"""append the char value in the array """
ret = libxml2mod.xmlCopyCharMultiByte(out, val)
return ret | [
"def",
"copyCharMultiByte",
"(",
"out",
",",
"val",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlCopyCharMultiByte",
"(",
"out",
",",
"val",
")",
"return",
"ret"
] | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py#L674-L677 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/framework/python/ops/variables.py | python | assign_from_values | (var_names_to_values) | return assign_op, feed_dict | Creates an assignment operation from a given mapping.
This function provides a mechanism for performing assignment of variables
to values in a way that does not fill the graph with large assignment values.
Args:
var_names_to_values: A map from variable names to values.
Returns:
assign_op: An `Operati... | Creates an assignment operation from a given mapping. | [
"Creates",
"an",
"assignment",
"operation",
"from",
"a",
"given",
"mapping",
"."
] | def assign_from_values(var_names_to_values):
"""Creates an assignment operation from a given mapping.
This function provides a mechanism for performing assignment of variables
to values in a way that does not fill the graph with large assignment values.
Args:
var_names_to_values: A map from variable names... | [
"def",
"assign_from_values",
"(",
"var_names_to_values",
")",
":",
"feed_dict",
"=",
"{",
"}",
"assign_ops",
"=",
"[",
"]",
"for",
"var_name",
"in",
"var_names_to_values",
":",
"var_value",
"=",
"var_names_to_values",
"[",
"var_name",
"]",
"var",
"=",
"ops",
"... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/framework/python/ops/variables.py#L514-L566 | |
apache/kudu | 90895ce76590f10730ad7aac3613b69d89ff5422 | build-support/iwyu/fix_includes.py | python | _MarkHeaderGuardIfPresent | (file_lines) | If any line in file_lines is a header-guard, mark it in file_lines.
We define a header-guard as follows: an #ifdef where there is
nothing contentful before or after the #ifdef. Also, the #ifdef
should have no #elif in it (though we don't currently test that).
This catches the common case of an 'ifdef guard' i... | If any line in file_lines is a header-guard, mark it in file_lines. | [
"If",
"any",
"line",
"in",
"file_lines",
"is",
"a",
"header",
"-",
"guard",
"mark",
"it",
"in",
"file_lines",
"."
] | def _MarkHeaderGuardIfPresent(file_lines):
"""If any line in file_lines is a header-guard, mark it in file_lines.
We define a header-guard as follows: an #ifdef where there is
nothing contentful before or after the #ifdef. Also, the #ifdef
should have no #elif in it (though we don't currently test that).
Th... | [
"def",
"_MarkHeaderGuardIfPresent",
"(",
"file_lines",
")",
":",
"# Pass over blank lines, pragmas and comments at the top of the file.",
"i",
"=",
"0",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"file_lines",
")",
")",
":",
"if",
"(",
"not",
"file_lines",
"[",
"... | https://github.com/apache/kudu/blob/90895ce76590f10730ad7aac3613b69d89ff5422/build-support/iwyu/fix_includes.py#L637-L698 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/cookielib.py | python | eff_request_host | (request) | return req_host, erhn | Return a tuple (request-host, effective request-host name).
As defined by RFC 2965, except both are lowercased. | Return a tuple (request-host, effective request-host name). | [
"Return",
"a",
"tuple",
"(",
"request",
"-",
"host",
"effective",
"request",
"-",
"host",
"name",
")",
"."
] | def eff_request_host(request):
"""Return a tuple (request-host, effective request-host name).
As defined by RFC 2965, except both are lowercased.
"""
erhn = req_host = request_host(request)
if req_host.find(".") == -1 and not IPV4_RE.search(req_host):
erhn = req_host + ".local"
return ... | [
"def",
"eff_request_host",
"(",
"request",
")",
":",
"erhn",
"=",
"req_host",
"=",
"request_host",
"(",
"request",
")",
"if",
"req_host",
".",
"find",
"(",
"\".\"",
")",
"==",
"-",
"1",
"and",
"not",
"IPV4_RE",
".",
"search",
"(",
"req_host",
")",
":",... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/cookielib.py#L598-L607 | |
nyuwireless-unipd/ns3-mmwave | 4ff9e87e8079764e04cbeccd8e85bff15ae16fb3 | utils/grid.py | python | TimelinesRenderer.layout | (self, width) | ! Get Data X Start
@param self this object
@param width width
@return none | ! Get Data X Start | [
"!",
"Get",
"Data",
"X",
"Start"
] | def layout(self, width):
"""! Get Data X Start
@param self this object
@param width width
@return none
"""
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 1, 1)
ctx = cairo.Context(surface)
max_text_height = ctx.text_extents("ABCDEFGHIJKLMNOPQRSTUVWXYZa... | [
"def",
"layout",
"(",
"self",
",",
"width",
")",
":",
"surface",
"=",
"cairo",
".",
"ImageSurface",
"(",
"cairo",
".",
"FORMAT_ARGB32",
",",
"1",
",",
"1",
")",
"ctx",
"=",
"cairo",
".",
"Context",
"(",
"surface",
")",
"max_text_height",
"=",
"ctx",
... | https://github.com/nyuwireless-unipd/ns3-mmwave/blob/4ff9e87e8079764e04cbeccd8e85bff15ae16fb3/utils/grid.py#L664-L710 | ||
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/oldnumeric/ma.py | python | allclose | (a, b, fill_value=1, rtol=1.e-5, atol=1.e-8) | return fromnumeric.alltrue(fromnumeric.ravel(d)) | Returns true if all components of a and b are equal
subject to given tolerances.
If fill_value is 1, masked values considered equal.
If fill_value is 0, masked values considered unequal.
The relative error rtol should be positive and << 1.0
The absolute error atol comes into play... | Returns true if all components of a and b are equal
subject to given tolerances.
If fill_value is 1, masked values considered equal.
If fill_value is 0, masked values considered unequal.
The relative error rtol should be positive and << 1.0
The absolute error atol comes into play... | [
"Returns",
"true",
"if",
"all",
"components",
"of",
"a",
"and",
"b",
"are",
"equal",
"subject",
"to",
"given",
"tolerances",
".",
"If",
"fill_value",
"is",
"1",
"masked",
"values",
"considered",
"equal",
".",
"If",
"fill_value",
"is",
"0",
"masked",
"value... | def allclose (a, b, fill_value=1, rtol=1.e-5, atol=1.e-8):
""" Returns true if all components of a and b are equal
subject to given tolerances.
If fill_value is 1, masked values considered equal.
If fill_value is 0, masked values considered unequal.
The relative error rtol should be ... | [
"def",
"allclose",
"(",
"a",
",",
"b",
",",
"fill_value",
"=",
"1",
",",
"rtol",
"=",
"1.e-5",
",",
"atol",
"=",
"1.e-8",
")",
":",
"m",
"=",
"mask_or",
"(",
"getmask",
"(",
"a",
")",
",",
"getmask",
"(",
"b",
")",
")",
"d1",
"=",
"filled",
"... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/oldnumeric/ma.py#L1436-L1451 | |
zhuli19901106/leetcode-zhuli | 0f8fc29ccb8c33ea91149ecb2d4e961024c11db7 | algorithms/0501-1000/0622_design-circular-queue_1_AC.py | python | MyCircularQueue.isEmpty | (self) | return self.size == 0 | Checks whether the circular queue is empty or not. | Checks whether the circular queue is empty or not. | [
"Checks",
"whether",
"the",
"circular",
"queue",
"is",
"empty",
"or",
"not",
"."
] | def isEmpty(self) -> bool:
"""
Checks whether the circular queue is empty or not.
"""
return self.size == 0 | [
"def",
"isEmpty",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"size",
"==",
"0"
] | https://github.com/zhuli19901106/leetcode-zhuli/blob/0f8fc29ccb8c33ea91149ecb2d4e961024c11db7/algorithms/0501-1000/0622_design-circular-queue_1_AC.py#L54-L58 | |
microsoft/TSS.MSR | 0f2516fca2cd9929c31d5450e39301c9bde43688 | TSS.Py/src/TpmTypes.py | python | GetSessionAuditDigestResponse.fromTpm | (buf) | return buf.createObj(GetSessionAuditDigestResponse) | Returns new GetSessionAuditDigestResponse object constructed from
its marshaled representation in the given TpmBuffer buffer | Returns new GetSessionAuditDigestResponse object constructed from
its marshaled representation in the given TpmBuffer buffer | [
"Returns",
"new",
"GetSessionAuditDigestResponse",
"object",
"constructed",
"from",
"its",
"marshaled",
"representation",
"in",
"the",
"given",
"TpmBuffer",
"buffer"
] | def fromTpm(buf):
""" Returns new GetSessionAuditDigestResponse object constructed from
its marshaled representation in the given TpmBuffer buffer
"""
return buf.createObj(GetSessionAuditDigestResponse) | [
"def",
"fromTpm",
"(",
"buf",
")",
":",
"return",
"buf",
".",
"createObj",
"(",
"GetSessionAuditDigestResponse",
")"
] | https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L12856-L12860 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_controls.py | python | DatePickerCtrl.Create | (*args, **kwargs) | return _controls_.DatePickerCtrl_Create(*args, **kwargs) | Create(self, Window parent, int id=-1, DateTime dt=wxDefaultDateTime,
Point pos=DefaultPosition, Size size=DefaultSize,
long style=wxDP_DEFAULT|wxDP_SHOWCENTURY,
Validator validator=DefaultValidator,
String name=DatePickerCtrlNameStr) -> bool
Create the GUI p... | Create(self, Window parent, int id=-1, DateTime dt=wxDefaultDateTime,
Point pos=DefaultPosition, Size size=DefaultSize,
long style=wxDP_DEFAULT|wxDP_SHOWCENTURY,
Validator validator=DefaultValidator,
String name=DatePickerCtrlNameStr) -> bool | [
"Create",
"(",
"self",
"Window",
"parent",
"int",
"id",
"=",
"-",
"1",
"DateTime",
"dt",
"=",
"wxDefaultDateTime",
"Point",
"pos",
"=",
"DefaultPosition",
"Size",
"size",
"=",
"DefaultSize",
"long",
"style",
"=",
"wxDP_DEFAULT|wxDP_SHOWCENTURY",
"Validator",
"va... | def Create(*args, **kwargs):
"""
Create(self, Window parent, int id=-1, DateTime dt=wxDefaultDateTime,
Point pos=DefaultPosition, Size size=DefaultSize,
long style=wxDP_DEFAULT|wxDP_SHOWCENTURY,
Validator validator=DefaultValidator,
String name=DatePic... | [
"def",
"Create",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"DatePickerCtrl_Create",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_controls.py#L6526-L6537 | |
neopenx/Dragon | 0e639a7319035ddc81918bd3df059230436ee0a1 | Dragon/python/dragon/vm/caffe/net.py | python | Net.copy_from | (self, model) | Copy the parameters from the binary proto file. [**PyCaffe Style**]
Parameters
----------
model : str
The path of the ``.caffemodel`` file.
See Also
--------
`workspace.Restore(*args, **kwargs)`_ - How to restore tensors from a file.
References
... | Copy the parameters from the binary proto file. [**PyCaffe Style**] | [
"Copy",
"the",
"parameters",
"from",
"the",
"binary",
"proto",
"file",
".",
"[",
"**",
"PyCaffe",
"Style",
"**",
"]"
] | def copy_from(self, model):
"""Copy the parameters from the binary proto file. [**PyCaffe Style**]
Parameters
----------
model : str
The path of the ``.caffemodel`` file.
See Also
--------
`workspace.Restore(*args, **kwargs)`_ - How to restore tensor... | [
"def",
"copy_from",
"(",
"self",
",",
"model",
")",
":",
"ws",
".",
"Restore",
"(",
"model",
",",
"format",
"=",
"'caffe'",
")"
] | https://github.com/neopenx/Dragon/blob/0e639a7319035ddc81918bd3df059230436ee0a1/Dragon/python/dragon/vm/caffe/net.py#L312-L329 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/artmanager.py | python | ArtManager.GetTextStartLocation | (self, dc, rect, bitmap, text, style=0) | return startLocationX, startLocationY, fixedText | Returns the top left `x` and `y` cordinates of the text drawing.
In case the text is too long, the text is being fixed (the text is cut and
a '...' mark is added in the end).
:param `dc`: an instance of :class:`DC`;
:param Rect `rect`: the text's client rectangle;
:param Bitmap ... | Returns the top left `x` and `y` cordinates of the text drawing.
In case the text is too long, the text is being fixed (the text is cut and
a '...' mark is added in the end). | [
"Returns",
"the",
"top",
"left",
"x",
"and",
"y",
"cordinates",
"of",
"the",
"text",
"drawing",
".",
"In",
"case",
"the",
"text",
"is",
"too",
"long",
"the",
"text",
"is",
"being",
"fixed",
"(",
"the",
"text",
"is",
"cut",
"and",
"a",
"...",
"mark",
... | def GetTextStartLocation(self, dc, rect, bitmap, text, style=0):
"""
Returns the top left `x` and `y` cordinates of the text drawing.
In case the text is too long, the text is being fixed (the text is cut and
a '...' mark is added in the end).
:param `dc`: an instance of :class:... | [
"def",
"GetTextStartLocation",
"(",
"self",
",",
"dc",
",",
"rect",
",",
"bitmap",
",",
"text",
",",
"style",
"=",
"0",
")",
":",
"alignmentBuffer",
"=",
"self",
".",
"GetAlignBuffer",
"(",
")",
"# get the bitmap offset",
"bitmapOffset",
"=",
"0",
"if",
"b... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/artmanager.py#L1537-L1598 | |
weolar/miniblink49 | 1c4678db0594a4abde23d3ebbcc7cd13c3170777 | third_party/skia/bench/tile_analyze.py | python | OutputTileAnalysis | (rev, representation_alg, bench_dir, platform) | return (js_codes, body_codes) | Reads skp bench data and outputs tile vs. viewport analysis for the given
platform.
Ignores data with revisions other than rev. If bench_dir is not empty, read
from the local directory instead of Google Storage.
Uses the provided representation_alg for calculating bench representations.
Returns (js_codes, b... | Reads skp bench data and outputs tile vs. viewport analysis for the given
platform. | [
"Reads",
"skp",
"bench",
"data",
"and",
"outputs",
"tile",
"vs",
".",
"viewport",
"analysis",
"for",
"the",
"given",
"platform",
"."
] | def OutputTileAnalysis(rev, representation_alg, bench_dir, platform):
"""Reads skp bench data and outputs tile vs. viewport analysis for the given
platform.
Ignores data with revisions other than rev. If bench_dir is not empty, read
from the local directory instead of Google Storage.
Uses the provided repres... | [
"def",
"OutputTileAnalysis",
"(",
"rev",
",",
"representation_alg",
",",
"bench_dir",
",",
"platform",
")",
":",
"js_codes",
"=",
"''",
"body_codes",
"=",
"(",
"'}</script></head><body>'",
"'<h3>PLATFORM: %s REVISION: %s</h3><br>'",
"%",
"(",
"platform",
",",
"rev",
... | https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/third_party/skia/bench/tile_analyze.py#L183-L249 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/animate.py | python | AnimationCtrlBase.LoadFile | (*args, **kwargs) | return _animate.AnimationCtrlBase_LoadFile(*args, **kwargs) | LoadFile(self, String filename, int type=ANIMATION_TYPE_ANY) -> bool | LoadFile(self, String filename, int type=ANIMATION_TYPE_ANY) -> bool | [
"LoadFile",
"(",
"self",
"String",
"filename",
"int",
"type",
"=",
"ANIMATION_TYPE_ANY",
")",
"-",
">",
"bool"
] | def LoadFile(*args, **kwargs):
"""LoadFile(self, String filename, int type=ANIMATION_TYPE_ANY) -> bool"""
return _animate.AnimationCtrlBase_LoadFile(*args, **kwargs) | [
"def",
"LoadFile",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_animate",
".",
"AnimationCtrlBase_LoadFile",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/animate.py#L152-L154 | |
MegEngine/MegEngine | ce9ad07a27ec909fb8db4dd67943d24ba98fb93a | imperative/python/megengine/quantization/quantize.py | python | hook_qat_module | (module: Module, func: Callable) | return hooks | r"""Add hooks for all :class:`~.QATModule` submodule | r"""Add hooks for all :class:`~.QATModule` submodule | [
"r",
"Add",
"hooks",
"for",
"all",
":",
"class",
":",
"~",
".",
"QATModule",
"submodule"
] | def hook_qat_module(module: Module, func: Callable):
r"""Add hooks for all :class:`~.QATModule` submodule"""
def is_qat(mod: Module):
return isinstance(mod, QATModule)
hooks = []
for submodule in list(module._flatten(predicate=is_qat)):
hooks.append(submodule.register_forward_hook(func... | [
"def",
"hook_qat_module",
"(",
"module",
":",
"Module",
",",
"func",
":",
"Callable",
")",
":",
"def",
"is_qat",
"(",
"mod",
":",
"Module",
")",
":",
"return",
"isinstance",
"(",
"mod",
",",
"QATModule",
")",
"hooks",
"=",
"[",
"]",
"for",
"submodule",... | https://github.com/MegEngine/MegEngine/blob/ce9ad07a27ec909fb8db4dd67943d24ba98fb93a/imperative/python/megengine/quantization/quantize.py#L187-L197 | |
rdkit/rdkit | ede860ae316d12d8568daf5ee800921c3389c84e | rdkit/ML/ScreenComposite.py | python | MakePredPlot | (details, indices, data, goodVotes, badVotes, nRes, idCol=0, verbose=0) | **Arguments**
- details: a CompositeRun.RunDetails object
- indices: a sequence of integer indices into _data_
- data: the data set in question. We assume that the ids for
the data points are in the _idCol_ column
- goodVotes/badVotes: predictions where the model was correct/incorrect.
... | [] | def MakePredPlot(details, indices, data, goodVotes, badVotes, nRes, idCol=0, verbose=0):
"""
**Arguments**
- details: a CompositeRun.RunDetails object
- indices: a sequence of integer indices into _data_
- data: the data set in question. We assume that the ids for
the data points are in the ... | [
"def",
"MakePredPlot",
"(",
"details",
",",
"indices",
",",
"data",
",",
"goodVotes",
",",
"badVotes",
",",
"nRes",
",",
"idCol",
"=",
"0",
",",
"verbose",
"=",
"0",
")",
":",
"if",
"not",
"hasattr",
"(",
"details",
",",
"'predPlot'",
")",
"or",
"not... | https://github.com/rdkit/rdkit/blob/ede860ae316d12d8568daf5ee800921c3389c84e/rdkit/ML/ScreenComposite.py#L1060-L1178 | |||
espressomd/espresso | 7e29f9052e710fe1ebf0f5d2a8076b32921fbc6a | src/python/espressomd/io/writer/vtf.py | python | vtf_pid_map | (system, types='all') | return dict(zip(id_to_write, range(len(id_to_write)))) | Generates a VTF particle index map to ESPResSo ``id``.
This fills the gap for particle ID's as required by VMD.
Parameters
----------
system: :obj:`espressomd.system.System`
types : :obj:`str`
Specifies the particle types. The id mapping depends on which
particles are going to be pr... | Generates a VTF particle index map to ESPResSo ``id``.
This fills the gap for particle ID's as required by VMD. | [
"Generates",
"a",
"VTF",
"particle",
"index",
"map",
"to",
"ESPResSo",
"id",
".",
"This",
"fills",
"the",
"gap",
"for",
"particle",
"ID",
"s",
"as",
"required",
"by",
"VMD",
"."
] | def vtf_pid_map(system, types='all'):
"""
Generates a VTF particle index map to ESPResSo ``id``.
This fills the gap for particle ID's as required by VMD.
Parameters
----------
system: :obj:`espressomd.system.System`
types : :obj:`str`
Specifies the particle types. The id mapping dep... | [
"def",
"vtf_pid_map",
"(",
"system",
",",
"types",
"=",
"'all'",
")",
":",
"if",
"not",
"hasattr",
"(",
"types",
",",
"'__iter__'",
")",
":",
"types",
"=",
"[",
"types",
"]",
"if",
"types",
"==",
"\"all\"",
":",
"types",
"=",
"[",
"types",
"]",
"id... | https://github.com/espressomd/espresso/blob/7e29f9052e710fe1ebf0f5d2a8076b32921fbc6a/src/python/espressomd/io/writer/vtf.py#L19-L47 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | EvtHandler.GetPreviousHandler | (*args, **kwargs) | return _core_.EvtHandler_GetPreviousHandler(*args, **kwargs) | GetPreviousHandler(self) -> EvtHandler | GetPreviousHandler(self) -> EvtHandler | [
"GetPreviousHandler",
"(",
"self",
")",
"-",
">",
"EvtHandler"
] | def GetPreviousHandler(*args, **kwargs):
"""GetPreviousHandler(self) -> EvtHandler"""
return _core_.EvtHandler_GetPreviousHandler(*args, **kwargs) | [
"def",
"GetPreviousHandler",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"EvtHandler_GetPreviousHandler",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L4124-L4126 | |
Constellation/iv | 64c3a9c7c517063f29d90d449180ea8f6f4d946f | tools/cpplint.py | python | FindStartOfExpressionInLine | (line, endpos, depth, startchar, endchar) | return (-1, depth) | Find position at the matching startchar.
This is almost the reverse of FindEndOfExpressionInLine, but note
that the input position and returned position differs by 1.
Args:
line: a CleansedLines line.
endpos: start searching at this position.
depth: nesting level at endpos.
startchar: expression... | Find position at the matching startchar. | [
"Find",
"position",
"at",
"the",
"matching",
"startchar",
"."
] | def FindStartOfExpressionInLine(line, endpos, depth, startchar, endchar):
"""Find position at the matching startchar.
This is almost the reverse of FindEndOfExpressionInLine, but note
that the input position and returned position differs by 1.
Args:
line: a CleansedLines line.
endpos: start searching ... | [
"def",
"FindStartOfExpressionInLine",
"(",
"line",
",",
"endpos",
",",
"depth",
",",
"startchar",
",",
"endchar",
")",
":",
"for",
"i",
"in",
"xrange",
"(",
"endpos",
",",
"-",
"1",
",",
"-",
"1",
")",
":",
"if",
"line",
"[",
"i",
"]",
"==",
"endch... | https://github.com/Constellation/iv/blob/64c3a9c7c517063f29d90d449180ea8f6f4d946f/tools/cpplint.py#L1288-L1312 | |
mongodb/mongo-cxx-driver | eb86512b05be20d2f51d53ba9b860c709e0799b3 | etc/clang_format.py | python | parallel_process | (items, func) | return pp_result[0] | Run a set of work items to completion | Run a set of work items to completion | [
"Run",
"a",
"set",
"of",
"work",
"items",
"to",
"completion"
] | def parallel_process(items, func):
"""Run a set of work items to completion
"""
try:
cpus = cpu_count()
except NotImplementedError:
cpus = 1
task_queue = Queue.Queue()
# Use a list so that worker function will capture this variable
pp_event = threading.Event()
pp_result... | [
"def",
"parallel_process",
"(",
"items",
",",
"func",
")",
":",
"try",
":",
"cpus",
"=",
"cpu_count",
"(",
")",
"except",
"NotImplementedError",
":",
"cpus",
"=",
"1",
"task_queue",
"=",
"Queue",
".",
"Queue",
"(",
")",
"# Use a list so that worker function wi... | https://github.com/mongodb/mongo-cxx-driver/blob/eb86512b05be20d2f51d53ba9b860c709e0799b3/etc/clang_format.py#L334-L397 | |
cathywu/Sentiment-Analysis | eb501fd1375c0c3f3ab430f963255f1bb858e659 | PyML-0.7.9/PyML/evaluators/assess.py | python | test | (classifier, data, **args) | return res | test a classifier on a given dataset
:Parameters:
- `classifier` - a trained classifier
- `data` - a dataset
:Return:
a Results class instance
:Keywords:
- `stats` - whether to compute the statistics of the match between the
predicted labels and the given labels ... | test a classifier on a given dataset
:Parameters:
- `classifier` - a trained classifier
- `data` - a dataset
:Return:
a Results class instance | [
"test",
"a",
"classifier",
"on",
"a",
"given",
"dataset",
":",
"Parameters",
":",
"-",
"classifier",
"-",
"a",
"trained",
"classifier",
"-",
"data",
"-",
"a",
"dataset",
":",
"Return",
":",
"a",
"Results",
"class",
"instance"
] | def test(classifier, data, **args) :
"""test a classifier on a given dataset
:Parameters:
- `classifier` - a trained classifier
- `data` - a dataset
:Return:
a Results class instance
:Keywords:
- `stats` - whether to compute the statistics of the match between the
... | [
"def",
"test",
"(",
"classifier",
",",
"data",
",",
"*",
"*",
"args",
")",
":",
"if",
"'verbose'",
"in",
"args",
":",
"verbose",
"=",
"args",
"[",
"'verbose'",
"]",
"else",
":",
"verbose",
"=",
"1",
"if",
"verbose",
":",
"print",
"'testing'",
",",
... | https://github.com/cathywu/Sentiment-Analysis/blob/eb501fd1375c0c3f3ab430f963255f1bb858e659/PyML-0.7.9/PyML/evaluators/assess.py#L16-L70 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/mailbox.py | python | MaildirMessage.set_subdir | (self, subdir) | Set subdir to 'new' or 'cur'. | Set subdir to 'new' or 'cur'. | [
"Set",
"subdir",
"to",
"new",
"or",
"cur",
"."
] | def set_subdir(self, subdir):
"""Set subdir to 'new' or 'cur'."""
if subdir == 'new' or subdir == 'cur':
self._subdir = subdir
else:
raise ValueError("subdir must be 'new' or 'cur': %s" % subdir) | [
"def",
"set_subdir",
"(",
"self",
",",
"subdir",
")",
":",
"if",
"subdir",
"==",
"'new'",
"or",
"subdir",
"==",
"'cur'",
":",
"self",
".",
"_subdir",
"=",
"subdir",
"else",
":",
"raise",
"ValueError",
"(",
"\"subdir must be 'new' or 'cur': %s\"",
"%",
"subdi... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/mailbox.py#L1539-L1544 | ||
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/tools/gyp/pylib/gyp/input.py | python | IsStrCanonicalInt | (string) | return False | Returns True if |string| is in its canonical integer form.
The canonical form is such that str(int(string)) == string. | Returns True if |string| is in its canonical integer form. | [
"Returns",
"True",
"if",
"|string|",
"is",
"in",
"its",
"canonical",
"integer",
"form",
"."
] | def IsStrCanonicalInt(string):
"""Returns True if |string| is in its canonical integer form.
The canonical form is such that str(int(string)) == string.
"""
if type(string) is str:
# This function is called a lot so for maximum performance, avoid
# involving regexps which would otherwise ma... | [
"def",
"IsStrCanonicalInt",
"(",
"string",
")",
":",
"if",
"type",
"(",
"string",
")",
"is",
"str",
":",
"# This function is called a lot so for maximum performance, avoid",
"# involving regexps which would otherwise make the code much",
"# shorter. Regexps would need twice the time ... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/gyp/pylib/gyp/input.py#L692-L711 | |
OSGeo/gdal | 3748fc4ba4fba727492774b2b908a2130c864a83 | swig/python/gdal-utils/osgeo_utils/gdal2tiles.py | python | GlobalGeodetic.PixelsToTile | (self, px, py) | return tx, ty | Returns coordinates of the tile covering region in pixel coordinates | Returns coordinates of the tile covering region in pixel coordinates | [
"Returns",
"coordinates",
"of",
"the",
"tile",
"covering",
"region",
"in",
"pixel",
"coordinates"
] | def PixelsToTile(self, px, py):
"Returns coordinates of the tile covering region in pixel coordinates"
tx = int(math.ceil(px / float(self.tile_size)) - 1)
ty = int(math.ceil(py / float(self.tile_size)) - 1)
return tx, ty | [
"def",
"PixelsToTile",
"(",
"self",
",",
"px",
",",
"py",
")",
":",
"tx",
"=",
"int",
"(",
"math",
".",
"ceil",
"(",
"px",
"/",
"float",
"(",
"self",
".",
"tile_size",
")",
")",
"-",
"1",
")",
"ty",
"=",
"int",
"(",
"math",
".",
"ceil",
"(",
... | https://github.com/OSGeo/gdal/blob/3748fc4ba4fba727492774b2b908a2130c864a83/swig/python/gdal-utils/osgeo_utils/gdal2tiles.py#L515-L520 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/lib/io/file_io.py | python | create_dir | (dirname) | Creates a directory with the name 'dirname'.
Args:
dirname: string, name of the directory to be created
Notes:
The parent directories need to exist. Use recursive_create_dir instead if
there is the possibility that the parent dirs don't exist.
Raises:
errors.OpError: If the operation fails. | Creates a directory with the name 'dirname'. | [
"Creates",
"a",
"directory",
"with",
"the",
"name",
"dirname",
"."
] | def create_dir(dirname):
"""Creates a directory with the name 'dirname'.
Args:
dirname: string, name of the directory to be created
Notes:
The parent directories need to exist. Use recursive_create_dir instead if
there is the possibility that the parent dirs don't exist.
Raises:
errors.OpErro... | [
"def",
"create_dir",
"(",
"dirname",
")",
":",
"with",
"errors",
".",
"raise_exception_on_not_ok_status",
"(",
")",
"as",
"status",
":",
"pywrap_tensorflow",
".",
"CreateDir",
"(",
"compat",
".",
"as_bytes",
"(",
"dirname",
")",
",",
"status",
")"
] | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/lib/io/file_io.py#L338-L352 | ||
bareos/bareos | 56a10bb368b0a81e977bb51304033fe49d59efb0 | restapi/bareos_restapi/__init__.py | python | move_volume | (
*,
response: Response,
current_user: User = Depends(get_current_user),
moveParams: volumeMove = Body(..., title="Volume move parameters"),
) | return responseDict | Move a volume, using the _move_ command
TODO: handle encrypt flag | Move a volume, using the _move_ command
TODO: handle encrypt flag | [
"Move",
"a",
"volume",
"using",
"the",
"_move_",
"command",
"TODO",
":",
"handle",
"encrypt",
"flag"
] | def move_volume(
*,
response: Response,
current_user: User = Depends(get_current_user),
moveParams: volumeMove = Body(..., title="Volume move parameters"),
):
"""
Move a volume, using the _move_ command
TODO: handle encrypt flag
"""
responseDict = {}
updateCommand = "move"
up... | [
"def",
"move_volume",
"(",
"*",
",",
"response",
":",
"Response",
",",
"current_user",
":",
"User",
"=",
"Depends",
"(",
"get_current_user",
")",
",",
"moveParams",
":",
"volumeMove",
"=",
"Body",
"(",
"...",
",",
"title",
"=",
"\"Volume move parameters\"",
... | https://github.com/bareos/bareos/blob/56a10bb368b0a81e977bb51304033fe49d59efb0/restapi/bareos_restapi/__init__.py#L1322-L1345 | |
panda3d/panda3d | 833ad89ebad58395d0af0b7ec08538e5e4308265 | direct/src/fsm/State.py | python | State.hasChildren | (self) | return len(self.__FSMList) > 0 | Return true if state has child FSMs | Return true if state has child FSMs | [
"Return",
"true",
"if",
"state",
"has",
"child",
"FSMs"
] | def hasChildren(self):
"""
Return true if state has child FSMs
"""
return len(self.__FSMList) > 0 | [
"def",
"hasChildren",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"__FSMList",
")",
">",
"0"
] | https://github.com/panda3d/panda3d/blob/833ad89ebad58395d0af0b7ec08538e5e4308265/direct/src/fsm/State.py#L155-L159 | |
apache/qpid-proton | 6bcdfebb55ea3554bc29b1901422532db331a591 | python/proton/_transport.py | python | SSLDomain.set_credentials | (self, cert_file: str, key_file: str, password: Optional[str]) | return self._check(pn_ssl_domain_set_credentials(self._domain,
cert_file, key_file,
password)) | Set the certificate that identifies the local node to the remote.
This certificate establishes the identity for the local node for all :class:`SSL` sessions
created from this domain. It will be sent to the remote if the remote needs to verify
the identity of this node. This may be used for bo... | Set the certificate that identifies the local node to the remote. | [
"Set",
"the",
"certificate",
"that",
"identifies",
"the",
"local",
"node",
"to",
"the",
"remote",
"."
] | def set_credentials(self, cert_file: str, key_file: str, password: Optional[str]) -> int:
"""
Set the certificate that identifies the local node to the remote.
This certificate establishes the identity for the local node for all :class:`SSL` sessions
created from this domain. It will b... | [
"def",
"set_credentials",
"(",
"self",
",",
"cert_file",
":",
"str",
",",
"key_file",
":",
"str",
",",
"password",
":",
"Optional",
"[",
"str",
"]",
")",
"->",
"int",
":",
"return",
"self",
".",
"_check",
"(",
"pn_ssl_domain_set_credentials",
"(",
"self",
... | https://github.com/apache/qpid-proton/blob/6bcdfebb55ea3554bc29b1901422532db331a591/python/proton/_transport.py#L729-L757 | |
NVIDIA/TensorRT | 42805f078052daad1a98bc5965974fcffaad0960 | tools/pytorch-quantization/pytorch_quantization/tensor_quant.py | python | ScaledQuantDescriptor.from_yaml | (cls, yaml_str) | return quant_desc | Create descriptor from yaml str | Create descriptor from yaml str | [
"Create",
"descriptor",
"from",
"yaml",
"str"
] | def from_yaml(cls, yaml_str):
"""Create descriptor from yaml str"""
obj_dict = yaml.safe_load(yaml_str)
if 'axis' in obj_dict:
obj_dict['axis'] = tuple(obj_dict['axis'])
quant_desc = cls(**obj_dict)
return quant_desc | [
"def",
"from_yaml",
"(",
"cls",
",",
"yaml_str",
")",
":",
"obj_dict",
"=",
"yaml",
".",
"safe_load",
"(",
"yaml_str",
")",
"if",
"'axis'",
"in",
"obj_dict",
":",
"obj_dict",
"[",
"'axis'",
"]",
"=",
"tuple",
"(",
"obj_dict",
"[",
"'axis'",
"]",
")",
... | https://github.com/NVIDIA/TensorRT/blob/42805f078052daad1a98bc5965974fcffaad0960/tools/pytorch-quantization/pytorch_quantization/tensor_quant.py#L208-L217 | |
intel-iot-devkit/how-to-code-samples | b4ea616f36bbfa2e042beb1698f968cfd651d79f | alarm-clock/python/iot_alarm_clock/hardware/dfrobot.py | python | DfrobotBoard.change_brightness | (self, value) | Change LCD screen brightness.
Only supports on (value < 512) and off (value >= 512) on the dfrobot. | Change LCD screen brightness.
Only supports on (value < 512) and off (value >= 512) on the dfrobot. | [
"Change",
"LCD",
"screen",
"brightness",
".",
"Only",
"supports",
"on",
"(",
"value",
"<",
"512",
")",
"and",
"off",
"(",
"value",
">",
"=",
"512",
")",
"on",
"the",
"dfrobot",
"."
] | def change_brightness(self, value):
"""
Change LCD screen brightness.
Only supports on (value < 512) and off (value >= 512) on the dfrobot.
"""
if value < 512:
self.screen.displayOff()
else:
self.screen.displayOn() | [
"def",
"change_brightness",
"(",
"self",
",",
"value",
")",
":",
"if",
"value",
"<",
"512",
":",
"self",
".",
"screen",
".",
"displayOff",
"(",
")",
"else",
":",
"self",
".",
"screen",
".",
"displayOn",
"(",
")"
] | https://github.com/intel-iot-devkit/how-to-code-samples/blob/b4ea616f36bbfa2e042beb1698f968cfd651d79f/alarm-clock/python/iot_alarm_clock/hardware/dfrobot.py#L139-L149 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/propgrid.py | python | PGVIterator.UnRef | (*args, **kwargs) | return _propgrid.PGVIterator_UnRef(*args, **kwargs) | UnRef(self) | UnRef(self) | [
"UnRef",
"(",
"self",
")"
] | def UnRef(*args, **kwargs):
"""UnRef(self)"""
return _propgrid.PGVIterator_UnRef(*args, **kwargs) | [
"def",
"UnRef",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PGVIterator_UnRef",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/propgrid.py#L1055-L1057 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/tensor_forest/hybrid/python/ops/training_ops.py | python | _KFeatureRoutingFunctionGradient | (op, grad) | return input_gradients | The gradient of RoutingFunction.
Args:
op: The RoutingFunction op.
grad: Gradient with respect to the output of the RoutingFunction op.
Returns:
Gradients with respect to the input of the RoutingFunction op. | The gradient of RoutingFunction. | [
"The",
"gradient",
"of",
"RoutingFunction",
"."
] | def _KFeatureRoutingFunctionGradient(op, grad):
"""The gradient of RoutingFunction.
Args:
op: The RoutingFunction op.
grad: Gradient with respect to the output of the RoutingFunction op.
Returns:
Gradients with respect to the input of the RoutingFunction op.
"""
gradient_op = gen_training_ops.k_... | [
"def",
"_KFeatureRoutingFunctionGradient",
"(",
"op",
",",
"grad",
")",
":",
"gradient_op",
"=",
"gen_training_ops",
".",
"k_feature_gradient",
"input_data_tensor",
"=",
"op",
".",
"inputs",
"[",
"0",
"]",
"tree_weights_tensor",
"=",
"op",
".",
"inputs",
"[",
"1... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/tensor_forest/hybrid/python/ops/training_ops.py#L202-L276 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/turtle.py | python | RawTurtle.shapetransform | (self, t11=None, t12=None, t21=None, t22=None) | Set or return the current transformation matrix of the turtle shape.
Optional arguments: t11, t12, t21, t22 -- numbers.
If none of the matrix elements are given, return the transformation
matrix.
Otherwise set the given elements and transform the turtleshape
according to the ma... | Set or return the current transformation matrix of the turtle shape. | [
"Set",
"or",
"return",
"the",
"current",
"transformation",
"matrix",
"of",
"the",
"turtle",
"shape",
"."
] | def shapetransform(self, t11=None, t12=None, t21=None, t22=None):
"""Set or return the current transformation matrix of the turtle shape.
Optional arguments: t11, t12, t21, t22 -- numbers.
If none of the matrix elements are given, return the transformation
matrix.
Otherwise set... | [
"def",
"shapetransform",
"(",
"self",
",",
"t11",
"=",
"None",
",",
"t12",
"=",
"None",
",",
"t21",
"=",
"None",
",",
"t22",
"=",
"None",
")",
":",
"if",
"t11",
"is",
"t12",
"is",
"t21",
"is",
"t22",
"is",
"None",
":",
"return",
"self",
".",
"_... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/turtle.py#L2912-L2949 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/_op_impl/tbe/select.py | python | _select_tbe | () | return | Select TBE register | Select TBE register | [
"Select",
"TBE",
"register"
] | def _select_tbe():
"""Select TBE register"""
return | [
"def",
"_select_tbe",
"(",
")",
":",
"return"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/_op_impl/tbe/select.py#L36-L38 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/linear_optimizer/python/sdca_estimator.py | python | SDCALinearRegressor.predict_scores | (self, input_fn) | return (pred[key] for pred in predictions) | Returns predicted scores for given features.
Args:
input_fn: The input function providing features.
Returns:
A generator of predicted scores for the features provided by input_fn. | Returns predicted scores for given features. | [
"Returns",
"predicted",
"scores",
"for",
"given",
"features",
"."
] | def predict_scores(self, input_fn):
"""Returns predicted scores for given features.
Args:
input_fn: The input function providing features.
Returns:
A generator of predicted scores for the features provided by input_fn.
"""
key = prediction_key.PredictionKey.SCORES
predictions = sup... | [
"def",
"predict_scores",
"(",
"self",
",",
"input_fn",
")",
":",
"key",
"=",
"prediction_key",
".",
"PredictionKey",
".",
"SCORES",
"predictions",
"=",
"super",
"(",
"SDCALinearRegressor",
",",
"self",
")",
".",
"predict",
"(",
"input_fn",
"=",
"input_fn",
"... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/linear_optimizer/python/sdca_estimator.py#L523-L535 | |
bh107/bohrium | 5b83e7117285fefc7779ed0e9acb0f8e74c7e068 | bridge/py_api/bohrium_api/stack_info.py | python | pprint | () | return ret | Pretty print Bohrium info | Pretty print Bohrium info | [
"Pretty",
"print",
"Bohrium",
"info"
] | def pprint():
"""Pretty print Bohrium info"""
ret = """----
Bohrium API version: %s
Installed through PyPI: %s
Config file: %s
Header dir: %s
Backend stack:
%s----
""" % (__version__, installed_through_pypi(), config_file_path(), header_dir(), messaging.runtime_info())
if not (is_opencl_in_stack() or is_cu... | [
"def",
"pprint",
"(",
")",
":",
"ret",
"=",
"\"\"\"----\nBohrium API version: %s\nInstalled through PyPI: %s\nConfig file: %s\nHeader dir: %s\nBackend stack:\n%s----\n\"\"\"",
"%",
"(",
"__version__",
",",
"installed_through_pypi",
"(",
")",
",",
"config_file_path",
"(",
")",
"... | https://github.com/bh107/bohrium/blob/5b83e7117285fefc7779ed0e9acb0f8e74c7e068/bridge/py_api/bohrium_api/stack_info.py#L79-L93 | |
Kitware/VTK | 5b4df4d90a4f31194d97d3c639dd38ea8f81e8b8 | Filters/Core/vtkStreamingTessellatorGenerator.py | python | vtkTessCase.__init__ | ( self, label ) | Create an empty decomposition with a unique name. | Create an empty decomposition with a unique name. | [
"Create",
"an",
"empty",
"decomposition",
"with",
"a",
"unique",
"name",
"."
] | def __init__( self, label ):
"""Create an empty decomposition with a unique name."""
#print(' Tetrahedra: %s' % label, file=sys.stderr)
self.Tets = []
self.Label = label
self.Offset = vtkTessCase.CurrentOffset
vtkTessCase.CurrentOffset += 1
vtkTessCase.AllCases[ self.Label ] = self | [
"def",
"__init__",
"(",
"self",
",",
"label",
")",
":",
"#print(' Tetrahedra: %s' % label, file=sys.stderr)",
"self",
".",
"Tets",
"=",
"[",
"]",
"self",
".",
"Label",
"=",
"label",
"self",
".",
"Offset",
"=",
"vtkTessCase",
".",
"CurrentOffset",
"vtkTessCase",... | https://github.com/Kitware/VTK/blob/5b4df4d90a4f31194d97d3c639dd38ea8f81e8b8/Filters/Core/vtkStreamingTessellatorGenerator.py#L60-L67 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/basic_fitting/fit_function_options_view.py | python | FitFunctionOptionsView.set_slot_for_exclude_end_x_updated | (self, slot) | Connect the slot for the exclude end x option. | Connect the slot for the exclude end x option. | [
"Connect",
"the",
"slot",
"for",
"the",
"exclude",
"end",
"x",
"option",
"."
] | def set_slot_for_exclude_end_x_updated(self, slot) -> None:
"""Connect the slot for the exclude end x option."""
self.exclude_end_x_line_edit.editingFinished.connect(slot) | [
"def",
"set_slot_for_exclude_end_x_updated",
"(",
"self",
",",
"slot",
")",
"->",
"None",
":",
"self",
".",
"exclude_end_x_line_edit",
".",
"editingFinished",
".",
"connect",
"(",
"slot",
")"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/basic_fitting/fit_function_options_view.py#L114-L116 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/directtools/__init__.py | python | _normws | (workspace) | return workspace | Retrieve workspace from mtd if it is a string, otherwise return as-is. | Retrieve workspace from mtd if it is a string, otherwise return as-is. | [
"Retrieve",
"workspace",
"from",
"mtd",
"if",
"it",
"is",
"a",
"string",
"otherwise",
"return",
"as",
"-",
"is",
"."
] | def _normws(workspace):
"""Retrieve workspace from mtd if it is a string, otherwise return as-is."""
name = str(workspace)
if name:
workspace = mtd[name]
return workspace | [
"def",
"_normws",
"(",
"workspace",
")",
":",
"name",
"=",
"str",
"(",
"workspace",
")",
"if",
"name",
":",
"workspace",
"=",
"mtd",
"[",
"name",
"]",
"return",
"workspace"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/directtools/__init__.py#L201-L206 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/cython/Cython/Coverage.py | python | CythonModuleReporter.source | (self) | Return the source code of the file as a string. | Return the source code of the file as a string. | [
"Return",
"the",
"source",
"code",
"of",
"the",
"file",
"as",
"a",
"string",
"."
] | def source(self):
"""
Return the source code of the file as a string.
"""
if os.path.exists(self._abs_filename):
with open_source_file(self._abs_filename) as f:
return f.read()
else:
return '\n'.join(
(tokens[0][1] if tokens... | [
"def",
"source",
"(",
"self",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"_abs_filename",
")",
":",
"with",
"open_source_file",
"(",
"self",
".",
"_abs_filename",
")",
"as",
"f",
":",
"return",
"f",
".",
"read",
"(",
")",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/cython/Cython/Coverage.py#L351-L361 | ||
baoboa/pyqt5 | 11d5f43bc6f213d9d60272f3954a0048569cfc7c | configure.py | python | pro_add_qt_dependencies | (target_config, metadata, pro_lines, debug=None) | Add the Qt dependencies of a module to a .pro file. target_config is
the target configuration. metadata is the module's meta-data. pro_lines
is the list of lines making up the .pro file that is updated. debug is set
if debug, rather than release, mode is to be used. If it is None then the
mode is t... | Add the Qt dependencies of a module to a .pro file. target_config is
the target configuration. metadata is the module's meta-data. pro_lines
is the list of lines making up the .pro file that is updated. debug is set
if debug, rather than release, mode is to be used. If it is None then the
mode is t... | [
"Add",
"the",
"Qt",
"dependencies",
"of",
"a",
"module",
"to",
"a",
".",
"pro",
"file",
".",
"target_config",
"is",
"the",
"target",
"configuration",
".",
"metadata",
"is",
"the",
"module",
"s",
"meta",
"-",
"data",
".",
"pro_lines",
"is",
"the",
"list",... | def pro_add_qt_dependencies(target_config, metadata, pro_lines, debug=None):
""" Add the Qt dependencies of a module to a .pro file. target_config is
the target configuration. metadata is the module's meta-data. pro_lines
is the list of lines making up the .pro file that is updated. debug is set
if ... | [
"def",
"pro_add_qt_dependencies",
"(",
"target_config",
",",
"metadata",
",",
"pro_lines",
",",
"debug",
"=",
"None",
")",
":",
"if",
"debug",
"is",
"None",
":",
"debug",
"=",
"target_config",
".",
"debug",
"add",
"=",
"[",
"]",
"remove",
"=",
"[",
"]",
... | https://github.com/baoboa/pyqt5/blob/11d5f43bc6f213d9d60272f3954a0048569cfc7c/configure.py#L2328-L2359 | ||
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/libdeps/libdeps/analyzer.py | python | InDegreeOne.report | (self, report) | Add the indegree one list to the report. | Add the indegree one list to the report. | [
"Add",
"the",
"indegree",
"one",
"list",
"to",
"the",
"report",
"."
] | def report(self, report):
"""Add the indegree one list to the report."""
report[DependsReportTypes.IN_DEGREE_ONE.name] = self.run() | [
"def",
"report",
"(",
"self",
",",
"report",
")",
":",
"report",
"[",
"DependsReportTypes",
".",
"IN_DEGREE_ONE",
".",
"name",
"]",
"=",
"self",
".",
"run",
"(",
")"
] | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/libdeps/libdeps/analyzer.py#L490-L493 | ||
Mahlet-Inc/hobbits | 071d7a542f1af0a7791bcaab17b08224df9ecd4e | src/hobbits-plugins/analyzers/KaitaiStruct/ksy_py/serialization/msgpack.py | python | Msgpack.is_fix_array | (self) | return self._m_is_fix_array if hasattr(self, '_m_is_fix_array') else None | .. seealso::
Source - https://github.com/msgpack/msgpack/blob/master/spec.md#formats-array | .. seealso::
Source - https://github.com/msgpack/msgpack/blob/master/spec.md#formats-array | [
"..",
"seealso",
"::",
"Source",
"-",
"https",
":",
"//",
"github",
".",
"com",
"/",
"msgpack",
"/",
"msgpack",
"/",
"blob",
"/",
"master",
"/",
"spec",
".",
"md#formats",
"-",
"array"
] | def is_fix_array(self):
"""
.. seealso::
Source - https://github.com/msgpack/msgpack/blob/master/spec.md#formats-array
"""
if hasattr(self, '_m_is_fix_array'):
return self._m_is_fix_array if hasattr(self, '_m_is_fix_array') else None
self._m_is_fix_array =... | [
"def",
"is_fix_array",
"(",
"self",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"'_m_is_fix_array'",
")",
":",
"return",
"self",
".",
"_m_is_fix_array",
"if",
"hasattr",
"(",
"self",
",",
"'_m_is_fix_array'",
")",
"else",
"None",
"self",
".",
"_m_is_fix_arr... | https://github.com/Mahlet-Inc/hobbits/blob/071d7a542f1af0a7791bcaab17b08224df9ecd4e/src/hobbits-plugins/analyzers/KaitaiStruct/ksy_py/serialization/msgpack.py#L180-L189 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/operations/custom_ops.py | python | Custom._get_imply_type | (self, reg_info, target) | return func_type_to_imply_type.get(self.func_type, "AKG") | Get imply_typ information. | Get imply_typ information. | [
"Get",
"imply_typ",
"information",
"."
] | def _get_imply_type(self, reg_info, target):
"""Get imply_typ information."""
# Get imply_type from reg_info["imply_type"]
if isinstance(reg_info, dict) and isinstance(reg_info.get("imply_type"), str) and \
reg_info["imply_type"].strip():
return reg_info["imply_type"]... | [
"def",
"_get_imply_type",
"(",
"self",
",",
"reg_info",
",",
"target",
")",
":",
"# Get imply_type from reg_info[\"imply_type\"]",
"if",
"isinstance",
"(",
"reg_info",
",",
"dict",
")",
"and",
"isinstance",
"(",
"reg_info",
".",
"get",
"(",
"\"imply_type\"",
")",
... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/operations/custom_ops.py#L519-L527 | |
Atarity/Lightpack | 4dee73a443cba4c4073291febe450e6c1941f3af | Software/apiexamples/liOSC/OSC.py | python | OSCServer.noCallback_handler | (self, addr, tags, data, client_address) | Example handler for OSCMessages.
All registerd handlers must accept these three arguments:
- addr (string): The OSC-address pattern of the received Message
(the 'addr' string has already been matched against the handler's registerd OSC-address,
but may contain '*'s & such)
- tags (string): The OSC-typeta... | Example handler for OSCMessages.
All registerd handlers must accept these three arguments:
- addr (string): The OSC-address pattern of the received Message
(the 'addr' string has already been matched against the handler's registerd OSC-address,
but may contain '*'s & such)
- tags (string): The OSC-typeta... | [
"Example",
"handler",
"for",
"OSCMessages",
".",
"All",
"registerd",
"handlers",
"must",
"accept",
"these",
"three",
"arguments",
":",
"-",
"addr",
"(",
"string",
")",
":",
"The",
"OSC",
"-",
"address",
"pattern",
"of",
"the",
"received",
"Message",
"(",
"... | def noCallback_handler(self, addr, tags, data, client_address):
"""Example handler for OSCMessages.
All registerd handlers must accept these three arguments:
- addr (string): The OSC-address pattern of the received Message
(the 'addr' string has already been matched against the handler's registerd OSC-address... | [
"def",
"noCallback_handler",
"(",
"self",
",",
"addr",
",",
"tags",
",",
"data",
",",
"client_address",
")",
":",
"self",
".",
"reportErr",
"(",
"\"No callback registered to handle OSC-address '%s'\"",
"%",
"addr",
",",
"client_address",
")"
] | https://github.com/Atarity/Lightpack/blob/4dee73a443cba4c4073291febe450e6c1941f3af/Software/apiexamples/liOSC/OSC.py#L2024-L2041 | ||
microsoft/checkedc-clang | a173fefde5d7877b7750e7ce96dd08cf18baebf2 | lldb/third_party/Python/module/pexpect-4.6/pexpect/pty_spawn.py | python | spawn.isatty | (self) | return os.isatty(self.child_fd) | This returns True if the file descriptor is open and connected to a
tty(-like) device, else False.
On SVR4-style platforms implementing streams, such as SunOS and HP-UX,
the child pty may not appear as a terminal device. This means
methods such as setecho(), setwinsize(), getwinsize() ... | This returns True if the file descriptor is open and connected to a
tty(-like) device, else False. | [
"This",
"returns",
"True",
"if",
"the",
"file",
"descriptor",
"is",
"open",
"and",
"connected",
"to",
"a",
"tty",
"(",
"-",
"like",
")",
"device",
"else",
"False",
"."
] | def isatty(self):
'''This returns True if the file descriptor is open and connected to a
tty(-like) device, else False.
On SVR4-style platforms implementing streams, such as SunOS and HP-UX,
the child pty may not appear as a terminal device. This means
methods such as setecho()... | [
"def",
"isatty",
"(",
"self",
")",
":",
"return",
"os",
".",
"isatty",
"(",
"self",
".",
"child_fd",
")"
] | https://github.com/microsoft/checkedc-clang/blob/a173fefde5d7877b7750e7ce96dd08cf18baebf2/lldb/third_party/Python/module/pexpect-4.6/pexpect/pty_spawn.py#L332-L341 | |
dusty-nv/jetbot_ros | e2bd28b3e182d772ef051f1cc0e5c42c9fb4f1ec | jetbot_ros/dnn/navigation_model.py | python | NavigationModel.save_checkpoint | (self, state, is_best, path=None, filename='checkpoint.pth', best_filename='model_best.pth') | Save a model checkpoint file, along with the best-performing model if applicable | Save a model checkpoint file, along with the best-performing model if applicable | [
"Save",
"a",
"model",
"checkpoint",
"file",
"along",
"with",
"the",
"best",
"-",
"performing",
"model",
"if",
"applicable"
] | def save_checkpoint(self, state, is_best, path=None, filename='checkpoint.pth', best_filename='model_best.pth'):
"""
Save a model checkpoint file, along with the best-performing model if applicable
"""
if path:
filename = os.path.join(path, filename)
best_filename... | [
"def",
"save_checkpoint",
"(",
"self",
",",
"state",
",",
"is_best",
",",
"path",
"=",
"None",
",",
"filename",
"=",
"'checkpoint.pth'",
",",
"best_filename",
"=",
"'model_best.pth'",
")",
":",
"if",
"path",
":",
"filename",
"=",
"os",
".",
"path",
".",
... | https://github.com/dusty-nv/jetbot_ros/blob/e2bd28b3e182d772ef051f1cc0e5c42c9fb4f1ec/jetbot_ros/dnn/navigation_model.py#L256-L275 | ||
google/tink | 59bb34495d1cb8f9d9dbc0f0a52c4f9e21491a14 | python/tink/jwt/_jwk_set_converter.py | python | _validate_use_and_key_ops | (key: Dict[str, Union[str, List[str]]]) | Checks that 'key_ops' and 'use' have the right values if present. | Checks that 'key_ops' and 'use' have the right values if present. | [
"Checks",
"that",
"key_ops",
"and",
"use",
"have",
"the",
"right",
"values",
"if",
"present",
"."
] | def _validate_use_and_key_ops(key: Dict[str, Union[str, List[str]]]):
"""Checks that 'key_ops' and 'use' have the right values if present."""
if 'key_ops' in key:
key_ops = key['key_ops']
if len(key_ops) != 1 or key_ops[0] != 'verify':
raise tink.TinkError('invalid key_ops')
if 'use' in key and key[... | [
"def",
"_validate_use_and_key_ops",
"(",
"key",
":",
"Dict",
"[",
"str",
",",
"Union",
"[",
"str",
",",
"List",
"[",
"str",
"]",
"]",
"]",
")",
":",
"if",
"'key_ops'",
"in",
"key",
":",
"key_ops",
"=",
"key",
"[",
"'key_ops'",
"]",
"if",
"len",
"("... | https://github.com/google/tink/blob/59bb34495d1cb8f9d9dbc0f0a52c4f9e21491a14/python/tink/jwt/_jwk_set_converter.py#L268-L275 | ||
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | media/webrtc/trunk/tools/gyp/pylib/gyp/xcode_emulation.py | python | _TopologicallySortedEnvVarKeys | (env) | Takes a dict |env| whose values are strings that can refer to other keys,
for example env['foo'] = '$(bar) and $(baz)'. Returns a list L of all keys of
env such that key2 is after key1 in L if env[key2] refers to env[key1].
Throws an Exception in case of dependency cycles. | Takes a dict |env| whose values are strings that can refer to other keys,
for example env['foo'] = '$(bar) and $(baz)'. Returns a list L of all keys of
env such that key2 is after key1 in L if env[key2] refers to env[key1]. | [
"Takes",
"a",
"dict",
"|env|",
"whose",
"values",
"are",
"strings",
"that",
"can",
"refer",
"to",
"other",
"keys",
"for",
"example",
"env",
"[",
"foo",
"]",
"=",
"$",
"(",
"bar",
")",
"and",
"$",
"(",
"baz",
")",
".",
"Returns",
"a",
"list",
"L",
... | def _TopologicallySortedEnvVarKeys(env):
"""Takes a dict |env| whose values are strings that can refer to other keys,
for example env['foo'] = '$(bar) and $(baz)'. Returns a list L of all keys of
env such that key2 is after key1 in L if env[key2] refers to env[key1].
Throws an Exception in case of dependency c... | [
"def",
"_TopologicallySortedEnvVarKeys",
"(",
"env",
")",
":",
"# Since environment variables can refer to other variables, the evaluation",
"# order is important. Below is the logic to compute the dependency graph",
"# and sort it.",
"regex",
"=",
"re",
".",
"compile",
"(",
"r'\\$\\{(... | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/media/webrtc/trunk/tools/gyp/pylib/gyp/xcode_emulation.py#L1015-L1046 | ||
papyrussolution/OpenPapyrus | bbfb5ec2ea2109b8e2f125edd838e12eaf7b8b91 | Src/OSF/protobuf-3.19.1/python/google/protobuf/internal/containers.py | python | RepeatedCompositeFieldContainer.add | (self, **kwargs) | return new_element | Adds a new element at the end of the list and returns it. Keyword
arguments may be used to initialize the element. | Adds a new element at the end of the list and returns it. Keyword
arguments may be used to initialize the element. | [
"Adds",
"a",
"new",
"element",
"at",
"the",
"end",
"of",
"the",
"list",
"and",
"returns",
"it",
".",
"Keyword",
"arguments",
"may",
"be",
"used",
"to",
"initialize",
"the",
"element",
"."
] | def add(self, **kwargs):
"""Adds a new element at the end of the list and returns it. Keyword
arguments may be used to initialize the element.
"""
new_element = self._message_descriptor._concrete_class(**kwargs)
new_element._SetListener(self._message_listener)
self._values.append(new_element)
... | [
"def",
"add",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"new_element",
"=",
"self",
".",
"_message_descriptor",
".",
"_concrete_class",
"(",
"*",
"*",
"kwargs",
")",
"new_element",
".",
"_SetListener",
"(",
"self",
".",
"_message_listener",
")",
"sel... | https://github.com/papyrussolution/OpenPapyrus/blob/bbfb5ec2ea2109b8e2f125edd838e12eaf7b8b91/Src/OSF/protobuf-3.19.1/python/google/protobuf/internal/containers.py#L234-L243 | |
goldeneye-source/ges-code | 2630cd8ef3d015af53c72ec2e19fc1f7e7fe8d9d | thirdparty/protobuf-2.3.0/python/google/protobuf/internal/decoder.py | python | _EndGroup | (buffer, pos, end) | return -1 | Skipping an END_GROUP tag returns -1 to tell the parent loop to break. | Skipping an END_GROUP tag returns -1 to tell the parent loop to break. | [
"Skipping",
"an",
"END_GROUP",
"tag",
"returns",
"-",
"1",
"to",
"tell",
"the",
"parent",
"loop",
"to",
"break",
"."
] | def _EndGroup(buffer, pos, end):
"""Skipping an END_GROUP tag returns -1 to tell the parent loop to break."""
return -1 | [
"def",
"_EndGroup",
"(",
"buffer",
",",
"pos",
",",
"end",
")",
":",
"return",
"-",
"1"
] | https://github.com/goldeneye-source/ges-code/blob/2630cd8ef3d015af53c72ec2e19fc1f7e7fe8d9d/thirdparty/protobuf-2.3.0/python/google/protobuf/internal/decoder.py#L590-L593 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_controls.py | python | ListItem.SetText | (*args, **kwargs) | return _controls_.ListItem_SetText(*args, **kwargs) | SetText(self, String text) | SetText(self, String text) | [
"SetText",
"(",
"self",
"String",
"text",
")"
] | def SetText(*args, **kwargs):
"""SetText(self, String text)"""
return _controls_.ListItem_SetText(*args, **kwargs) | [
"def",
"SetText",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"ListItem_SetText",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_controls.py#L4188-L4190 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.