nwo stringlengths 5 86 | sha stringlengths 40 40 | path stringlengths 4 189 | language stringclasses 1
value | identifier stringlengths 1 94 | parameters stringlengths 2 4.03k | argument_list stringclasses 1
value | return_statement stringlengths 0 11.5k | docstring stringlengths 1 33.2k | docstring_summary stringlengths 0 5.15k | docstring_tokens list | function stringlengths 34 151k | function_tokens list | url stringlengths 90 278 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/functools.py | python | lru_cache | (maxsize=128, typed=False) | return decorating_function | Least-recently-used cache decorator.
If *maxsize* is set to None, the LRU features are disabled and the cache
can grow without bound.
If *typed* is True, arguments of different types will be cached separately.
For example, f(3.0) and f(3) will be treated as distinct calls with
distinct results.
... | Least-recently-used cache decorator. | [
"Least",
"-",
"recently",
"-",
"used",
"cache",
"decorator",
"."
] | def lru_cache(maxsize=128, typed=False):
"""Least-recently-used cache decorator.
If *maxsize* is set to None, the LRU features are disabled and the cache
can grow without bound.
If *typed* is True, arguments of different types will be cached separately.
For example, f(3.0) and f(3) will be treated... | [
"def",
"lru_cache",
"(",
"maxsize",
"=",
"128",
",",
"typed",
"=",
"False",
")",
":",
"# Users should only access the lru_cache through its public API:",
"# cache_info, cache_clear, and f.__wrapped__",
"# The internals of the lru_cache are encapsulated for thread safety and",
"# ... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/functools.py#L458-L496 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/datetime.py | python | _ymd2ord | (year, month, day) | return (_days_before_year(year) +
_days_before_month(year, month) +
day) | year, month, day -> ordinal, considering 01-Jan-0001 as day 1. | year, month, day -> ordinal, considering 01-Jan-0001 as day 1. | [
"year",
"month",
"day",
"-",
">",
"ordinal",
"considering",
"01",
"-",
"Jan",
"-",
"0001",
"as",
"day",
"1",
"."
] | def _ymd2ord(year, month, day):
"year, month, day -> ordinal, considering 01-Jan-0001 as day 1."
assert 1 <= month <= 12, 'month must be in 1..12'
dim = _days_in_month(year, month)
assert 1 <= day <= dim, ('day must be in 1..%d' % dim)
return (_days_before_year(year) +
_days_before_month... | [
"def",
"_ymd2ord",
"(",
"year",
",",
"month",
",",
"day",
")",
":",
"assert",
"1",
"<=",
"month",
"<=",
"12",
",",
"'month must be in 1..12'",
"dim",
"=",
"_days_in_month",
"(",
"year",
",",
"month",
")",
"assert",
"1",
"<=",
"day",
"<=",
"dim",
",",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/datetime.py#L62-L69 | |
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/ops/image_ops.py | python | rgb_to_grayscale | (images, name=None) | Converts one or more images from RGB to Grayscale.
Outputs a tensor of the same `DType` and rank as `images`. The size of the
last dimension of the output is 1, containing the Grayscale value of the
pixels.
Args:
images: The RGB tensor to convert. Last dimension must have size 3 and
should contain ... | Converts one or more images from RGB to Grayscale. | [
"Converts",
"one",
"or",
"more",
"images",
"from",
"RGB",
"to",
"Grayscale",
"."
] | def rgb_to_grayscale(images, name=None):
"""Converts one or more images from RGB to Grayscale.
Outputs a tensor of the same `DType` and rank as `images`. The size of the
last dimension of the output is 1, containing the Grayscale value of the
pixels.
Args:
images: The RGB tensor to convert. Last dimens... | [
"def",
"rgb_to_grayscale",
"(",
"images",
",",
"name",
"=",
"None",
")",
":",
"with",
"ops",
".",
"op_scope",
"(",
"[",
"images",
"]",
",",
"name",
",",
"'rgb_to_grayscale'",
")",
"as",
"name",
":",
"images",
"=",
"ops",
".",
"convert_to_tensor",
"(",
... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/ops/image_ops.py#L1126-L1155 | ||
google/shaka-packager | e1b0c7c45431327fd3ce193514a5407d07b39b22 | packager/third_party/protobuf/python/google/protobuf/internal/python_message.py | python | _Listener.__init__ | (self, parent_message) | Args:
parent_message: The message whose _Modified() method we should call when
we receive Modified() messages. | Args:
parent_message: The message whose _Modified() method we should call when
we receive Modified() messages. | [
"Args",
":",
"parent_message",
":",
"The",
"message",
"whose",
"_Modified",
"()",
"method",
"we",
"should",
"call",
"when",
"we",
"receive",
"Modified",
"()",
"messages",
"."
] | def __init__(self, parent_message):
"""Args:
parent_message: The message whose _Modified() method we should call when
we receive Modified() messages.
"""
# This listener establishes a back reference from a child (contained) object
# to its parent (containing) object. We make this a weak r... | [
"def",
"__init__",
"(",
"self",
",",
"parent_message",
")",
":",
"# This listener establishes a back reference from a child (contained) object",
"# to its parent (containing) object. We make this a weak reference to avoid",
"# creating cyclic garbage when the client finishes with the 'parent' o... | https://github.com/google/shaka-packager/blob/e1b0c7c45431327fd3ce193514a5407d07b39b22/packager/third_party/protobuf/python/google/protobuf/internal/python_message.py#L1369-L1386 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib-tk/Tkinter.py | python | Wm.wm_frame | (self) | return self.tk.call('wm', 'frame', self._w) | Return identifier for decorative frame of this widget if present. | Return identifier for decorative frame of this widget if present. | [
"Return",
"identifier",
"for",
"decorative",
"frame",
"of",
"this",
"widget",
"if",
"present",
"."
] | def wm_frame(self):
"""Return identifier for decorative frame of this widget if present."""
return self.tk.call('wm', 'frame', self._w) | [
"def",
"wm_frame",
"(",
"self",
")",
":",
"return",
"self",
".",
"tk",
".",
"call",
"(",
"'wm'",
",",
"'frame'",
",",
"self",
".",
"_w",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib-tk/Tkinter.py#L1587-L1589 | |
pytorch/glow | 15baf2376f7ebff7d4e75ccb094624a9c1e9a089 | utils/compilation_filter.py | python | find_all_related_transformation | (cursor: sqlite3.Cursor, transIDs: List[str]) | return transIDs | A recursive function that find all related transformations given a list of transformation IDs in the database.
Args:
cursor: sqlite3.Cursor. Cursor of current sqlite3 database connection.
transIDs: List[str]. A list of transformation IDs. | A recursive function that find all related transformations given a list of transformation IDs in the database. | [
"A",
"recursive",
"function",
"that",
"find",
"all",
"related",
"transformations",
"given",
"a",
"list",
"of",
"transformation",
"IDs",
"in",
"the",
"database",
"."
] | def find_all_related_transformation(cursor: sqlite3.Cursor, transIDs: List[str]):
"""A recursive function that find all related transformations given a list of transformation IDs in the database.
Args:
cursor: sqlite3.Cursor. Cursor of current sqlite3 database connection.
transIDs: List[str]. A... | [
"def",
"find_all_related_transformation",
"(",
"cursor",
":",
"sqlite3",
".",
"Cursor",
",",
"transIDs",
":",
"List",
"[",
"str",
"]",
")",
":",
"transQueryStr",
"=",
"\"(\"",
"+",
"\", \"",
".",
"join",
"(",
"transIDs",
")",
"+",
"\")\"",
"cursor",
".",
... | https://github.com/pytorch/glow/blob/15baf2376f7ebff7d4e75ccb094624a9c1e9a089/utils/compilation_filter.py#L161-L195 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/site.py | python | check_enableusersite | () | return True | Check if user site directory is safe for inclusion
The function tests for the command line flag (including environment var),
process uid/gid equal to effective uid/gid.
None: Disabled for security reasons
False: Disabled by user (command line option)
True: Safe and enabled | Check if user site directory is safe for inclusion | [
"Check",
"if",
"user",
"site",
"directory",
"is",
"safe",
"for",
"inclusion"
] | def check_enableusersite():
"""Check if user site directory is safe for inclusion
The function tests for the command line flag (including environment var),
process uid/gid equal to effective uid/gid.
None: Disabled for security reasons
False: Disabled by user (command line option)
True: Safe a... | [
"def",
"check_enableusersite",
"(",
")",
":",
"if",
"sys",
".",
"flags",
".",
"no_user_site",
":",
"return",
"False",
"if",
"hasattr",
"(",
"os",
",",
"\"getuid\"",
")",
"and",
"hasattr",
"(",
"os",
",",
"\"geteuid\"",
")",
":",
"# check process uid == effec... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/site.py#L198-L220 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/s3fs/errors.py | python | translate_boto_error | (error, message=None, *args, **kwargs) | return constructor(message, *args, **kwargs) | Convert a ClientError exception into a Python one.
Parameters
----------
error : botocore.exceptions.ClientError
The exception returned by the boto API.
message : str
An error message to use for the returned exception. If not given, the
error message returned by the server is u... | Convert a ClientError exception into a Python one. | [
"Convert",
"a",
"ClientError",
"exception",
"into",
"a",
"Python",
"one",
"."
] | def translate_boto_error(error, message=None, *args, **kwargs):
"""Convert a ClientError exception into a Python one.
Parameters
----------
error : botocore.exceptions.ClientError
The exception returned by the boto API.
message : str
An error message to use for the returned excepti... | [
"def",
"translate_boto_error",
"(",
"error",
",",
"message",
"=",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"code",
"=",
"error",
".",
"response",
"[",
"'Error'",
"]",
".",
"get",
"(",
"'Code'",
")",
"constructor",
"=",
"ERROR_CODE_T... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/s3fs/errors.py#L115-L145 | |
gv22ga/dlib-face-recognition-android | 42d6305cbd85833f2b85bb79b70ab9ab004153c9 | tools/lint/cpplint.py | python | CheckForMultilineCommentsAndStrings | (filename, clean_lines, linenum, error) | Logs an error if we see /* ... */ or "..." that extend past one line.
/* ... */ comments are legit inside macros, for one line.
Otherwise, we prefer // comments, so it's ok to warn about the
other. Likewise, it's ok for strings to extend across multiple
lines, as long as a line continuation character (backslas... | Logs an error if we see /* ... */ or "..." that extend past one line.
/* ... */ comments are legit inside macros, for one line.
Otherwise, we prefer // comments, so it's ok to warn about the
other. Likewise, it's ok for strings to extend across multiple
lines, as long as a line continuation character (backslas... | [
"Logs",
"an",
"error",
"if",
"we",
"see",
"/",
"*",
"...",
"*",
"/",
"or",
"...",
"that",
"extend",
"past",
"one",
"line",
".",
"/",
"*",
"...",
"*",
"/",
"comments",
"are",
"legit",
"inside",
"macros",
"for",
"one",
"line",
".",
"Otherwise",
"we",... | def CheckForMultilineCommentsAndStrings(filename, clean_lines, linenum, error):
"""Logs an error if we see /* ... */ or "..." that extend past one line.
/* ... */ comments are legit inside macros, for one line.
Otherwise, we prefer // comments, so it's ok to warn about the
other. Likewise, it's ok for strings ... | [
"def",
"CheckForMultilineCommentsAndStrings",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"# Remove all \\\\ (escaped backslashes) from the line. They are OK, and the",
"# secon... | https://github.com/gv22ga/dlib-face-recognition-android/blob/42d6305cbd85833f2b85bb79b70ab9ab004153c9/tools/lint/cpplint.py#L1847-L1880 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/email/message.py | python | Message.__setitem__ | (self, name, val) | Set the value of a header.
Note: this does not overwrite an existing header with the same field
name. Use __delitem__() first to delete any existing headers. | Set the value of a header. | [
"Set",
"the",
"value",
"of",
"a",
"header",
"."
] | def __setitem__(self, name, val):
"""Set the value of a header.
Note: this does not overwrite an existing header with the same field
name. Use __delitem__() first to delete any existing headers.
"""
self._headers.append((name, val)) | [
"def",
"__setitem__",
"(",
"self",
",",
"name",
",",
"val",
")",
":",
"self",
".",
"_headers",
".",
"append",
"(",
"(",
"name",
",",
"val",
")",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/email/message.py#L296-L302 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/ed_menu.py | python | WalkMenu | (menu, label, collection) | return collection | Recursively walk a menu and collect all its sub items
@param menu: wxMenu to walk
@param label: the menu's label
@param collection: dictionary to collect results in
@return: dict {menulabel : [menu id, (item1 id, label1),]} | Recursively walk a menu and collect all its sub items
@param menu: wxMenu to walk
@param label: the menu's label
@param collection: dictionary to collect results in
@return: dict {menulabel : [menu id, (item1 id, label1),]} | [
"Recursively",
"walk",
"a",
"menu",
"and",
"collect",
"all",
"its",
"sub",
"items",
"@param",
"menu",
":",
"wxMenu",
"to",
"walk",
"@param",
"label",
":",
"the",
"menu",
"s",
"label",
"@param",
"collection",
":",
"dictionary",
"to",
"collect",
"results",
"... | def WalkMenu(menu, label, collection):
"""Recursively walk a menu and collect all its sub items
@param menu: wxMenu to walk
@param label: the menu's label
@param collection: dictionary to collect results in
@return: dict {menulabel : [menu id, (item1 id, label1),]}
"""
if label not in colle... | [
"def",
"WalkMenu",
"(",
"menu",
",",
"label",
",",
"collection",
")",
":",
"if",
"label",
"not",
"in",
"collection",
":",
"collection",
"[",
"label",
"]",
"=",
"list",
"(",
")",
"for",
"item",
"in",
"menu",
".",
"GetMenuItems",
"(",
")",
":",
"i_id",... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/ed_menu.py#L1194-L1228 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/_pydecimal.py | python | Decimal._power_modulo | (self, other, modulo, context=None) | return _dec_from_triple(sign, str(base), 0) | Three argument version of __pow__ | Three argument version of __pow__ | [
"Three",
"argument",
"version",
"of",
"__pow__"
] | def _power_modulo(self, other, modulo, context=None):
"""Three argument version of __pow__"""
other = _convert_other(other)
if other is NotImplemented:
return other
modulo = _convert_other(modulo)
if modulo is NotImplemented:
return modulo
if con... | [
"def",
"_power_modulo",
"(",
"self",
",",
"other",
",",
"modulo",
",",
"context",
"=",
"None",
")",
":",
"other",
"=",
"_convert_other",
"(",
"other",
")",
"if",
"other",
"is",
"NotImplemented",
":",
"return",
"other",
"modulo",
"=",
"_convert_other",
"(",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/_pydecimal.py#L1966-L2049 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/decimal.py | python | Context.compare | (self, a, b) | return a.compare(b, context=self) | Compares values numerically.
If the signs of the operands differ, a value representing each operand
('-1' if the operand is less than zero, '0' if the operand is zero or
negative zero, or '1' if the operand is greater than zero) is used in
place of that operand for the comparison instea... | Compares values numerically. | [
"Compares",
"values",
"numerically",
"."
] | def compare(self, a, b):
"""Compares values numerically.
If the signs of the operands differ, a value representing each operand
('-1' if the operand is less than zero, '0' if the operand is zero or
negative zero, or '1' if the operand is greater than zero) is used in
place of th... | [
"def",
"compare",
"(",
"self",
",",
"a",
",",
"b",
")",
":",
"return",
"a",
".",
"compare",
"(",
"b",
",",
"context",
"=",
"self",
")"
] | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/decimal.py#L3829-L3856 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/keras/python/keras/models.py | python | Sequential.compile | (self,
optimizer,
loss,
metrics=None,
sample_weight_mode=None,
**kwargs) | Configures the learning process.
Arguments:
optimizer: str (name of optimizer) or optimizer object.
See [optimizers](/optimizers).
loss: str (name of objective function) or objective function.
See [losses](/losses).
metrics: list of metrics to be evaluated by the mod... | Configures the learning process. | [
"Configures",
"the",
"learning",
"process",
"."
] | def compile(self,
optimizer,
loss,
metrics=None,
sample_weight_mode=None,
**kwargs):
"""Configures the learning process.
Arguments:
optimizer: str (name of optimizer) or optimizer object.
See [optimizers](/optimizers).
... | [
"def",
"compile",
"(",
"self",
",",
"optimizer",
",",
"loss",
",",
"metrics",
"=",
"None",
",",
"sample_weight_mode",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# create the underlying model",
"self",
".",
"build",
"(",
")",
"# call compile method of Mod... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/keras/python/keras/models.py#L727-L779 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/prompt-toolkit/py2/prompt_toolkit/layout/containers.py | python | Window._show_input_processor_key_buffer | (self, cli, new_screen) | When the user is typing a key binding that consists of several keys,
display the last pressed key if the user is in insert mode and the key
is meaningful to be displayed.
E.g. Some people want to bind 'jj' to escape in Vi insert mode. But the
first 'j' needs to be displayed in order... | When the user is typing a key binding that consists of several keys,
display the last pressed key if the user is in insert mode and the key
is meaningful to be displayed.
E.g. Some people want to bind 'jj' to escape in Vi insert mode. But the
first 'j' needs to be displayed in order... | [
"When",
"the",
"user",
"is",
"typing",
"a",
"key",
"binding",
"that",
"consists",
"of",
"several",
"keys",
"display",
"the",
"last",
"pressed",
"key",
"if",
"the",
"user",
"is",
"in",
"insert",
"mode",
"and",
"the",
"key",
"is",
"meaningful",
"to",
"be",... | def _show_input_processor_key_buffer(self, cli, new_screen):
"""
When the user is typing a key binding that consists of several keys,
display the last pressed key if the user is in insert mode and the key
is meaningful to be displayed.
E.g. Some people want to bind 'jj' to escape... | [
"def",
"_show_input_processor_key_buffer",
"(",
"self",
",",
"cli",
",",
"new_screen",
")",
":",
"key_buffer",
"=",
"cli",
".",
"input_processor",
".",
"key_buffer",
"if",
"key_buffer",
"and",
"_in_insert_mode",
"(",
"cli",
")",
"and",
"not",
"cli",
".",
"is_d... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/prompt-toolkit/py2/prompt_toolkit/layout/containers.py#L1346-L1365 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/python/turicreate/toolkits/classifier/boosted_trees_classifier.py | python | create | (
dataset,
target,
features=None,
max_iterations=10,
validation_set="auto",
class_weights=None,
max_depth=6,
step_size=0.3,
min_loss_reduction=0.0,
min_child_weight=0.1,
row_subsample=1.0,
column_subsample=1.0,
verbose=True,
random_seed=None,
metric="auto",
... | return BoostedTreesClassifier(model.__proxy__) | Create a (binary or multi-class) classifier model of type
:class:`~turicreate.boosted_trees_classifier.BoostedTreesClassifier` using
gradient boosted trees (sometimes known as GBMs).
Parameters
----------
dataset : SFrame
A training dataset containing feature columns and a target column.
... | Create a (binary or multi-class) classifier model of type
:class:`~turicreate.boosted_trees_classifier.BoostedTreesClassifier` using
gradient boosted trees (sometimes known as GBMs). | [
"Create",
"a",
"(",
"binary",
"or",
"multi",
"-",
"class",
")",
"classifier",
"model",
"of",
"type",
":",
"class",
":",
"~turicreate",
".",
"boosted_trees_classifier",
".",
"BoostedTreesClassifier",
"using",
"gradient",
"boosted",
"trees",
"(",
"sometimes",
"kno... | def create(
dataset,
target,
features=None,
max_iterations=10,
validation_set="auto",
class_weights=None,
max_depth=6,
step_size=0.3,
min_loss_reduction=0.0,
min_child_weight=0.1,
row_subsample=1.0,
column_subsample=1.0,
verbose=True,
random_seed=None,
metric=... | [
"def",
"create",
"(",
"dataset",
",",
"target",
",",
"features",
"=",
"None",
",",
"max_iterations",
"=",
"10",
",",
"validation_set",
"=",
"\"auto\"",
",",
"class_weights",
"=",
"None",
",",
"max_depth",
"=",
"6",
",",
"step_size",
"=",
"0.3",
",",
"min... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/python/turicreate/toolkits/classifier/boosted_trees_classifier.py#L465-L666 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/basic_fitting/fit_function_options_view.py | python | FitFunctionOptionsView.start_x | (self) | return float(self.start_x_line_edit.text()) | Returns the selected start X. | Returns the selected start X. | [
"Returns",
"the",
"selected",
"start",
"X",
"."
] | def start_x(self) -> float:
"""Returns the selected start X."""
return float(self.start_x_line_edit.text()) | [
"def",
"start_x",
"(",
"self",
")",
"->",
"float",
":",
"return",
"float",
"(",
"self",
".",
"start_x_line_edit",
".",
"text",
"(",
")",
")"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/basic_fitting/fit_function_options_view.py#L218-L220 | |
godotengine/godot | 39562294ff3e6a273f9a73f97bc54791a4e98f07 | platform/windows/detect.py | python | setup_msvc_auto | (env) | Set up MSVC using SCons's auto-detection logic | Set up MSVC using SCons's auto-detection logic | [
"Set",
"up",
"MSVC",
"using",
"SCons",
"s",
"auto",
"-",
"detection",
"logic"
] | def setup_msvc_auto(env):
"""Set up MSVC using SCons's auto-detection logic"""
# If MSVC_VERSION is set by SCons, we know MSVC is installed.
# But we may want a different version or target arch.
# The env may have already been set up with default MSVC tools, so
# reset a few things so we can set i... | [
"def",
"setup_msvc_auto",
"(",
"env",
")",
":",
"# If MSVC_VERSION is set by SCons, we know MSVC is installed.",
"# But we may want a different version or target arch.",
"# The env may have already been set up with default MSVC tools, so",
"# reset a few things so we can set it up with the tools w... | https://github.com/godotengine/godot/blob/39562294ff3e6a273f9a73f97bc54791a4e98f07/platform/windows/detect.py#L138-L167 | ||
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/client/timeline.py | python | Timeline._is_gputrace_device | (self, device_name) | return '/stream:' in device_name or '/memcpy' in device_name | Returns true if this device is part of the GPUTracer logging. | Returns true if this device is part of the GPUTracer logging. | [
"Returns",
"true",
"if",
"this",
"device",
"is",
"part",
"of",
"the",
"GPUTracer",
"logging",
"."
] | def _is_gputrace_device(self, device_name):
"""Returns true if this device is part of the GPUTracer logging."""
return '/stream:' in device_name or '/memcpy' in device_name | [
"def",
"_is_gputrace_device",
"(",
"self",
",",
"device_name",
")",
":",
"return",
"'/stream:'",
"in",
"device_name",
"or",
"'/memcpy'",
"in",
"device_name"
] | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/client/timeline.py#L458-L460 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/tornado/tornado-6/tornado/web.py | python | RequestHandler.create_template_loader | (self, template_path: str) | return template.Loader(template_path, **kwargs) | Returns a new template loader for the given path.
May be overridden by subclasses. By default returns a
directory-based loader on the given path, using the
``autoescape`` and ``template_whitespace`` application
settings. If a ``template_loader`` application setting is
supplied... | Returns a new template loader for the given path. | [
"Returns",
"a",
"new",
"template",
"loader",
"for",
"the",
"given",
"path",
"."
] | def create_template_loader(self, template_path: str) -> template.BaseLoader:
"""Returns a new template loader for the given path.
May be overridden by subclasses. By default returns a
directory-based loader on the given path, using the
``autoescape`` and ``template_whitespace`` applica... | [
"def",
"create_template_loader",
"(",
"self",
",",
"template_path",
":",
"str",
")",
"->",
"template",
".",
"BaseLoader",
":",
"settings",
"=",
"self",
".",
"application",
".",
"settings",
"if",
"\"template_loader\"",
"in",
"settings",
":",
"return",
"settings",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/tornado/tornado-6/tornado/web.py#L1037-L1056 | |
xlgames-inc/XLE | cdd8682367d9e9fdbdda9f79d72bb5b1499cec46 | Foreign/FreeType/src/tools/docmaker/content.py | python | DocBlock.get_markup | ( self, tag_name ) | return None | Return the DocMarkup corresponding to a given tag in a block. | Return the DocMarkup corresponding to a given tag in a block. | [
"Return",
"the",
"DocMarkup",
"corresponding",
"to",
"a",
"given",
"tag",
"in",
"a",
"block",
"."
] | def get_markup( self, tag_name ):
"""Return the DocMarkup corresponding to a given tag in a block."""
for m in self.markups:
if m.tag == string.lower( tag_name ):
return m
return None | [
"def",
"get_markup",
"(",
"self",
",",
"tag_name",
")",
":",
"for",
"m",
"in",
"self",
".",
"markups",
":",
"if",
"m",
".",
"tag",
"==",
"string",
".",
"lower",
"(",
"tag_name",
")",
":",
"return",
"m",
"return",
"None"
] | https://github.com/xlgames-inc/XLE/blob/cdd8682367d9e9fdbdda9f79d72bb5b1499cec46/Foreign/FreeType/src/tools/docmaker/content.py#L597-L602 | |
gem5/gem5 | 141cc37c2d4b93959d4c249b8f7e6a8b2ef75338 | src/mem/slicc/parser.py | python | SLICC.p_decls | (self, p) | decls : declsx | decls : declsx | [
"decls",
":",
"declsx"
] | def p_decls(self, p):
"decls : declsx"
p[0] = ast.DeclListAST(self, p[1]) | [
"def",
"p_decls",
"(",
"self",
",",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"ast",
".",
"DeclListAST",
"(",
"self",
",",
"p",
"[",
"1",
"]",
")"
] | https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/src/mem/slicc/parser.py#L240-L242 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/XRCed/view.py | python | Frame.InitToolBar | (self, long) | Initialize toolbar, long is boolean. | Initialize toolbar, long is boolean. | [
"Initialize",
"toolbar",
"long",
"is",
"boolean",
"."
] | def InitToolBar(self, long):
'''Initialize toolbar, long is boolean.'''
tb = self.tb
tb.ClearTools()
new_bmp = wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE, wx.ART_TOOLBAR)
open_bmp = wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN, wx.ART_TOOLBAR)
save_bmp = wx.ArtProvider.Get... | [
"def",
"InitToolBar",
"(",
"self",
",",
"long",
")",
":",
"tb",
"=",
"self",
".",
"tb",
"tb",
".",
"ClearTools",
"(",
")",
"new_bmp",
"=",
"wx",
".",
"ArtProvider",
".",
"GetBitmap",
"(",
"wx",
".",
"ART_NORMAL_FILE",
",",
"wx",
".",
"ART_TOOLBAR",
"... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/XRCed/view.py#L291-L344 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/slim/python/slim/nets/vgg.py | python | vgg_19 | (inputs,
num_classes=1000,
is_training=True,
dropout_keep_prob=0.5,
spatial_squeeze=True,
scope='vgg_19') | Oxford Net VGG 19-Layers version E Example.
Note: All the fully_connected layers have been transformed to conv2d layers.
To use in classification mode, resize input to 224x224.
Args:
inputs: a tensor of size [batch_size, height, width, channels].
num_classes: number of predicted classes.
is_tr... | Oxford Net VGG 19-Layers version E Example. | [
"Oxford",
"Net",
"VGG",
"19",
"-",
"Layers",
"version",
"E",
"Example",
"."
] | def vgg_19(inputs,
num_classes=1000,
is_training=True,
dropout_keep_prob=0.5,
spatial_squeeze=True,
scope='vgg_19'):
"""Oxford Net VGG 19-Layers version E Example.
Note: All the fully_connected layers have been transformed to conv2d layers.
To use in c... | [
"def",
"vgg_19",
"(",
"inputs",
",",
"num_classes",
"=",
"1000",
",",
"is_training",
"=",
"True",
",",
"dropout_keep_prob",
"=",
"0.5",
",",
"spatial_squeeze",
"=",
"True",
",",
"scope",
"=",
"'vgg_19'",
")",
":",
"with",
"variable_scope",
".",
"variable_sco... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/slim/python/slim/nets/vgg.py#L204-L263 | ||
HKUST-Aerial-Robotics/Teach-Repeat-Replan | 98505a7f74b13c8b501176ff838a38423dbef536 | utils/quadrotor_msgs/src/quadrotor_msgs/msg/_AuxCommand.py | python | AuxCommand._get_types | (self) | return self._slot_types | internal API method | internal API method | [
"internal",
"API",
"method"
] | def _get_types(self):
"""
internal API method
"""
return self._slot_types | [
"def",
"_get_types",
"(",
"self",
")",
":",
"return",
"self",
".",
"_slot_types"
] | https://github.com/HKUST-Aerial-Robotics/Teach-Repeat-Replan/blob/98505a7f74b13c8b501176ff838a38423dbef536/utils/quadrotor_msgs/src/quadrotor_msgs/msg/_AuxCommand.py#L56-L60 | |
iam-abbas/cs-algorithms | d04aa8fd9a1fa290266dde96afe9b90ee23c5a92 | MachineLearning/agent.py | python | DQNAgent.replay | (self, batch_size=32) | vectorized implementation; 30x speed up compared with for loop | vectorized implementation; 30x speed up compared with for loop | [
"vectorized",
"implementation",
";",
"30x",
"speed",
"up",
"compared",
"with",
"for",
"loop"
] | def replay(self, batch_size=32):
""" vectorized implementation; 30x speed up compared with for loop """
minibatch = random.sample(self.memory, batch_size)
states = np.array([tup[0][0] for tup in minibatch])
actions = np.array([tup[1] for tup in minibatch])
rewards = np.array([tup[2] for tup in mini... | [
"def",
"replay",
"(",
"self",
",",
"batch_size",
"=",
"32",
")",
":",
"minibatch",
"=",
"random",
".",
"sample",
"(",
"self",
".",
"memory",
",",
"batch_size",
")",
"states",
"=",
"np",
".",
"array",
"(",
"[",
"tup",
"[",
"0",
"]",
"[",
"0",
"]",... | https://github.com/iam-abbas/cs-algorithms/blob/d04aa8fd9a1fa290266dde96afe9b90ee23c5a92/MachineLearning/agent.py#L32-L55 | ||
spencer-project/spencer_people_tracking | 09b256ba4bc22c5cae8a5ae88960de1a387cfd7f | tracking/people/spencer_tracking_metrics/src/spencer_tracking_metrics/pymot/__init__.py | python | MOTEvaluation.resetStatistics | (self) | Reset counters and mapping. | Reset counters and mapping. | [
"Reset",
"counters",
"and",
"mapping",
"."
] | def resetStatistics(self):
"""Reset counters and mapping."""
self.resetMapping()
# yin-yang
self.recoverable_mismatches_ = 0
self.non_recoverable_mismatches_ = 0
# MOTA related
self.mismatches_ = 0
self.misses_ = 0
self.false_positives_ = 0
... | [
"def",
"resetStatistics",
"(",
"self",
")",
":",
"self",
".",
"resetMapping",
"(",
")",
"# yin-yang",
"self",
".",
"recoverable_mismatches_",
"=",
"0",
"self",
".",
"non_recoverable_mismatches_",
"=",
"0",
"# MOTA related",
"self",
".",
"mismatches_",
"=",
"0",
... | https://github.com/spencer-project/spencer_people_tracking/blob/09b256ba4bc22c5cae8a5ae88960de1a387cfd7f/tracking/people/spencer_tracking_metrics/src/spencer_tracking_metrics/pymot/__init__.py#L591-L610 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/scipy/constants/constants.py | python | lambda2nu | (lambda_) | return _np.asanyarray(c) / lambda_ | Convert wavelength to optical frequency
Parameters
----------
lambda_ : array_like
Wavelength(s) to be converted.
Returns
-------
nu : float or array of floats
Equivalent optical frequency.
Notes
-----
Computes ``nu = c / lambda`` where c = 299792458.0, i.e., the
... | Convert wavelength to optical frequency | [
"Convert",
"wavelength",
"to",
"optical",
"frequency"
] | def lambda2nu(lambda_):
"""
Convert wavelength to optical frequency
Parameters
----------
lambda_ : array_like
Wavelength(s) to be converted.
Returns
-------
nu : float or array of floats
Equivalent optical frequency.
Notes
-----
Computes ``nu = c / lambda`... | [
"def",
"lambda2nu",
"(",
"lambda_",
")",
":",
"return",
"_np",
".",
"asanyarray",
"(",
"c",
")",
"/",
"lambda_"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/constants/constants.py#L466-L492 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/code.py | python | InteractiveConsole.push | (self, line) | return more | Push a line to the interpreter.
The line should not have a trailing newline; it may have
internal newlines. The line is appended to a buffer and the
interpreter's runsource() method is called with the
concatenated contents of the buffer as source. If this
indicates that the co... | Push a line to the interpreter. | [
"Push",
"a",
"line",
"to",
"the",
"interpreter",
"."
] | def push(self, line):
"""Push a line to the interpreter.
The line should not have a trailing newline; it may have
internal newlines. The line is appended to a buffer and the
interpreter's runsource() method is called with the
concatenated contents of the buffer as source. If t... | [
"def",
"push",
"(",
"self",
",",
"line",
")",
":",
"self",
".",
"buffer",
".",
"append",
"(",
"line",
")",
"source",
"=",
"\"\\n\"",
".",
"join",
"(",
"self",
".",
"buffer",
")",
"more",
"=",
"self",
".",
"runsource",
"(",
"source",
",",
"self",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/code.py#L242-L261 | |
ValveSoftware/source-sdk-2013 | 0d8dceea4310fde5706b3ce1c70609d72a38efdf | sp/src/thirdparty/protobuf-2.3.0/python/google/protobuf/service_reflection.py | python | _ServiceBuilder._CallMethod | (self, srvc, method_descriptor,
rpc_controller, request, callback) | return method(rpc_controller, request, callback) | Calls the method described by a given method descriptor.
Args:
srvc: Instance of the service for which this method is called.
method_descriptor: Descriptor that represent the method to call.
rpc_controller: RPC controller to use for this method's execution.
request: Request protocol message... | Calls the method described by a given method descriptor. | [
"Calls",
"the",
"method",
"described",
"by",
"a",
"given",
"method",
"descriptor",
"."
] | def _CallMethod(self, srvc, method_descriptor,
rpc_controller, request, callback):
"""Calls the method described by a given method descriptor.
Args:
srvc: Instance of the service for which this method is called.
method_descriptor: Descriptor that represent the method to call.
... | [
"def",
"_CallMethod",
"(",
"self",
",",
"srvc",
",",
"method_descriptor",
",",
"rpc_controller",
",",
"request",
",",
"callback",
")",
":",
"if",
"method_descriptor",
".",
"containing_service",
"!=",
"self",
".",
"descriptor",
":",
"raise",
"RuntimeError",
"(",
... | https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/thirdparty/protobuf-2.3.0/python/google/protobuf/service_reflection.py#L156-L171 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_controls.py | python | ContextHelp.__init__ | (self, *args, **kwargs) | __init__(self, Window window=None, bool doNow=True) -> ContextHelp
Constructs a context help object, calling BeginContextHelp if doNow is
true (the default).
If window is None, the top window is used. | __init__(self, Window window=None, bool doNow=True) -> ContextHelp | [
"__init__",
"(",
"self",
"Window",
"window",
"=",
"None",
"bool",
"doNow",
"=",
"True",
")",
"-",
">",
"ContextHelp"
] | def __init__(self, *args, **kwargs):
"""
__init__(self, Window window=None, bool doNow=True) -> ContextHelp
Constructs a context help object, calling BeginContextHelp if doNow is
true (the default).
If window is None, the top window is used.
"""
_controls_.Cont... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_controls_",
".",
"ContextHelp_swiginit",
"(",
"self",
",",
"_controls_",
".",
"new_ContextHelp",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_controls.py#L6135-L6144 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/Tkinter.py | python | PhotoImage.__init__ | (self, name=None, cnf={}, master=None, **kw) | Create an image with NAME.
Valid resource names: data, format, file, gamma, height, palette,
width. | Create an image with NAME. | [
"Create",
"an",
"image",
"with",
"NAME",
"."
] | def __init__(self, name=None, cnf={}, master=None, **kw):
"""Create an image with NAME.
Valid resource names: data, format, file, gamma, height, palette,
width."""
Image.__init__(self, 'photo', name, cnf, master, **kw) | [
"def",
"__init__",
"(",
"self",
",",
"name",
"=",
"None",
",",
"cnf",
"=",
"{",
"}",
",",
"master",
"=",
"None",
",",
"*",
"*",
"kw",
")",
":",
"Image",
".",
"__init__",
"(",
"self",
",",
"'photo'",
",",
"name",
",",
"cnf",
",",
"master",
",",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/Tkinter.py#L3301-L3306 | ||
CanalTP/navitia | cb84ce9859070187e708818b058e6a7e0b7f891b | source/jormungandr/jormungandr/authentication.py | python | cache_get_user | (token) | return user | We allow this method to be cached even if it depends on the current time
because we assume the cache time is small and the error can be tolerated. | We allow this method to be cached even if it depends on the current time
because we assume the cache time is small and the error can be tolerated. | [
"We",
"allow",
"this",
"method",
"to",
"be",
"cached",
"even",
"if",
"it",
"depends",
"on",
"the",
"current",
"time",
"because",
"we",
"assume",
"the",
"cache",
"time",
"is",
"small",
"and",
"the",
"error",
"can",
"be",
"tolerated",
"."
] | def cache_get_user(token):
"""
We allow this method to be cached even if it depends on the current time
because we assume the cache time is small and the error can be tolerated.
"""
if not can_connect_to_database():
return None
try:
user = User.get_from_token(token, datetime.date... | [
"def",
"cache_get_user",
"(",
"token",
")",
":",
"if",
"not",
"can_connect_to_database",
"(",
")",
":",
"return",
"None",
"try",
":",
"user",
"=",
"User",
".",
"get_from_token",
"(",
"token",
",",
"datetime",
".",
"datetime",
".",
"now",
"(",
")",
")",
... | https://github.com/CanalTP/navitia/blob/cb84ce9859070187e708818b058e6a7e0b7f891b/source/jormungandr/jormungandr/authentication.py#L177-L191 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/http/cookies.py | python | BaseCookie.__setitem__ | (self, key, value) | Dictionary style assignment. | Dictionary style assignment. | [
"Dictionary",
"style",
"assignment",
"."
] | def __setitem__(self, key, value):
"""Dictionary style assignment."""
if isinstance(value, Morsel):
# allow assignment of constructed Morsels (e.g. for pickling)
dict.__setitem__(self, key, value)
else:
rval, cval = self.value_encode(value)
self.__... | [
"def",
"__setitem__",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"Morsel",
")",
":",
"# allow assignment of constructed Morsels (e.g. for pickling)",
"dict",
".",
"__setitem__",
"(",
"self",
",",
"key",
",",
"value",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/http/cookies.py#L488-L495 | ||
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Warnings.py | python | process_warn_strings | (arguments) | Process string specifications of enabling/disabling warnings,
as passed to the --warn option or the SetOption('warn') function.
An argument to this option should be of the form <warning-class>
or no-<warning-class>. The warning class is munged in order
to get an actual class name from the classes... | Process string specifications of enabling/disabling warnings,
as passed to the --warn option or the SetOption('warn') function. | [
"Process",
"string",
"specifications",
"of",
"enabling",
"/",
"disabling",
"warnings",
"as",
"passed",
"to",
"the",
"--",
"warn",
"option",
"or",
"the",
"SetOption",
"(",
"warn",
")",
"function",
"."
] | def process_warn_strings(arguments):
"""Process string specifications of enabling/disabling warnings,
as passed to the --warn option or the SetOption('warn') function.
An argument to this option should be of the form <warning-class>
or no-<warning-class>. The warning class is munged in order
... | [
"def",
"process_warn_strings",
"(",
"arguments",
")",
":",
"def",
"_capitalize",
"(",
"s",
")",
":",
"if",
"s",
"[",
":",
"5",
"]",
"==",
"\"scons\"",
":",
"return",
"\"SCons\"",
"+",
"s",
"[",
"5",
":",
"]",
"else",
":",
"return",
"s",
".",
"capit... | https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Warnings.py#L198-L248 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/json_schema_compiler/cpp_type_generator.py | python | CppTypeGenerator.GenerateForwardDeclarations | (self) | return c | Returns the forward declarations for self._default_namespace. | Returns the forward declarations for self._default_namespace. | [
"Returns",
"the",
"forward",
"declarations",
"for",
"self",
".",
"_default_namespace",
"."
] | def GenerateForwardDeclarations(self):
"""Returns the forward declarations for self._default_namespace.
"""
c = Code()
for namespace, deps in self._NamespaceTypeDependencies().iteritems():
filtered_deps = [
dep for dep in deps
# Add more ways to forward declare things as necessary.... | [
"def",
"GenerateForwardDeclarations",
"(",
"self",
")",
":",
"c",
"=",
"Code",
"(",
")",
"for",
"namespace",
",",
"deps",
"in",
"self",
".",
"_NamespaceTypeDependencies",
"(",
")",
".",
"iteritems",
"(",
")",
":",
"filtered_deps",
"=",
"[",
"dep",
"for",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/json_schema_compiler/cpp_type_generator.py#L138-L159 | |
strukturag/libheif | 0082fea96ee70a20c8906a0373bedec0c01777bc | scripts/cpplint.py | python | NestingState.Update | (self, filename, clean_lines, linenum, error) | Update nesting state with current line.
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. | Update nesting state with current line. | [
"Update",
"nesting",
"state",
"with",
"current",
"line",
"."
] | def Update(self, filename, clean_lines, linenum, error):
"""Update nesting state with current line.
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 err... | [
"def",
"Update",
"(",
"self",
",",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"# Remember top of the previous nesting stack.",
"#",
"# The stack is always pushed/popped and no... | https://github.com/strukturag/libheif/blob/0082fea96ee70a20c8906a0373bedec0c01777bc/scripts/cpplint.py#L2461-L2623 | ||
OAID/Caffe-HRT | aae71e498ab842c6f92bcc23fc668423615a4d65 | scripts/cpp_lint.py | python | CheckCaffeRandom | (filename, clean_lines, linenum, error) | Checks for calls to C random functions (rand, rand_r, random, ...).
Caffe code should (almost) always use the caffe_rng_* functions rather
than these, as the internal state of these C functions is independent of the
native Caffe RNG system which should produce deterministic results for a
fixed Caffe seed set u... | Checks for calls to C random functions (rand, rand_r, random, ...). | [
"Checks",
"for",
"calls",
"to",
"C",
"random",
"functions",
"(",
"rand",
"rand_r",
"random",
"...",
")",
"."
] | def CheckCaffeRandom(filename, clean_lines, linenum, error):
"""Checks for calls to C random functions (rand, rand_r, random, ...).
Caffe code should (almost) always use the caffe_rng_* functions rather
than these, as the internal state of these C functions is independent of the
native Caffe RNG system which s... | [
"def",
"CheckCaffeRandom",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"for",
"function",
"in",
"c_random_function_list",
":",
"ix",
"=",
"line",
".",
"find",
... | https://github.com/OAID/Caffe-HRT/blob/aae71e498ab842c6f92bcc23fc668423615a4d65/scripts/cpp_lint.py#L1640-L1663 | ||
limbo018/DREAMPlace | 146c3b9fd003d1acd52c96d9fd02e3f0a05154e4 | dreamplace/ops/dct/discrete_spectral_transform.py | python | dst | (x, expkp1=None) | return y | Batch Discrete Sine Transformation without normalization to coefficients.
Compute y_u = \sum_i x_i sin(pi*(2i+1)*(u+1)/(2N)),
Impelements the 2N padding trick to solve DCT with FFT in the following link,
https://dsp.stackexchange.com/questions/2807/fast-cosine-transform-via-fft
1. Pad x by zeros
2... | Batch Discrete Sine Transformation without normalization to coefficients.
Compute y_u = \sum_i x_i sin(pi*(2i+1)*(u+1)/(2N)),
Impelements the 2N padding trick to solve DCT with FFT in the following link,
https://dsp.stackexchange.com/questions/2807/fast-cosine-transform-via-fft | [
"Batch",
"Discrete",
"Sine",
"Transformation",
"without",
"normalization",
"to",
"coefficients",
".",
"Compute",
"y_u",
"=",
"\\",
"sum_i",
"x_i",
"sin",
"(",
"pi",
"*",
"(",
"2i",
"+",
"1",
")",
"*",
"(",
"u",
"+",
"1",
")",
"/",
"(",
"2N",
"))",
... | def dst(x, expkp1=None):
""" Batch Discrete Sine Transformation without normalization to coefficients.
Compute y_u = \sum_i x_i sin(pi*(2i+1)*(u+1)/(2N)),
Impelements the 2N padding trick to solve DCT with FFT in the following link,
https://dsp.stackexchange.com/questions/2807/fast-cosine-transform-via... | [
"def",
"dst",
"(",
"x",
",",
"expkp1",
"=",
"None",
")",
":",
"# last dimension",
"N",
"=",
"x",
".",
"size",
"(",
"-",
"1",
")",
"# pad last dimension",
"x_pad",
"=",
"F",
".",
"pad",
"(",
"x",
",",
"(",
"0",
",",
"N",
")",
",",
"'constant'",
... | https://github.com/limbo018/DREAMPlace/blob/146c3b9fd003d1acd52c96d9fd02e3f0a05154e4/dreamplace/ops/dct/discrete_spectral_transform.py#L217-L242 | |
BitcoinUnlimited/BitcoinUnlimited | 05de381c02eb4bfca94957733acadfa217527f25 | contrib/devtools/security-check.py | python | get_ELF_program_headers | (executable) | return headers | Return type and flags for ELF program headers | Return type and flags for ELF program headers | [
"Return",
"type",
"and",
"flags",
"for",
"ELF",
"program",
"headers"
] | def get_ELF_program_headers(executable):
'''Return type and flags for ELF program headers'''
p = subprocess.Popen([READELF_CMD, '-l', '-W', executable], stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
(stdout, stderr) = p.communicate()
if p.returncode:
raise IOError('Error... | [
"def",
"get_ELF_program_headers",
"(",
"executable",
")",
":",
"p",
"=",
"subprocess",
".",
"Popen",
"(",
"[",
"READELF_CMD",
",",
"'-l'",
",",
"'-W'",
",",
"executable",
"]",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
",",
"stderr",
"=",
"subprocess",... | https://github.com/BitcoinUnlimited/BitcoinUnlimited/blob/05de381c02eb4bfca94957733acadfa217527f25/contrib/devtools/security-check.py#L32-L59 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/decimal.py | python | _nbits | (n, correction = {
'0': 4, '1': 3, '2': 2, '3': 2,
'4': 1, '5': 1, '6': 1, '7': 1,
'8': 0, '9': 0, 'a': 0, 'b': 0,
'c': 0, 'd': 0, 'e': 0, 'f': 0}) | return 4*len(hex_n) - correction[hex_n[0]] | Number of bits in binary representation of the positive integer n,
or 0 if n == 0. | Number of bits in binary representation of the positive integer n,
or 0 if n == 0. | [
"Number",
"of",
"bits",
"in",
"binary",
"representation",
"of",
"the",
"positive",
"integer",
"n",
"or",
"0",
"if",
"n",
"==",
"0",
"."
] | def _nbits(n, correction = {
'0': 4, '1': 3, '2': 2, '3': 2,
'4': 1, '5': 1, '6': 1, '7': 1,
'8': 0, '9': 0, 'a': 0, 'b': 0,
'c': 0, 'd': 0, 'e': 0, 'f': 0}):
"""Number of bits in binary representation of the positive integer n,
or 0 if n == 0.
"""
if n < 0:
raise... | [
"def",
"_nbits",
"(",
"n",
",",
"correction",
"=",
"{",
"'0'",
":",
"4",
",",
"'1'",
":",
"3",
",",
"'2'",
":",
"2",
",",
"'3'",
":",
"2",
",",
"'4'",
":",
"1",
",",
"'5'",
":",
"1",
",",
"'6'",
":",
"1",
",",
"'7'",
":",
"1",
",",
"'8'... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/decimal.py#L5481-L5492 | |
gimli-org/gimli | 17aa2160de9b15ababd9ef99e89b1bc3277bbb23 | doc/examples/5_misc/plot_1_dcem.py | python | DCEM1dModelling.response | (self, model) | return pg.cat(self.fDC_(model), self.fEM_(model)) | Return concatenated response of DC and EM FOPs. | Return concatenated response of DC and EM FOPs. | [
"Return",
"concatenated",
"response",
"of",
"DC",
"and",
"EM",
"FOPs",
"."
] | def response(self, model):
"""Return concatenated response of DC and EM FOPs."""
return pg.cat(self.fDC_(model), self.fEM_(model)) | [
"def",
"response",
"(",
"self",
",",
"model",
")",
":",
"return",
"pg",
".",
"cat",
"(",
"self",
".",
"fDC_",
"(",
"model",
")",
",",
"self",
".",
"fEM_",
"(",
"model",
")",
")"
] | https://github.com/gimli-org/gimli/blob/17aa2160de9b15ababd9ef99e89b1bc3277bbb23/doc/examples/5_misc/plot_1_dcem.py#L38-L40 | |
NERSC/timemory | 431912b360ff50d1a160d7826e2eea04fbd1037f | scripts/gprof2dot.py | python | Function.stripped_name | (self) | return name | Remove extraneous information from C++ demangled function names. | Remove extraneous information from C++ demangled function names. | [
"Remove",
"extraneous",
"information",
"from",
"C",
"++",
"demangled",
"function",
"names",
"."
] | def stripped_name(self):
"""Remove extraneous information from C++ demangled function names."""
name = self.name
# Strip function parameters from name by recursively removing paired parenthesis
while True:
name, n = self._parenthesis_re.subn('', name)
if not n:
... | [
"def",
"stripped_name",
"(",
"self",
")",
":",
"name",
"=",
"self",
".",
"name",
"# Strip function parameters from name by recursively removing paired parenthesis",
"while",
"True",
":",
"name",
",",
"n",
"=",
"self",
".",
"_parenthesis_re",
".",
"subn",
"(",
"''",
... | https://github.com/NERSC/timemory/blob/431912b360ff50d1a160d7826e2eea04fbd1037f/scripts/gprof2dot.py#L244-L264 | |
gromacs/gromacs | 7dec3a3f99993cf5687a122de3e12de31c21c399 | docs/doxygen/doxygenxml.py | python | Compound.get_xml_path | (self) | return os.path.join(self._docset.get_xmlroot(), self.get_id() + '.xml') | Return path to the details XML file for this compound. | Return path to the details XML file for this compound. | [
"Return",
"path",
"to",
"the",
"details",
"XML",
"file",
"for",
"this",
"compound",
"."
] | def get_xml_path(self):
"""Return path to the details XML file for this compound."""
return os.path.join(self._docset.get_xmlroot(), self.get_id() + '.xml') | [
"def",
"get_xml_path",
"(",
"self",
")",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"_docset",
".",
"get_xmlroot",
"(",
")",
",",
"self",
".",
"get_id",
"(",
")",
"+",
"'.xml'",
")"
] | https://github.com/gromacs/gromacs/blob/7dec3a3f99993cf5687a122de3e12de31c21c399/docs/doxygen/doxygenxml.py#L606-L608 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/ndimage/_ni_support.py | python | _extend_mode_to_code | (mode) | Convert an extension mode to the corresponding integer code. | Convert an extension mode to the corresponding integer code. | [
"Convert",
"an",
"extension",
"mode",
"to",
"the",
"corresponding",
"integer",
"code",
"."
] | def _extend_mode_to_code(mode):
"""Convert an extension mode to the corresponding integer code.
"""
if mode == 'nearest':
return 0
elif mode == 'wrap':
return 1
elif mode == 'reflect':
return 2
elif mode == 'mirror':
return 3
elif mode == 'constant':
r... | [
"def",
"_extend_mode_to_code",
"(",
"mode",
")",
":",
"if",
"mode",
"==",
"'nearest'",
":",
"return",
"0",
"elif",
"mode",
"==",
"'wrap'",
":",
"return",
"1",
"elif",
"mode",
"==",
"'reflect'",
":",
"return",
"2",
"elif",
"mode",
"==",
"'mirror'",
":",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/ndimage/_ni_support.py#L38-L52 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/summary/plugin_asset.py | python | PluginAsset.assets | (self) | Provide all of the assets contained by the PluginAsset instance.
The assets method should return a dictionary structured as
{asset_name: asset_contents}. asset_contents is a string.
This method will be called by the tf.summary.FileWriter when it is time to
write the assets out to disk. | Provide all of the assets contained by the PluginAsset instance. | [
"Provide",
"all",
"of",
"the",
"assets",
"contained",
"by",
"the",
"PluginAsset",
"instance",
"."
] | def assets(self):
"""Provide all of the assets contained by the PluginAsset instance.
The assets method should return a dictionary structured as
{asset_name: asset_contents}. asset_contents is a string.
This method will be called by the tf.summary.FileWriter when it is time to
write the assets out... | [
"def",
"assets",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/summary/plugin_asset.py#L132-L141 | ||
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | src/pybind/mgr/volumes/fs/async_cloner.py | python | Cloner.cancel_job | (self, volname, job) | override base class `cancel_job`. interpret @job as (clone, group) tuple. | override base class `cancel_job`. interpret | [
"override",
"base",
"class",
"cancel_job",
".",
"interpret"
] | def cancel_job(self, volname, job):
"""
override base class `cancel_job`. interpret @job as (clone, group) tuple.
"""
clonename = job[0]
groupname = job[1]
track_idx = None
try:
with open_volume(self.fs_client, volname) as fs_handle:
w... | [
"def",
"cancel_job",
"(",
"self",
",",
"volname",
",",
"job",
")",
":",
"clonename",
"=",
"job",
"[",
"0",
"]",
"groupname",
"=",
"job",
"[",
"1",
"]",
"track_idx",
"=",
"None",
"try",
":",
"with",
"open_volume",
"(",
"self",
".",
"fs_client",
",",
... | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/src/pybind/mgr/volumes/fs/async_cloner.py#L337-L377 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap.py | python | _call_with_frames_removed | (f, *args, **kwds) | return f(*args, **kwds) | remove_importlib_frames in import.c will always remove sequences
of importlib frames that end with a call to this function
Use it instead of a normal call in places where including the importlib
frames introduces unwanted noise into the traceback (e.g. when executing
module code) | remove_importlib_frames in import.c will always remove sequences
of importlib frames that end with a call to this function | [
"remove_importlib_frames",
"in",
"import",
".",
"c",
"will",
"always",
"remove",
"sequences",
"of",
"importlib",
"frames",
"that",
"end",
"with",
"a",
"call",
"to",
"this",
"function"
] | def _call_with_frames_removed(f, *args, **kwds):
"""remove_importlib_frames in import.c will always remove sequences
of importlib frames that end with a call to this function
Use it instead of a normal call in places where including the importlib
frames introduces unwanted noise into the traceback (e.g... | [
"def",
"_call_with_frames_removed",
"(",
"f",
",",
"*",
"args",
",",
"*",
"*",
"kwds",
")",
":",
"return",
"f",
"(",
"*",
"args",
",",
"*",
"*",
"kwds",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap.py#L211-L219 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/feature_column/feature_column.py | python | _transform_features | (features, feature_columns) | return outputs | Returns transformed features based on features columns passed in.
Please note that most probably you would not need to use this function. Please
check `input_layer` and `linear_model` to see whether they will
satisfy your use case or not.
Example:
```python
# Define features and transformations
crosses... | Returns transformed features based on features columns passed in. | [
"Returns",
"transformed",
"features",
"based",
"on",
"features",
"columns",
"passed",
"in",
"."
] | def _transform_features(features, feature_columns):
"""Returns transformed features based on features columns passed in.
Please note that most probably you would not need to use this function. Please
check `input_layer` and `linear_model` to see whether they will
satisfy your use case or not.
Example:
``... | [
"def",
"_transform_features",
"(",
"features",
",",
"feature_columns",
")",
":",
"feature_columns",
"=",
"_clean_feature_columns",
"(",
"feature_columns",
")",
"outputs",
"=",
"{",
"}",
"with",
"ops",
".",
"name_scope",
"(",
"None",
",",
"default_name",
"=",
"'t... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/feature_column/feature_column.py#L379-L420 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/SANS/isis_reduction_steps.py | python | ConvertToQISIS._set_up_diameter | (self, h, w) | return 2 * math.sqrt((h * h + w * w) / 6) | Prepare the diameter parameter. If there are corresponding H and W values, then
use them instead. Richard provided the formula: A = 2*sqrt((H^2 + W^2)/6)
@param h: the height
@param w: the width
@returns the new diameter | Prepare the diameter parameter. If there are corresponding H and W values, then
use them instead. Richard provided the formula: A = 2*sqrt((H^2 + W^2)/6) | [
"Prepare",
"the",
"diameter",
"parameter",
".",
"If",
"there",
"are",
"corresponding",
"H",
"and",
"W",
"values",
"then",
"use",
"them",
"instead",
".",
"Richard",
"provided",
"the",
"formula",
":",
"A",
"=",
"2",
"*",
"sqrt",
"((",
"H^2",
"+",
"W^2",
... | def _set_up_diameter(self, h, w):
'''
Prepare the diameter parameter. If there are corresponding H and W values, then
use them instead. Richard provided the formula: A = 2*sqrt((H^2 + W^2)/6)
@param h: the height
@param w: the width
@returns the new diameter
'''
... | [
"def",
"_set_up_diameter",
"(",
"self",
",",
"h",
",",
"w",
")",
":",
"return",
"2",
"*",
"math",
".",
"sqrt",
"(",
"(",
"h",
"*",
"h",
"+",
"w",
"*",
"w",
")",
"/",
"6",
")"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/SANS/isis_reduction_steps.py#L3003-L3011 | |
Slicer/Slicer | ba9fadf332cb0303515b68d8d06a344c82e3e3e5 | Modules/Scripted/VectorToScalarVolume/VectorToScalarVolume.py | python | MyObjectsBlockSignals | (*qobjects) | Context manager to block/reset signals of any number of input qobjects.
Usage:
with MyObjectsBlockSignals(self.aComboBox, self.otherComboBox): | Context manager to block/reset signals of any number of input qobjects.
Usage:
with MyObjectsBlockSignals(self.aComboBox, self.otherComboBox): | [
"Context",
"manager",
"to",
"block",
"/",
"reset",
"signals",
"of",
"any",
"number",
"of",
"input",
"qobjects",
".",
"Usage",
":",
"with",
"MyObjectsBlockSignals",
"(",
"self",
".",
"aComboBox",
"self",
".",
"otherComboBox",
")",
":"
] | def MyObjectsBlockSignals(*qobjects):
"""
Context manager to block/reset signals of any number of input qobjects.
Usage:
with MyObjectsBlockSignals(self.aComboBox, self.otherComboBox):
"""
# TODO: Move it to slicer.utils and delete it here.
previousValues = list()
for qobject in qobjects:
# blockedS... | [
"def",
"MyObjectsBlockSignals",
"(",
"*",
"qobjects",
")",
":",
"# TODO: Move it to slicer.utils and delete it here.",
"previousValues",
"=",
"list",
"(",
")",
"for",
"qobject",
"in",
"qobjects",
":",
"# blockedSignal returns the previous value of signalsBlocked()",
"previousVa... | https://github.com/Slicer/Slicer/blob/ba9fadf332cb0303515b68d8d06a344c82e3e3e5/Modules/Scripted/VectorToScalarVolume/VectorToScalarVolume.py#L22-L35 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/extern/aui/auibar.py | python | AuiToolBar.SetAuiManager | (self, auiManager) | Sets the :class:`~lib.agw.aui.framemanager.AuiManager` which manages the toolbar. | Sets the :class:`~lib.agw.aui.framemanager.AuiManager` which manages the toolbar. | [
"Sets",
"the",
":",
"class",
":",
"~lib",
".",
"agw",
".",
"aui",
".",
"framemanager",
".",
"AuiManager",
"which",
"manages",
"the",
"toolbar",
"."
] | def SetAuiManager(self, auiManager):
""" Sets the :class:`~lib.agw.aui.framemanager.AuiManager` which manages the toolbar. """
self._auiManager = auiManager | [
"def",
"SetAuiManager",
"(",
"self",
",",
"auiManager",
")",
":",
"self",
".",
"_auiManager",
"=",
"auiManager"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/aui/auibar.py#L3233-L3236 | ||
dmlc/xgboost | 2775c2a1abd4b5b759ff517617434c8b9aeb4cc0 | demo/json-model/json_parser.py | python | Tree.parent | (self, node_id: int) | return self.nodes[node_id][self._parent] | Parent ID of a node. | Parent ID of a node. | [
"Parent",
"ID",
"of",
"a",
"node",
"."
] | def parent(self, node_id: int):
'''Parent ID of a node.'''
return self.nodes[node_id][self._parent] | [
"def",
"parent",
"(",
"self",
",",
"node_id",
":",
"int",
")",
":",
"return",
"self",
".",
"nodes",
"[",
"node_id",
"]",
"[",
"self",
".",
"_parent",
"]"
] | https://github.com/dmlc/xgboost/blob/2775c2a1abd4b5b759ff517617434c8b9aeb4cc0/demo/json-model/json_parser.py#L47-L49 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py2/pkg_resources/__init__.py | python | EntryPoint.resolve | (self) | Resolve the entry point from its module and attrs. | Resolve the entry point from its module and attrs. | [
"Resolve",
"the",
"entry",
"point",
"from",
"its",
"module",
"and",
"attrs",
"."
] | def resolve(self):
"""
Resolve the entry point from its module and attrs.
"""
module = __import__(self.module_name, fromlist=['__name__'], level=0)
try:
return functools.reduce(getattr, self.attrs, module)
except AttributeError as exc:
raise Import... | [
"def",
"resolve",
"(",
"self",
")",
":",
"module",
"=",
"__import__",
"(",
"self",
".",
"module_name",
",",
"fromlist",
"=",
"[",
"'__name__'",
"]",
",",
"level",
"=",
"0",
")",
"try",
":",
"return",
"functools",
".",
"reduce",
"(",
"getattr",
",",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py2/pkg_resources/__init__.py#L2445-L2453 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_misc.py | python | Display.GetFromPoint | (*args, **kwargs) | return _misc_.Display_GetFromPoint(*args, **kwargs) | GetFromPoint(Point pt) -> int
Find the display where the given point lies, return wx.NOT_FOUND if it
doesn't belong to any display | GetFromPoint(Point pt) -> int | [
"GetFromPoint",
"(",
"Point",
"pt",
")",
"-",
">",
"int"
] | def GetFromPoint(*args, **kwargs):
"""
GetFromPoint(Point pt) -> int
Find the display where the given point lies, return wx.NOT_FOUND if it
doesn't belong to any display
"""
return _misc_.Display_GetFromPoint(*args, **kwargs) | [
"def",
"GetFromPoint",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"Display_GetFromPoint",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_misc.py#L6093-L6100 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/tensor/creation.py | python | arange | (start=0, end=None, step=1, dtype=None, name=None) | return paddle.fluid.layers.range(start, end, step, dtype, name) | This OP returns a 1-D Tensor with spaced values within a given interval.
Values are generated into the half-open interval [``start``, ``end``) with
the ``step``. (the interval including ``start`` but excluding ``end``).
If ``dtype`` is float32 or float64, we advise adding a small epsilon to
``end`` to... | This OP returns a 1-D Tensor with spaced values within a given interval. | [
"This",
"OP",
"returns",
"a",
"1",
"-",
"D",
"Tensor",
"with",
"spaced",
"values",
"within",
"a",
"given",
"interval",
"."
] | def arange(start=0, end=None, step=1, dtype=None, name=None):
"""
This OP returns a 1-D Tensor with spaced values within a given interval.
Values are generated into the half-open interval [``start``, ``end``) with
the ``step``. (the interval including ``start`` but excluding ``end``).
If ``dtype``... | [
"def",
"arange",
"(",
"start",
"=",
"0",
",",
"end",
"=",
"None",
",",
"step",
"=",
"1",
",",
"dtype",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"if",
"dtype",
"is",
"None",
":",
"dtype",
"=",
"'int64'",
"if",
"end",
"is",
"None",
":",
... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/tensor/creation.py#L488-L552 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/multiprocessing/managers.py | python | Server.debug_info | (self, c) | Return some info --- useful to spot problems with refcounting | Return some info --- useful to spot problems with refcounting | [
"Return",
"some",
"info",
"---",
"useful",
"to",
"spot",
"problems",
"with",
"refcounting"
] | def debug_info(self, c):
'''
Return some info --- useful to spot problems with refcounting
'''
# Perhaps include debug info about 'c'?
with self.mutex:
result = []
keys = list(self.id_to_refcount.keys())
keys.sort()
for ident in key... | [
"def",
"debug_info",
"(",
"self",
",",
"c",
")",
":",
"# Perhaps include debug info about 'c'?",
"with",
"self",
".",
"mutex",
":",
"result",
"=",
"[",
"]",
"keys",
"=",
"list",
"(",
"self",
".",
"id_to_refcount",
".",
"keys",
"(",
")",
")",
"keys",
".",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/multiprocessing/managers.py#L318-L332 | ||
smilehao/xlua-framework | a03801538be2b0e92d39332d445b22caca1ef61f | ConfigData/trunk/tools/protobuf-2.5.0/protobuf-2.5.0/python/build/lib/google/protobuf/message.py | python | Message.__getstate__ | (self) | return dict(serialized=self.SerializePartialToString()) | Support the pickle protocol. | Support the pickle protocol. | [
"Support",
"the",
"pickle",
"protocol",
"."
] | def __getstate__(self):
"""Support the pickle protocol."""
return dict(serialized=self.SerializePartialToString()) | [
"def",
"__getstate__",
"(",
"self",
")",
":",
"return",
"dict",
"(",
"serialized",
"=",
"self",
".",
"SerializePartialToString",
"(",
")",
")"
] | https://github.com/smilehao/xlua-framework/blob/a03801538be2b0e92d39332d445b22caca1ef61f/ConfigData/trunk/tools/protobuf-2.5.0/protobuf-2.5.0/python/build/lib/google/protobuf/message.py#L273-L275 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/WebOb/webob/request.py | python | BaseRequest.path_qs | (self) | return path | The path of the request, without host but with query string | The path of the request, without host but with query string | [
"The",
"path",
"of",
"the",
"request",
"without",
"host",
"but",
"with",
"query",
"string"
] | def path_qs(self):
"""
The path of the request, without host but with query string
"""
path = self.path
qs = self.environ.get('QUERY_STRING')
if qs:
path += '?' + qs
return path | [
"def",
"path_qs",
"(",
"self",
")",
":",
"path",
"=",
"self",
".",
"path",
"qs",
"=",
"self",
".",
"environ",
".",
"get",
"(",
"'QUERY_STRING'",
")",
"if",
"qs",
":",
"path",
"+=",
"'?'",
"+",
"qs",
"return",
"path"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/WebOb/webob/request.py#L490-L498 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/tools/gyp/pylib/gyp/generator/ninja.py | python | NinjaWriter.GetMsvsToolchainEnv | (self, additional_settings=None) | return self.msvs_settings.GetVSMacroEnv(
"$!PRODUCT_DIR", config=self.config_name
) | Returns the variables Visual Studio would set for build steps. | Returns the variables Visual Studio would set for build steps. | [
"Returns",
"the",
"variables",
"Visual",
"Studio",
"would",
"set",
"for",
"build",
"steps",
"."
] | def GetMsvsToolchainEnv(self, additional_settings=None):
"""Returns the variables Visual Studio would set for build steps."""
return self.msvs_settings.GetVSMacroEnv(
"$!PRODUCT_DIR", config=self.config_name
) | [
"def",
"GetMsvsToolchainEnv",
"(",
"self",
",",
"additional_settings",
"=",
"None",
")",
":",
"return",
"self",
".",
"msvs_settings",
".",
"GetVSMacroEnv",
"(",
"\"$!PRODUCT_DIR\"",
",",
"config",
"=",
"self",
".",
"config_name",
")"
] | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/gyp/pylib/gyp/generator/ninja.py#L1686-L1690 | |
aimerykong/Low-Rank-Bilinear-Pooling | 487eb2c857fd9c95357a5166b0c15ad0fe135b28 | caffe-20160312/scripts/cpp_lint.py | python | FindPreviousMatchingAngleBracket | (clean_lines, linenum, init_prefix) | return False | Find the corresponding < that started a template.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: Current line number.
init_prefix: Part of the current line before the initial >.
Returns:
True if a matching bracket exists. | Find the corresponding < that started a template. | [
"Find",
"the",
"corresponding",
"<",
"that",
"started",
"a",
"template",
"."
] | def FindPreviousMatchingAngleBracket(clean_lines, linenum, init_prefix):
"""Find the corresponding < that started a template.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: Current line number.
init_prefix: Part of the current line before the initial >.
Returns:
True i... | [
"def",
"FindPreviousMatchingAngleBracket",
"(",
"clean_lines",
",",
"linenum",
",",
"init_prefix",
")",
":",
"line",
"=",
"init_prefix",
"nesting_stack",
"=",
"[",
"'>'",
"]",
"while",
"True",
":",
"# Find the previous operator",
"match",
"=",
"Search",
"(",
"r'^(... | https://github.com/aimerykong/Low-Rank-Bilinear-Pooling/blob/487eb2c857fd9c95357a5166b0c15ad0fe135b28/caffe-20160312/scripts/cpp_lint.py#L2586-L2640 | |
bulletphysics/bullet3 | f0f2a952e146f016096db6f85cf0c44ed75b0b9a | examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/in_graph_batch_env.py | python | InGraphBatchEnv._parse_dtype | (self, space) | Get a tensor dtype from a OpenAI Gym space.
Args:
space: Gym space.
Returns:
TensorFlow data type. | Get a tensor dtype from a OpenAI Gym space. | [
"Get",
"a",
"tensor",
"dtype",
"from",
"a",
"OpenAI",
"Gym",
"space",
"."
] | def _parse_dtype(self, space):
"""Get a tensor dtype from a OpenAI Gym space.
Args:
space: Gym space.
Returns:
TensorFlow data type.
"""
if isinstance(space, gym.spaces.Discrete):
return tf.int32
if isinstance(space, gym.spaces.Box):
return tf.float32
raise NotImple... | [
"def",
"_parse_dtype",
"(",
"self",
",",
"space",
")",
":",
"if",
"isinstance",
"(",
"space",
",",
"gym",
".",
"spaces",
".",
"Discrete",
")",
":",
"return",
"tf",
".",
"int32",
"if",
"isinstance",
"(",
"space",
",",
"gym",
".",
"spaces",
".",
"Box",... | https://github.com/bulletphysics/bullet3/blob/f0f2a952e146f016096db6f85cf0c44ed75b0b9a/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/in_graph_batch_env.py#L161-L174 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/series.py | python | Series.dot | (self, other) | Compute the dot product between the Series and the columns of other.
This method computes the dot product between the Series and another
one, or the Series and each columns of a DataFrame, or the Series and
each columns of an array.
It can also be called using `self @ other` in Python ... | Compute the dot product between the Series and the columns of other. | [
"Compute",
"the",
"dot",
"product",
"between",
"the",
"Series",
"and",
"the",
"columns",
"of",
"other",
"."
] | def dot(self, other):
"""
Compute the dot product between the Series and the columns of other.
This method computes the dot product between the Series and another
one, or the Series and each columns of a DataFrame, or the Series and
each columns of an array.
It can also... | [
"def",
"dot",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"(",
"Series",
",",
"ABCDataFrame",
")",
")",
":",
"common",
"=",
"self",
".",
"index",
".",
"union",
"(",
"other",
".",
"index",
")",
"if",
"len",
"(",
"co... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/series.py#L2406-L2482 | ||
nasa/fprime | 595cf3682d8365943d86c1a6fe7c78f0a116acf0 | Autocoders/Python/src/fprime_ac/generators/visitors/InstanceTopologyChannelsHTMLVisitor.py | python | InstanceTopologyChannelsHTMLVisitor.initFilesVisit | (self, obj) | Defined to generate files for generated code products.
@param obj: the instance of the model to visit. | Defined to generate files for generated code products. | [
"Defined",
"to",
"generate",
"files",
"for",
"generated",
"code",
"products",
"."
] | def initFilesVisit(self, obj):
"""
Defined to generate files for generated code products.
@param obj: the instance of the model to visit.
"""
# Check for command dir here and if none create it but always switch into it
if not os.path.exists(self.__cmd_dir):
os... | [
"def",
"initFilesVisit",
"(",
"self",
",",
"obj",
")",
":",
"# Check for command dir here and if none create it but always switch into it",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"__cmd_dir",
")",
":",
"os",
".",
"mkdir",
"(",
"self",
"... | https://github.com/nasa/fprime/blob/595cf3682d8365943d86c1a6fe7c78f0a116acf0/Autocoders/Python/src/fprime_ac/generators/visitors/InstanceTopologyChannelsHTMLVisitor.py#L91-L124 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/opt/python/training/shampoo.py | python | ShampooOptimizer._weighted_average | (self, var, weight, weight_t, rest) | return var.assign_add((weight_t - 1) * var + rest) | Computes exponential weighted average: var = weight_t * var + rest.
Important to ensure that var does not occur in rest, otherwise
we can get race conditions in a distributed setting.
Args:
var: variable to be updated
weight: parameter to be checked. If it is a constant, we can optimize.
... | Computes exponential weighted average: var = weight_t * var + rest. | [
"Computes",
"exponential",
"weighted",
"average",
":",
"var",
"=",
"weight_t",
"*",
"var",
"+",
"rest",
"."
] | def _weighted_average(self, var, weight, weight_t, rest):
"""Computes exponential weighted average: var = weight_t * var + rest.
Important to ensure that var does not occur in rest, otherwise
we can get race conditions in a distributed setting.
Args:
var: variable to be updated
weight: par... | [
"def",
"_weighted_average",
"(",
"self",
",",
"var",
",",
"weight",
",",
"weight_t",
",",
"rest",
")",
":",
"if",
"weight",
"==",
"0.0",
":",
"return",
"rest",
"# no need to update var, we will never use it.",
"if",
"weight",
"==",
"1.0",
":",
"# common case",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/opt/python/training/shampoo.py#L178-L201 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/ros_comm/rosgraph/src/rosgraph/masterapi.py | python | Master.getSystemState | (self) | return self._succeed(self.handle.getSystemState(self.caller_id)) | Retrieve list representation of system state (i.e. publishers, subscribers, and services).
@rtype: [[str,[str]], [str,[str]], [str,[str]]]
@return: systemState
System state is in list representation::
[publishers, subscribers, services].
publishers is of the ... | Retrieve list representation of system state (i.e. publishers, subscribers, and services).
@rtype: [[str,[str]], [str,[str]], [str,[str]]]
@return: systemState | [
"Retrieve",
"list",
"representation",
"of",
"system",
"state",
"(",
"i",
".",
"e",
".",
"publishers",
"subscribers",
"and",
"services",
")",
".",
"@rtype",
":",
"[[",
"str",
"[",
"str",
"]]",
"[",
"str",
"[",
"str",
"]]",
"[",
"str",
"[",
"str",
"]]]... | def getSystemState(self):
"""
Retrieve list representation of system state (i.e. publishers, subscribers, and services).
@rtype: [[str,[str]], [str,[str]], [str,[str]]]
@return: systemState
System state is in list representation::
[publishers, subscribers, servi... | [
"def",
"getSystemState",
"(",
"self",
")",
":",
"return",
"self",
".",
"_succeed",
"(",
"self",
".",
"handle",
".",
"getSystemState",
"(",
"self",
".",
"caller_id",
")",
")"
] | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros_comm/rosgraph/src/rosgraph/masterapi.py#L475-L496 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_windows.py | python | PreHScrolledWindow | (*args, **kwargs) | return val | PreHScrolledWindow() -> HScrolledWindow | PreHScrolledWindow() -> HScrolledWindow | [
"PreHScrolledWindow",
"()",
"-",
">",
"HScrolledWindow"
] | def PreHScrolledWindow(*args, **kwargs):
"""PreHScrolledWindow() -> HScrolledWindow"""
val = _windows_.new_PreHScrolledWindow(*args, **kwargs)
return val | [
"def",
"PreHScrolledWindow",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"val",
"=",
"_windows_",
".",
"new_PreHScrolledWindow",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"val"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_windows.py#L2530-L2533 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/nn/cell.py | python | Cell.parameters_broadcast_dict | (self, recurse=True) | return param_dict | Gets the parameters broadcast dictionary of this cell.
Args:
recurse (bool): Whether contains the parameters of subcells. Default: True.
Returns:
OrderedDict, return parameters broadcast dictionary. | Gets the parameters broadcast dictionary of this cell. | [
"Gets",
"the",
"parameters",
"broadcast",
"dictionary",
"of",
"this",
"cell",
"."
] | def parameters_broadcast_dict(self, recurse=True):
"""
Gets the parameters broadcast dictionary of this cell.
Args:
recurse (bool): Whether contains the parameters of subcells. Default: True.
Returns:
OrderedDict, return parameters broadcast dictionary.
... | [
"def",
"parameters_broadcast_dict",
"(",
"self",
",",
"recurse",
"=",
"True",
")",
":",
"param_dict",
"=",
"OrderedDict",
"(",
")",
"for",
"param",
"in",
"self",
".",
"get_parameters",
"(",
"expand",
"=",
"recurse",
")",
":",
"if",
"param",
".",
"layerwise... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/nn/cell.py#L1027-L1043 | |
google/skia | 82d65d0487bd72f5f7332d002429ec2dc61d2463 | infra/bots/utils.py | python | git_clone | (repo_url, dest_dir) | Clone the given repo into the given destination directory. | Clone the given repo into the given destination directory. | [
"Clone",
"the",
"given",
"repo",
"into",
"the",
"given",
"destination",
"directory",
"."
] | def git_clone(repo_url, dest_dir):
"""Clone the given repo into the given destination directory."""
subprocess.check_call([GIT, 'clone', repo_url, dest_dir]) | [
"def",
"git_clone",
"(",
"repo_url",
",",
"dest_dir",
")",
":",
"subprocess",
".",
"check_call",
"(",
"[",
"GIT",
",",
"'clone'",
",",
"repo_url",
",",
"dest_dir",
"]",
")"
] | https://github.com/google/skia/blob/82d65d0487bd72f5f7332d002429ec2dc61d2463/infra/bots/utils.py#L77-L79 | ||
funnyzhou/Adaptive_Feeding | 9c78182331d8c0ea28de47226e805776c638d46f | lib/rpn/anchor_target_layer.py | python | AnchorTargetLayer.backward | (self, top, propagate_down, bottom) | This layer does not propagate gradients. | This layer does not propagate gradients. | [
"This",
"layer",
"does",
"not",
"propagate",
"gradients",
"."
] | def backward(self, top, propagate_down, bottom):
"""This layer does not propagate gradients."""
pass | [
"def",
"backward",
"(",
"self",
",",
"top",
",",
"propagate_down",
",",
"bottom",
")",
":",
"pass"
] | https://github.com/funnyzhou/Adaptive_Feeding/blob/9c78182331d8c0ea28de47226e805776c638d46f/lib/rpn/anchor_target_layer.py#L252-L254 | ||
Tencent/PhoenixGo | fbf67f9aec42531bff9569c44b85eb4c3f37b7be | configure.py | python | set_action_env_var | (environ_cp,
var_name,
query_item,
enabled_by_default,
question=None,
yes_reply=None,
no_reply=None) | Set boolean action_env variable.
Ask user if query_item will be enabled. Default is used if no input is given.
Set environment variable and write to .bazelrc.
Args:
environ_cp: copy of the os.environ.
var_name: string for name of environment variable, e.g. "TF_NEED_HDFS".
query_item: string for feat... | Set boolean action_env variable. | [
"Set",
"boolean",
"action_env",
"variable",
"."
] | def set_action_env_var(environ_cp,
var_name,
query_item,
enabled_by_default,
question=None,
yes_reply=None,
no_reply=None):
"""Set boolean action_env variable.
Ask user if query... | [
"def",
"set_action_env_var",
"(",
"environ_cp",
",",
"var_name",
",",
"query_item",
",",
"enabled_by_default",
",",
"question",
"=",
"None",
",",
"yes_reply",
"=",
"None",
",",
"no_reply",
"=",
"None",
")",
":",
"var",
"=",
"int",
"(",
"get_var",
"(",
"env... | https://github.com/Tencent/PhoenixGo/blob/fbf67f9aec42531bff9569c44b85eb4c3f37b7be/configure.py#L391-L418 | ||
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/ops/math_grad.py | python | _ZetaGrad | (op, grad) | Returns gradient of zeta(x, q) with respect to x and q. | Returns gradient of zeta(x, q) with respect to x and q. | [
"Returns",
"gradient",
"of",
"zeta",
"(",
"x",
"q",
")",
"with",
"respect",
"to",
"x",
"and",
"q",
"."
] | def _ZetaGrad(op, grad):
"""Returns gradient of zeta(x, q) with respect to x and q."""
# TODO(tillahoffmann): Add derivative with respect to x
x = op.inputs[0]
q = op.inputs[1]
# Broadcast gradients
sx = array_ops.shape(x)
sq = array_ops.shape(q)
unused_rx, rq = gen_array_ops._broadcast_gradient_args(sx... | [
"def",
"_ZetaGrad",
"(",
"op",
",",
"grad",
")",
":",
"# TODO(tillahoffmann): Add derivative with respect to x",
"x",
"=",
"op",
".",
"inputs",
"[",
"0",
"]",
"q",
"=",
"op",
".",
"inputs",
"[",
"1",
"]",
"# Broadcast gradients",
"sx",
"=",
"array_ops",
".",... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/ops/math_grad.py#L411-L426 | ||
Tencent/CMONGO | c40380caa14e05509f46993aa8b8da966b09b0b5 | src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Node/__init__.py | python | Node.get_implicit_deps | (self, env, initial_scanner, path_func, kw = {}) | return dependencies | Return a list of implicit dependencies for this node.
This method exists to handle recursive invocation of the scanner
on the implicit dependencies returned by the scanner, if the
scanner's recursive flag says that we should. | Return a list of implicit dependencies for this node. | [
"Return",
"a",
"list",
"of",
"implicit",
"dependencies",
"for",
"this",
"node",
"."
] | def get_implicit_deps(self, env, initial_scanner, path_func, kw = {}):
"""Return a list of implicit dependencies for this node.
This method exists to handle recursive invocation of the scanner
on the implicit dependencies returned by the scanner, if the
scanner's recursive flag says tha... | [
"def",
"get_implicit_deps",
"(",
"self",
",",
"env",
",",
"initial_scanner",
",",
"path_func",
",",
"kw",
"=",
"{",
"}",
")",
":",
"nodes",
"=",
"[",
"self",
"]",
"seen",
"=",
"{",
"}",
"seen",
"[",
"self",
"]",
"=",
"1",
"dependencies",
"=",
"[",
... | https://github.com/Tencent/CMONGO/blob/c40380caa14e05509f46993aa8b8da966b09b0b5/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Node/__init__.py#L919-L950 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/train/train_thor/model_thor.py | python | _exec_datagraph | (exec_dataset, dataset_size, phase='dataset') | Initialize and execute the dataset graph. | Initialize and execute the dataset graph. | [
"Initialize",
"and",
"execute",
"the",
"dataset",
"graph",
"."
] | def _exec_datagraph(exec_dataset, dataset_size, phase='dataset'):
"""Initialize and execute the dataset graph."""
batch_size = exec_dataset.get_batch_size()
input_indexs = exec_dataset.input_indexs
# transform data format
dataset_types, dataset_shapes = _get_types_and_shapes(exec_dataset)
init_... | [
"def",
"_exec_datagraph",
"(",
"exec_dataset",
",",
"dataset_size",
",",
"phase",
"=",
"'dataset'",
")",
":",
"batch_size",
"=",
"exec_dataset",
".",
"get_batch_size",
"(",
")",
"input_indexs",
"=",
"exec_dataset",
".",
"input_indexs",
"# transform data format",
"da... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/train/train_thor/model_thor.py#L57-L71 | ||
sebastianstarke/AI4Animation | e2cd539816b1cb1fa0a57e9d21df21d48467b313 | AI4Animation/SIGGRAPH_Asia_2019/TensorFlow/NSM/Lib_Expert/ComponentNN.py | python | ComponentNN.saveNN | (self, sess, savepath, index_component) | :param index_component: index of current component | :param index_component: index of current component | [
":",
"param",
"index_component",
":",
"index",
"of",
"current",
"component"
] | def saveNN(self, sess, savepath, index_component):
"""
:param index_component: index of current component
"""
for i in range(self.num_layers):
for j in range(self.num_experts):
sess.run(self.experts[i].alpha[j]).tofile(savepath + '/wc%0i%0i%0i_w.bin' % (index_... | [
"def",
"saveNN",
"(",
"self",
",",
"sess",
",",
"savepath",
",",
"index_component",
")",
":",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"num_layers",
")",
":",
"for",
"j",
"in",
"range",
"(",
"self",
".",
"num_experts",
")",
":",
"sess",
".",
"r... | https://github.com/sebastianstarke/AI4Animation/blob/e2cd539816b1cb1fa0a57e9d21df21d48467b313/AI4Animation/SIGGRAPH_Asia_2019/TensorFlow/NSM/Lib_Expert/ComponentNN.py#L90-L97 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/graph_editor/transform.py | python | Transformer._copy_ops | (self, info) | Copy ops without connecting them. | Copy ops without connecting them. | [
"Copy",
"ops",
"without",
"connecting",
"them",
"."
] | def _copy_ops(self, info):
"""Copy ops without connecting them."""
for op in info.sgv.ops:
logging.debug("Copying op: %s", op.name)
# TODO(fkp): return a subgraph?
op_, op_outputs_ = self.transform_op_handler(info, op)
if op is op_:
raise ValueError("In-place transformation not a... | [
"def",
"_copy_ops",
"(",
"self",
",",
"info",
")",
":",
"for",
"op",
"in",
"info",
".",
"sgv",
".",
"ops",
":",
"logging",
".",
"debug",
"(",
"\"Copying op: %s\"",
",",
"op",
".",
"name",
")",
"# TODO(fkp): return a subgraph?",
"op_",
",",
"op_outputs_",
... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/graph_editor/transform.py#L441-L457 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/stc.py | python | StyledTextCtrl.GetMultiPaste | (*args, **kwargs) | return _stc.StyledTextCtrl_GetMultiPaste(*args, **kwargs) | GetMultiPaste(self) -> int | GetMultiPaste(self) -> int | [
"GetMultiPaste",
"(",
"self",
")",
"-",
">",
"int"
] | def GetMultiPaste(*args, **kwargs):
"""GetMultiPaste(self) -> int"""
return _stc.StyledTextCtrl_GetMultiPaste(*args, **kwargs) | [
"def",
"GetMultiPaste",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_GetMultiPaste",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/stc.py#L4281-L4283 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/client/session.py | python | register_session_run_conversion_functions | (tensor_type, fetch_function,
feed_function=None, feed_function_for_partial_run=None) | Register fetch and feed conversion functions for `tf.Session.run()`.
This function registers a triple of conversion functions for fetching and/or
feeding values of user-defined types in a call to tf.Session.run().
An example
```python
class SquaredTensor(object):
def __init__(self, tensor):
... | Register fetch and feed conversion functions for `tf.Session.run()`. | [
"Register",
"fetch",
"and",
"feed",
"conversion",
"functions",
"for",
"tf",
".",
"Session",
".",
"run",
"()",
"."
] | def register_session_run_conversion_functions(tensor_type, fetch_function,
feed_function=None, feed_function_for_partial_run=None):
"""Register fetch and feed conversion functions for `tf.Session.run()`.
This function registers a triple of conversion functions for fetching and/or
feeding values of user-defin... | [
"def",
"register_session_run_conversion_functions",
"(",
"tensor_type",
",",
"fetch_function",
",",
"feed_function",
"=",
"None",
",",
"feed_function_for_partial_run",
"=",
"None",
")",
":",
"for",
"conversion_function",
"in",
"_REGISTERED_EXPANSIONS",
":",
"if",
"issubcl... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/client/session.py#L128-L174 | ||
eclipse/sumo | 7132a9b8b6eea734bdec38479026b4d8c4336d03 | tools/contributed/sumopy/coremodules/network/network.py | python | Network.set_boundaries | (self, convBoundary, origBoundary=None) | Format of Boundary box
[MinX, MinY ,MaxX, MaxY ] | Format of Boundary box
[MinX, MinY ,MaxX, MaxY ] | [
"Format",
"of",
"Boundary",
"box",
"[",
"MinX",
"MinY",
"MaxX",
"MaxY",
"]"
] | def set_boundaries(self, convBoundary, origBoundary=None):
"""
Format of Boundary box
[MinX, MinY ,MaxX, MaxY ]
"""
self._boundaries = convBoundary
if origBoundary is None:
self._boundaries_orig = self._boundaries
else:
self._boundaries_o... | [
"def",
"set_boundaries",
"(",
"self",
",",
"convBoundary",
",",
"origBoundary",
"=",
"None",
")",
":",
"self",
".",
"_boundaries",
"=",
"convBoundary",
"if",
"origBoundary",
"is",
"None",
":",
"self",
".",
"_boundaries_orig",
"=",
"self",
".",
"_boundaries",
... | https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/contributed/sumopy/coremodules/network/network.py#L3369-L3379 | ||
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | example/bayesian-methods/data_loader.py | python | load_mnist | (training_num=50000) | return X, Y, X_test, Y_test | Load mnist dataset | Load mnist dataset | [
"Load",
"mnist",
"dataset"
] | def load_mnist(training_num=50000):
"""Load mnist dataset"""
data_path = os.path.join(os.path.dirname(os.path.realpath('__file__')), 'mnist.npz')
if not os.path.isfile(data_path):
from six.moves import urllib
origin = (
'https://github.com/sxjscience/mxnet/raw/master/example/baye... | [
"def",
"load_mnist",
"(",
"training_num",
"=",
"50000",
")",
":",
"data_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"realpath",
"(",
"'__file__'",
")",
")",
",",
"'mnist.npz'",
")",... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/example/bayesian-methods/data_loader.py#L24-L44 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Tools/webchecker/tktools.py | python | test | () | Test make_text_box(), make_form_entry(), flatten(), boolean(). | Test make_text_box(), make_form_entry(), flatten(), boolean(). | [
"Test",
"make_text_box",
"()",
"make_form_entry",
"()",
"flatten",
"()",
"boolean",
"()",
"."
] | def test():
"""Test make_text_box(), make_form_entry(), flatten(), boolean()."""
import sys
root = Tk()
entry, eframe = make_form_entry(root, 'Boolean:')
text, tframe = make_text_box(root)
def enter(event, entry=entry, text=text):
s = boolean(entry.get()) and '\nyes' or '\nno'
te... | [
"def",
"test",
"(",
")",
":",
"import",
"sys",
"root",
"=",
"Tk",
"(",
")",
"entry",
",",
"eframe",
"=",
"make_form_entry",
"(",
"root",
",",
"'Boolean:'",
")",
"text",
",",
"tframe",
"=",
"make_text_box",
"(",
"root",
")",
"def",
"enter",
"(",
"even... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Tools/webchecker/tktools.py#L351-L362 | ||
rbgirshick/caffe-fast-rcnn | 28a579eaf0668850705598b3075b8969f22226d9 | scripts/cpp_lint.py | python | CheckSpacingForFunctionCall | (filename, line, linenum, error) | Checks for the correctness of various spacing around function calls.
Args:
filename: The name of the current file.
line: The text of the line to check.
linenum: The number of the line to check.
error: The function to call with any errors found. | Checks for the correctness of various spacing around function calls. | [
"Checks",
"for",
"the",
"correctness",
"of",
"various",
"spacing",
"around",
"function",
"calls",
"."
] | def CheckSpacingForFunctionCall(filename, line, linenum, error):
"""Checks for the correctness of various spacing around function calls.
Args:
filename: The name of the current file.
line: The text of the line to check.
linenum: The number of the line to check.
error: The function to call with any ... | [
"def",
"CheckSpacingForFunctionCall",
"(",
"filename",
",",
"line",
",",
"linenum",
",",
"error",
")",
":",
"# Since function calls often occur inside if/for/while/switch",
"# expressions - which have their own, more liberal conventions - we",
"# first see if we should be looking inside ... | https://github.com/rbgirshick/caffe-fast-rcnn/blob/28a579eaf0668850705598b3075b8969f22226d9/scripts/cpp_lint.py#L2301-L2366 | ||
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | utils/vim-lldb/python-vim-lldb/vim_panes.py | python | goto_window | (nr) | go to window number nr | go to window number nr | [
"go",
"to",
"window",
"number",
"nr"
] | def goto_window(nr):
""" go to window number nr"""
if nr != winnr():
vim.command(str(nr) + ' wincmd w') | [
"def",
"goto_window",
"(",
"nr",
")",
":",
"if",
"nr",
"!=",
"winnr",
"(",
")",
":",
"vim",
".",
"command",
"(",
"str",
"(",
"nr",
")",
"+",
"' wincmd w'",
")"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/utils/vim-lldb/python-vim-lldb/vim_panes.py#L123-L126 | ||
apiaryio/drafter | 4634ebd07f6c6f257cc656598ccd535492fdfb55 | tools/gyp/pylib/gyp/generator/make.py | python | QuoteIfNecessary | (string) | return string | TODO: Should this ideally be replaced with one or more of the above
functions? | TODO: Should this ideally be replaced with one or more of the above
functions? | [
"TODO",
":",
"Should",
"this",
"ideally",
"be",
"replaced",
"with",
"one",
"or",
"more",
"of",
"the",
"above",
"functions?"
] | def QuoteIfNecessary(string):
"""TODO: Should this ideally be replaced with one or more of the above
functions?"""
if '"' in string:
string = '"' + string.replace('"', '\\"') + '"'
return string | [
"def",
"QuoteIfNecessary",
"(",
"string",
")",
":",
"if",
"'\"'",
"in",
"string",
":",
"string",
"=",
"'\"'",
"+",
"string",
".",
"replace",
"(",
"'\"'",
",",
"'\\\\\"'",
")",
"+",
"'\"'",
"return",
"string"
] | https://github.com/apiaryio/drafter/blob/4634ebd07f6c6f257cc656598ccd535492fdfb55/tools/gyp/pylib/gyp/generator/make.py#L600-L605 | |
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/buildscripts/idl/idl/generator.py | python | _CppSourceFileWriter.gen_op_msg_request_serializer_method | (self, struct) | Generate the serialzer method definition for OpMsgRequest. | Generate the serialzer method definition for OpMsgRequest. | [
"Generate",
"the",
"serialzer",
"method",
"definition",
"for",
"OpMsgRequest",
"."
] | def gen_op_msg_request_serializer_method(self, struct):
# type: (ast.Struct) -> None
"""Generate the serialzer method definition for OpMsgRequest."""
# pylint: disable=invalid-name
if not isinstance(struct, ast.Command):
return
struct_type_info = struct_types.get_str... | [
"def",
"gen_op_msg_request_serializer_method",
"(",
"self",
",",
"struct",
")",
":",
"# type: (ast.Struct) -> None",
"# pylint: disable=invalid-name",
"if",
"not",
"isinstance",
"(",
"struct",
",",
"ast",
".",
"Command",
")",
":",
"return",
"struct_type_info",
"=",
"s... | https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/buildscripts/idl/idl/generator.py#L1308-L1332 | ||
TheLegendAli/DeepLab-Context | fb04e9e2fc2682490ad9f60533b9d6c4c0e0479c | scripts/cpp_lint.py | python | CheckCheck | (filename, clean_lines, linenum, error) | Checks the use of CHECK and EXPECT macros.
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. | Checks the use of CHECK and EXPECT macros. | [
"Checks",
"the",
"use",
"of",
"CHECK",
"and",
"EXPECT",
"macros",
"."
] | def CheckCheck(filename, clean_lines, linenum, error):
"""Checks the use of CHECK and EXPECT macros.
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.
... | [
"def",
"CheckCheck",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"# Decide the set of replacement macros that should be suggested",
"lines",
"=",
"clean_lines",
".",
"elided",
"check_macro",
"=",
"None",
"start_pos",
"=",
"-",
"1",
"... | https://github.com/TheLegendAli/DeepLab-Context/blob/fb04e9e2fc2682490ad9f60533b9d6c4c0e0479c/scripts/cpp_lint.py#L3278-L3402 | ||
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/predict-the-winner.py | python | Solution.PredictTheWinner | (self, nums) | return dp[-1] >= 0 | :type nums: List[int]
:rtype: bool | :type nums: List[int]
:rtype: bool | [
":",
"type",
"nums",
":",
"List",
"[",
"int",
"]",
":",
"rtype",
":",
"bool"
] | def PredictTheWinner(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""
if len(nums) % 2 == 0 or len(nums) == 1:
return True
dp = [0] * len(nums)
for i in reversed(xrange(len(nums))):
dp[i] = nums[i]
for j in xrange(i+1, l... | [
"def",
"PredictTheWinner",
"(",
"self",
",",
"nums",
")",
":",
"if",
"len",
"(",
"nums",
")",
"%",
"2",
"==",
"0",
"or",
"len",
"(",
"nums",
")",
"==",
"1",
":",
"return",
"True",
"dp",
"=",
"[",
"0",
"]",
"*",
"len",
"(",
"nums",
")",
"for",... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/predict-the-winner.py#L5-L19 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/keras/utils/tf_inspect.py | python | getargspec | (obj) | return _getargspec(type(target).__call__) | TFDecorator-aware replacement for `inspect.getargspec`.
Note: `getfullargspec` is recommended as the python 2/3 compatible
replacement for this function.
Args:
obj: A function, partial function, or callable object, possibly decorated.
Returns:
The `ArgSpec` that describes the signature of the outermo... | TFDecorator-aware replacement for `inspect.getargspec`. | [
"TFDecorator",
"-",
"aware",
"replacement",
"for",
"inspect",
".",
"getargspec",
"."
] | def getargspec(obj):
"""TFDecorator-aware replacement for `inspect.getargspec`.
Note: `getfullargspec` is recommended as the python 2/3 compatible
replacement for this function.
Args:
obj: A function, partial function, or callable object, possibly decorated.
Returns:
The `ArgSpec` that describes th... | [
"def",
"getargspec",
"(",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"functools",
".",
"partial",
")",
":",
"return",
"_get_argspec_for_partial",
"(",
"obj",
")",
"decorators",
",",
"target",
"=",
"tf_decorator",
".",
"unwrap",
"(",
"obj",
")",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/keras/utils/tf_inspect.py#L93-L142 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/reshape/reshape.py | python | stack | (frame, level=-1, dropna=True) | return frame._constructor_sliced(new_values, index=new_index) | Convert DataFrame to Series with multi-level Index. Columns become the
second level of the resulting hierarchical index
Returns
-------
stacked : Series | Convert DataFrame to Series with multi-level Index. Columns become the
second level of the resulting hierarchical index | [
"Convert",
"DataFrame",
"to",
"Series",
"with",
"multi",
"-",
"level",
"Index",
".",
"Columns",
"become",
"the",
"second",
"level",
"of",
"the",
"resulting",
"hierarchical",
"index"
] | def stack(frame, level=-1, dropna=True):
"""
Convert DataFrame to Series with multi-level Index. Columns become the
second level of the resulting hierarchical index
Returns
-------
stacked : Series
"""
def factorize(index):
if index.is_unique:
return index, np.arang... | [
"def",
"stack",
"(",
"frame",
",",
"level",
"=",
"-",
"1",
",",
"dropna",
"=",
"True",
")",
":",
"def",
"factorize",
"(",
"index",
")",
":",
"if",
"index",
".",
"is_unique",
":",
"return",
"index",
",",
"np",
".",
"arange",
"(",
"len",
"(",
"inde... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/reshape/reshape.py#L493-L564 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/html.py | python | HtmlColourCell.__init__ | (self, *args, **kwargs) | __init__(self, Colour clr, int flags=HTML_CLR_FOREGROUND) -> HtmlColourCell | __init__(self, Colour clr, int flags=HTML_CLR_FOREGROUND) -> HtmlColourCell | [
"__init__",
"(",
"self",
"Colour",
"clr",
"int",
"flags",
"=",
"HTML_CLR_FOREGROUND",
")",
"-",
">",
"HtmlColourCell"
] | def __init__(self, *args, **kwargs):
"""__init__(self, Colour clr, int flags=HTML_CLR_FOREGROUND) -> HtmlColourCell"""
_html.HtmlColourCell_swiginit(self,_html.new_HtmlColourCell(*args, **kwargs)) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_html",
".",
"HtmlColourCell_swiginit",
"(",
"self",
",",
"_html",
".",
"new_HtmlColourCell",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/html.py#L877-L879 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/PolDiffILLReduction.py | python | PolDiffILLReduction._read_experiment_properties | (self, ws) | Reads the user-provided dictionary that contains sample geometry (type, dimensions) and experimental conditions,
such as the beam size and calculates derived parameters. | Reads the user-provided dictionary that contains sample geometry (type, dimensions) and experimental conditions,
such as the beam size and calculates derived parameters. | [
"Reads",
"the",
"user",
"-",
"provided",
"dictionary",
"that",
"contains",
"sample",
"geometry",
"(",
"type",
"dimensions",
")",
"and",
"experimental",
"conditions",
"such",
"as",
"the",
"beam",
"size",
"and",
"calculates",
"derived",
"parameters",
"."
] | def _read_experiment_properties(self, ws):
"""Reads the user-provided dictionary that contains sample geometry (type, dimensions) and experimental conditions,
such as the beam size and calculates derived parameters."""
self._sampleAndEnvironmentProperties = self.getProperty('SampleAndEnvironmen... | [
"def",
"_read_experiment_properties",
"(",
"self",
",",
"ws",
")",
":",
"self",
".",
"_sampleAndEnvironmentProperties",
"=",
"self",
".",
"getProperty",
"(",
"'SampleAndEnvironmentProperties'",
")",
".",
"value",
"if",
"'InitialEnergy'",
"not",
"in",
"self",
".",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/PolDiffILLReduction.py#L1080-L1095 | ||
apple/swift-clang | d7403439fc6641751840b723e7165fb02f52db95 | bindings/python/clang/cindex.py | python | Cursor.exception_specification_kind | (self) | return self._exception_specification_kind | Retrieve the exception specification kind, which is one of the values
from the ExceptionSpecificationKind enumeration. | Retrieve the exception specification kind, which is one of the values
from the ExceptionSpecificationKind enumeration. | [
"Retrieve",
"the",
"exception",
"specification",
"kind",
"which",
"is",
"one",
"of",
"the",
"values",
"from",
"the",
"ExceptionSpecificationKind",
"enumeration",
"."
] | def exception_specification_kind(self):
'''
Retrieve the exception specification kind, which is one of the values
from the ExceptionSpecificationKind enumeration.
'''
if not hasattr(self, '_exception_specification_kind'):
exc_kind = conf.lib.clang_getCursorExceptionSp... | [
"def",
"exception_specification_kind",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_exception_specification_kind'",
")",
":",
"exc_kind",
"=",
"conf",
".",
"lib",
".",
"clang_getCursorExceptionSpecificationType",
"(",
"self",
")",
"self",
".... | https://github.com/apple/swift-clang/blob/d7403439fc6641751840b723e7165fb02f52db95/bindings/python/clang/cindex.py#L1676-L1685 | |
nest/nest-simulator | f2623eb78518cdbd55e77e0ed486bf1111bcb62f | pynest/nest/server/hl_api_server.py | python | do_call | (call_name, args=[], kwargs={}) | return combine(call_name, response) | Call a PYNEST function or execute a script within the server.
If the server is run serially (i.e., without MPI), this function
will do one of two things: If call_name is "exec", it will execute
the script given in args via do_exec(). If call_name is the name
of a PyNEST API function, it will call that ... | Call a PYNEST function or execute a script within the server. | [
"Call",
"a",
"PYNEST",
"function",
"or",
"execute",
"a",
"script",
"within",
"the",
"server",
"."
] | def do_call(call_name, args=[], kwargs={}):
"""Call a PYNEST function or execute a script within the server.
If the server is run serially (i.e., without MPI), this function
will do one of two things: If call_name is "exec", it will execute
the script given in args via do_exec(). If call_name is the na... | [
"def",
"do_call",
"(",
"call_name",
",",
"args",
"=",
"[",
"]",
",",
"kwargs",
"=",
"{",
"}",
")",
":",
"if",
"mpi_comm",
"is",
"not",
"None",
":",
"assert",
"mpi_comm",
".",
"Get_rank",
"(",
")",
"==",
"0",
"if",
"mpi_comm",
"is",
"not",
"None",
... | https://github.com/nest/nest-simulator/blob/f2623eb78518cdbd55e77e0ed486bf1111bcb62f/pynest/nest/server/hl_api_server.py#L115-L158 | |
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/swift/utils/swift_build_support/swift_build_support/which.py | python | which | (cmd) | return out.rstrip() | Return the path to an executable which would be run if
the given cmd was called. If no cmd would be called, return None.
Python 3.3+ provides this behavior via the shutil.which() function;
see: https://docs.python.org/3.3/library/shutil.html#shutil.which
We provide our own implementation because shuti... | Return the path to an executable which would be run if
the given cmd was called. If no cmd would be called, return None. | [
"Return",
"the",
"path",
"to",
"an",
"executable",
"which",
"would",
"be",
"run",
"if",
"the",
"given",
"cmd",
"was",
"called",
".",
"If",
"no",
"cmd",
"would",
"be",
"called",
"return",
"None",
"."
] | def which(cmd):
"""
Return the path to an executable which would be run if
the given cmd was called. If no cmd would be called, return None.
Python 3.3+ provides this behavior via the shutil.which() function;
see: https://docs.python.org/3.3/library/shutil.html#shutil.which
We provide our own ... | [
"def",
"which",
"(",
"cmd",
")",
":",
"out",
"=",
"shell",
".",
"capture",
"(",
"[",
"'which'",
",",
"cmd",
"]",
",",
"dry_run",
"=",
"False",
",",
"echo",
"=",
"False",
",",
"optional",
"=",
"True",
")",
"if",
"out",
"is",
"None",
":",
"return",... | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/swift/utils/swift_build_support/swift_build_support/which.py#L26-L41 | |
InsightSoftwareConsortium/ITK | 87acfce9a93d928311c38bc371b666b515b9f19d | Modules/ThirdParty/pygccxml/src/pygccxml/declarations/declaration.py | python | declaration_t.attributes | (self) | return self._attributes | GCCXML attributes, set using __attribute__((gccxml("...")))
@type: str | GCCXML attributes, set using __attribute__((gccxml("..."))) | [
"GCCXML",
"attributes",
"set",
"using",
"__attribute__",
"((",
"gccxml",
"(",
"...",
")))"
] | def attributes(self):
"""
GCCXML attributes, set using __attribute__((gccxml("...")))
@type: str
"""
return self._attributes | [
"def",
"attributes",
"(",
"self",
")",
":",
"return",
"self",
".",
"_attributes"
] | https://github.com/InsightSoftwareConsortium/ITK/blob/87acfce9a93d928311c38bc371b666b515b9f19d/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/declaration.py#L277-L285 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/core/window/rolling.py | python | BaseWindow._apply | (
self,
func: Callable[..., Any],
name: str | None = None,
numba_cache_key: tuple[Callable, str] | None = None,
**kwargs,
) | Rolling statistical measure using supplied function.
Designed to be used with passed-in Cython array-based functions.
Parameters
----------
func : callable function to apply
name : str,
numba_cache_key : tuple
caching key to be used to store a compiled numba... | Rolling statistical measure using supplied function. | [
"Rolling",
"statistical",
"measure",
"using",
"supplied",
"function",
"."
] | def _apply(
self,
func: Callable[..., Any],
name: str | None = None,
numba_cache_key: tuple[Callable, str] | None = None,
**kwargs,
):
"""
Rolling statistical measure using supplied function.
Designed to be used with passed-in Cython array-based funct... | [
"def",
"_apply",
"(",
"self",
",",
"func",
":",
"Callable",
"[",
"...",
",",
"Any",
"]",
",",
"name",
":",
"str",
"|",
"None",
"=",
"None",
",",
"numba_cache_key",
":",
"tuple",
"[",
"Callable",
",",
"str",
"]",
"|",
"None",
"=",
"None",
",",
"*"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/window/rolling.py#L482-L547 | ||
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | python/peacock/Input/InputTree.py | python | InputTree.moveBlock | (self, path, new_index) | Moves the block to another position | Moves the block to another position | [
"Moves",
"the",
"block",
"to",
"another",
"position"
] | def moveBlock(self, path, new_index):
"""
Moves the block to another position
"""
pinfo = self.path_map.get(path)
if pinfo:
pinfo.parent.moveChildBlock(pinfo.name, new_index) | [
"def",
"moveBlock",
"(",
"self",
",",
"path",
",",
"new_index",
")",
":",
"pinfo",
"=",
"self",
".",
"path_map",
".",
"get",
"(",
"path",
")",
"if",
"pinfo",
":",
"pinfo",
".",
"parent",
".",
"moveChildBlock",
"(",
"pinfo",
".",
"name",
",",
"new_ind... | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/peacock/Input/InputTree.py#L298-L304 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pkg_resources/extern/__init__.py | python | VendorImporter.load_module | (self, fullname) | Iterate over the search path to locate and load fullname. | Iterate over the search path to locate and load fullname. | [
"Iterate",
"over",
"the",
"search",
"path",
"to",
"locate",
"and",
"load",
"fullname",
"."
] | def load_module(self, fullname):
"""
Iterate over the search path to locate and load fullname.
"""
root, base, target = fullname.partition(self.root_name + '.')
for prefix in self.search_path:
try:
extant = prefix + target
__import__(ex... | [
"def",
"load_module",
"(",
"self",
",",
"fullname",
")",
":",
"root",
",",
"base",
",",
"target",
"=",
"fullname",
".",
"partition",
"(",
"self",
".",
"root_name",
"+",
"'.'",
")",
"for",
"prefix",
"in",
"self",
".",
"search_path",
":",
"try",
":",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pkg_resources/extern/__init__.py#L35-L55 | ||
PixarAnimationStudios/USD | faed18ce62c8736b02413635b584a2f637156bad | pxr/usdImaging/usdviewq/selectionDataModel.py | python | Blocker.__enter__ | (self) | Enter the 'blocked' state until the context is exited. | Enter the 'blocked' state until the context is exited. | [
"Enter",
"the",
"blocked",
"state",
"until",
"the",
"context",
"is",
"exited",
"."
] | def __enter__(self):
"""Enter the 'blocked' state until the context is exited."""
self._count += 1 | [
"def",
"__enter__",
"(",
"self",
")",
":",
"self",
".",
"_count",
"+=",
"1"
] | https://github.com/PixarAnimationStudios/USD/blob/faed18ce62c8736b02413635b584a2f637156bad/pxr/usdImaging/usdviewq/selectionDataModel.py#L54-L57 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/ed_vim.py | python | EditraCommander.DeleteSelection | (self) | Yank selection and delete it | Yank selection and delete it | [
"Yank",
"selection",
"and",
"delete",
"it"
] | def DeleteSelection(self):
"""Yank selection and delete it"""
start, end = self._GetSelectionRange()
self.stc.BeginUndoAction()
self.YankSelection()
self.stc.Clear()
self._SetPos(start)
self.stc.EndUndoAction() | [
"def",
"DeleteSelection",
"(",
"self",
")",
":",
"start",
",",
"end",
"=",
"self",
".",
"_GetSelectionRange",
"(",
")",
"self",
".",
"stc",
".",
"BeginUndoAction",
"(",
")",
"self",
".",
"YankSelection",
"(",
")",
"self",
".",
"stc",
".",
"Clear",
"(",... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/ed_vim.py#L621-L628 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.