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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/fractions.py | python | Fraction.__floordiv__ | (a, b) | a // b | a // b | [
"a",
"//",
"b"
] | def __floordiv__(a, b):
"""a // b"""
# Will be math.floor(a / b) in 3.0.
div = a / b
if isinstance(div, Rational):
# trunc(math.floor(div)) doesn't work if the rational is
# more precise than a float because the intermediate
# rounding may cross an int... | [
"def",
"__floordiv__",
"(",
"a",
",",
"b",
")",
":",
"# Will be math.floor(a / b) in 3.0.",
"div",
"=",
"a",
"/",
"b",
"if",
"isinstance",
"(",
"div",
",",
"Rational",
")",
":",
"# trunc(math.floor(div)) doesn't work if the rational is",
"# more precise than a float bec... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/fractions.py#L417-L427 | ||
macchina-io/macchina.io | ef24ba0e18379c3dd48fb84e6dbf991101cb8db0 | platform/JS/V8/tools/gyp/pylib/gyp/msvs_emulation.py | python | MsvsSettings.GetMapFileName | (self, config, expand_special) | return map_file | Gets the explicitly overriden map file name for a target or returns None
if it's not set. | Gets the explicitly overriden map file name for a target or returns None
if it's not set. | [
"Gets",
"the",
"explicitly",
"overriden",
"map",
"file",
"name",
"for",
"a",
"target",
"or",
"returns",
"None",
"if",
"it",
"s",
"not",
"set",
"."
] | def GetMapFileName(self, config, expand_special):
"""Gets the explicitly overriden map file name for a target or returns None
if it's not set."""
config = self._TargetConfig(config)
map_file = self._Setting(('VCLinkerTool', 'MapFileName'), config)
if map_file:
map_file = expand_special(self.Co... | [
"def",
"GetMapFileName",
"(",
"self",
",",
"config",
",",
"expand_special",
")",
":",
"config",
"=",
"self",
".",
"_TargetConfig",
"(",
"config",
")",
"map_file",
"=",
"self",
".",
"_Setting",
"(",
"(",
"'VCLinkerTool'",
",",
"'MapFileName'",
")",
",",
"co... | https://github.com/macchina-io/macchina.io/blob/ef24ba0e18379c3dd48fb84e6dbf991101cb8db0/platform/JS/V8/tools/gyp/pylib/gyp/msvs_emulation.py#L381-L388 | |
ispc/ispc | 0a7ee59b6ec50e54d545eb2a31056e54c4891d51 | utils/lit/lit/ShUtil.py | python | ShLexer.lex_one_token | (self) | return self.lex_arg(c) | lex_one_token - Lex a single 'sh' token. | lex_one_token - Lex a single 'sh' token. | [
"lex_one_token",
"-",
"Lex",
"a",
"single",
"sh",
"token",
"."
] | def lex_one_token(self):
"""
lex_one_token - Lex a single 'sh' token. """
c = self.eat()
if c == ';':
return (c,)
if c == '|':
if self.maybe_eat('|'):
return ('||',)
return (c,)
if c == '&':
if self.maybe_ea... | [
"def",
"lex_one_token",
"(",
"self",
")",
":",
"c",
"=",
"self",
".",
"eat",
"(",
")",
"if",
"c",
"==",
"';'",
":",
"return",
"(",
"c",
",",
")",
"if",
"c",
"==",
"'|'",
":",
"if",
"self",
".",
"maybe_eat",
"(",
"'|'",
")",
":",
"return",
"("... | https://github.com/ispc/ispc/blob/0a7ee59b6ec50e54d545eb2a31056e54c4891d51/utils/lit/lit/ShUtil.py#L148-L178 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/arrays/period.py | python | PeriodArray._add_delta | (self, other) | return type(self)(new_ordinals, freq=self.freq) | Add a timedelta-like, Tick, or TimedeltaIndex-like object
to self, yielding a new PeriodArray
Parameters
----------
other : {timedelta, np.timedelta64, Tick,
TimedeltaIndex, ndarray[timedelta64]}
Returns
-------
result : PeriodArray | Add a timedelta-like, Tick, or TimedeltaIndex-like object
to self, yielding a new PeriodArray | [
"Add",
"a",
"timedelta",
"-",
"like",
"Tick",
"or",
"TimedeltaIndex",
"-",
"like",
"object",
"to",
"self",
"yielding",
"a",
"new",
"PeriodArray"
] | def _add_delta(self, other):
"""
Add a timedelta-like, Tick, or TimedeltaIndex-like object
to self, yielding a new PeriodArray
Parameters
----------
other : {timedelta, np.timedelta64, Tick,
TimedeltaIndex, ndarray[timedelta64]}
Returns
... | [
"def",
"_add_delta",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"self",
".",
"freq",
",",
"Tick",
")",
":",
"# We cannot add timedelta-like to non-tick PeriodArray",
"_raise_on_incompatible",
"(",
"self",
",",
"other",
")",
"new_ordinals"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/arrays/period.py#L604-L623 | |
xiaolonw/caffe-video_triplet | c39ea1ad6e937ccf7deba4510b7e555165abf05f | scripts/cpp_lint.py | python | GetPreviousNonBlankLine | (clean_lines, linenum) | return ('', -1) | Return the most recent non-blank line and its line number.
Args:
clean_lines: A CleansedLines instance containing the file contents.
linenum: The number of the line to check.
Returns:
A tuple with two elements. The first element is the contents of the last
non-blank line before the current line, ... | Return the most recent non-blank line and its line number. | [
"Return",
"the",
"most",
"recent",
"non",
"-",
"blank",
"line",
"and",
"its",
"line",
"number",
"."
] | def GetPreviousNonBlankLine(clean_lines, linenum):
"""Return the most recent non-blank line and its line number.
Args:
clean_lines: A CleansedLines instance containing the file contents.
linenum: The number of the line to check.
Returns:
A tuple with two elements. The first element is the contents ... | [
"def",
"GetPreviousNonBlankLine",
"(",
"clean_lines",
",",
"linenum",
")",
":",
"prevlinenum",
"=",
"linenum",
"-",
"1",
"while",
"prevlinenum",
">=",
"0",
":",
"prevline",
"=",
"clean_lines",
".",
"elided",
"[",
"prevlinenum",
"]",
"if",
"not",
"IsBlankLine",... | https://github.com/xiaolonw/caffe-video_triplet/blob/c39ea1ad6e937ccf7deba4510b7e555165abf05f/scripts/cpp_lint.py#L3046-L3066 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py2/setuptools/_vendor/ordered_set.py | python | OrderedSet.difference_update | (self, *sets) | Update this OrderedSet to remove items from one or more other sets.
Example:
>>> this = OrderedSet([1, 2, 3])
>>> this.difference_update(OrderedSet([2, 4]))
>>> print(this)
OrderedSet([1, 3])
>>> this = OrderedSet([1, 2, 3, 4, 5])
>>> thi... | Update this OrderedSet to remove items from one or more other sets. | [
"Update",
"this",
"OrderedSet",
"to",
"remove",
"items",
"from",
"one",
"or",
"more",
"other",
"sets",
"."
] | def difference_update(self, *sets):
"""
Update this OrderedSet to remove items from one or more other sets.
Example:
>>> this = OrderedSet([1, 2, 3])
>>> this.difference_update(OrderedSet([2, 4]))
>>> print(this)
OrderedSet([1, 3])
>>... | [
"def",
"difference_update",
"(",
"self",
",",
"*",
"sets",
")",
":",
"items_to_remove",
"=",
"set",
"(",
")",
"for",
"other",
"in",
"sets",
":",
"items_to_remove",
"|=",
"set",
"(",
"other",
")",
"self",
".",
"_update_items",
"(",
"[",
"item",
"for",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py2/setuptools/_vendor/ordered_set.py#L437-L455 | ||
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/buildscripts/idl/idl/cpp_types.py | python | _call_method_or_global_function | (expression, method_name) | return common.template_args(
'${expression}.${method_name}()', expression=expression, method_name=short_method_name) | Given a fully-qualified method name, call it correctly.
A function is prefixed with "::" and use it to indicate a function instead of a method. It is
not treated as a global C++ function though. This notion of functions is designed to support
enum deserializers/serializers which are not methods. | Given a fully-qualified method name, call it correctly. | [
"Given",
"a",
"fully",
"-",
"qualified",
"method",
"name",
"call",
"it",
"correctly",
"."
] | def _call_method_or_global_function(expression, method_name):
# type: (unicode, unicode) -> unicode
"""
Given a fully-qualified method name, call it correctly.
A function is prefixed with "::" and use it to indicate a function instead of a method. It is
not treated as a global C++ function though. ... | [
"def",
"_call_method_or_global_function",
"(",
"expression",
",",
"method_name",
")",
":",
"# type: (unicode, unicode) -> unicode",
"short_method_name",
"=",
"writer",
".",
"get_method_name",
"(",
"method_name",
")",
"if",
"writer",
".",
"is_function",
"(",
"method_name",... | https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/buildscripts/idl/idl/cpp_types.py#L569-L584 | |
GrammaTech/gtirb | 415dd72e1e3c475004d013723c16cdcb29c0826e | python/gtirb/section.py | python | Section._add_to_uuid_cache | (self, cache: typing.Dict[UUID, Node]) | Update the UUID cache when this node is added. | Update the UUID cache when this node is added. | [
"Update",
"the",
"UUID",
"cache",
"when",
"this",
"node",
"is",
"added",
"."
] | def _add_to_uuid_cache(self, cache: typing.Dict[UUID, Node]) -> None:
"""Update the UUID cache when this node is added."""
cache[self.uuid] = self
for bi in self.byte_intervals:
bi._add_to_uuid_cache(cache) | [
"def",
"_add_to_uuid_cache",
"(",
"self",
",",
"cache",
":",
"typing",
".",
"Dict",
"[",
"UUID",
",",
"Node",
"]",
")",
"->",
"None",
":",
"cache",
"[",
"self",
".",
"uuid",
"]",
"=",
"self",
"for",
"bi",
"in",
"self",
".",
"byte_intervals",
":",
"... | https://github.com/GrammaTech/gtirb/blob/415dd72e1e3c475004d013723c16cdcb29c0826e/python/gtirb/section.py#L379-L384 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/keras/_impl/keras/callbacks.py | python | CallbackList.on_train_begin | (self, logs=None) | Called at the beginning of training.
Arguments:
logs: dictionary of logs. | Called at the beginning of training. | [
"Called",
"at",
"the",
"beginning",
"of",
"training",
"."
] | def on_train_begin(self, logs=None):
"""Called at the beginning of training.
Arguments:
logs: dictionary of logs.
"""
logs = logs or {}
for callback in self.callbacks:
callback.on_train_begin(logs) | [
"def",
"on_train_begin",
"(",
"self",
",",
"logs",
"=",
"None",
")",
":",
"logs",
"=",
"logs",
"or",
"{",
"}",
"for",
"callback",
"in",
"self",
".",
"callbacks",
":",
"callback",
".",
"on_train_begin",
"(",
"logs",
")"
] | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/keras/_impl/keras/callbacks.py#L139-L147 | ||
rdkit/rdkit | ede860ae316d12d8568daf5ee800921c3389c84e | rdkit/sping/PDF/pidPDF.py | python | PDFCanvas.clear | (self) | Not wll defined for file formats, use same as ShowPage | Not wll defined for file formats, use same as ShowPage | [
"Not",
"wll",
"defined",
"for",
"file",
"formats",
"use",
"same",
"as",
"ShowPage"
] | def clear(self):
"Not wll defined for file formats, use same as ShowPage"
self.showPage() | [
"def",
"clear",
"(",
"self",
")",
":",
"self",
".",
"showPage",
"(",
")"
] | https://github.com/rdkit/rdkit/blob/ede860ae316d12d8568daf5ee800921c3389c84e/rdkit/sping/PDF/pidPDF.py#L159-L161 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/stc.py | python | StyledTextCtrl.SetStatus | (*args, **kwargs) | return _stc.StyledTextCtrl_SetStatus(*args, **kwargs) | SetStatus(self, int statusCode)
Change error status - 0 = OK. | SetStatus(self, int statusCode) | [
"SetStatus",
"(",
"self",
"int",
"statusCode",
")"
] | def SetStatus(*args, **kwargs):
"""
SetStatus(self, int statusCode)
Change error status - 0 = OK.
"""
return _stc.StyledTextCtrl_SetStatus(*args, **kwargs) | [
"def",
"SetStatus",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_SetStatus",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/stc.py#L5038-L5044 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pathlib2/pathlib2/__init__.py | python | PurePath.name | (self) | return parts[-1] | The final path component, if any. | The final path component, if any. | [
"The",
"final",
"path",
"component",
"if",
"any",
"."
] | def name(self):
"""The final path component, if any."""
parts = self._parts
if len(parts) == (1 if (self._drv or self._root) else 0):
return ''
return parts[-1] | [
"def",
"name",
"(",
"self",
")",
":",
"parts",
"=",
"self",
".",
"_parts",
"if",
"len",
"(",
"parts",
")",
"==",
"(",
"1",
"if",
"(",
"self",
".",
"_drv",
"or",
"self",
".",
"_root",
")",
"else",
"0",
")",
":",
"return",
"''",
"return",
"parts"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pathlib2/pathlib2/__init__.py#L1040-L1045 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/coremltools_wrap/coremltools/deps/protobuf/python/setup.py | python | GetVersion | () | Gets the version from google/protobuf/__init__.py
Do not import google.protobuf.__init__ directly, because an installed
protobuf library may be loaded instead. | Gets the version from google/protobuf/__init__.py | [
"Gets",
"the",
"version",
"from",
"google",
"/",
"protobuf",
"/",
"__init__",
".",
"py"
] | def GetVersion():
"""Gets the version from google/protobuf/__init__.py
Do not import google.protobuf.__init__ directly, because an installed
protobuf library may be loaded instead."""
with open(os.path.join('google', 'protobuf', '__init__.py')) as version_file:
exec(version_file.read(), globals())
ret... | [
"def",
"GetVersion",
"(",
")",
":",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"'google'",
",",
"'protobuf'",
",",
"'__init__.py'",
")",
")",
"as",
"version_file",
":",
"exec",
"(",
"version_file",
".",
"read",
"(",
")",
",",
"globals",
... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/coremltools_wrap/coremltools/deps/protobuf/python/setup.py#L39-L47 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py3/sklearn/manifold/_t_sne.py | python | _gradient_descent | (objective, p0, it, n_iter,
n_iter_check=1, n_iter_without_progress=300,
momentum=0.8, learning_rate=200.0, min_gain=0.01,
min_grad_norm=1e-7, verbose=0, args=None, kwargs=None) | return p, error, i | Batch gradient descent with momentum and individual gains.
Parameters
----------
objective : function or callable
Should return a tuple of cost and gradient for a given parameter
vector. When expensive to compute, the cost can optionally
be None and can be computed every n_iter_chec... | Batch gradient descent with momentum and individual gains. | [
"Batch",
"gradient",
"descent",
"with",
"momentum",
"and",
"individual",
"gains",
"."
] | def _gradient_descent(objective, p0, it, n_iter,
n_iter_check=1, n_iter_without_progress=300,
momentum=0.8, learning_rate=200.0, min_gain=0.01,
min_grad_norm=1e-7, verbose=0, args=None, kwargs=None):
"""Batch gradient descent with momentum and indivi... | [
"def",
"_gradient_descent",
"(",
"objective",
",",
"p0",
",",
"it",
",",
"n_iter",
",",
"n_iter_check",
"=",
"1",
",",
"n_iter_without_progress",
"=",
"300",
",",
"momentum",
"=",
"0.8",
",",
"learning_rate",
"=",
"200.0",
",",
"min_gain",
"=",
"0.01",
","... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/manifold/_t_sne.py#L270-L396 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/mailbox.py | python | MH.add_folder | (self, folder) | return MH(os.path.join(self._path, folder),
factory=self._factory) | Create a folder and return an MH instance representing it. | Create a folder and return an MH instance representing it. | [
"Create",
"a",
"folder",
"and",
"return",
"an",
"MH",
"instance",
"representing",
"it",
"."
] | def add_folder(self, folder):
"""Create a folder and return an MH instance representing it."""
return MH(os.path.join(self._path, folder),
factory=self._factory) | [
"def",
"add_folder",
"(",
"self",
",",
"folder",
")",
":",
"return",
"MH",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"_path",
",",
"folder",
")",
",",
"factory",
"=",
"self",
".",
"_factory",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/mailbox.py#L1126-L1129 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/swf/layer1_decisions.py | python | Layer1Decisions.schedule_activity_task | (self,
activity_id,
activity_type_name,
activity_type_version,
task_list=None,
control=None,
heartbeat_timeout=None,
... | Schedules an activity task.
:type activity_id: string
:param activity_id: The activityId of the type of the activity
being scheduled.
:type activity_type_name: string
:param activity_type_name: The name of the type of the activity
being scheduled.
:type... | Schedules an activity task. | [
"Schedules",
"an",
"activity",
"task",
"."
] | def schedule_activity_task(self,
activity_id,
activity_type_name,
activity_type_version,
task_list=None,
control=None,
heartbeat_timeo... | [
"def",
"schedule_activity_task",
"(",
"self",
",",
"activity_id",
",",
"activity_type_name",
",",
"activity_type_version",
",",
"task_list",
"=",
"None",
",",
"control",
"=",
"None",
",",
"heartbeat_timeout",
"=",
"None",
",",
"schedule_to_close_timeout",
"=",
"None... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/swf/layer1_decisions.py#L16-L73 | ||
google/certificate-transparency | 2588562fd306a447958471b6f06c1069619c1641 | python/ct/client/log_client.py | python | RequestHandler.get_response | (self, uri, params=None) | Get an HTTP response for a GET request. | Get an HTTP response for a GET request. | [
"Get",
"an",
"HTTP",
"response",
"for",
"a",
"GET",
"request",
"."
] | def get_response(self, uri, params=None):
"""Get an HTTP response for a GET request."""
uri_with_params = self._uri_with_params(uri, params)
num_get_attempts = self._num_retries + 1
while num_get_attempts > 0:
try:
return requests.get(uri, params=params, timeo... | [
"def",
"get_response",
"(",
"self",
",",
"uri",
",",
"params",
"=",
"None",
")",
":",
"uri_with_params",
"=",
"self",
".",
"_uri_with_params",
"(",
"uri",
",",
"params",
")",
"num_get_attempts",
"=",
"self",
".",
"_num_retries",
"+",
"1",
"while",
"num_get... | https://github.com/google/certificate-transparency/blob/2588562fd306a447958471b6f06c1069619c1641/python/ct/client/log_client.py#L174-L190 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/lib/_datasource.py | python | Repository._fullpath | (self, path) | return result | Return complete path for path. Prepends baseurl if necessary. | Return complete path for path. Prepends baseurl if necessary. | [
"Return",
"complete",
"path",
"for",
"path",
".",
"Prepends",
"baseurl",
"if",
"necessary",
"."
] | def _fullpath(self, path):
"""Return complete path for path. Prepends baseurl if necessary."""
splitpath = path.split(self._baseurl, 2)
if len(splitpath) == 1:
result = os.path.join(self._baseurl, path)
else:
result = path # path contains baseurl already
... | [
"def",
"_fullpath",
"(",
"self",
",",
"path",
")",
":",
"splitpath",
"=",
"path",
".",
"split",
"(",
"self",
".",
"_baseurl",
",",
"2",
")",
"if",
"len",
"(",
"splitpath",
")",
"==",
"1",
":",
"result",
"=",
"os",
".",
"path",
".",
"join",
"(",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/lib/_datasource.py#L674-L681 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/signal/ltisys.py | python | StateSpace.__repr__ | (self) | return '{0}(\n{1},\n{2},\n{3},\n{4},\ndt: {5}\n)'.format(
self.__class__.__name__,
repr(self.A),
repr(self.B),
repr(self.C),
repr(self.D),
repr(self.dt),
) | Return representation of the `StateSpace` system. | Return representation of the `StateSpace` system. | [
"Return",
"representation",
"of",
"the",
"StateSpace",
"system",
"."
] | def __repr__(self):
"""Return representation of the `StateSpace` system."""
return '{0}(\n{1},\n{2},\n{3},\n{4},\ndt: {5}\n)'.format(
self.__class__.__name__,
repr(self.A),
repr(self.B),
repr(self.C),
repr(self.D),
repr(self.dt),
... | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"'{0}(\\n{1},\\n{2},\\n{3},\\n{4},\\ndt: {5}\\n)'",
".",
"format",
"(",
"self",
".",
"__class__",
".",
"__name__",
",",
"repr",
"(",
"self",
".",
"A",
")",
",",
"repr",
"(",
"self",
".",
"B",
")",
",",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/signal/ltisys.py#L1335-L1344 | |
rrwick/Unicycler | 96ffea71e3a78d63ade19d6124946773e65cf129 | unicycler/assembly_graph_copy_depth.py | python | scale_copy_depths | (target_depth, source_depths) | return scaled_depths, error | This function takes the source depths and scales them so their sum matches the target
depth. It returns the scaled depths and the error. | This function takes the source depths and scales them so their sum matches the target
depth. It returns the scaled depths and the error. | [
"This",
"function",
"takes",
"the",
"source",
"depths",
"and",
"scales",
"them",
"so",
"their",
"sum",
"matches",
"the",
"target",
"depth",
".",
"It",
"returns",
"the",
"scaled",
"depths",
"and",
"the",
"error",
"."
] | def scale_copy_depths(target_depth, source_depths):
"""
This function takes the source depths and scales them so their sum matches the target
depth. It returns the scaled depths and the error.
"""
source_depth_sum = sum(source_depths)
scaling_factor = target_depth / source_depth_sum
scaled_... | [
"def",
"scale_copy_depths",
"(",
"target_depth",
",",
"source_depths",
")",
":",
"source_depth_sum",
"=",
"sum",
"(",
"source_depths",
")",
"scaling_factor",
"=",
"target_depth",
"/",
"source_depth_sum",
"scaled_depths",
"=",
"sorted",
"(",
"[",
"scaling_factor",
"*... | https://github.com/rrwick/Unicycler/blob/96ffea71e3a78d63ade19d6124946773e65cf129/unicycler/assembly_graph_copy_depth.py#L368-L377 | |
SpenceKonde/megaTinyCore | 1c4a70b18a149fe6bcb551dfa6db11ca50b8997b | megaavr/tools/libs/pyedbglib/protocols/avrcmsisdap.py | python | AvrCommand.poll_events | (self) | return resp | Polling for events from AVRs
:return: response from events | Polling for events from AVRs | [
"Polling",
"for",
"events",
"from",
"AVRs"
] | def poll_events(self):
"""
Polling for events from AVRs
:return: response from events
"""
self.logger.debug("Polling AVR events")
resp = self.dap_command_response(bytearray([self.AVR_EVENT]))
return resp | [
"def",
"poll_events",
"(",
"self",
")",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"\"Polling AVR events\"",
")",
"resp",
"=",
"self",
".",
"dap_command_response",
"(",
"bytearray",
"(",
"[",
"self",
".",
"AVR_EVENT",
"]",
")",
")",
"return",
"resp"
] | https://github.com/SpenceKonde/megaTinyCore/blob/1c4a70b18a149fe6bcb551dfa6db11ca50b8997b/megaavr/tools/libs/pyedbglib/protocols/avrcmsisdap.py#L43-L51 | |
microsoft/TSS.MSR | 0f2516fca2cd9929c31d5450e39301c9bde43688 | TSS.Py/src/TpmTypes.py | python | TPM2_LoadExternal_REQUEST.fromTpm | (buf) | return buf.createObj(TPM2_LoadExternal_REQUEST) | Returns new TPM2_LoadExternal_REQUEST object constructed from its
marshaled representation in the given TpmBuffer buffer | Returns new TPM2_LoadExternal_REQUEST object constructed from its
marshaled representation in the given TpmBuffer buffer | [
"Returns",
"new",
"TPM2_LoadExternal_REQUEST",
"object",
"constructed",
"from",
"its",
"marshaled",
"representation",
"in",
"the",
"given",
"TpmBuffer",
"buffer"
] | def fromTpm(buf):
""" Returns new TPM2_LoadExternal_REQUEST object constructed from its
marshaled representation in the given TpmBuffer buffer
"""
return buf.createObj(TPM2_LoadExternal_REQUEST) | [
"def",
"fromTpm",
"(",
"buf",
")",
":",
"return",
"buf",
".",
"createObj",
"(",
"TPM2_LoadExternal_REQUEST",
")"
] | https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L9691-L9695 | |
commaai/openpilot | 4416c21b1e738ab7d04147c5ae52b5135e0cdb40 | selfdrive/debug/can_print_changes.py | python | can_printer | (bus=0) | Collects messages and prints when a new bit transition is observed.
This is very useful to find signals based on user triggered actions, such as blinkers and seatbelt.
Leave the script running until no new transitions are seen, then perform the action. | Collects messages and prints when a new bit transition is observed.
This is very useful to find signals based on user triggered actions, such as blinkers and seatbelt.
Leave the script running until no new transitions are seen, then perform the action. | [
"Collects",
"messages",
"and",
"prints",
"when",
"a",
"new",
"bit",
"transition",
"is",
"observed",
".",
"This",
"is",
"very",
"useful",
"to",
"find",
"signals",
"based",
"on",
"user",
"triggered",
"actions",
"such",
"as",
"blinkers",
"and",
"seatbelt",
".",... | def can_printer(bus=0):
"""Collects messages and prints when a new bit transition is observed.
This is very useful to find signals based on user triggered actions, such as blinkers and seatbelt.
Leave the script running until no new transitions are seen, then perform the action."""
logcan = messaging.sub_sock('... | [
"def",
"can_printer",
"(",
"bus",
"=",
"0",
")",
":",
"logcan",
"=",
"messaging",
".",
"sub_sock",
"(",
"'can'",
")",
"low_to_high",
"=",
"defaultdict",
"(",
"int",
")",
"high_to_low",
"=",
"defaultdict",
"(",
"int",
")",
"while",
"1",
":",
"can_recv",
... | https://github.com/commaai/openpilot/blob/4416c21b1e738ab7d04147c5ae52b5135e0cdb40/selfdrive/debug/can_print_changes.py#L10-L39 | ||
networkit/networkit | 695b7a786a894a303fa8587597d5ef916e797729 | benchmark/Benchmark.py | python | Bench.plotSummary2 | (self, figsize=None, groupby="framework", palette="Greens_d") | Plot a summary of algorithm performances | Plot a summary of algorithm performances | [
"Plot",
"a",
"summary",
"of",
"algorithm",
"performances"
] | def plotSummary2(self, figsize=None, groupby="framework", palette="Greens_d"):
""" Plot a summary of algorithm performances"""
if not have_plt:
raise MissingDependencyError("matplotlib")
if not have_seaborn:
raise MissingDependencyError("seaborn")
if figsize:
plt.figure(figsize=figsize)
plt.gca().xax... | [
"def",
"plotSummary2",
"(",
"self",
",",
"figsize",
"=",
"None",
",",
"groupby",
"=",
"\"framework\"",
",",
"palette",
"=",
"\"Greens_d\"",
")",
":",
"if",
"not",
"have_plt",
":",
"raise",
"MissingDependencyError",
"(",
"\"matplotlib\"",
")",
"if",
"not",
"h... | https://github.com/networkit/networkit/blob/695b7a786a894a303fa8587597d5ef916e797729/benchmark/Benchmark.py#L380-L393 | ||
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/tools/inspector_protocol/jinja2/ext.py | python | Extension.attr | (self, name, lineno=None) | return nodes.ExtensionAttribute(self.identifier, name, lineno=lineno) | Return an attribute node for the current extension. This is useful
to pass constants on extensions to generated template code.
::
self.attr('_my_attribute', lineno=lineno) | Return an attribute node for the current extension. This is useful
to pass constants on extensions to generated template code. | [
"Return",
"an",
"attribute",
"node",
"for",
"the",
"current",
"extension",
".",
"This",
"is",
"useful",
"to",
"pass",
"constants",
"on",
"extensions",
"to",
"generated",
"template",
"code",
"."
] | def attr(self, name, lineno=None):
"""Return an attribute node for the current extension. This is useful
to pass constants on extensions to generated template code.
::
self.attr('_my_attribute', lineno=lineno)
"""
return nodes.ExtensionAttribute(self.identifier, na... | [
"def",
"attr",
"(",
"self",
",",
"name",
",",
"lineno",
"=",
"None",
")",
":",
"return",
"nodes",
".",
"ExtensionAttribute",
"(",
"self",
".",
"identifier",
",",
"name",
",",
"lineno",
"=",
"lineno",
")"
] | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/tools/inspector_protocol/jinja2/ext.py#L109-L117 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/pydoc.py | python | getpager | () | Decide what method to use for paging through text. | Decide what method to use for paging through text. | [
"Decide",
"what",
"method",
"to",
"use",
"for",
"paging",
"through",
"text",
"."
] | def getpager():
"""Decide what method to use for paging through text."""
if type(sys.stdout) is not types.FileType:
return plainpager
if not sys.stdin.isatty() or not sys.stdout.isatty():
return plainpager
if 'PAGER' in os.environ:
if sys.platform == 'win32': # pipes completely b... | [
"def",
"getpager",
"(",
")",
":",
"if",
"type",
"(",
"sys",
".",
"stdout",
")",
"is",
"not",
"types",
".",
"FileType",
":",
"return",
"plainpager",
"if",
"not",
"sys",
".",
"stdin",
".",
"isatty",
"(",
")",
"or",
"not",
"sys",
".",
"stdout",
".",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/pydoc.py#L1339-L1368 | ||
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/optparse.py | python | OptionParser.print_usage | (self, file=None) | print_usage(file : file = stdout)
Print the usage message for the current program (self.usage) to
'file' (default stdout). Any occurrence of the string "%prog" in
self.usage is replaced with the name of the current program
(basename of sys.argv[0]). Does nothing if self.usage is empty... | print_usage(file : file = stdout) | [
"print_usage",
"(",
"file",
":",
"file",
"=",
"stdout",
")"
] | def print_usage(self, file=None):
"""print_usage(file : file = stdout)
Print the usage message for the current program (self.usage) to
'file' (default stdout). Any occurrence of the string "%prog" in
self.usage is replaced with the name of the current program
(basename of sys.a... | [
"def",
"print_usage",
"(",
"self",
",",
"file",
"=",
"None",
")",
":",
"if",
"self",
".",
"usage",
":",
"print",
">>",
"file",
",",
"self",
".",
"get_usage",
"(",
")"
] | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/optparse.py#L1587-L1597 | ||
generalized-intelligence/GAAS | 29ab17d3e8a4ba18edef3a57c36d8db6329fac73 | deprecated/algorithms/sfm/OpenSfM/opensfm/dataset.py | python | DataSet.load_camera_models | (self) | Return camera models data | Return camera models data | [
"Return",
"camera",
"models",
"data"
] | def load_camera_models(self):
"""Return camera models data"""
with io.open_rt(self._camera_models_file()) as fin:
obj = json.load(fin)
return io.cameras_from_json(obj) | [
"def",
"load_camera_models",
"(",
"self",
")",
":",
"with",
"io",
".",
"open_rt",
"(",
"self",
".",
"_camera_models_file",
"(",
")",
")",
"as",
"fin",
":",
"obj",
"=",
"json",
".",
"load",
"(",
"fin",
")",
"return",
"io",
".",
"cameras_from_json",
"(",... | https://github.com/generalized-intelligence/GAAS/blob/29ab17d3e8a4ba18edef3a57c36d8db6329fac73/deprecated/algorithms/sfm/OpenSfM/opensfm/dataset.py#L638-L642 | ||
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/contrib/tensor_forest/python/topn.py | python | TopN.get_best | (self, n) | Return the indices and values of the n highest scores in the TopN. | Return the indices and values of the n highest scores in the TopN. | [
"Return",
"the",
"indices",
"and",
"values",
"of",
"the",
"n",
"highest",
"scores",
"in",
"the",
"TopN",
"."
] | def get_best(self, n):
"""Return the indices and values of the n highest scores in the TopN."""
def refresh_shortlist():
"""Update the shortlist with the highest scores in id_to_score."""
new_scores, new_ids = tf.nn.top_k(self.id_to_score, self.shortlist_size)
smallest_new_score = tf.reduce_m... | [
"def",
"get_best",
"(",
"self",
",",
"n",
")",
":",
"def",
"refresh_shortlist",
"(",
")",
":",
"\"\"\"Update the shortlist with the highest scores in id_to_score.\"\"\"",
"new_scores",
",",
"new_ids",
"=",
"tf",
".",
"nn",
".",
"top_k",
"(",
"self",
".",
"id_to_sc... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/tensor_forest/python/topn.py#L126-L152 | ||
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/path-sum-iv.py | python | Solution.pathSum | (self, nums) | return result | :type nums: List[int]
:rtype: int | :type nums: List[int]
:rtype: int | [
":",
"type",
"nums",
":",
"List",
"[",
"int",
"]",
":",
"rtype",
":",
"int"
] | def pathSum(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
class Node(object):
def __init__(self, num):
self.level = num/100 - 1
self.i = (num%100)/10 - 1
self.val = num%10
self.leaf = True
... | [
"def",
"pathSum",
"(",
"self",
",",
"nums",
")",
":",
"class",
"Node",
"(",
"object",
")",
":",
"def",
"__init__",
"(",
"self",
",",
"num",
")",
":",
"self",
".",
"level",
"=",
"num",
"/",
"100",
"-",
"1",
"self",
".",
"i",
"=",
"(",
"num",
"... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/path-sum-iv.py#L8-L40 | |
apache/trafodion | 8455c839ad6b6d7b6e04edda5715053095b78046 | install/python-installer/scripts/common.py | python | HadoopDiscover._get_rsnodes_cdh | (self) | get list of HBase RegionServer nodes in CDH | get list of HBase RegionServer nodes in CDH | [
"get",
"list",
"of",
"HBase",
"RegionServer",
"nodes",
"in",
"CDH"
] | def _get_rsnodes_cdh(self):
""" get list of HBase RegionServer nodes in CDH """
hostids = []
for c in self.cm['clusters']:
if c['displayName'] == self.cluster_name:
for s in c['services']:
if s['type'] == 'HBASE':
for r in s... | [
"def",
"_get_rsnodes_cdh",
"(",
"self",
")",
":",
"hostids",
"=",
"[",
"]",
"for",
"c",
"in",
"self",
".",
"cm",
"[",
"'clusters'",
"]",
":",
"if",
"c",
"[",
"'displayName'",
"]",
"==",
"self",
".",
"cluster_name",
":",
"for",
"s",
"in",
"c",
"[",
... | https://github.com/apache/trafodion/blob/8455c839ad6b6d7b6e04edda5715053095b78046/install/python-installer/scripts/common.py#L265-L276 | ||
MythTV/mythtv | d282a209cb8be85d036f85a62a8ec971b67d45f4 | mythtv/programs/scripts/internetcontent/nv_python_libs/vimeo/vimeo_api.py | python | CurlyRequest.do_post_call | (self, url, args, use_progress=False) | return res | Send a simple POST request | Send a simple POST request | [
"Send",
"a",
"simple",
"POST",
"request"
] | def do_post_call(self, url, args, use_progress=False):
"""
Send a simple POST request
"""
c = pycurl.Curl()
c.setopt(c.POST, 1)
c.setopt(c.URL, url)
c.setopt(c.HTTPPOST, args)
c.setopt(c.WRITEFUNCTION, self.body_callback)
#c.setopt(c.VERBOSE, 1)
... | [
"def",
"do_post_call",
"(",
"self",
",",
"url",
",",
"args",
",",
"use_progress",
"=",
"False",
")",
":",
"c",
"=",
"pycurl",
".",
"Curl",
"(",
")",
"c",
".",
"setopt",
"(",
"c",
".",
"POST",
",",
"1",
")",
"c",
".",
"setopt",
"(",
"c",
".",
... | https://github.com/MythTV/mythtv/blob/d282a209cb8be85d036f85a62a8ec971b67d45f4/mythtv/programs/scripts/internetcontent/nv_python_libs/vimeo/vimeo_api.py#L183-L204 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py3/numpy/distutils/command/autodist.py | python | check_gcc_function_attribute_with_intrinsics | (cmd, attribute, name, code,
include) | return cmd.try_compile(body, None, None) != 0 | Return True if the given function attribute is supported with
intrinsics. | Return True if the given function attribute is supported with
intrinsics. | [
"Return",
"True",
"if",
"the",
"given",
"function",
"attribute",
"is",
"supported",
"with",
"intrinsics",
"."
] | def check_gcc_function_attribute_with_intrinsics(cmd, attribute, name, code,
include):
"""Return True if the given function attribute is supported with
intrinsics."""
cmd._check_compiler()
body = textwrap.dedent("""
#include<%s>
int %s %s(v... | [
"def",
"check_gcc_function_attribute_with_intrinsics",
"(",
"cmd",
",",
"attribute",
",",
"name",
",",
"code",
",",
"include",
")",
":",
"cmd",
".",
"_check_compiler",
"(",
")",
"body",
"=",
"textwrap",
".",
"dedent",
"(",
"\"\"\"\n #include<%s>\n int ... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py3/numpy/distutils/command/autodist.py#L111-L130 | |
bairdzhang/smallhardface | 76fa1d87a9602d9b13d7a7fe693fc7aec91cab80 | external/marcopede-face-eval-f2870fd85d48/util.py | python | myinclusion | (rect1, rect2) | return ia / float(a21) - dc | Calculate the intersection percentage between two rectangles
Note that it is not anymore symmetric | Calculate the intersection percentage between two rectangles
Note that it is not anymore symmetric | [
"Calculate",
"the",
"intersection",
"percentage",
"between",
"two",
"rectangles",
"Note",
"that",
"it",
"is",
"not",
"anymore",
"symmetric"
] | def myinclusion(rect1, rect2):
"""
Calculate the intersection percentage between two rectangles
Note that it is not anymore symmetric
"""
dy1 = abs(rect1[0] - rect1[2]) + 1
dx1 = abs(rect1[1] - rect1[3]) + 1
dy2 = abs(rect2[0] - rect2[2]) + 1
dx2 = abs(rect2[1] - rect2[3]) + 1
... | [
"def",
"myinclusion",
"(",
"rect1",
",",
"rect2",
")",
":",
"dy1",
"=",
"abs",
"(",
"rect1",
"[",
"0",
"]",
"-",
"rect1",
"[",
"2",
"]",
")",
"+",
"1",
"dx1",
"=",
"abs",
"(",
"rect1",
"[",
"1",
"]",
"-",
"rect1",
"[",
"3",
"]",
")",
"+",
... | https://github.com/bairdzhang/smallhardface/blob/76fa1d87a9602d9b13d7a7fe693fc7aec91cab80/external/marcopede-face-eval-f2870fd85d48/util.py#L217-L249 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/training/training_util.py | python | assert_global_step | (global_step_tensor) | Asserts `global_step_tensor` is a scalar int `Variable` or `Tensor`.
Args:
global_step_tensor: `Tensor` to test. | Asserts `global_step_tensor` is a scalar int `Variable` or `Tensor`. | [
"Asserts",
"global_step_tensor",
"is",
"a",
"scalar",
"int",
"Variable",
"or",
"Tensor",
"."
] | def assert_global_step(global_step_tensor):
"""Asserts `global_step_tensor` is a scalar int `Variable` or `Tensor`.
Args:
global_step_tensor: `Tensor` to test.
"""
if not (isinstance(global_step_tensor, variables.Variable) or
isinstance(global_step_tensor, ops.Tensor) or
isinstance(glob... | [
"def",
"assert_global_step",
"(",
"global_step_tensor",
")",
":",
"if",
"not",
"(",
"isinstance",
"(",
"global_step_tensor",
",",
"variables",
".",
"Variable",
")",
"or",
"isinstance",
"(",
"global_step_tensor",
",",
"ops",
".",
"Tensor",
")",
"or",
"isinstance"... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/training/training_util.py#L148-L169 | ||
arangodb/arangodb | 0d658689c7d1b721b314fa3ca27d38303e1570c8 | 3rdParty/boost/1.78.0/libs/metaparse/tools/benchmark/benchmark.py | python | make_filename | (string) | return ''.join(string_char(c) for c in string) | Turn the string into a filename | Turn the string into a filename | [
"Turn",
"the",
"string",
"into",
"a",
"filename"
] | def make_filename(string):
"""Turn the string into a filename"""
return ''.join(string_char(c) for c in string) | [
"def",
"make_filename",
"(",
"string",
")",
":",
"return",
"''",
".",
"join",
"(",
"string_char",
"(",
"c",
")",
"for",
"c",
"in",
"string",
")"
] | https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/boost/1.78.0/libs/metaparse/tools/benchmark/benchmark.py#L100-L102 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/tools/gyp/pylib/gyp/generator/ninja.py | python | Target.Linkable | (self) | return self.type in ("static_library", "shared_library") | Return true if this is a target that can be linked against. | Return true if this is a target that can be linked against. | [
"Return",
"true",
"if",
"this",
"is",
"a",
"target",
"that",
"can",
"be",
"linked",
"against",
"."
] | def Linkable(self):
"""Return true if this is a target that can be linked against."""
return self.type in ("static_library", "shared_library") | [
"def",
"Linkable",
"(",
"self",
")",
":",
"return",
"self",
".",
"type",
"in",
"(",
"\"static_library\"",
",",
"\"shared_library\"",
")"
] | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/gyp/pylib/gyp/generator/ninja.py#L156-L158 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/cuda/cudadrv/driver.py | python | profile_stop | () | Disable profile collection in the current context. | Disable profile collection in the current context. | [
"Disable",
"profile",
"collection",
"in",
"the",
"current",
"context",
"."
] | def profile_stop():
'''
Disable profile collection in the current context.
'''
driver.cuProfilerStop() | [
"def",
"profile_stop",
"(",
")",
":",
"driver",
".",
"cuProfilerStop",
"(",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/cuda/cudadrv/driver.py#L1967-L1971 | ||
baidu/lac | 3e10dbed9bfd87bea927c84a6627a167c17b5617 | python/LAC/models.py | python | LacModel.call_run | (self, texts) | return lac_result | lac被rank模型调用时返回的结果 | lac被rank模型调用时返回的结果 | [
"lac被rank模型调用时返回的结果"
] | def call_run(self, texts):
"""lac被rank模型调用时返回的结果"""
lac_result = super(LacModel, self).run(texts)
return lac_result | [
"def",
"call_run",
"(",
"self",
",",
"texts",
")",
":",
"lac_result",
"=",
"super",
"(",
"LacModel",
",",
"self",
")",
".",
"run",
"(",
"texts",
")",
"return",
"lac_result"
] | https://github.com/baidu/lac/blob/3e10dbed9bfd87bea927c84a6627a167c17b5617/python/LAC/models.py#L243-L246 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/mailbox.py | python | Mailbox.pop | (self, key, default=None) | return result | Delete the keyed message and return it, or default. | Delete the keyed message and return it, or default. | [
"Delete",
"the",
"keyed",
"message",
"and",
"return",
"it",
"or",
"default",
"."
] | def pop(self, key, default=None):
"""Delete the keyed message and return it, or default."""
try:
result = self[key]
except KeyError:
return default
self.discard(key)
return result | [
"def",
"pop",
"(",
"self",
",",
"key",
",",
"default",
"=",
"None",
")",
":",
"try",
":",
"result",
"=",
"self",
"[",
"key",
"]",
"except",
"KeyError",
":",
"return",
"default",
"self",
".",
"discard",
"(",
"key",
")",
"return",
"result"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/mailbox.py#L151-L158 | |
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/lldb/utils/vim-lldb/python-vim-lldb/vim_panes.py | python | BacktracePane.get_selected_line | (self) | Returns the line number in the buffer with the selected frame.
Formula: selected_line = selected_frame_id + 2
FIXME: the above formula hack does not work when the function return
value is printed in the bt window; the wrong line is highlighted. | Returns the line number in the buffer with the selected frame.
Formula: selected_line = selected_frame_id + 2
FIXME: the above formula hack does not work when the function return
value is printed in the bt window; the wrong line is highlighted. | [
"Returns",
"the",
"line",
"number",
"in",
"the",
"buffer",
"with",
"the",
"selected",
"frame",
".",
"Formula",
":",
"selected_line",
"=",
"selected_frame_id",
"+",
"2",
"FIXME",
":",
"the",
"above",
"formula",
"hack",
"does",
"not",
"work",
"when",
"the",
... | def get_selected_line(self):
""" Returns the line number in the buffer with the selected frame.
Formula: selected_line = selected_frame_id + 2
FIXME: the above formula hack does not work when the function return
value is printed in the bt window; the wrong line is high... | [
"def",
"get_selected_line",
"(",
"self",
")",
":",
"(",
"frame",
",",
"err",
")",
"=",
"get_selected_frame",
"(",
"self",
".",
"target",
")",
"if",
"frame",
"is",
"None",
":",
"return",
"None",
"else",
":",
"return",
"frame",
".",
"GetFrameID",
"(",
")... | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/utils/vim-lldb/python-vim-lldb/vim_panes.py#L645-L656 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/aui.py | python | AuiToolBar.AddTool | (*args) | return _aui.AuiToolBar_AddTool(*args) | AddTool(self, int toolId, String label, Bitmap bitmap, String shortHelpString=wxEmptyString,
int kind=ITEM_NORMAL) -> AuiToolBarItem
AddTool(self, int toolId, String label, Bitmap bitmap, Bitmap disabledBitmap,
int kind, String shortHelpString,
String longHelpString, Objec... | AddTool(self, int toolId, String label, Bitmap bitmap, String shortHelpString=wxEmptyString,
int kind=ITEM_NORMAL) -> AuiToolBarItem
AddTool(self, int toolId, String label, Bitmap bitmap, Bitmap disabledBitmap,
int kind, String shortHelpString,
String longHelpString, Objec... | [
"AddTool",
"(",
"self",
"int",
"toolId",
"String",
"label",
"Bitmap",
"bitmap",
"String",
"shortHelpString",
"=",
"wxEmptyString",
"int",
"kind",
"=",
"ITEM_NORMAL",
")",
"-",
">",
"AuiToolBarItem",
"AddTool",
"(",
"self",
"int",
"toolId",
"String",
"label",
"... | def AddTool(*args):
"""
AddTool(self, int toolId, String label, Bitmap bitmap, String shortHelpString=wxEmptyString,
int kind=ITEM_NORMAL) -> AuiToolBarItem
AddTool(self, int toolId, String label, Bitmap bitmap, Bitmap disabledBitmap,
int kind, String shortHelpString,
... | [
"def",
"AddTool",
"(",
"*",
"args",
")",
":",
"return",
"_aui",
".",
"AuiToolBar_AddTool",
"(",
"*",
"args",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/aui.py#L2017-L2028 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/sheet.py | python | CSheet.OnGridSelectCell | (self, event) | Track cell selections | Track cell selections | [
"Track",
"cell",
"selections"
] | def OnGridSelectCell(self, event):
""" Track cell selections """
# Save the last cell coordinates
self._lastRow, self._lastCol = event.GetRow(), event.GetCol()
event.Skip() | [
"def",
"OnGridSelectCell",
"(",
"self",
",",
"event",
")",
":",
"# Save the last cell coordinates",
"self",
".",
"_lastRow",
",",
"self",
".",
"_lastCol",
"=",
"event",
".",
"GetRow",
"(",
")",
",",
"event",
".",
"GetCol",
"(",
")",
"event",
".",
"Skip",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/sheet.py#L198-L202 | ||
Atarity/Lightpack | 4dee73a443cba4c4073291febe450e6c1941f3af | Software/apiexamples/liOSC/OSC.py | python | OSCServer.setSrvErrorPrefix | (self, pattern="") | Set the OSC-address (pattern) this server will use to report errors occuring during
received message handling to the remote client.
If pattern is empty (default), server-errors are not reported back to the client. | Set the OSC-address (pattern) this server will use to report errors occuring during
received message handling to the remote client.
If pattern is empty (default), server-errors are not reported back to the client. | [
"Set",
"the",
"OSC",
"-",
"address",
"(",
"pattern",
")",
"this",
"server",
"will",
"use",
"to",
"report",
"errors",
"occuring",
"during",
"received",
"message",
"handling",
"to",
"the",
"remote",
"client",
".",
"If",
"pattern",
"is",
"empty",
"(",
"defaul... | def setSrvErrorPrefix(self, pattern=""):
"""Set the OSC-address (pattern) this server will use to report errors occuring during
received message handling to the remote client.
If pattern is empty (default), server-errors are not reported back to the client.
"""
if len(pattern):
pattern = '/' + pattern.s... | [
"def",
"setSrvErrorPrefix",
"(",
"self",
",",
"pattern",
"=",
"\"\"",
")",
":",
"if",
"len",
"(",
"pattern",
")",
":",
"pattern",
"=",
"'/'",
"+",
"pattern",
".",
"strip",
"(",
"'/'",
")",
"self",
".",
"error_prefix",
"=",
"pattern"
] | https://github.com/Atarity/Lightpack/blob/4dee73a443cba4c4073291febe450e6c1941f3af/Software/apiexamples/liOSC/OSC.py#L1877-L1886 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/debug/cli/analyzer_cli.py | python | DebugAnalyzer._list_node_dumps | (self, node_name) | return output_with_header | List dumped tensor data from a node.
Args:
node_name: Name of the node of which the attributes are to be listed.
Returns:
A RichTextLines object. | List dumped tensor data from a node. | [
"List",
"dumped",
"tensor",
"data",
"from",
"a",
"node",
"."
] | def _list_node_dumps(self, node_name):
"""List dumped tensor data from a node.
Args:
node_name: Name of the node of which the attributes are to be listed.
Returns:
A RichTextLines object.
"""
lines = []
font_attr_segs = {}
watch_keys = self._debug_dump.debug_watch_keys(node_n... | [
"def",
"_list_node_dumps",
"(",
"self",
",",
"node_name",
")",
":",
"lines",
"=",
"[",
"]",
"font_attr_segs",
"=",
"{",
"}",
"watch_keys",
"=",
"self",
".",
"_debug_dump",
".",
"debug_watch_keys",
"(",
"node_name",
")",
"dump_count",
"=",
"0",
"for",
"watc... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/debug/cli/analyzer_cli.py#L1546-L1579 | |
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | third_party/numpy/files/numpy/lib/type_check.py | python | iscomplexobj | (x) | return issubclass( asarray(x).dtype.type, _nx.complexfloating) | Return True if x is a complex type or an array of complex numbers.
The type of the input is checked, not the value. So even if the input
has an imaginary part equal to zero, `iscomplexobj` evaluates to True
if the data type is complex.
Parameters
----------
x : any
The input can be of ... | Return True if x is a complex type or an array of complex numbers. | [
"Return",
"True",
"if",
"x",
"is",
"a",
"complex",
"type",
"or",
"an",
"array",
"of",
"complex",
"numbers",
"."
] | def iscomplexobj(x):
"""
Return True if x is a complex type or an array of complex numbers.
The type of the input is checked, not the value. So even if the input
has an imaginary part equal to zero, `iscomplexobj` evaluates to True
if the data type is complex.
Parameters
----------
x :... | [
"def",
"iscomplexobj",
"(",
"x",
")",
":",
"return",
"issubclass",
"(",
"asarray",
"(",
"x",
")",
".",
"dtype",
".",
"type",
",",
"_nx",
".",
"complexfloating",
")"
] | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/lib/type_check.py#L235-L267 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/OpenSSL/SSL.py | python | Context.set_session_cache_mode | (self, mode) | return _lib.SSL_CTX_set_session_cache_mode(self._context, mode) | Set the behavior of the session cache used by all connections using
this Context. The previously set mode is returned. See
:const:`SESS_CACHE_*` for details about particular modes.
:param mode: One or more of the SESS_CACHE_* flags (combine using
bitwise or)
:returns: The ... | Set the behavior of the session cache used by all connections using
this Context. The previously set mode is returned. See
:const:`SESS_CACHE_*` for details about particular modes. | [
"Set",
"the",
"behavior",
"of",
"the",
"session",
"cache",
"used",
"by",
"all",
"connections",
"using",
"this",
"Context",
".",
"The",
"previously",
"set",
"mode",
"is",
"returned",
".",
"See",
":",
"const",
":",
"SESS_CACHE_",
"*",
"for",
"details",
"abou... | def set_session_cache_mode(self, mode):
"""
Set the behavior of the session cache used by all connections using
this Context. The previously set mode is returned. See
:const:`SESS_CACHE_*` for details about particular modes.
:param mode: One or more of the SESS_CACHE_* flags (... | [
"def",
"set_session_cache_mode",
"(",
"self",
",",
"mode",
")",
":",
"if",
"not",
"isinstance",
"(",
"mode",
",",
"integer_types",
")",
":",
"raise",
"TypeError",
"(",
"\"mode must be an integer\"",
")",
"return",
"_lib",
".",
"SSL_CTX_set_session_cache_mode",
"("... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/OpenSSL/SSL.py#L1067-L1082 | |
GoSSIP-SJTU/Armariris | ad5d868482956b2194a77b39c8d543c7c2318200 | tools/clang/tools/scan-build-py/libscanbuild/compilation.py | python | classify_source | (filename, c_compiler=True) | return mapping.get(extension) | Return the language from file name extension. | Return the language from file name extension. | [
"Return",
"the",
"language",
"from",
"file",
"name",
"extension",
"."
] | def classify_source(filename, c_compiler=True):
""" Return the language from file name extension. """
mapping = {
'.c': 'c' if c_compiler else 'c++',
'.i': 'c-cpp-output' if c_compiler else 'c++-cpp-output',
'.ii': 'c++-cpp-output',
'.m': 'objective-c',
'.mi': 'objective... | [
"def",
"classify_source",
"(",
"filename",
",",
"c_compiler",
"=",
"True",
")",
":",
"mapping",
"=",
"{",
"'.c'",
":",
"'c'",
"if",
"c_compiler",
"else",
"'c++'",
",",
"'.i'",
":",
"'c-cpp-output'",
"if",
"c_compiler",
"else",
"'c++-cpp-output'",
",",
"'.ii'... | https://github.com/GoSSIP-SJTU/Armariris/blob/ad5d868482956b2194a77b39c8d543c7c2318200/tools/clang/tools/scan-build-py/libscanbuild/compilation.py#L104-L127 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/pkg_resources/__init__.py | python | get_entry_info | (dist, group, name) | return get_distribution(dist).get_entry_info(group, name) | Return the EntryPoint object for `group`+`name`, or ``None`` | Return the EntryPoint object for `group`+`name`, or ``None`` | [
"Return",
"the",
"EntryPoint",
"object",
"for",
"group",
"+",
"name",
"or",
"None"
] | def get_entry_info(dist, group, name):
"""Return the EntryPoint object for `group`+`name`, or ``None``"""
return get_distribution(dist).get_entry_info(group, name) | [
"def",
"get_entry_info",
"(",
"dist",
",",
"group",
",",
"name",
")",
":",
"return",
"get_distribution",
"(",
"dist",
")",
".",
"get_entry_info",
"(",
"group",
",",
"name",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/pkg_resources/__init__.py#L580-L582 | |
deepmind/open_spiel | 4ca53bea32bb2875c7385d215424048ae92f78c8 | open_spiel/python/egt/visualization.py | python | Dynamics3x3Axes.plot | (self, points, **kwargs) | return super(Dynamics3x3Axes, self).plot(points[:, 0], points[:, 1],
**kwargs) | Creates a line plot.
Args:
points: Points in policy space.
**kwargs: Additional keyword arguments passed on to `Axes.plot`.
Returns:
The line plot. | Creates a line plot. | [
"Creates",
"a",
"line",
"plot",
"."
] | def plot(self, points, **kwargs):
"""Creates a line plot.
Args:
points: Points in policy space.
**kwargs: Additional keyword arguments passed on to `Axes.plot`.
Returns:
The line plot.
"""
points = np.array(points)
assert points.shape[1] == 3
points = self._simplex_transf... | [
"def",
"plot",
"(",
"self",
",",
"points",
",",
"*",
"*",
"kwargs",
")",
":",
"points",
"=",
"np",
".",
"array",
"(",
"points",
")",
"assert",
"points",
".",
"shape",
"[",
"1",
"]",
"==",
"3",
"points",
"=",
"self",
".",
"_simplex_transform",
".",
... | https://github.com/deepmind/open_spiel/blob/4ca53bea32bb2875c7385d215424048ae92f78c8/open_spiel/python/egt/visualization.py#L383-L397 | |
eldar/deepcut-cnn | 928bf2f224fce132f6e4404b4c95fb017297a5e0 | scripts/cpp_lint.py | python | CheckForBadCharacters | (filename, lines, error) | Logs an error for each line containing bad characters.
Two kinds of bad characters:
1. Unicode replacement characters: These indicate that either the file
contained invalid UTF-8 (likely) or Unicode replacement characters (which
it shouldn't). Note that it's possible for this to throw off line
numbering if... | Logs an error for each line containing bad characters. | [
"Logs",
"an",
"error",
"for",
"each",
"line",
"containing",
"bad",
"characters",
"."
] | def CheckForBadCharacters(filename, lines, error):
"""Logs an error for each line containing bad characters.
Two kinds of bad characters:
1. Unicode replacement characters: These indicate that either the file
contained invalid UTF-8 (likely) or Unicode replacement characters (which
it shouldn't). Note that... | [
"def",
"CheckForBadCharacters",
"(",
"filename",
",",
"lines",
",",
"error",
")",
":",
"for",
"linenum",
",",
"line",
"in",
"enumerate",
"(",
"lines",
")",
":",
"if",
"u'\\ufffd'",
"in",
"line",
":",
"error",
"(",
"filename",
",",
"linenum",
",",
"'reada... | https://github.com/eldar/deepcut-cnn/blob/928bf2f224fce132f6e4404b4c95fb017297a5e0/scripts/cpp_lint.py#L1483-L1505 | ||
crosslife/OpenBird | 9e0198a1a2295f03fa1e8676e216e22c9c7d380b | cocos2d/tools/project-creator/module/core.py | python | CocosProject.checkParams | (self) | return opts.name, opts.package, opts.language, opts.path | Custom and check param list. | Custom and check param list. | [
"Custom",
"and",
"check",
"param",
"list",
"."
] | def checkParams(self):
"""Custom and check param list.
"""
from optparse import OptionParser
# set the parser to parse input params
# the correspond variable name of "-x, --xxx" is parser.xxx
parser = OptionParser(
usage="Usage: %prog -n <PROJECT_NAME> -k <PAC... | [
"def",
"checkParams",
"(",
"self",
")",
":",
"from",
"optparse",
"import",
"OptionParser",
"# set the parser to parse input params",
"# the correspond variable name of \"-x, --xxx\" is parser.xxx",
"parser",
"=",
"OptionParser",
"(",
"usage",
"=",
"\"Usage: %prog -n <PROJECT_NAME... | https://github.com/crosslife/OpenBird/blob/9e0198a1a2295f03fa1e8676e216e22c9c7d380b/cocos2d/tools/project-creator/module/core.py#L80-L112 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/third_party/web-page-replay/third_party/dns/node.py | python | Node.__eq__ | (self, other) | return True | Two nodes are equal if they have the same rdatasets.
@rtype: bool | Two nodes are equal if they have the same rdatasets. | [
"Two",
"nodes",
"are",
"equal",
"if",
"they",
"have",
"the",
"same",
"rdatasets",
"."
] | def __eq__(self, other):
"""Two nodes are equal if they have the same rdatasets.
@rtype: bool
"""
#
# This is inefficient. Good thing we don't need to do it much.
#
for rd in self.rdatasets:
if rd not in other.rdatasets:
return False
... | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"#",
"# This is inefficient. Good thing we don't need to do it much.",
"#",
"for",
"rd",
"in",
"self",
".",
"rdatasets",
":",
"if",
"rd",
"not",
"in",
"other",
".",
"rdatasets",
":",
"return",
"False",
"fo... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/third_party/web-page-replay/third_party/dns/node.py#L58-L72 | |
Slicer/Slicer | ba9fadf332cb0303515b68d8d06a344c82e3e3e5 | Modules/Scripted/VectorToScalarVolume/VectorToScalarVolume.py | python | MyScopedQtPropertySetter | (qobject, properties) | Context manager to set/reset properties | Context manager to set/reset properties | [
"Context",
"manager",
"to",
"set",
"/",
"reset",
"properties"
] | def MyScopedQtPropertySetter(qobject, properties):
""" Context manager to set/reset properties"""
# TODO: Move it to slicer.utils and delete it here.
previousValues = {}
for propertyName, propertyValue in properties.items():
previousValues[propertyName] = getattr(qobject, propertyName)
setattr(qobject, ... | [
"def",
"MyScopedQtPropertySetter",
"(",
"qobject",
",",
"properties",
")",
":",
"# TODO: Move it to slicer.utils and delete it here.",
"previousValues",
"=",
"{",
"}",
"for",
"propertyName",
",",
"propertyValue",
"in",
"properties",
".",
"items",
"(",
")",
":",
"previ... | https://github.com/Slicer/Slicer/blob/ba9fadf332cb0303515b68d8d06a344c82e3e3e5/Modules/Scripted/VectorToScalarVolume/VectorToScalarVolume.py#L10-L19 | ||
freesurfer/freesurfer | 6dbe527d43ffa611acb2cd112e9469f9bfec8e36 | cnn_sphere_register/ext/neuron/neuron/layers.py | python | LocallyConnected3D.local_conv3d | (self, inputs, kernel, kernel_size, strides, output_shape, data_format=None) | return output | Apply 3D conv with un-shared weights.
# Arguments
inputs: 4D tensor with shape:
(batch_size, filters, new_rows, new_cols)
if data_format='channels_first'
or 4D tensor with shape:
(batch_size, new_rows, new_cols, filters)... | Apply 3D conv with un-shared weights.
# Arguments
inputs: 4D tensor with shape:
(batch_size, filters, new_rows, new_cols)
if data_format='channels_first'
or 4D tensor with shape:
(batch_size, new_rows, new_cols, filters)... | [
"Apply",
"3D",
"conv",
"with",
"un",
"-",
"shared",
"weights",
".",
"#",
"Arguments",
"inputs",
":",
"4D",
"tensor",
"with",
"shape",
":",
"(",
"batch_size",
"filters",
"new_rows",
"new_cols",
")",
"if",
"data_format",
"=",
"channels_first",
"or",
"4D",
"t... | def local_conv3d(self, inputs, kernel, kernel_size, strides, output_shape, data_format=None):
"""Apply 3D conv with un-shared weights.
# Arguments
inputs: 4D tensor with shape:
(batch_size, filters, new_rows, new_cols)
if data_format='channels_first'
... | [
"def",
"local_conv3d",
"(",
"self",
",",
"inputs",
",",
"kernel",
",",
"kernel_size",
",",
"strides",
",",
"output_shape",
",",
"data_format",
"=",
"None",
")",
":",
"if",
"data_format",
"is",
"None",
":",
"data_format",
"=",
"K",
".",
"image_data_format",
... | https://github.com/freesurfer/freesurfer/blob/6dbe527d43ffa611acb2cd112e9469f9bfec8e36/cnn_sphere_register/ext/neuron/neuron/layers.py#L459-L523 | |
pichenettes/eurorack | 11cc3a80f2c6d67ee024091c711dfce59a58cb59 | yarns/resources/lookup_tables.py | python | LayoutRaga | (raga, silence_other_notes=False) | return Compute(' '.join(mapping)) | Find a good assignments of swaras to keys for a raga. | Find a good assignments of swaras to keys for a raga. | [
"Find",
"a",
"good",
"assignments",
"of",
"swaras",
"to",
"keys",
"for",
"a",
"raga",
"."
] | def LayoutRaga(raga, silence_other_notes=False):
"""Find a good assignments of swaras to keys for a raga."""
raga = raga.lower()
scale = numpy.zeros((12,))
mapping = ['' for i in range(12)]
for swara in raga.split(' '):
key = recommended_keys.get(swara)
mapping[key] = swara
# Fill unassigned notes
... | [
"def",
"LayoutRaga",
"(",
"raga",
",",
"silence_other_notes",
"=",
"False",
")",
":",
"raga",
"=",
"raga",
".",
"lower",
"(",
")",
"scale",
"=",
"numpy",
".",
"zeros",
"(",
"(",
"12",
",",
")",
")",
"mapping",
"=",
"[",
"''",
"for",
"i",
"in",
"r... | https://github.com/pichenettes/eurorack/blob/11cc3a80f2c6d67ee024091c711dfce59a58cb59/yarns/resources/lookup_tables.py#L369-L396 | |
unsynchronized/gr-amps | 709d48272e7b605f34cfe89a517cc423923245e3 | docs/doxygen/doxyxml/base.py | python | Base.from_refid | (cls, refid, top=None) | return inst | Instantiate class from a refid rather than parsing object. | Instantiate class from a refid rather than parsing object. | [
"Instantiate",
"class",
"from",
"a",
"refid",
"rather",
"than",
"parsing",
"object",
"."
] | def from_refid(cls, refid, top=None):
""" Instantiate class from a refid rather than parsing object. """
# First check to see if its already been instantiated.
if top is not None and refid in top._refs:
return top._refs[refid]
# Otherwise create a new instance and set refid.
... | [
"def",
"from_refid",
"(",
"cls",
",",
"refid",
",",
"top",
"=",
"None",
")",
":",
"# First check to see if its already been instantiated.",
"if",
"top",
"is",
"not",
"None",
"and",
"refid",
"in",
"top",
".",
"_refs",
":",
"return",
"top",
".",
"_refs",
"[",
... | https://github.com/unsynchronized/gr-amps/blob/709d48272e7b605f34cfe89a517cc423923245e3/docs/doxygen/doxyxml/base.py#L65-L74 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/robotsim.py | python | RobotModelLink.getMass | (self) | return _robotsim.RobotModelLink_getMass(self) | getMass(RobotModelLink self) -> Mass
Retrieves the inertial properties of the link. (Note that the Mass is given with
origin at the link frame, not about the COM.) | getMass(RobotModelLink self) -> Mass | [
"getMass",
"(",
"RobotModelLink",
"self",
")",
"-",
">",
"Mass"
] | def getMass(self):
"""
getMass(RobotModelLink self) -> Mass
Retrieves the inertial properties of the link. (Note that the Mass is given with
origin at the link frame, not about the COM.)
"""
return _robotsim.RobotModelLink_getMass(self) | [
"def",
"getMass",
"(",
"self",
")",
":",
"return",
"_robotsim",
".",
"RobotModelLink_getMass",
"(",
"self",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/robotsim.py#L3795-L3805 | |
papyrussolution/OpenPapyrus | bbfb5ec2ea2109b8e2f125edd838e12eaf7b8b91 | Src/OSF/npp-gh20210917/scintilla/scripts/FileGenerator.py | python | ReadFileAsList | (path) | Read all the lnes in the file and return as a list of strings without line ends. | Read all the lnes in the file and return as a list of strings without line ends. | [
"Read",
"all",
"the",
"lnes",
"in",
"the",
"file",
"and",
"return",
"as",
"a",
"list",
"of",
"strings",
"without",
"line",
"ends",
"."
] | def ReadFileAsList(path):
"""Read all the lnes in the file and return as a list of strings without line ends.
"""
with codecs.open(path, "rU", "utf-8") as f:
return [l.rstrip('\n') for l in f] | [
"def",
"ReadFileAsList",
"(",
"path",
")",
":",
"with",
"codecs",
".",
"open",
"(",
"path",
",",
"\"rU\"",
",",
"\"utf-8\"",
")",
"as",
"f",
":",
"return",
"[",
"l",
".",
"rstrip",
"(",
"'\\n'",
")",
"for",
"l",
"in",
"f",
"]"
] | https://github.com/papyrussolution/OpenPapyrus/blob/bbfb5ec2ea2109b8e2f125edd838e12eaf7b8b91/Src/OSF/npp-gh20210917/scintilla/scripts/FileGenerator.py#L173-L177 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_core.py | python | Rect2D.SetTop | (*args, **kwargs) | return _core_.Rect2D_SetTop(*args, **kwargs) | SetTop(self, Double n) | SetTop(self, Double n) | [
"SetTop",
"(",
"self",
"Double",
"n",
")"
] | def SetTop(*args, **kwargs):
"""SetTop(self, Double n)"""
return _core_.Rect2D_SetTop(*args, **kwargs) | [
"def",
"SetTop",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Rect2D_SetTop",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_core.py#L1871-L1873 | |
naver/sling | 5671cd445a2caae0b4dd0332299e4cfede05062c | webkit/Tools/Scripts/webkitpy/port/base.py | python | Port.diff_image | (self, expected_contents, actual_contents, tolerance=None) | return self._image_differ.diff_image(expected_contents, actual_contents, tolerance) | Compare two images and return a tuple of an image diff, a percentage difference (0-100), and an error string.
|tolerance| should be a percentage value (0.0 - 100.0).
If it is omitted, the port default tolerance value is used.
If an error occurs (like ImageDiff isn't found, or crashes, we log a... | Compare two images and return a tuple of an image diff, a percentage difference (0-100), and an error string. | [
"Compare",
"two",
"images",
"and",
"return",
"a",
"tuple",
"of",
"an",
"image",
"diff",
"a",
"percentage",
"difference",
"(",
"0",
"-",
"100",
")",
"and",
"an",
"error",
"string",
"."
] | def diff_image(self, expected_contents, actual_contents, tolerance=None):
"""Compare two images and return a tuple of an image diff, a percentage difference (0-100), and an error string.
|tolerance| should be a percentage value (0.0 - 100.0).
If it is omitted, the port default tolerance value i... | [
"def",
"diff_image",
"(",
"self",
",",
"expected_contents",
",",
"actual_contents",
",",
"tolerance",
"=",
"None",
")",
":",
"if",
"not",
"actual_contents",
"and",
"not",
"expected_contents",
":",
"return",
"(",
"None",
",",
"0",
",",
"None",
")",
"if",
"n... | https://github.com/naver/sling/blob/5671cd445a2caae0b4dd0332299e4cfede05062c/webkit/Tools/Scripts/webkitpy/port/base.py#L290-L307 | |
Z3Prover/z3 | d745d03afdfdf638d66093e2bfbacaf87187f35b | src/api/python/z3/z3.py | python | AstVector.__contains__ | (self, item) | return False | Return `True` if the vector contains `item`.
>>> x = Int('x')
>>> A = AstVector()
>>> x in A
False
>>> A.push(x)
>>> x in A
True
>>> (x+1) in A
False
>>> A.push(x+1)
>>> (x+1) in A
True
>>> A
[x, x + 1] | Return `True` if the vector contains `item`. | [
"Return",
"True",
"if",
"the",
"vector",
"contains",
"item",
"."
] | def __contains__(self, item):
"""Return `True` if the vector contains `item`.
>>> x = Int('x')
>>> A = AstVector()
>>> x in A
False
>>> A.push(x)
>>> x in A
True
>>> (x+1) in A
False
>>> A.push(x+1)
>>> (x+1) in A
T... | [
"def",
"__contains__",
"(",
"self",
",",
"item",
")",
":",
"for",
"elem",
"in",
"self",
":",
"if",
"elem",
".",
"eq",
"(",
"item",
")",
":",
"return",
"True",
"return",
"False"
] | https://github.com/Z3Prover/z3/blob/d745d03afdfdf638d66093e2bfbacaf87187f35b/src/api/python/z3/z3.py#L5917-L5938 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/boto3/s3/transfer.py | python | S3Transfer.download_file | (self, bucket, key, filename, extra_args=None,
callback=None) | Download an S3 object to a file.
Variants have also been injected into S3 client, Bucket and Object.
You don't have to use S3Transfer.download_file() directly.
.. seealso::
:py:meth:`S3.Client.download_file`
:py:meth:`S3.Client.download_fileobj` | Download an S3 object to a file. | [
"Download",
"an",
"S3",
"object",
"to",
"a",
"file",
"."
] | def download_file(self, bucket, key, filename, extra_args=None,
callback=None):
"""Download an S3 object to a file.
Variants have also been injected into S3 client, Bucket and Object.
You don't have to use S3Transfer.download_file() directly.
.. seealso::
... | [
"def",
"download_file",
"(",
"self",
",",
"bucket",
",",
"key",
",",
"filename",
",",
"extra_args",
"=",
"None",
",",
"callback",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"filename",
",",
"six",
".",
"string_types",
")",
":",
"raise",
"Va... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/boto3/s3/transfer.py#L289-L314 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/framework/dtypes.py | python | DType.is_compatible_with | (self, other) | return self._type_enum in (
other.as_datatype_enum, other.base_dtype.as_datatype_enum) | Returns True if the `other` DType will be converted to this DType.
The conversion rules are as follows:
```python
DType(T) .is_compatible_with(DType(T)) == True
DType(T) .is_compatible_with(DType(T).as_ref) == True
DType(T).as_ref.is_compatible_with(DType(T)) == False
... | Returns True if the `other` DType will be converted to this DType. | [
"Returns",
"True",
"if",
"the",
"other",
"DType",
"will",
"be",
"converted",
"to",
"this",
"DType",
"."
] | def is_compatible_with(self, other):
"""Returns True if the `other` DType will be converted to this DType.
The conversion rules are as follows:
```python
DType(T) .is_compatible_with(DType(T)) == True
DType(T) .is_compatible_with(DType(T).as_ref) == True
DType(T).as_ref.is_c... | [
"def",
"is_compatible_with",
"(",
"self",
",",
"other",
")",
":",
"other",
"=",
"as_dtype",
"(",
"other",
")",
"return",
"self",
".",
"_type_enum",
"in",
"(",
"other",
".",
"as_datatype_enum",
",",
"other",
".",
"base_dtype",
".",
"as_datatype_enum",
")"
] | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/framework/dtypes.py#L237-L258 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/s3transfer/futures.py | python | ExecutorFuture.__init__ | (self, future) | A future returned from the executor
Currently, it is just a wrapper around a concurrent.futures.Future.
However, this can eventually grow to implement the needed functionality
of concurrent.futures.Future if we move off of the library and not
affect the rest of the codebase.
:t... | A future returned from the executor | [
"A",
"future",
"returned",
"from",
"the",
"executor"
] | def __init__(self, future):
"""A future returned from the executor
Currently, it is just a wrapper around a concurrent.futures.Future.
However, this can eventually grow to implement the needed functionality
of concurrent.futures.Future if we move off of the library and not
affec... | [
"def",
"__init__",
"(",
"self",
",",
"future",
")",
":",
"self",
".",
"_future",
"=",
"future"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/s3transfer/futures.py#L478-L489 | ||
fengbingchun/NN_Test | d6305825d5273e4569ccd1eda9ffa2a9c72e18d2 | src/tiny-dnn/third_party/cpplint.py | python | CheckTrailingSemicolon | (filename, clean_lines, linenum, error) | Looks for redundant trailing semicolon.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found. | Looks for redundant trailing semicolon. | [
"Looks",
"for",
"redundant",
"trailing",
"semicolon",
"."
] | def CheckTrailingSemicolon(filename, clean_lines, linenum, error):
"""Looks for redundant trailing semicolon.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any error... | [
"def",
"CheckTrailingSemicolon",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"# Block bodies should not be followed by a semicolon. Due to C++11",
"# brace initialization, ther... | https://github.com/fengbingchun/NN_Test/blob/d6305825d5273e4569ccd1eda9ffa2a9c72e18d2/src/tiny-dnn/third_party/cpplint.py#L3995-L4139 | ||
NVIDIA/nvvl | a94c7493ec9f309cc54acf81a66c62a068a06962 | examples/pytorch_superres/nvidia/fp16util.py | python | network_to_half | (network) | return nn.Sequential(tofp16(), BN_convert_float(network.half())) | Convert model to half precision in a batchnorm-safe way. | Convert model to half precision in a batchnorm-safe way. | [
"Convert",
"model",
"to",
"half",
"precision",
"in",
"a",
"batchnorm",
"-",
"safe",
"way",
"."
] | def network_to_half(network):
"""
Convert model to half precision in a batchnorm-safe way.
"""
return nn.Sequential(tofp16(), BN_convert_float(network.half())) | [
"def",
"network_to_half",
"(",
"network",
")",
":",
"return",
"nn",
".",
"Sequential",
"(",
"tofp16",
"(",
")",
",",
"BN_convert_float",
"(",
"network",
".",
"half",
"(",
")",
")",
")"
] | https://github.com/NVIDIA/nvvl/blob/a94c7493ec9f309cc54acf81a66c62a068a06962/examples/pytorch_superres/nvidia/fp16util.py#L48-L52 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/prompt-toolkit/py3/prompt_toolkit/buffer.py | python | Buffer._create_auto_validate_coroutine | (self) | return async_validator | Create a function for asynchronous validation while typing.
(This can be in another thread.) | Create a function for asynchronous validation while typing.
(This can be in another thread.) | [
"Create",
"a",
"function",
"for",
"asynchronous",
"validation",
"while",
"typing",
".",
"(",
"This",
"can",
"be",
"in",
"another",
"thread",
".",
")"
] | def _create_auto_validate_coroutine(self) -> Callable[[], Awaitable[None]]:
"""
Create a function for asynchronous validation while typing.
(This can be in another thread.)
"""
@_only_one_at_a_time
async def async_validator() -> None:
await self._validate_asy... | [
"def",
"_create_auto_validate_coroutine",
"(",
"self",
")",
"->",
"Callable",
"[",
"[",
"]",
",",
"Awaitable",
"[",
"None",
"]",
"]",
":",
"@",
"_only_one_at_a_time",
"async",
"def",
"async_validator",
"(",
")",
"->",
"None",
":",
"await",
"self",
".",
"_v... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/prompt-toolkit/py3/prompt_toolkit/buffer.py#L1852-L1862 | |
webmproject/libwebm | ee0bab576c338c9807249b99588e352b7268cb62 | PRESUBMIT.py | python | _CheckChangeLintsClean | (input_api, output_api) | return input_api.canned_checks.CheckChangeLintsClean(input_api, output_api,
sources) | Makes sure that libwebm/ code is cpplint clean. | Makes sure that libwebm/ code is cpplint clean. | [
"Makes",
"sure",
"that",
"libwebm",
"/",
"code",
"is",
"cpplint",
"clean",
"."
] | def _CheckChangeLintsClean(input_api, output_api):
"""Makes sure that libwebm/ code is cpplint clean."""
sources = lambda x: input_api.FilterSourceFile(
x, files_to_check=_INCLUDE_SOURCE_FILES_ONLY, files_to_skip=None)
return input_api.canned_checks.CheckChangeLintsClean(input_api, output_api,
... | [
"def",
"_CheckChangeLintsClean",
"(",
"input_api",
",",
"output_api",
")",
":",
"sources",
"=",
"lambda",
"x",
":",
"input_api",
".",
"FilterSourceFile",
"(",
"x",
",",
"files_to_check",
"=",
"_INCLUDE_SOURCE_FILES_ONLY",
",",
"files_to_skip",
"=",
"None",
")",
... | https://github.com/webmproject/libwebm/blob/ee0bab576c338c9807249b99588e352b7268cb62/PRESUBMIT.py#L81-L86 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/cond_v2.py | python | _make_intermediates_match_xla | (branch_graphs, branch_intermediates) | return new_branch_intermediates | Like _make_intermediates_match but for the XLA case. | Like _make_intermediates_match but for the XLA case. | [
"Like",
"_make_intermediates_match",
"but",
"for",
"the",
"XLA",
"case",
"."
] | def _make_intermediates_match_xla(branch_graphs, branch_intermediates):
"""Like _make_intermediates_match but for the XLA case."""
new_branch_intermediates = []
for i, branch_graph in enumerate(branch_graphs):
other_fakeparams = _create_fakeparams(
branch_graph,
sum((bi for bi in branch_interm... | [
"def",
"_make_intermediates_match_xla",
"(",
"branch_graphs",
",",
"branch_intermediates",
")",
":",
"new_branch_intermediates",
"=",
"[",
"]",
"for",
"i",
",",
"branch_graph",
"in",
"enumerate",
"(",
"branch_graphs",
")",
":",
"other_fakeparams",
"=",
"_create_fakepa... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/cond_v2.py#L525-L537 | |
libLAS/libLAS | e6a1aaed412d638687b8aec44f7b12df7ca2bbbb | python/liblas/point.py | python | Point.get_number_of_returns | (self) | return core.las.LASPoint_GetNumberOfReturns(self.handle) | Returns the number of returns for the point | Returns the number of returns for the point | [
"Returns",
"the",
"number",
"of",
"returns",
"for",
"the",
"point"
] | def get_number_of_returns(self):
"""Returns the number of returns for the point"""
return core.las.LASPoint_GetNumberOfReturns(self.handle) | [
"def",
"get_number_of_returns",
"(",
"self",
")",
":",
"return",
"core",
".",
"las",
".",
"LASPoint_GetNumberOfReturns",
"(",
"self",
".",
"handle",
")"
] | https://github.com/libLAS/libLAS/blob/e6a1aaed412d638687b8aec44f7b12df7ca2bbbb/python/liblas/point.py#L237-L239 | |
google/shaka-packager | e1b0c7c45431327fd3ce193514a5407d07b39b22 | packager/third_party/protobuf/python/google/protobuf/descriptor.py | python | FieldDescriptor.ProtoTypeToCppProtoType | (proto_type) | Converts from a Python proto type to a C++ Proto Type.
The Python ProtocolBuffer classes specify both the 'Python' datatype and the
'C++' datatype - and they're not the same. This helper method should
translate from one to another.
Args:
proto_type: the Python proto type (descriptor.FieldDescrip... | Converts from a Python proto type to a C++ Proto Type. | [
"Converts",
"from",
"a",
"Python",
"proto",
"type",
"to",
"a",
"C",
"++",
"Proto",
"Type",
"."
] | def ProtoTypeToCppProtoType(proto_type):
"""Converts from a Python proto type to a C++ Proto Type.
The Python ProtocolBuffer classes specify both the 'Python' datatype and the
'C++' datatype - and they're not the same. This helper method should
translate from one to another.
Args:
proto_type... | [
"def",
"ProtoTypeToCppProtoType",
"(",
"proto_type",
")",
":",
"try",
":",
"return",
"FieldDescriptor",
".",
"_PYTHON_TO_CPP_PROTO_TYPE_MAP",
"[",
"proto_type",
"]",
"except",
"KeyError",
":",
"raise",
"TypeTransformationError",
"(",
"'Unknown proto_type: %s'",
"%",
"pr... | https://github.com/google/shaka-packager/blob/e1b0c7c45431327fd3ce193514a5407d07b39b22/packager/third_party/protobuf/python/google/protobuf/descriptor.py#L547-L564 | ||
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/ops/data_flow_ops.py | python | QueueBase.dequeue | (self, name=None) | return self._dequeue_return_value(ret) | Dequeues one element from this queue.
If the queue is empty when this operation executes, it will block
until there is an element to dequeue.
At runtime, this operation may raise an error if the queue is
[closed](#QueueBase.close) before or during its execution. If the
queue is closed, the queue i... | Dequeues one element from this queue. | [
"Dequeues",
"one",
"element",
"from",
"this",
"queue",
"."
] | def dequeue(self, name=None):
"""Dequeues one element from this queue.
If the queue is empty when this operation executes, it will block
until there is an element to dequeue.
At runtime, this operation may raise an error if the queue is
[closed](#QueueBase.close) before or during its execution. If... | [
"def",
"dequeue",
"(",
"self",
",",
"name",
"=",
"None",
")",
":",
"if",
"name",
"is",
"None",
":",
"name",
"=",
"\"%s_Dequeue\"",
"%",
"self",
".",
"_name",
"ret",
"=",
"gen_data_flow_ops",
".",
"_queue_dequeue",
"(",
"self",
".",
"_queue_ref",
",",
"... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/ops/data_flow_ops.py#L397-L428 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow2.x/tensorflow_model_optimization/python/core/quantization/keras/vitis/vitis_quantize.py | python | VitisQuantizer._calibrate_without_loss | (self, calib_dataset, calib_batch_size,
calib_steps) | Calibrate model without loss, only with unlabeled dataset. | Calibrate model without loss, only with unlabeled dataset. | [
"Calibrate",
"model",
"without",
"loss",
"only",
"with",
"unlabeled",
"dataset",
"."
] | def _calibrate_without_loss(self, calib_dataset, calib_batch_size,
calib_steps):
"""Calibrate model without loss, only with unlabeled dataset."""
# Create quantize calibration model
if not self._optimized_model:
logger.error(
'Should call `optimize_model()` befo... | [
"def",
"_calibrate_without_loss",
"(",
"self",
",",
"calib_dataset",
",",
"calib_batch_size",
",",
"calib_steps",
")",
":",
"# Create quantize calibration model",
"if",
"not",
"self",
".",
"_optimized_model",
":",
"logger",
".",
"error",
"(",
"'Should call `optimize_mod... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow2.x/tensorflow_model_optimization/python/core/quantization/keras/vitis/vitis_quantize.py#L259-L288 | ||
schwehr/libais | 1e19605942c8e155cd02fde6d1acde75ecd15d75 | third_party/gmock/scripts/upload.py | python | SplitPatch | (data) | return patches | Splits a patch into separate pieces for each file.
Args:
data: A string containing the output of svn diff.
Returns:
A list of 2-tuple (filename, text) where text is the svn diff output
pertaining to filename. | Splits a patch into separate pieces for each file. | [
"Splits",
"a",
"patch",
"into",
"separate",
"pieces",
"for",
"each",
"file",
"."
] | def SplitPatch(data):
"""Splits a patch into separate pieces for each file.
Args:
data: A string containing the output of svn diff.
Returns:
A list of 2-tuple (filename, text) where text is the svn diff output
pertaining to filename.
"""
patches = []
filename = None
diff = []
for line in... | [
"def",
"SplitPatch",
"(",
"data",
")",
":",
"patches",
"=",
"[",
"]",
"filename",
"=",
"None",
"diff",
"=",
"[",
"]",
"for",
"line",
"in",
"data",
".",
"splitlines",
"(",
"True",
")",
":",
"new_filename",
"=",
"None",
"if",
"line",
".",
"startswith",... | https://github.com/schwehr/libais/blob/1e19605942c8e155cd02fde6d1acde75ecd15d75/third_party/gmock/scripts/upload.py#L1141-L1178 | |
panda3d/panda3d | 833ad89ebad58395d0af0b7ec08538e5e4308265 | direct/src/distributed/DistributedObject.py | python | DistributedObject.delete | (self) | Inheritors should redefine this to take appropriate action on delete | Inheritors should redefine this to take appropriate action on delete | [
"Inheritors",
"should",
"redefine",
"this",
"to",
"take",
"appropriate",
"action",
"on",
"delete"
] | def delete(self):
"""
Inheritors should redefine this to take appropriate action on delete
"""
assert self.notify.debug('delete(): %s' % (self.doId))
self.DistributedObject_deleted = 1 | [
"def",
"delete",
"(",
"self",
")",
":",
"assert",
"self",
".",
"notify",
".",
"debug",
"(",
"'delete(): %s'",
"%",
"(",
"self",
".",
"doId",
")",
")",
"self",
".",
"DistributedObject_deleted",
"=",
"1"
] | https://github.com/panda3d/panda3d/blob/833ad89ebad58395d0af0b7ec08538e5e4308265/direct/src/distributed/DistributedObject.py#L296-L301 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_internal/cache.py | python | Cache._get_cache_path_parts | (self, link) | return parts | Get parts of part that must be os.path.joined with cache_dir | Get parts of part that must be os.path.joined with cache_dir | [
"Get",
"parts",
"of",
"part",
"that",
"must",
"be",
"os",
".",
"path",
".",
"joined",
"with",
"cache_dir"
] | def _get_cache_path_parts(self, link):
# type: (Link) -> List[str]
"""Get parts of part that must be os.path.joined with cache_dir
"""
# We want to generate an url to use as our cache key, we don't want to
# just re-use the URL because it might have other items in the fragment
... | [
"def",
"_get_cache_path_parts",
"(",
"self",
",",
"link",
")",
":",
"# type: (Link) -> List[str]",
"# We want to generate an url to use as our cache key, we don't want to",
"# just re-use the URL because it might have other items in the fragment",
"# and we don't care about those.",
"key_par... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_internal/cache.py#L58-L91 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/io/excel/_pyxlsb.py | python | _PyxlsbReader.__init__ | (self, filepath_or_buffer: FilePathOrBuffer) | Reader using pyxlsb engine.
Parameters
__________
filepath_or_buffer: string, path object, or Workbook
Object to be parsed. | Reader using pyxlsb engine. | [
"Reader",
"using",
"pyxlsb",
"engine",
"."
] | def __init__(self, filepath_or_buffer: FilePathOrBuffer):
"""Reader using pyxlsb engine.
Parameters
__________
filepath_or_buffer: string, path object, or Workbook
Object to be parsed.
"""
import_optional_dependency("pyxlsb")
# This will call load_wor... | [
"def",
"__init__",
"(",
"self",
",",
"filepath_or_buffer",
":",
"FilePathOrBuffer",
")",
":",
"import_optional_dependency",
"(",
"\"pyxlsb\"",
")",
"# This will call load_workbook on the filepath or buffer",
"# And set the result to the book-attribute",
"super",
"(",
")",
".",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/io/excel/_pyxlsb.py#L10-L21 | ||
Tencent/mars | 54969ba56b402a622db123e780a4f760b38c5c36 | mars/lint/cpplint.py | python | _CppLintState.PrintErrorCounts | (self) | Print a summary of errors by category, and the total. | Print a summary of errors by category, and the total. | [
"Print",
"a",
"summary",
"of",
"errors",
"by",
"category",
"and",
"the",
"total",
"."
] | def PrintErrorCounts(self):
"""Print a summary of errors by category, and the total."""
for category, count in self.errors_by_category.iteritems():
sys.stderr.write('Category \'%s\' errors found: %d\n' %
(category, count))
sys.stderr.write('Total errors found: %d\n' % self.error... | [
"def",
"PrintErrorCounts",
"(",
"self",
")",
":",
"for",
"category",
",",
"count",
"in",
"self",
".",
"errors_by_category",
".",
"iteritems",
"(",
")",
":",
"sys",
".",
"stderr",
".",
"write",
"(",
"'Category \\'%s\\' errors found: %d\\n'",
"%",
"(",
"category... | https://github.com/Tencent/mars/blob/54969ba56b402a622db123e780a4f760b38c5c36/mars/lint/cpplint.py#L842-L847 | ||
MythTV/mythtv | d282a209cb8be85d036f85a62a8ec971b67d45f4 | mythtv/programs/scripts/internetcontent/nv_python_libs/mashups/mashups_api.py | python | Videos.searchForVideos | (self, title, pagenumber) | Common name for a video search. Used to interface with MythTV plugin NetVision
Display the results and exit | Common name for a video search. Used to interface with MythTV plugin NetVision
Display the results and exit | [
"Common",
"name",
"for",
"a",
"video",
"search",
".",
"Used",
"to",
"interface",
"with",
"MythTV",
"plugin",
"NetVision",
"Display",
"the",
"results",
"and",
"exit"
] | def searchForVideos(self, title, pagenumber):
"""Common name for a video search. Used to interface with MythTV plugin NetVision
Display the results and exit
"""
# Get the user preferences
try:
self.getUserPreferences()
except Exception as e:
sys.st... | [
"def",
"searchForVideos",
"(",
"self",
",",
"title",
",",
"pagenumber",
")",
":",
"# Get the user preferences",
"try",
":",
"self",
".",
"getUserPreferences",
"(",
")",
"except",
"Exception",
"as",
"e",
":",
"sys",
".",
"stderr",
".",
"write",
"(",
"'%s'",
... | https://github.com/MythTV/mythtv/blob/d282a209cb8be85d036f85a62a8ec971b67d45f4/mythtv/programs/scripts/internetcontent/nv_python_libs/mashups/mashups_api.py#L303-L434 | ||
google/certificate-transparency | 2588562fd306a447958471b6f06c1069619c1641 | python/ct/client/db/temp_db.py | python | TempDB.store_entries | (self, entries) | Batch store log entries.
Args:
entries: an iterable of (entry_number, client_pb2.EntryResponse)
tuples | Batch store log entries.
Args:
entries: an iterable of (entry_number, client_pb2.EntryResponse)
tuples | [
"Batch",
"store",
"log",
"entries",
".",
"Args",
":",
"entries",
":",
"an",
"iterable",
"of",
"(",
"entry_number",
"client_pb2",
".",
"EntryResponse",
")",
"tuples"
] | def store_entries(self, entries):
"""Batch store log entries.
Args:
entries: an iterable of (entry_number, client_pb2.EntryResponse)
tuples
""" | [
"def",
"store_entries",
"(",
"self",
",",
"entries",
")",
":"
] | https://github.com/google/certificate-transparency/blob/2588562fd306a447958471b6f06c1069619c1641/python/ct/client/db/temp_db.py#L10-L15 | ||
papyrussolution/OpenPapyrus | bbfb5ec2ea2109b8e2f125edd838e12eaf7b8b91 | Src/OSF/protobuf-3.19.1/python/google/protobuf/descriptor_pool.py | python | DescriptorPool._ExtractSymbols | (self, descriptors) | Pulls out all the symbols from descriptor protos.
Args:
descriptors: The messages to extract descriptors from.
Yields:
A two element tuple of the type name and descriptor object. | Pulls out all the symbols from descriptor protos. | [
"Pulls",
"out",
"all",
"the",
"symbols",
"from",
"descriptor",
"protos",
"."
] | def _ExtractSymbols(self, descriptors):
"""Pulls out all the symbols from descriptor protos.
Args:
descriptors: The messages to extract descriptors from.
Yields:
A two element tuple of the type name and descriptor object.
"""
for desc in descriptors:
yield (_PrefixWithDot(desc.fu... | [
"def",
"_ExtractSymbols",
"(",
"self",
",",
"descriptors",
")",
":",
"for",
"desc",
"in",
"descriptors",
":",
"yield",
"(",
"_PrefixWithDot",
"(",
"desc",
".",
"full_name",
")",
",",
"desc",
")",
"for",
"symbol",
"in",
"self",
".",
"_ExtractSymbols",
"(",
... | https://github.com/papyrussolution/OpenPapyrus/blob/bbfb5ec2ea2109b8e2f125edd838e12eaf7b8b91/Src/OSF/protobuf-3.19.1/python/google/protobuf/descriptor_pool.py#L1220-L1234 | ||
facebookresearch/habitat-sim | 63b6c71d9ca8adaefb140b198196f5d0ca1f1e34 | src_python/habitat_sim/robots/mobile_manipulator.py | python | MobileManipulator.gripper_joint_pos | (self) | return np.array(
[self.sim_obj.joint_positions[i] for i in gripper_pos_indices],
dtype=np.float32,
) | Get the current gripper joint positions. | Get the current gripper joint positions. | [
"Get",
"the",
"current",
"gripper",
"joint",
"positions",
"."
] | def gripper_joint_pos(self) -> np.ndarray:
"""Get the current gripper joint positions."""
gripper_pos_indices = map(
lambda x: self.joint_pos_indices[x], self.params.gripper_joints
)
return np.array(
[self.sim_obj.joint_positions[i] for i in gripper_pos_indices],
... | [
"def",
"gripper_joint_pos",
"(",
"self",
")",
"->",
"np",
".",
"ndarray",
":",
"gripper_pos_indices",
"=",
"map",
"(",
"lambda",
"x",
":",
"self",
".",
"joint_pos_indices",
"[",
"x",
"]",
",",
"self",
".",
"params",
".",
"gripper_joints",
")",
"return",
... | https://github.com/facebookresearch/habitat-sim/blob/63b6c71d9ca8adaefb140b198196f5d0ca1f1e34/src_python/habitat_sim/robots/mobile_manipulator.py#L306-L314 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/debug/lib/debug_data.py | python | load_tensor_from_event_file | (event_file_path) | Load a tensor from an event file.
Assumes that the event file contains a `Event` protobuf and the `Event`
protobuf contains a `Tensor` value.
Args:
event_file_path: (`str`) path to the event file.
Returns:
The tensor value loaded from the event file, as a `numpy.ndarray`. For
uninitialized Tensor... | Load a tensor from an event file. | [
"Load",
"a",
"tensor",
"from",
"an",
"event",
"file",
"."
] | def load_tensor_from_event_file(event_file_path):
"""Load a tensor from an event file.
Assumes that the event file contains a `Event` protobuf and the `Event`
protobuf contains a `Tensor` value.
Args:
event_file_path: (`str`) path to the event file.
Returns:
The tensor value loaded from the event f... | [
"def",
"load_tensor_from_event_file",
"(",
"event_file_path",
")",
":",
"event",
"=",
"event_pb2",
".",
"Event",
"(",
")",
"with",
"gfile",
".",
"Open",
"(",
"event_file_path",
",",
"\"rb\"",
")",
"as",
"f",
":",
"event",
".",
"ParseFromString",
"(",
"f",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/debug/lib/debug_data.py#L83-L102 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/frame.py | python | DataFrame._sanitize_column | (self, key, value, broadcast=True) | return np.atleast_2d(np.asarray(value)) | Ensures new columns (which go into the BlockManager as new blocks) are
always copied and converted into an array.
Parameters
----------
key : object
value : scalar, Series, or array-like
broadcast : bool, default True
If ``key`` matches multiple duplicate col... | Ensures new columns (which go into the BlockManager as new blocks) are
always copied and converted into an array. | [
"Ensures",
"new",
"columns",
"(",
"which",
"go",
"into",
"the",
"BlockManager",
"as",
"new",
"blocks",
")",
"are",
"always",
"copied",
"and",
"converted",
"into",
"an",
"array",
"."
] | def _sanitize_column(self, key, value, broadcast=True):
"""
Ensures new columns (which go into the BlockManager as new blocks) are
always copied and converted into an array.
Parameters
----------
key : object
value : scalar, Series, or array-like
broadcas... | [
"def",
"_sanitize_column",
"(",
"self",
",",
"key",
",",
"value",
",",
"broadcast",
"=",
"True",
")",
":",
"def",
"reindexer",
"(",
"value",
")",
":",
"# reindex if necessary",
"if",
"value",
".",
"index",
".",
"equals",
"(",
"self",
".",
"index",
")",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/frame.py#L3565-L3668 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/geographic_msgs/srv/_GetRoutePlan.py | python | GetRoutePlanResponse.__init__ | (self, *args, **kwds) | Constructor. Any message fields that are implicitly/explicitly
set to None will be assigned a default value. The recommend
use is keyword arguments as this is more robust to future message
changes. You cannot mix in-order arguments and keyword arguments.
The available fields are:
success,status... | Constructor. Any message fields that are implicitly/explicitly
set to None will be assigned a default value. The recommend
use is keyword arguments as this is more robust to future message
changes. You cannot mix in-order arguments and keyword arguments. | [
"Constructor",
".",
"Any",
"message",
"fields",
"that",
"are",
"implicitly",
"/",
"explicitly",
"set",
"to",
"None",
"will",
"be",
"assigned",
"a",
"default",
"value",
".",
"The",
"recommend",
"use",
"is",
"keyword",
"arguments",
"as",
"this",
"is",
"more",
... | def __init__(self, *args, **kwds):
"""
Constructor. Any message fields that are implicitly/explicitly
set to None will be assigned a default value. The recommend
use is keyword arguments as this is more robust to future message
changes. You cannot mix in-order arguments and keyword arguments.
... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwds",
")",
":",
"if",
"args",
"or",
"kwds",
":",
"super",
"(",
"GetRoutePlanResponse",
",",
"self",
")",
".",
"__init__",
"(",
"*",
"args",
",",
"*",
"*",
"kwds",
")",
"#message fie... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/geographic_msgs/srv/_GetRoutePlan.py#L259-L285 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py | python | EggInfoDistribution._reload_version | (self) | return self | Packages installed by distutils (e.g. numpy or scipy),
which uses an old safe_version, and so
their version numbers can get mangled when
converted to filenames (e.g., 1.11.0.dev0+2329eae to
1.11.0.dev0_2329eae). These distributions will not be
parsed properly
downst... | [] | def _reload_version(self):
"""
Packages installed by distutils (e.g. numpy or scipy),
which uses an old safe_version, and so
their version numbers can get mangled when
converted to filenames (e.g., 1.11.0.dev0+2329eae to
1.11.0.dev0_2329eae). These distributions wil... | [
"def",
"_reload_version",
"(",
"self",
")",
":",
"md_version",
"=",
"self",
".",
"_get_version",
"(",
")",
"if",
"md_version",
":",
"self",
".",
"_version",
"=",
"md_version",
"return",
"self"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L5963-L5993 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/model_fitting/model_fitting_presenter.py | python | ModelFittingPresenter.handle_parameter_combinations_created_successfully | (self) | Handles when the parameter combination workspaces have been created successfully. | Handles when the parameter combination workspaces have been created successfully. | [
"Handles",
"when",
"the",
"parameter",
"combination",
"workspaces",
"have",
"been",
"created",
"successfully",
"."
] | def handle_parameter_combinations_created_successfully(self) -> None:
"""Handles when the parameter combination workspaces have been created successfully."""
self.view.set_datasets_in_function_browser(self.model.dataset_names)
self.view.update_dataset_name_combo_box(self.model.dataset_names, emi... | [
"def",
"handle_parameter_combinations_created_successfully",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"view",
".",
"set_datasets_in_function_browser",
"(",
"self",
".",
"model",
".",
"dataset_names",
")",
"self",
".",
"view",
".",
"update_dataset_name_combo_b... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/model_fitting/model_fitting_presenter.py#L84-L94 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/plugins/codebrowser/codebrowser/gentag/taglib.py | python | Code.SetName | (self, objname) | Set the name of this code object
@param objname: string | Set the name of this code object
@param objname: string | [
"Set",
"the",
"name",
"of",
"this",
"code",
"object",
"@param",
"objname",
":",
"string"
] | def SetName(self, objname):
"""Set the name of this code object
@param objname: string
"""
self.name = objname | [
"def",
"SetName",
"(",
"self",
",",
"objname",
")",
":",
"self",
".",
"name",
"=",
"objname"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/plugins/codebrowser/codebrowser/gentag/taglib.py#L116-L121 | ||
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/expected-lite/script/create-vcpkg.py | python | versionFrom | ( filename ) | return version | Obtain version from CMakeLists.txt | Obtain version from CMakeLists.txt | [
"Obtain",
"version",
"from",
"CMakeLists",
".",
"txt"
] | def versionFrom( filename ):
"""Obtain version from CMakeLists.txt"""
with open( filename, 'r' ) as f:
content = f.read()
version = re.search(r'VERSION\s(\d+\.\d+\.\d+)', content).group(1)
return version | [
"def",
"versionFrom",
"(",
"filename",
")",
":",
"with",
"open",
"(",
"filename",
",",
"'r'",
")",
"as",
"f",
":",
"content",
"=",
"f",
".",
"read",
"(",
")",
"version",
"=",
"re",
".",
"search",
"(",
"r'VERSION\\s(\\d+\\.\\d+\\.\\d+)'",
",",
"content",
... | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/expected-lite/script/create-vcpkg.py#L93-L98 | |
SpaceNetChallenge/BuildingDetectors | 3def3c44b5847c744cd2f3356182892d92496579 | qinhaifang/src/caffe-mnc/scripts/cpp_lint.py | python | FileInfo.Extension | (self) | return self.Split()[2] | File extension - text following the final period. | File extension - text following the final period. | [
"File",
"extension",
"-",
"text",
"following",
"the",
"final",
"period",
"."
] | def Extension(self):
"""File extension - text following the final period."""
return self.Split()[2] | [
"def",
"Extension",
"(",
"self",
")",
":",
"return",
"self",
".",
"Split",
"(",
")",
"[",
"2",
"]"
] | https://github.com/SpaceNetChallenge/BuildingDetectors/blob/3def3c44b5847c744cd2f3356182892d92496579/qinhaifang/src/caffe-mnc/scripts/cpp_lint.py#L948-L950 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/tpu/tensor_tracer_report.py | python | TTReportHandle._write_report | (self, content) | Writes the given content to the report. | Writes the given content to the report. | [
"Writes",
"the",
"given",
"content",
"to",
"the",
"report",
"."
] | def _write_report(self, content):
"""Writes the given content to the report."""
line = '%s %s'%(_TRACER_LOG_PREFIX, content)
if self._report_file:
self._report_file.write(line)
else:
logging.info(line) | [
"def",
"_write_report",
"(",
"self",
",",
"content",
")",
":",
"line",
"=",
"'%s %s'",
"%",
"(",
"_TRACER_LOG_PREFIX",
",",
"content",
")",
"if",
"self",
".",
"_report_file",
":",
"self",
".",
"_report_file",
".",
"write",
"(",
"line",
")",
"else",
":",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/tpu/tensor_tracer_report.py#L335-L342 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_windows.py | python | DirDialog.GetPath | (*args, **kwargs) | return _windows_.DirDialog_GetPath(*args, **kwargs) | GetPath(self) -> String
Returns the default or user-selected path. | GetPath(self) -> String | [
"GetPath",
"(",
"self",
")",
"-",
">",
"String"
] | def GetPath(*args, **kwargs):
"""
GetPath(self) -> String
Returns the default or user-selected path.
"""
return _windows_.DirDialog_GetPath(*args, **kwargs) | [
"def",
"GetPath",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"DirDialog_GetPath",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_windows.py#L3070-L3076 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/cluster/hierarchy.py | python | _remove_dups | (L) | return L2 | Remove duplicates AND preserve the original order of the elements.
The set class is not guaranteed to do this. | Remove duplicates AND preserve the original order of the elements. | [
"Remove",
"duplicates",
"AND",
"preserve",
"the",
"original",
"order",
"of",
"the",
"elements",
"."
] | def _remove_dups(L):
"""
Remove duplicates AND preserve the original order of the elements.
The set class is not guaranteed to do this.
"""
seen_before = set([])
L2 = []
for i in L:
if i not in seen_before:
seen_before.add(i)
L2.append(i)
return L2 | [
"def",
"_remove_dups",
"(",
"L",
")",
":",
"seen_before",
"=",
"set",
"(",
"[",
"]",
")",
"L2",
"=",
"[",
"]",
"for",
"i",
"in",
"L",
":",
"if",
"i",
"not",
"in",
"seen_before",
":",
"seen_before",
".",
"add",
"(",
"i",
")",
"L2",
".",
"append"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/cluster/hierarchy.py#L2823-L2835 | |
neopenx/Dragon | 0e639a7319035ddc81918bd3df059230436ee0a1 | Dragon/python/dragon/operators/recurrent.py | python | LSTMUnit | (c_t_1, gate_input, cont_t=None, **kwargs) | return Tensor.CreateOperator(inputs=[c_t_1, gate_input], nout=2,
op_type='LSTMUnit', **arguments) | Simple LSTMCell module.
Parameters
----------
c_t_1 : Tensor
The initial state of cell.
gate_input : Tensor
The concatenated input for 4 gates.
cont_t : Tensor
The mask to discard specific instances. Default is ``None``.
Returns
-------
tuple
The lstm ou... | Simple LSTMCell module. | [
"Simple",
"LSTMCell",
"module",
"."
] | def LSTMUnit(c_t_1, gate_input, cont_t=None, **kwargs):
"""Simple LSTMCell module.
Parameters
----------
c_t_1 : Tensor
The initial state of cell.
gate_input : Tensor
The concatenated input for 4 gates.
cont_t : Tensor
The mask to discard specific instances. Default is `... | [
"def",
"LSTMUnit",
"(",
"c_t_1",
",",
"gate_input",
",",
"cont_t",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"arguments",
"=",
"ParseArguments",
"(",
"locals",
"(",
")",
")",
"if",
"cont_t",
"is",
"not",
"None",
":",
"if",
"isinstance",
"(",
"c... | https://github.com/neopenx/Dragon/blob/0e639a7319035ddc81918bd3df059230436ee0a1/Dragon/python/dragon/operators/recurrent.py#L14-L38 | |
stitchEm/stitchEm | 0f399501d41ab77933677f2907f41f80ceb704d7 | lib/bindings/samples/server/debug/debug_api.py | python | DebugAPI.__init__ | (self, extra) | Init | Init | [
"Init"
] | def __init__(self, extra):
"""Init
"""
self.server = extra["server"]
self.stitcher = extra["video_stitcher"]
self.project_manager = extra["project_manager"]
self.output_manager = extra["output_manager"]
self.preset_manager = extra["preset_manager"]
self.ca... | [
"def",
"__init__",
"(",
"self",
",",
"extra",
")",
":",
"self",
".",
"server",
"=",
"extra",
"[",
"\"server\"",
"]",
"self",
".",
"stitcher",
"=",
"extra",
"[",
"\"video_stitcher\"",
"]",
"self",
".",
"project_manager",
"=",
"extra",
"[",
"\"project_manage... | https://github.com/stitchEm/stitchEm/blob/0f399501d41ab77933677f2907f41f80ceb704d7/lib/bindings/samples/server/debug/debug_api.py#L34-L43 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/site_compare/site_compare.py | python | Scrape | (browsers, urls, window_size=(1024, 768),
window_pos=(0, 0), timeout=20, save_path=None, **kwargs) | Invoke one or more browsers over one or more URLs, scraping renders.
Args:
browsers: browsers to invoke with optional version strings
urls: URLs to visit
window_size: size of the browser window to display
window_pos: location of browser window
timeout: time (in seconds) to wait for page to load
... | Invoke one or more browsers over one or more URLs, scraping renders. | [
"Invoke",
"one",
"or",
"more",
"browsers",
"over",
"one",
"or",
"more",
"URLs",
"scraping",
"renders",
"."
] | def Scrape(browsers, urls, window_size=(1024, 768),
window_pos=(0, 0), timeout=20, save_path=None, **kwargs):
"""Invoke one or more browsers over one or more URLs, scraping renders.
Args:
browsers: browsers to invoke with optional version strings
urls: URLs to visit
window_size: size of the ... | [
"def",
"Scrape",
"(",
"browsers",
",",
"urls",
",",
"window_size",
"=",
"(",
"1024",
",",
"768",
")",
",",
"window_pos",
"=",
"(",
"0",
",",
"0",
")",
",",
"timeout",
"=",
"20",
",",
"save_path",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/site_compare/site_compare.py#L37-L73 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | Control_Ellipsize | (*args, **kwargs) | return _core_.Control_Ellipsize(*args, **kwargs) | Control_Ellipsize(String label, DC dc, int mode, int maxWidth, int flags=ELLIPSIZE_FLAGS_DEFAULT) -> String | Control_Ellipsize(String label, DC dc, int mode, int maxWidth, int flags=ELLIPSIZE_FLAGS_DEFAULT) -> String | [
"Control_Ellipsize",
"(",
"String",
"label",
"DC",
"dc",
"int",
"mode",
"int",
"maxWidth",
"int",
"flags",
"=",
"ELLIPSIZE_FLAGS_DEFAULT",
")",
"-",
">",
"String"
] | def Control_Ellipsize(*args, **kwargs):
"""Control_Ellipsize(String label, DC dc, int mode, int maxWidth, int flags=ELLIPSIZE_FLAGS_DEFAULT) -> String"""
return _core_.Control_Ellipsize(*args, **kwargs) | [
"def",
"Control_Ellipsize",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Control_Ellipsize",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L12809-L12811 | |
yun-liu/RCF | 91bfb054ad04187dbbe21e539e165ad9bd3ff00b | tools/extra/parse_log.py | python | parse_line_for_net_output | (regex_obj, row, row_dict_list,
line, iteration, seconds, learning_rate) | return row_dict_list, row | Parse a single line for training or test output
Returns a a tuple with (row_dict_list, row)
row: may be either a new row or an augmented version of the current row
row_dict_list: may be either the current row_dict_list or an augmented
version of the current row_dict_list | Parse a single line for training or test output | [
"Parse",
"a",
"single",
"line",
"for",
"training",
"or",
"test",
"output"
] | def parse_line_for_net_output(regex_obj, row, row_dict_list,
line, iteration, seconds, learning_rate):
"""Parse a single line for training or test output
Returns a a tuple with (row_dict_list, row)
row: may be either a new row or an augmented version of the current row
row... | [
"def",
"parse_line_for_net_output",
"(",
"regex_obj",
",",
"row",
",",
"row_dict_list",
",",
"line",
",",
"iteration",
",",
"seconds",
",",
"learning_rate",
")",
":",
"output_match",
"=",
"regex_obj",
".",
"search",
"(",
"line",
")",
"if",
"output_match",
":",... | https://github.com/yun-liu/RCF/blob/91bfb054ad04187dbbe21e539e165ad9bd3ff00b/tools/extra/parse_log.py#L74-L113 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/ros_comm/rospy/src/rospy/msproxy.py | python | MasterProxy.__contains__ | (self, key) | return value | Check if parameter is set on Parameter Server
@param key: parameter key
@type key: str
@raise ROSException: if parameter server reports an error | Check if parameter is set on Parameter Server | [
"Check",
"if",
"parameter",
"is",
"set",
"on",
"Parameter",
"Server"
] | def __contains__(self, key):
"""
Check if parameter is set on Parameter Server
@param key: parameter key
@type key: str
@raise ROSException: if parameter server reports an error
"""
with self._lock:
code, msg, value = self.target.hasParam(rospy... | [
"def",
"__contains__",
"(",
"self",
",",
"key",
")",
":",
"with",
"self",
".",
"_lock",
":",
"code",
",",
"msg",
",",
"value",
"=",
"self",
".",
"target",
".",
"hasParam",
"(",
"rospy",
".",
"names",
".",
"get_caller_id",
"(",
")",
",",
"rospy",
".... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros_comm/rospy/src/rospy/msproxy.py#L194-L205 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.