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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/ao/quantization/fx/qconfig_utils.py | python | check_is_valid_convert_custom_config_dict | (convert_custom_config_dict: Optional[Dict[str, Any]] = None) | r""" Checks if the given convert_custom_config_dict has the correct keys
Args:
`convert_custom_config_dict`: dictionary for custom configurations for
convert function | r""" Checks if the given convert_custom_config_dict has the correct keys | [
"r",
"Checks",
"if",
"the",
"given",
"convert_custom_config_dict",
"has",
"the",
"correct",
"keys"
] | def check_is_valid_convert_custom_config_dict(convert_custom_config_dict: Optional[Dict[str, Any]] = None) -> None:
r""" Checks if the given convert_custom_config_dict has the correct keys
Args:
`convert_custom_config_dict`: dictionary for custom configurations for
convert function
"""
if n... | [
"def",
"check_is_valid_convert_custom_config_dict",
"(",
"convert_custom_config_dict",
":",
"Optional",
"[",
"Dict",
"[",
"str",
",",
"Any",
"]",
"]",
"=",
"None",
")",
"->",
"None",
":",
"if",
"not",
"convert_custom_config_dict",
":",
"return",
"convert_custom_conf... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/ao/quantization/fx/qconfig_utils.py#L227-L241 | ||
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/external/bazel_tools/tools/android/incremental_install.py | python | ConvertNativeLibs | (args) | return native_libs | Converts the --native_libs command line argument to an arch -> libs map. | Converts the --native_libs command line argument to an arch -> libs map. | [
"Converts",
"the",
"--",
"native_libs",
"command",
"line",
"argument",
"to",
"an",
"arch",
"-",
">",
"libs",
"map",
"."
] | def ConvertNativeLibs(args):
"""Converts the --native_libs command line argument to an arch -> libs map."""
native_libs = {}
if args is not None:
for native_lib in args:
abi, path = native_lib.split(":")
if abi not in native_libs:
native_libs[abi] = set()
native_libs[abi].add(path)
... | [
"def",
"ConvertNativeLibs",
"(",
"args",
")",
":",
"native_libs",
"=",
"{",
"}",
"if",
"args",
"is",
"not",
"None",
":",
"for",
"native_lib",
"in",
"args",
":",
"abi",
",",
"path",
"=",
"native_lib",
".",
"split",
"(",
"\":\"",
")",
"if",
"abi",
"not... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/external/bazel_tools/tools/android/incremental_install.py#L473-L484 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/oauthlib/oauth1/rfc5849/endpoints/request_token.py | python | RequestTokenEndpoint.validate_request_token_request | (self, request) | return v, request | Validate a request token request.
:param request: An oauthlib.common.Request object.
:raises: OAuth1Error if the request is invalid.
:returns: A tuple of 2 elements.
1. The validation result (True or False).
2. The request object. | Validate a request token request. | [
"Validate",
"a",
"request",
"token",
"request",
"."
] | def validate_request_token_request(self, request):
"""Validate a request token request.
:param request: An oauthlib.common.Request object.
:raises: OAuth1Error if the request is invalid.
:returns: A tuple of 2 elements.
1. The validation result (True or False).
... | [
"def",
"validate_request_token_request",
"(",
"self",
",",
"request",
")",
":",
"self",
".",
"_check_transport_security",
"(",
"request",
")",
"self",
".",
"_check_mandatory_parameters",
"(",
"request",
")",
"if",
"request",
".",
"realm",
":",
"request",
".",
"r... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/oauthlib/oauth1/rfc5849/endpoints/request_token.py#L111-L209 | |
GJDuck/LowFat | ecf6a0f0fa1b73a27a626cf493cc39e477b6faea | llvm-4.0.0.src/projects/compiler-rt/lib/sanitizer_common/scripts/cpplint.py | python | ProcessFileData | (filename, file_extension, lines, error,
extra_check_functions=[]) | Performs lint checks and reports any errors to the given error function.
Args:
filename: Filename of the file that is being processed.
file_extension: The extension (dot not included) of the file.
lines: An array of strings, each representing a line of the file, with the
last element being emp... | Performs lint checks and reports any errors to the given error function. | [
"Performs",
"lint",
"checks",
"and",
"reports",
"any",
"errors",
"to",
"the",
"given",
"error",
"function",
"."
] | def ProcessFileData(filename, file_extension, lines, error,
extra_check_functions=[]):
"""Performs lint checks and reports any errors to the given error function.
Args:
filename: Filename of the file that is being processed.
file_extension: The extension (dot not included) of the file.
... | [
"def",
"ProcessFileData",
"(",
"filename",
",",
"file_extension",
",",
"lines",
",",
"error",
",",
"extra_check_functions",
"=",
"[",
"]",
")",
":",
"lines",
"=",
"(",
"[",
"'// marker so line numbers and indices both start at 1'",
"]",
"+",
"lines",
"+",
"[",
"... | https://github.com/GJDuck/LowFat/blob/ecf6a0f0fa1b73a27a626cf493cc39e477b6faea/llvm-4.0.0.src/projects/compiler-rt/lib/sanitizer_common/scripts/cpplint.py#L3814-L3857 | ||
IfcOpenShell/IfcOpenShell | 2c2954b11a9c9d581bef03240836d4567e69ad0b | src/ifcopenshell-python/ifcopenshell/file.py | python | file.by_id | (self, id) | return self[id] | Return an IFC entity instance filtered by IFC ID.
:param id: STEP numerical identifier
:type id: int
:returns: An ifcopenshell.entity_instance.entity_instance
:rtype: ifcopenshell.entity_instance.entity_instance | Return an IFC entity instance filtered by IFC ID. | [
"Return",
"an",
"IFC",
"entity",
"instance",
"filtered",
"by",
"IFC",
"ID",
"."
] | def by_id(self, id):
"""Return an IFC entity instance filtered by IFC ID.
:param id: STEP numerical identifier
:type id: int
:returns: An ifcopenshell.entity_instance.entity_instance
:rtype: ifcopenshell.entity_instance.entity_instance
"""
return self[id] | [
"def",
"by_id",
"(",
"self",
",",
"id",
")",
":",
"return",
"self",
"[",
"id",
"]"
] | https://github.com/IfcOpenShell/IfcOpenShell/blob/2c2954b11a9c9d581bef03240836d4567e69ad0b/src/ifcopenshell-python/ifcopenshell/file.py#L310-L318 | |
OSGeo/gdal | 3748fc4ba4fba727492774b2b908a2130c864a83 | swig/python/osgeo/osr.py | python | SpatialReference.IsLocal | (self, *args) | return _osr.SpatialReference_IsLocal(self, *args) | r"""IsLocal(SpatialReference self) -> int | r"""IsLocal(SpatialReference self) -> int | [
"r",
"IsLocal",
"(",
"SpatialReference",
"self",
")",
"-",
">",
"int"
] | def IsLocal(self, *args):
r"""IsLocal(SpatialReference self) -> int"""
return _osr.SpatialReference_IsLocal(self, *args) | [
"def",
"IsLocal",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_osr",
".",
"SpatialReference_IsLocal",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/OSGeo/gdal/blob/3748fc4ba4fba727492774b2b908a2130c864a83/swig/python/osgeo/osr.py#L366-L368 | |
bulletphysics/bullet3 | f0f2a952e146f016096db6f85cf0c44ed75b0b9a | examples/pybullet/gym/pybullet_envs/agents/utility.py | python | save_config | (config, logdir=None) | return config | Save a new configuration by name.
If a logging directory is specified, is will be created and the configuration
will be stored there. Otherwise, a log message will be printed.
Args:
config: Configuration object.
logdir: Location for writing summaries and checkpoints if specified.
Returns:
Configu... | Save a new configuration by name. | [
"Save",
"a",
"new",
"configuration",
"by",
"name",
"."
] | def save_config(config, logdir=None):
"""Save a new configuration by name.
If a logging directory is specified, is will be created and the configuration
will be stored there. Otherwise, a log message will be printed.
Args:
config: Configuration object.
logdir: Location for writing summaries and checkp... | [
"def",
"save_config",
"(",
"config",
",",
"logdir",
"=",
"None",
")",
":",
"if",
"logdir",
":",
"with",
"config",
".",
"unlocked",
":",
"config",
".",
"logdir",
"=",
"logdir",
"message",
"=",
"'Start a new run and write summaries and checkpoints to {}.'",
"tf",
... | https://github.com/bulletphysics/bullet3/blob/f0f2a952e146f016096db6f85cf0c44ed75b0b9a/examples/pybullet/gym/pybullet_envs/agents/utility.py#L129-L155 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_windows.py | python | LayoutAlgorithm.LayoutWindow | (*args, **kwargs) | return _windows_.LayoutAlgorithm_LayoutWindow(*args, **kwargs) | LayoutWindow(self, Window parent, Window mainWindow=None) -> bool | LayoutWindow(self, Window parent, Window mainWindow=None) -> bool | [
"LayoutWindow",
"(",
"self",
"Window",
"parent",
"Window",
"mainWindow",
"=",
"None",
")",
"-",
">",
"bool"
] | def LayoutWindow(*args, **kwargs):
"""LayoutWindow(self, Window parent, Window mainWindow=None) -> bool"""
return _windows_.LayoutAlgorithm_LayoutWindow(*args, **kwargs) | [
"def",
"LayoutWindow",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"LayoutAlgorithm_LayoutWindow",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_windows.py#L2101-L2103 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/core/ops/__init__.py | python | should_reindex_frame_op | (
left: DataFrame, right, op, axis, default_axis, fill_value, level
) | return False | Check if this is an operation between DataFrames that will need to reindex. | Check if this is an operation between DataFrames that will need to reindex. | [
"Check",
"if",
"this",
"is",
"an",
"operation",
"between",
"DataFrames",
"that",
"will",
"need",
"to",
"reindex",
"."
] | def should_reindex_frame_op(
left: DataFrame, right, op, axis, default_axis, fill_value, level
) -> bool:
"""
Check if this is an operation between DataFrames that will need to reindex.
"""
assert isinstance(left, ABCDataFrame)
if op is operator.pow or op is roperator.rpow:
# GH#32685 p... | [
"def",
"should_reindex_frame_op",
"(",
"left",
":",
"DataFrame",
",",
"right",
",",
"op",
",",
"axis",
",",
"default_axis",
",",
"fill_value",
",",
"level",
")",
"->",
"bool",
":",
"assert",
"isinstance",
"(",
"left",
",",
"ABCDataFrame",
")",
"if",
"op",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/ops/__init__.py#L314-L340 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/stc.py | python | StyledTextCtrl.SelectionIsRectangle | (*args, **kwargs) | return _stc.StyledTextCtrl_SelectionIsRectangle(*args, **kwargs) | SelectionIsRectangle(self) -> bool
Is the selection rectangular? The alternative is the more common stream selection. | SelectionIsRectangle(self) -> bool | [
"SelectionIsRectangle",
"(",
"self",
")",
"-",
">",
"bool"
] | def SelectionIsRectangle(*args, **kwargs):
"""
SelectionIsRectangle(self) -> bool
Is the selection rectangular? The alternative is the more common stream selection.
"""
return _stc.StyledTextCtrl_SelectionIsRectangle(*args, **kwargs) | [
"def",
"SelectionIsRectangle",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_SelectionIsRectangle",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/stc.py#L4964-L4970 | |
panda3d/panda3d | 833ad89ebad58395d0af0b7ec08538e5e4308265 | direct/src/showutil/TexMemWatcher.py | python | TexMemWatcher.unplaceTexture | (self, tr) | Removes the texture from its place on the canvas. | Removes the texture from its place on the canvas. | [
"Removes",
"the",
"texture",
"from",
"its",
"place",
"on",
"the",
"canvas",
"."
] | def unplaceTexture(self, tr):
""" Removes the texture from its place on the canvas. """
if tr.placements:
for tp in tr.placements:
tp.clearBitmasks(self.bitmasks)
if not tp.overflowed:
self.placedQSize -= tp.area
assert ... | [
"def",
"unplaceTexture",
"(",
"self",
",",
"tr",
")",
":",
"if",
"tr",
".",
"placements",
":",
"for",
"tp",
"in",
"tr",
".",
"placements",
":",
"tp",
".",
"clearBitmasks",
"(",
"self",
".",
"bitmasks",
")",
"if",
"not",
"tp",
".",
"overflowed",
":",
... | https://github.com/panda3d/panda3d/blob/833ad89ebad58395d0af0b7ec08538e5e4308265/direct/src/showutil/TexMemWatcher.py#L756-L770 | ||
weolar/miniblink49 | 1c4678db0594a4abde23d3ebbcc7cd13c3170777 | v8_7_5/tools/stats-viewer.py | python | ChromeCounterCollection.__init__ | (self, data) | Create a new instance.
Args:
data: the shared data access object | Create a new instance. | [
"Create",
"a",
"new",
"instance",
"."
] | def __init__(self, data):
"""Create a new instance.
Args:
data: the shared data access object
"""
self.data = data
self.max_counters = data.IntAt(8)
self.max_threads = data.IntAt(12)
self.counter_names_offset = \
self._HEADER_SIZE + self.max_threads * (self._THREAD_NAME_SIZE +... | [
"def",
"__init__",
"(",
"self",
",",
"data",
")",
":",
"self",
".",
"data",
"=",
"data",
"self",
".",
"max_counters",
"=",
"data",
".",
"IntAt",
"(",
"8",
")",
"self",
".",
"max_threads",
"=",
"data",
".",
"IntAt",
"(",
"12",
")",
"self",
".",
"c... | https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/v8_7_5/tools/stats-viewer.py#L425-L437 | ||
microsoft/CNTK | e9396480025b9ca457d26b6f33dd07c474c6aa04 | bindings/python/cntk/learners/__init__.py | python | momentum_as_time_constant_schedule | (momentum, epoch_size=None) | Create a momentum schedule in a minibatch-size agnostic way
(using the same semantics as :func:`training_parameter_schedule`
with `unit=UnitType.sample`).
Deprecated:: 2.2
This is for legacy API.
In this legacy API,::
#assume the desired minibatch size invariant constan... | Create a momentum schedule in a minibatch-size agnostic way
(using the same semantics as :func:`training_parameter_schedule`
with `unit=UnitType.sample`). | [
"Create",
"a",
"momentum",
"schedule",
"in",
"a",
"minibatch",
"-",
"size",
"agnostic",
"way",
"(",
"using",
"the",
"same",
"semantics",
"as",
":",
"func",
":",
"training_parameter_schedule",
"with",
"unit",
"=",
"UnitType",
".",
"sample",
")",
"."
] | def momentum_as_time_constant_schedule(momentum, epoch_size=None):
'''
Create a momentum schedule in a minibatch-size agnostic way
(using the same semantics as :func:`training_parameter_schedule`
with `unit=UnitType.sample`).
Deprecated:: 2.2
This is for legacy API.
In this legacy A... | [
"def",
"momentum_as_time_constant_schedule",
"(",
"momentum",
",",
"epoch_size",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"momentum",
",",
"(",
"cntk_py",
".",
"training_double_parameter_schedule",
")",
")",
":",
"#the legacy momentum as time constant schedule: the... | https://github.com/microsoft/CNTK/blob/e9396480025b9ca457d26b6f33dd07c474c6aa04/bindings/python/cntk/learners/__init__.py#L471-L537 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/nn/dynamic_lr.py | python | natural_exp_decay_lr | (learning_rate, decay_rate, total_step, step_per_epoch, decay_epoch, is_stair=False) | return lr | r"""
Calculates learning rate base on natural exponential decay function.
For the i-th step, the formula of computing decayed_learning_rate[i] is:
.. math::
decayed\_learning\_rate[i] = learning\_rate * e^{-decay\_rate * current\_epoch}
Where :math:`current\_epoch=floor(\frac{i}{step\_per\_ep... | r"""
Calculates learning rate base on natural exponential decay function. | [
"r",
"Calculates",
"learning",
"rate",
"base",
"on",
"natural",
"exponential",
"decay",
"function",
"."
] | def natural_exp_decay_lr(learning_rate, decay_rate, total_step, step_per_epoch, decay_epoch, is_stair=False):
r"""
Calculates learning rate base on natural exponential decay function.
For the i-th step, the formula of computing decayed_learning_rate[i] is:
.. math::
decayed\_learning\_rate[i] ... | [
"def",
"natural_exp_decay_lr",
"(",
"learning_rate",
",",
"decay_rate",
",",
"total_step",
",",
"step_per_epoch",
",",
"decay_epoch",
",",
"is_stair",
"=",
"False",
")",
":",
"_check_inputs",
"(",
"learning_rate",
",",
"decay_rate",
",",
"total_step",
",",
"step_p... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/nn/dynamic_lr.py#L129-L172 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/debug/wrappers/framework.py | python | NonInteractiveDebugWrapperSession.on_session_init | (self, request) | return OnSessionInitResponse(OnSessionInitAction.PROCEED) | See doc of BaseDebugWrapperSession.on_run_start. | See doc of BaseDebugWrapperSession.on_run_start. | [
"See",
"doc",
"of",
"BaseDebugWrapperSession",
".",
"on_run_start",
"."
] | def on_session_init(self, request):
"""See doc of BaseDebugWrapperSession.on_run_start."""
return OnSessionInitResponse(OnSessionInitAction.PROCEED) | [
"def",
"on_session_init",
"(",
"self",
",",
"request",
")",
":",
"return",
"OnSessionInitResponse",
"(",
"OnSessionInitAction",
".",
"PROCEED",
")"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/debug/wrappers/framework.py#L920-L923 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/logging/__init__.py | python | FileHandler.emit | (self, record) | Emit a record.
If the stream was not opened because 'delay' was specified in the
constructor, open it before calling the superclass's emit. | Emit a record. | [
"Emit",
"a",
"record",
"."
] | def emit(self, record):
"""
Emit a record.
If the stream was not opened because 'delay' was specified in the
constructor, open it before calling the superclass's emit.
"""
if self.stream is None:
self.stream = self._open()
StreamHandler.emit(self, rec... | [
"def",
"emit",
"(",
"self",
",",
"record",
")",
":",
"if",
"self",
".",
"stream",
"is",
"None",
":",
"self",
".",
"stream",
"=",
"self",
".",
"_open",
"(",
")",
"StreamHandler",
".",
"emit",
"(",
"self",
",",
"record",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/logging/__init__.py#L1178-L1187 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/pkg_resources/__init__.py | python | Distribution._filter_extras | (dm) | return dm | Given a mapping of extras to dependencies, strip off
environment markers and filter out any dependencies
not matching the markers. | Given a mapping of extras to dependencies, strip off
environment markers and filter out any dependencies
not matching the markers. | [
"Given",
"a",
"mapping",
"of",
"extras",
"to",
"dependencies",
"strip",
"off",
"environment",
"markers",
"and",
"filter",
"out",
"any",
"dependencies",
"not",
"matching",
"the",
"markers",
"."
] | def _filter_extras(dm):
"""
Given a mapping of extras to dependencies, strip off
environment markers and filter out any dependencies
not matching the markers.
"""
for extra in list(filter(None, dm)):
new_extra = extra
reqs = dm.pop(extra)
... | [
"def",
"_filter_extras",
"(",
"dm",
")",
":",
"for",
"extra",
"in",
"list",
"(",
"filter",
"(",
"None",
",",
"dm",
")",
")",
":",
"new_extra",
"=",
"extra",
"reqs",
"=",
"dm",
".",
"pop",
"(",
"extra",
")",
"new_extra",
",",
"_",
",",
"marker",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/pkg_resources/__init__.py#L2706-L2725 | |
Jittor/jittor | e9aca0444c2bdc8e2389d99122954cd0903eec46 | python/jittor/__init__.py | python | rand_like | (x, dtype=None) | return jt.random(x.shape, x.dtype) | samples random values from standard uniform distribution with the same shape as x.
:param x: reference variable.
:type x: jt.Var
:param dtype: if None, the dtype of the output is the same as x.
Otherwise, use the specified dtype. Defaults to None.
:type dtype: str, optional
... | samples random values from standard uniform distribution with the same shape as x.
:param x: reference variable.
:type x: jt.Var
:param dtype: if None, the dtype of the output is the same as x.
Otherwise, use the specified dtype. Defaults to None.
:type dtype: str, optional
... | [
"samples",
"random",
"values",
"from",
"standard",
"uniform",
"distribution",
"with",
"the",
"same",
"shape",
"as",
"x",
".",
":",
"param",
"x",
":",
"reference",
"variable",
".",
":",
"type",
"x",
":",
"jt",
".",
"Var",
":",
"param",
"dtype",
":",
"if... | def rand_like(x, dtype=None) -> Var:
''' samples random values from standard uniform distribution with the same shape as x.
:param x: reference variable.
:type x: jt.Var
:param dtype: if None, the dtype of the output is the same as x.
Otherwise, use the specified dtype. Defaul... | [
"def",
"rand_like",
"(",
"x",
",",
"dtype",
"=",
"None",
")",
"->",
"Var",
":",
"if",
"dtype",
"is",
"None",
":",
"dtype",
"=",
"x",
".",
"dtype",
"return",
"jt",
".",
"random",
"(",
"x",
".",
"shape",
",",
"x",
".",
"dtype",
")"
] | https://github.com/Jittor/jittor/blob/e9aca0444c2bdc8e2389d99122954cd0903eec46/python/jittor/__init__.py#L536-L554 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/reader/decorator.py | python | compose | (*readers, **kwargs) | return reader | Creates a data reader whose output is the combination of input readers.
If input readers output following data entries:
(1, 2) 3 (4, 5)
The composed reader will output:
(1, 2, 3, 4, 5)
Args:
readers (Reader|list of Reader): readers that will be composed together.
check_align... | Creates a data reader whose output is the combination of input readers. | [
"Creates",
"a",
"data",
"reader",
"whose",
"output",
"is",
"the",
"combination",
"of",
"input",
"readers",
"."
] | def compose(*readers, **kwargs):
"""
Creates a data reader whose output is the combination of input readers.
If input readers output following data entries:
(1, 2) 3 (4, 5)
The composed reader will output:
(1, 2, 3, 4, 5)
Args:
readers (Reader|list of Reader): readers that wi... | [
"def",
"compose",
"(",
"*",
"readers",
",",
"*",
"*",
"kwargs",
")",
":",
"check_alignment",
"=",
"kwargs",
".",
"pop",
"(",
"'check_alignment'",
",",
"True",
")",
"def",
"make_tuple",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"tuple",
"... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/reader/decorator.py#L248-L305 | |
rodeofx/OpenWalter | 6116fbe3f04f1146c854afbfbdbe944feaee647e | walter/katana/WalterIn/walterVariantsMenu.py | python | WalterVariantsToolbar._buildControlWidget | (self, layout) | Called when FormWidget needs a container for control widgets. | Called when FormWidget needs a container for control widgets. | [
"Called",
"when",
"FormWidget",
"needs",
"a",
"container",
"for",
"control",
"widgets",
"."
] | def _buildControlWidget(self, layout):
"""Called when FormWidget needs a container for control widgets."""
self.variantsMenu = VariantsMenu(self)
action = QtGui.QAction("Variants", self)
action.triggered.connect(self.__showVariantsMenu)
self.__variantButton = ToolbarButton(
... | [
"def",
"_buildControlWidget",
"(",
"self",
",",
"layout",
")",
":",
"self",
".",
"variantsMenu",
"=",
"VariantsMenu",
"(",
"self",
")",
"action",
"=",
"QtGui",
".",
"QAction",
"(",
"\"Variants\"",
",",
"self",
")",
"action",
".",
"triggered",
".",
"connect... | https://github.com/rodeofx/OpenWalter/blob/6116fbe3f04f1146c854afbfbdbe944feaee647e/walter/katana/WalterIn/walterVariantsMenu.py#L99-L113 | ||
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | media/webrtc/trunk/tools/gyp/pylib/gyp/generator/scons.py | python | GenerateSConscript | (output_filename, spec, build_file, build_file_data) | Generates a SConscript file for a specific target.
This generates a SConscript file suitable for building any or all of
the target's configurations.
A SConscript file may be called multiple times to generate targets for
multiple configurations. Consequently, it needs to be ready to build
the target for any... | Generates a SConscript file for a specific target. | [
"Generates",
"a",
"SConscript",
"file",
"for",
"a",
"specific",
"target",
"."
] | def GenerateSConscript(output_filename, spec, build_file, build_file_data):
"""
Generates a SConscript file for a specific target.
This generates a SConscript file suitable for building any or all of
the target's configurations.
A SConscript file may be called multiple times to generate targets for
multip... | [
"def",
"GenerateSConscript",
"(",
"output_filename",
",",
"spec",
",",
"build_file",
",",
"build_file_data",
")",
":",
"scons_target",
"=",
"SCons",
".",
"Target",
"(",
"spec",
")",
"gyp_dir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"output_filename",
"... | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/media/webrtc/trunk/tools/gyp/pylib/gyp/generator/scons.py#L251-L575 | ||
facebook/fbthrift | fb9c8562aba04c4fd9b17716eb5d970cc88a75bb | thrift/lib/py/util/randomizer.py | python | BaseRandomizer.flatten_constraints | (self, constraints) | return flattened | Return a single constraint dictionary by combining default
constraints with overriding constraints. | Return a single constraint dictionary by combining default
constraints with overriding constraints. | [
"Return",
"a",
"single",
"constraint",
"dictionary",
"by",
"combining",
"default",
"constraints",
"with",
"overriding",
"constraints",
"."
] | def flatten_constraints(self, constraints):
"""Return a single constraint dictionary by combining default
constraints with overriding constraints."""
cls = self.__class__
flattened = {}
deep_dict_update(flattened, cls.default_constraints)
# Put the default constraints o... | [
"def",
"flatten_constraints",
"(",
"self",
",",
"constraints",
")",
":",
"cls",
"=",
"self",
".",
"__class__",
"flattened",
"=",
"{",
"}",
"deep_dict_update",
"(",
"flattened",
",",
"cls",
".",
"default_constraints",
")",
"# Put the default constraints of the whole ... | https://github.com/facebook/fbthrift/blob/fb9c8562aba04c4fd9b17716eb5d970cc88a75bb/thrift/lib/py/util/randomizer.py#L126-L143 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/python/ops/nn_ops.py | python | _calc_dilation2d_flops | (graph, node) | return ops.OpStats("flops", (output_count * filter_height * filter_width * 2)) | Calculates the compute resources needed for Dilation2D. | Calculates the compute resources needed for Dilation2D. | [
"Calculates",
"the",
"compute",
"resources",
"needed",
"for",
"Dilation2D",
"."
] | def _calc_dilation2d_flops(graph, node):
"""Calculates the compute resources needed for Dilation2D."""
input_shape = graph_util.tensor_shape_from_node_def_name(graph, node.input[0])
input_shape.assert_is_fully_defined()
filter_shape = graph_util.tensor_shape_from_node_def_name(graph,
... | [
"def",
"_calc_dilation2d_flops",
"(",
"graph",
",",
"node",
")",
":",
"input_shape",
"=",
"graph_util",
".",
"tensor_shape_from_node_def_name",
"(",
"graph",
",",
"node",
".",
"input",
"[",
"0",
"]",
")",
"input_shape",
".",
"assert_is_fully_defined",
"(",
")",
... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/ops/nn_ops.py#L1261-L1273 | |
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | .github/github_org_control/github_api.py | python | GithubOrgApi.remove_users | (self, users) | Removes users from GitHub organization | Removes users from GitHub organization | [
"Removes",
"users",
"from",
"GitHub",
"organization"
] | def remove_users(self, users):
"""Removes users from GitHub organization"""
if not isinstance(users, typing.Iterable):
users = [users]
print(f"\nRemove {len(users)} users:")
dry_run = self._cfg.DRY_RUN
if not dry_run and len(users) > self._cfg.MAX_MEMBERS_TO_REMOVE:
... | [
"def",
"remove_users",
"(",
"self",
",",
"users",
")",
":",
"if",
"not",
"isinstance",
"(",
"users",
",",
"typing",
".",
"Iterable",
")",
":",
"users",
"=",
"[",
"users",
"]",
"print",
"(",
"f\"\\nRemove {len(users)} users:\"",
")",
"dry_run",
"=",
"self",... | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/.github/github_org_control/github_api.py#L342-L370 | ||
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/ops/string_ops.py | python | _StringJoinShape | (op) | return [base_shape] | Shape function for the StringJoin op. | Shape function for the StringJoin op. | [
"Shape",
"function",
"for",
"the",
"StringJoin",
"op",
"."
] | def _StringJoinShape(op):
"""Shape function for the StringJoin op."""
input_shapes = [x.get_shape() for x in op.inputs]
# First check if all inputs are scalars. In the next section
# we may have *some* scalars and we will be broadcasting them
if all([s.ndims == 0 for s in input_shapes]):
return [tensor_... | [
"def",
"_StringJoinShape",
"(",
"op",
")",
":",
"input_shapes",
"=",
"[",
"x",
".",
"get_shape",
"(",
")",
"for",
"x",
"in",
"op",
".",
"inputs",
"]",
"# First check if all inputs are scalars. In the next section",
"# we may have *some* scalars and we will be broadcastin... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/ops/string_ops.py#L114-L127 | |
giuspen/cherrytree | 84712f206478fcf9acf30174009ad28c648c6344 | pygtk2/modules/core.py | python | CherryTree.nodes_add_from_html_folder | (self, action) | Add Nodes from HTML File(s) in Selected Folder | Add Nodes from HTML File(s) in Selected Folder | [
"Add",
"Nodes",
"from",
"HTML",
"File",
"(",
"s",
")",
"in",
"Selected",
"Folder"
] | def nodes_add_from_html_folder(self, action):
"""Add Nodes from HTML File(s) in Selected Folder"""
folderpath = support.dialog_folder_select(curr_folder=self.pick_dir_import, parent=self.window)
if not folderpath: return
self.pick_dir_import = os.path.dirname(folderpath)
html = i... | [
"def",
"nodes_add_from_html_folder",
"(",
"self",
",",
"action",
")",
":",
"folderpath",
"=",
"support",
".",
"dialog_folder_select",
"(",
"curr_folder",
"=",
"self",
".",
"pick_dir_import",
",",
"parent",
"=",
"self",
".",
"window",
")",
"if",
"not",
"folderp... | https://github.com/giuspen/cherrytree/blob/84712f206478fcf9acf30174009ad28c648c6344/pygtk2/modules/core.py#L1006-L1013 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/utils/stats.py | python | _weighted_percentile | (array, sample_weight, percentile=50) | return array[sorted_idx[percentile_idx]] | Compute the weighted ``percentile`` of ``array`` with ``sample_weight``. | Compute the weighted ``percentile`` of ``array`` with ``sample_weight``. | [
"Compute",
"the",
"weighted",
"percentile",
"of",
"array",
"with",
"sample_weight",
"."
] | def _weighted_percentile(array, sample_weight, percentile=50):
"""Compute the weighted ``percentile`` of ``array`` with ``sample_weight``. """
sorted_idx = np.argsort(array)
# Find index of median prediction for each sample
weight_cdf = sample_weight[sorted_idx].cumsum()
percentile_idx = np.searchs... | [
"def",
"_weighted_percentile",
"(",
"array",
",",
"sample_weight",
",",
"percentile",
"=",
"50",
")",
":",
"sorted_idx",
"=",
"np",
".",
"argsort",
"(",
"array",
")",
"# Find index of median prediction for each sample",
"weight_cdf",
"=",
"sample_weight",
"[",
"sort... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/utils/stats.py#L51-L59 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/kvstore/kvstore.py | python | KVStore.pull | (self, key, out=None, priority=0, ignore_sparse=True) | Pulls a single value or a sequence of values from the store.
This function returns immediately after adding an operator to the engine.
Subsequent attempts to read from the `out` variable will be blocked until the
pull operation completes.
`pull` is executed asynchronously after all pre... | Pulls a single value or a sequence of values from the store. | [
"Pulls",
"a",
"single",
"value",
"or",
"a",
"sequence",
"of",
"values",
"from",
"the",
"store",
"."
] | def pull(self, key, out=None, priority=0, ignore_sparse=True):
""" Pulls a single value or a sequence of values from the store.
This function returns immediately after adding an operator to the engine.
Subsequent attempts to read from the `out` variable will be blocked until the
pull op... | [
"def",
"pull",
"(",
"self",
",",
"key",
",",
"out",
"=",
"None",
",",
"priority",
"=",
"0",
",",
"ignore_sparse",
"=",
"True",
")",
":",
"assert",
"(",
"out",
"is",
"not",
"None",
")",
"ckeys",
",",
"cvals",
",",
"use_str_keys",
"=",
"_ctype_key_valu... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/kvstore/kvstore.py#L265-L338 | ||
klzgrad/naiveproxy | ed2c513637c77b18721fe428d7ed395b4d284c83 | src/build/fuchsia/binary_sizes.py | python | GetCompressedSize | (file_path) | return int(math.ceil(blob_bytes / BLOBFS_BLOCK_SIZE)) * BLOBFS_BLOCK_SIZE | Measures file size after blobfs compression. | Measures file size after blobfs compression. | [
"Measures",
"file",
"size",
"after",
"blobfs",
"compression",
"."
] | def GetCompressedSize(file_path):
"""Measures file size after blobfs compression."""
compressor_path = GetHostToolPathFromPlatform('blobfs-compression')
try:
temp_dir = tempfile.mkdtemp()
compressed_file_path = os.path.join(temp_dir, os.path.basename(file_path))
compressor_cmd = [
compressor_... | [
"def",
"GetCompressedSize",
"(",
"file_path",
")",
":",
"compressor_path",
"=",
"GetHostToolPathFromPlatform",
"(",
"'blobfs-compression'",
")",
"try",
":",
"temp_dir",
"=",
"tempfile",
".",
"mkdtemp",
"(",
")",
"compressed_file_path",
"=",
"os",
".",
"path",
".",... | https://github.com/klzgrad/naiveproxy/blob/ed2c513637c77b18721fe428d7ed395b4d284c83/src/build/fuchsia/binary_sizes.py#L240-L275 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/lib-tk/Tkinter.py | python | Canvas.insert | (self, *args) | Insert TEXT in item TAGORID at position POS. ARGS must
be TAGORID POS TEXT. | Insert TEXT in item TAGORID at position POS. ARGS must
be TAGORID POS TEXT. | [
"Insert",
"TEXT",
"in",
"item",
"TAGORID",
"at",
"position",
"POS",
".",
"ARGS",
"must",
"be",
"TAGORID",
"POS",
"TEXT",
"."
] | def insert(self, *args):
"""Insert TEXT in item TAGORID at position POS. ARGS must
be TAGORID POS TEXT."""
self.tk.call((self._w, 'insert') + args) | [
"def",
"insert",
"(",
"self",
",",
"*",
"args",
")",
":",
"self",
".",
"tk",
".",
"call",
"(",
"(",
"self",
".",
"_w",
",",
"'insert'",
")",
"+",
"args",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/lib-tk/Tkinter.py#L2334-L2337 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/supertooltip.py | python | ToolTipWindowBase.MakeWindowTransparent | (self, amount) | Makes the :class:`SuperToolTip` window transparent.
:param `amount`: the alpha channel value.
:note: This method is available only on Windows and requires Mark Hammond's
pywin32 package. | Makes the :class:`SuperToolTip` window transparent. | [
"Makes",
"the",
":",
"class",
":",
"SuperToolTip",
"window",
"transparent",
"."
] | def MakeWindowTransparent(self, amount):
"""
Makes the :class:`SuperToolTip` window transparent.
:param `amount`: the alpha channel value.
:note: This method is available only on Windows and requires Mark Hammond's
pywin32 package.
"""
if not _libimported:
... | [
"def",
"MakeWindowTransparent",
"(",
"self",
",",
"amount",
")",
":",
"if",
"not",
"_libimported",
":",
"# No way, only Windows XP with Mark Hammond's win32all",
"return",
"# this API call is not in all SDKs, only the newer ones, so",
"# we will runtime bind this",
"if",
"wx",
".... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/supertooltip.py#L637-L671 | ||
epam/Indigo | 30e40b4b1eb9bae0207435a26cfcb81ddcc42be1 | api/python/indigo/__init__.py | python | IndigoObject.clone | (self) | return self.dispatcher.IndigoObject(
self.dispatcher,
self.dispatcher._checkResult(Indigo._lib.indigoClone(self.id)),
) | Clones IndigoObject
Returns:
IndigoObject: cloned object | Clones IndigoObject | [
"Clones",
"IndigoObject"
] | def clone(self):
"""Clones IndigoObject
Returns:
IndigoObject: cloned object
"""
self.dispatcher._setSessionId()
return self.dispatcher.IndigoObject(
self.dispatcher,
self.dispatcher._checkResult(Indigo._lib.indigoClone(self.id)),
) | [
"def",
"clone",
"(",
"self",
")",
":",
"self",
".",
"dispatcher",
".",
"_setSessionId",
"(",
")",
"return",
"self",
".",
"dispatcher",
".",
"IndigoObject",
"(",
"self",
".",
"dispatcher",
",",
"self",
".",
"dispatcher",
".",
"_checkResult",
"(",
"Indigo",
... | https://github.com/epam/Indigo/blob/30e40b4b1eb9bae0207435a26cfcb81ddcc42be1/api/python/indigo/__init__.py#L205-L215 | |
baidu/bigflow | 449245016c0df7d1252e85581e588bfc60cefad3 | bigflow_python/python/bigflow/rpc/requests.py | python | suspend | (pipeline_id, logical_plan_message, commit_args=None) | return None, res.status | Send the rpc command to the other end to suspend the logical plan
Args:
Raises:
error.BigflowRPCException: if any error happened | Send the rpc command to the other end to suspend the logical plan | [
"Send",
"the",
"rpc",
"command",
"to",
"the",
"other",
"end",
"to",
"suspend",
"the",
"logical",
"plan"
] | def suspend(pipeline_id, logical_plan_message, commit_args=None):
"""
Send the rpc command to the other end to suspend the logical plan
Args:
Raises:
error.BigflowRPCException: if any error happened
"""
request = service_pb2.SuspendRequest()
request.pipeline_id = pipeline_id
re... | [
"def",
"suspend",
"(",
"pipeline_id",
",",
"logical_plan_message",
",",
"commit_args",
"=",
"None",
")",
":",
"request",
"=",
"service_pb2",
".",
"SuspendRequest",
"(",
")",
"request",
".",
"pipeline_id",
"=",
"pipeline_id",
"request",
".",
"logical_plan",
".",
... | https://github.com/baidu/bigflow/blob/449245016c0df7d1252e85581e588bfc60cefad3/bigflow_python/python/bigflow/rpc/requests.py#L117-L138 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/idlelib/tooltip.py | python | OnHoverTooltipBase._show_event | (self, event=None) | event handler to display the tooltip | event handler to display the tooltip | [
"event",
"handler",
"to",
"display",
"the",
"tooltip"
] | def _show_event(self, event=None):
"""event handler to display the tooltip"""
if self.hover_delay:
self.schedule()
else:
self.showtip() | [
"def",
"_show_event",
"(",
"self",
",",
"event",
"=",
"None",
")",
":",
"if",
"self",
".",
"hover_delay",
":",
"self",
".",
"schedule",
"(",
")",
"else",
":",
"self",
".",
"showtip",
"(",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/idlelib/tooltip.py#L112-L117 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/dataview.py | python | DataViewRenderer.FinishEditing | (*args, **kwargs) | return _dataview.DataViewRenderer_FinishEditing(*args, **kwargs) | FinishEditing(self) -> bool | FinishEditing(self) -> bool | [
"FinishEditing",
"(",
"self",
")",
"-",
">",
"bool"
] | def FinishEditing(*args, **kwargs):
"""FinishEditing(self) -> bool"""
return _dataview.DataViewRenderer_FinishEditing(*args, **kwargs) | [
"def",
"FinishEditing",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_dataview",
".",
"DataViewRenderer_FinishEditing",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/dataview.py#L1229-L1231 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/python/ops/math_ops.py | python | _calc_mat_mul_flops | (graph, node) | return ops.OpStats("flops", (k * output_count * 2)) | Calculates the compute resources needed for MatMul. | Calculates the compute resources needed for MatMul. | [
"Calculates",
"the",
"compute",
"resources",
"needed",
"for",
"MatMul",
"."
] | def _calc_mat_mul_flops(graph, node):
"""Calculates the compute resources needed for MatMul."""
transpose_a = node.attr["transpose_a"].b
a_shape = graph_util.tensor_shape_from_node_def_name(graph, node.input[0])
a_shape.assert_is_fully_defined()
if transpose_a:
k = int(a_shape[0])
else:
k = int(a_sh... | [
"def",
"_calc_mat_mul_flops",
"(",
"graph",
",",
"node",
")",
":",
"transpose_a",
"=",
"node",
".",
"attr",
"[",
"\"transpose_a\"",
"]",
".",
"b",
"a_shape",
"=",
"graph_util",
".",
"tensor_shape_from_node_def_name",
"(",
"graph",
",",
"node",
".",
"input",
... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/python/ops/math_ops.py#L1362-L1374 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/genericpath.py | python | isdir | (s) | return stat.S_ISDIR(st.st_mode) | Return true if the pathname refers to an existing directory. | Return true if the pathname refers to an existing directory. | [
"Return",
"true",
"if",
"the",
"pathname",
"refers",
"to",
"an",
"existing",
"directory",
"."
] | def isdir(s):
"""Return true if the pathname refers to an existing directory."""
try:
st = os.stat(s)
except os.error:
return False
return stat.S_ISDIR(st.st_mode) | [
"def",
"isdir",
"(",
"s",
")",
":",
"try",
":",
"st",
"=",
"os",
".",
"stat",
"(",
"s",
")",
"except",
"os",
".",
"error",
":",
"return",
"False",
"return",
"stat",
".",
"S_ISDIR",
"(",
"st",
".",
"st_mode",
")"
] | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/genericpath.py#L38-L44 | |
facebook/mysql-5.6 | 65a650660ec7b4d627d1b738f397252ff4706207 | arcanist/lint/cpp_linter/cpplint.py | python | CheckCStyleCast | (filename, linenum, line, raw_line, cast_type, pattern,
error) | return True | Checks for a C-style cast by looking for the pattern.
Args:
filename: The name of the current file.
linenum: The number of the line to check.
line: The line of code to check.
raw_line: The raw line of code to check, with comments.
cast_type: The string for the C++ cast to recommend. This is eith... | Checks for a C-style cast by looking for the pattern. | [
"Checks",
"for",
"a",
"C",
"-",
"style",
"cast",
"by",
"looking",
"for",
"the",
"pattern",
"."
] | def CheckCStyleCast(filename, linenum, line, raw_line, cast_type, pattern,
error):
"""Checks for a C-style cast by looking for the pattern.
Args:
filename: The name of the current file.
linenum: The number of the line to check.
line: The line of code to check.
raw_line: The raw ... | [
"def",
"CheckCStyleCast",
"(",
"filename",
",",
"linenum",
",",
"line",
",",
"raw_line",
",",
"cast_type",
",",
"pattern",
",",
"error",
")",
":",
"match",
"=",
"Search",
"(",
"pattern",
",",
"line",
")",
"if",
"not",
"match",
":",
"return",
"False",
"... | https://github.com/facebook/mysql-5.6/blob/65a650660ec7b4d627d1b738f397252ff4706207/arcanist/lint/cpp_linter/cpplint.py#L4152-L4243 | |
plaidml/plaidml | f3c6681db21460e5fdc11ae651d6d7b6c27f8262 | mlperf/models/base_model_r34.py | python | Loss._loc_vec | (self, loc) | return torch.cat((gxy, gwh), dim=1).contiguous() | Generate Location Vectors | Generate Location Vectors | [
"Generate",
"Location",
"Vectors"
] | def _loc_vec(self, loc):
"""
Generate Location Vectors
"""
gxy = self.scale_xy * (loc[:, :2, :] - self.dboxes[:, :2, :]) / self.dboxes[:, 2:,]
gwh = self.scale_wh * (loc[:, 2:, :] / self.dboxes[:, 2:, :]).log()
return torch.cat((gxy, gwh), dim=1).contiguous() | [
"def",
"_loc_vec",
"(",
"self",
",",
"loc",
")",
":",
"gxy",
"=",
"self",
".",
"scale_xy",
"*",
"(",
"loc",
"[",
":",
",",
":",
"2",
",",
":",
"]",
"-",
"self",
".",
"dboxes",
"[",
":",
",",
":",
"2",
",",
":",
"]",
")",
"/",
"self",
".",... | https://github.com/plaidml/plaidml/blob/f3c6681db21460e5fdc11ae651d6d7b6c27f8262/mlperf/models/base_model_r34.py#L164-L171 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/idlelib/configHandler.py | python | IdleConf.GetExtensionBindings | (self,extensionName) | return extBinds | Returns a dictionary of all the event bindings for a particular
extension. The configurable keybindings are returned as they exist in
the dictionary returned by GetCurrentKeySet; that is, where re-used
keybindings are disabled. | Returns a dictionary of all the event bindings for a particular
extension. The configurable keybindings are returned as they exist in
the dictionary returned by GetCurrentKeySet; that is, where re-used
keybindings are disabled. | [
"Returns",
"a",
"dictionary",
"of",
"all",
"the",
"event",
"bindings",
"for",
"a",
"particular",
"extension",
".",
"The",
"configurable",
"keybindings",
"are",
"returned",
"as",
"they",
"exist",
"in",
"the",
"dictionary",
"returned",
"by",
"GetCurrentKeySet",
";... | def GetExtensionBindings(self,extensionName):
"""
Returns a dictionary of all the event bindings for a particular
extension. The configurable keybindings are returned as they exist in
the dictionary returned by GetCurrentKeySet; that is, where re-used
keybindings are disabled.
... | [
"def",
"GetExtensionBindings",
"(",
"self",
",",
"extensionName",
")",
":",
"bindsName",
"=",
"extensionName",
"+",
"'_bindings'",
"extBinds",
"=",
"self",
".",
"GetExtensionKeys",
"(",
"extensionName",
")",
"#add the non-configurable bindings",
"if",
"self",
".",
"... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/idlelib/configHandler.py#L495-L513 | |
flexflow/FlexFlow | 581fad8ba8d10a16a3102ee2b406b0319586df24 | python/flexflow/core/flexflow_cffi.py | python | FFModel.identity | (self, input, name=None) | return Tensor(handle, owner_op_type=OpType.IDENTITY) | Identity function.
:param input: the input Tensor.
:type input: Tensor
:param name: the name of the layer. Default is None.
:type name: string
:returns: Tensor -- the output tensor. | Identity function.
:param input: the input Tensor.
:type input: Tensor
:param name: the name of the layer. Default is None.
:type name: string | [
"Identity",
"function",
".",
":",
"param",
"input",
":",
"the",
"input",
"Tensor",
".",
":",
"type",
"input",
":",
"Tensor",
":",
"param",
"name",
":",
"the",
"name",
"of",
"the",
"layer",
".",
"Default",
"is",
"None",
".",
":",
"type",
"name",
":",
... | def identity(self, input, name=None):
"""Identity function.
:param input: the input Tensor.
:type input: Tensor
:param name: the name of the layer. Default is None.
:type name: string
:returns: Tensor -- the output tensor.
"""
c_name = get_c_name(name)
h... | [
"def",
"identity",
"(",
"self",
",",
"input",
",",
"name",
"=",
"None",
")",
":",
"c_name",
"=",
"get_c_name",
"(",
"name",
")",
"handle",
"=",
"ffc",
".",
"flexflow_model_add_identity",
"(",
"self",
".",
"handle",
",",
"input",
".",
"handle",
",",
"c_... | https://github.com/flexflow/FlexFlow/blob/581fad8ba8d10a16a3102ee2b406b0319586df24/python/flexflow/core/flexflow_cffi.py#L1541-L1555 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/util/tf_inspect.py | python | stack | (context=1) | return _inspect.stack(context)[1:] | TFDecorator-aware replacement for inspect.stack. | TFDecorator-aware replacement for inspect.stack. | [
"TFDecorator",
"-",
"aware",
"replacement",
"for",
"inspect",
".",
"stack",
"."
] | def stack(context=1):
"""TFDecorator-aware replacement for inspect.stack."""
return _inspect.stack(context)[1:] | [
"def",
"stack",
"(",
"context",
"=",
"1",
")",
":",
"return",
"_inspect",
".",
"stack",
"(",
"context",
")",
"[",
"1",
":",
"]"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/util/tf_inspect.py#L405-L407 | |
cathywu/Sentiment-Analysis | eb501fd1375c0c3f3ab430f963255f1bb858e659 | PyML-0.7.9/PyML/datagen/toydata.py | python | noisyData | () | Creates two populations, usually linearly-separable, but with
vastly different variance. Simulates a problem where one
population has significantly more noise than another. Data are
output in a CSV format suitable for creating a PyML VectorDataSet
(labelsColumn=1). | Creates two populations, usually linearly-separable, but with
vastly different variance. Simulates a problem where one
population has significantly more noise than another. Data are
output in a CSV format suitable for creating a PyML VectorDataSet
(labelsColumn=1). | [
"Creates",
"two",
"populations",
"usually",
"linearly",
"-",
"separable",
"but",
"with",
"vastly",
"different",
"variance",
".",
"Simulates",
"a",
"problem",
"where",
"one",
"population",
"has",
"significantly",
"more",
"noise",
"than",
"another",
".",
"Data",
"... | def noisyData() :
"""
Creates two populations, usually linearly-separable, but with
vastly different variance. Simulates a problem where one
population has significantly more noise than another. Data are
output in a CSV format suitable for creating a PyML VectorDataSet
(labelsColumn=1).
""... | [
"def",
"noisyData",
"(",
")",
":",
"pid",
"=",
"0",
"for",
"label",
"in",
"[",
"-",
"1",
",",
"1",
"]",
":",
"if",
"label",
"<",
"0",
":",
"X",
",",
"Y",
"=",
"gaussCloud",
"(",
"-",
"0.5",
",",
"0.0",
",",
"sigma",
"=",
"0.05",
",",
"n",
... | https://github.com/cathywu/Sentiment-Analysis/blob/eb501fd1375c0c3f3ab430f963255f1bb858e659/PyML-0.7.9/PyML/datagen/toydata.py#L83-L99 | ||
domino-team/openwrt-cc | 8b181297c34d14d3ca521cc9f31430d561dbc688 | package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py | python | Writer.AddDebugSettings | (self, config_name, command, environment = {},
working_directory="") | Adds a DebugSettings node to the user file for a particular config.
Args:
command: command line to run. First element in the list is the
executable. All elements of the command will be quoted if
necessary.
working_directory: other files which may trigger the rule. (optional) | Adds a DebugSettings node to the user file for a particular config. | [
"Adds",
"a",
"DebugSettings",
"node",
"to",
"the",
"user",
"file",
"for",
"a",
"particular",
"config",
"."
] | def AddDebugSettings(self, config_name, command, environment = {},
working_directory=""):
"""Adds a DebugSettings node to the user file for a particular config.
Args:
command: command line to run. First element in the list is the
executable. All elements of the command wi... | [
"def",
"AddDebugSettings",
"(",
"self",
",",
"config_name",
",",
"command",
",",
"environment",
"=",
"{",
"}",
",",
"working_directory",
"=",
"\"\"",
")",
":",
"command",
"=",
"_QuoteWin32CommandLineArgs",
"(",
"command",
")",
"abs_command",
"=",
"_FindCommandIn... | https://github.com/domino-team/openwrt-cc/blob/8b181297c34d14d3ca521cc9f31430d561dbc688/package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py#L78-L133 | ||
microsoft/EdgeML | ef9f8a77f096acbdeb941014791f8eda1c1bc35b | examples/pytorch/DROCC/main_timeseries.py | python | adjust_learning_rate | (epoch, total_epochs, only_ce_epochs, learning_rate, optimizer) | return optimizer | Adjust learning rate during training.
Parameters
----------
epoch: Current training epoch.
total_epochs: Total number of epochs for training.
only_ce_epochs: Number of epochs for initial pretraining.
learning_rate: Initial learning rate for training. | Adjust learning rate during training. | [
"Adjust",
"learning",
"rate",
"during",
"training",
"."
] | def adjust_learning_rate(epoch, total_epochs, only_ce_epochs, learning_rate, optimizer):
"""Adjust learning rate during training.
Parameters
----------
epoch: Current training epoch.
total_epochs: Total number of epochs for training.
only_ce_epochs: Number of epochs for ... | [
"def",
"adjust_learning_rate",
"(",
"epoch",
",",
"total_epochs",
",",
"only_ce_epochs",
",",
"learning_rate",
",",
"optimizer",
")",
":",
"#We dont want to consider the only ce ",
"#based epochs for the lr scheduler",
"epoch",
"=",
"epoch",
"-",
"only_ce_epochs",
"drocc_ep... | https://github.com/microsoft/EdgeML/blob/ef9f8a77f096acbdeb941014791f8eda1c1bc35b/examples/pytorch/DROCC/main_timeseries.py#L54-L76 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/lib-tk/turtle.py | python | TurtleScreen.screensize | (self, canvwidth=None, canvheight=None, bg=None) | return self._resize(canvwidth, canvheight, bg) | Resize the canvas the turtles are drawing on.
Optional arguments:
canvwidth -- positive integer, new width of canvas in pixels
canvheight -- positive integer, new height of canvas in pixels
bg -- colorstring or color-tuple, new backgroundcolor
If no arguments are given, return ... | Resize the canvas the turtles are drawing on. | [
"Resize",
"the",
"canvas",
"the",
"turtles",
"are",
"drawing",
"on",
"."
] | def screensize(self, canvwidth=None, canvheight=None, bg=None):
"""Resize the canvas the turtles are drawing on.
Optional arguments:
canvwidth -- positive integer, new width of canvas in pixels
canvheight -- positive integer, new height of canvas in pixels
bg -- colorstring or ... | [
"def",
"screensize",
"(",
"self",
",",
"canvwidth",
"=",
"None",
",",
"canvheight",
"=",
"None",
",",
"bg",
"=",
"None",
")",
":",
"return",
"self",
".",
"_resize",
"(",
"canvwidth",
",",
"canvheight",
",",
"bg",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/lib-tk/turtle.py#L1402-L1419 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/win32/scripts/regsetup.py | python | LocatePythonCore | (searchPaths) | return installPath, [libPath, corePath] | Locate and validate the core Python directories. Returns a list
of paths that should be used as the core (ie, un-named) portion of
the Python path. | Locate and validate the core Python directories. Returns a list
of paths that should be used as the core (ie, un-named) portion of
the Python path. | [
"Locate",
"and",
"validate",
"the",
"core",
"Python",
"directories",
".",
"Returns",
"a",
"list",
"of",
"paths",
"that",
"should",
"be",
"used",
"as",
"the",
"core",
"(",
"ie",
"un",
"-",
"named",
")",
"portion",
"of",
"the",
"Python",
"path",
"."
] | def LocatePythonCore(searchPaths):
"""Locate and validate the core Python directories. Returns a list
of paths that should be used as the core (ie, un-named) portion of
the Python path.
"""
import os, regutil
currentPath = regutil.GetRegisteredNamedPath(None)
if currentPath:
prese... | [
"def",
"LocatePythonCore",
"(",
"searchPaths",
")",
":",
"import",
"os",
",",
"regutil",
"currentPath",
"=",
"regutil",
".",
"GetRegisteredNamedPath",
"(",
"None",
")",
"if",
"currentPath",
":",
"presearchPaths",
"=",
"currentPath",
".",
"split",
"(",
"\";\"",
... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/win32/scripts/regsetup.py#L201-L234 | |
jsupancic/deep_hand_pose | 22cbeae1a8410ff5d37c060c7315719d0a5d608f | 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/jsupancic/deep_hand_pose/blob/22cbeae1a8410ff5d37c060c7315719d0a5d608f/scripts/cpp_lint.py#L2301-L2366 | ||
weolar/miniblink49 | 1c4678db0594a4abde23d3ebbcc7cd13c3170777 | v8_4_5/PRESUBMIT.py | python | _CommonChecks | (input_api, output_api) | return results | Checks common to both upload and commit. | Checks common to both upload and commit. | [
"Checks",
"common",
"to",
"both",
"upload",
"and",
"commit",
"."
] | def _CommonChecks(input_api, output_api):
"""Checks common to both upload and commit."""
results = []
results.extend(input_api.canned_checks.CheckOwners(
input_api, output_api, source_file_filter=None))
results.extend(input_api.canned_checks.CheckPatchFormatted(
input_api, output_api))
results.ext... | [
"def",
"_CommonChecks",
"(",
"input_api",
",",
"output_api",
")",
":",
"results",
"=",
"[",
"]",
"results",
".",
"extend",
"(",
"input_api",
".",
"canned_checks",
".",
"CheckOwners",
"(",
"input_api",
",",
"output_api",
",",
"source_file_filter",
"=",
"None",
... | https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/v8_4_5/PRESUBMIT.py#L187-L198 | |
macchina-io/macchina.io | ef24ba0e18379c3dd48fb84e6dbf991101cb8db0 | platform/JS/V8/tools/gyp/pylib/gyp/ordered_dict.py | python | OrderedDict.keys | (self) | return list(self) | od.keys() -> list of keys in od | od.keys() -> list of keys in od | [
"od",
".",
"keys",
"()",
"-",
">",
"list",
"of",
"keys",
"in",
"od"
] | def keys(self):
'od.keys() -> list of keys in od'
return list(self) | [
"def",
"keys",
"(",
"self",
")",
":",
"return",
"list",
"(",
"self",
")"
] | https://github.com/macchina-io/macchina.io/blob/ef24ba0e18379c3dd48fb84e6dbf991101cb8db0/platform/JS/V8/tools/gyp/pylib/gyp/ordered_dict.py#L143-L145 | |
stan-dev/math | 5fd79f89933269a4ca4d8dd1fde2a36d53d4768c | lib/boost_1.75.0/tools/build/src/build/property.py | python | PropertyMap.insert | (self, properties, value) | Associate value with properties. | Associate value with properties. | [
"Associate",
"value",
"with",
"properties",
"."
] | def insert (self, properties, value):
""" Associate value with properties.
"""
assert is_iterable_typed(properties, basestring)
assert isinstance(value, basestring)
self.__properties.append(properties)
self.__values.append(value) | [
"def",
"insert",
"(",
"self",
",",
"properties",
",",
"value",
")",
":",
"assert",
"is_iterable_typed",
"(",
"properties",
",",
"basestring",
")",
"assert",
"isinstance",
"(",
"value",
",",
"basestring",
")",
"self",
".",
"__properties",
".",
"append",
"(",
... | https://github.com/stan-dev/math/blob/5fd79f89933269a4ca4d8dd1fde2a36d53d4768c/lib/boost_1.75.0/tools/build/src/build/property.py#L590-L596 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/dataset/engine/datasets.py | python | Schema.from_json | (self, json_obj) | Get schema file from JSON object.
Args:
json_obj(dictionary): Object of JSON parsed.
Raises:
RuntimeError: if there is unknown item in the object.
RuntimeError: if dataset type is missing in the object.
RuntimeError: if columns are missing in the object. | Get schema file from JSON object. | [
"Get",
"schema",
"file",
"from",
"JSON",
"object",
"."
] | def from_json(self, json_obj):
"""
Get schema file from JSON object.
Args:
json_obj(dictionary): Object of JSON parsed.
Raises:
RuntimeError: if there is unknown item in the object.
RuntimeError: if dataset type is missing in the object.
... | [
"def",
"from_json",
"(",
"self",
",",
"json_obj",
")",
":",
"self",
".",
"cpp_schema",
".",
"from_string",
"(",
"json",
".",
"dumps",
"(",
"json_obj",
",",
"indent",
"=",
"2",
")",
")"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/dataset/engine/datasets.py#L6360-L6372 | ||
perilouswithadollarsign/cstrike15_src | f82112a2388b841d72cb62ca48ab1846dfcc11c8 | thirdparty/protobuf-2.5.0/python/google/protobuf/descriptor_pool.py | python | DescriptorPool.FindMessageTypeByName | (self, full_name) | return self._descriptors[full_name] | Loads the named descriptor from the pool.
Args:
full_name: The full name of the descriptor to load.
Returns:
The descriptor for the named type. | Loads the named descriptor from the pool. | [
"Loads",
"the",
"named",
"descriptor",
"from",
"the",
"pool",
"."
] | def FindMessageTypeByName(self, full_name):
"""Loads the named descriptor from the pool.
Args:
full_name: The full name of the descriptor to load.
Returns:
The descriptor for the named type.
"""
full_name = full_name.lstrip('.') # fix inconsistent qualified name formats
if full_n... | [
"def",
"FindMessageTypeByName",
"(",
"self",
",",
"full_name",
")",
":",
"full_name",
"=",
"full_name",
".",
"lstrip",
"(",
"'.'",
")",
"# fix inconsistent qualified name formats",
"if",
"full_name",
"not",
"in",
"self",
".",
"_descriptors",
":",
"self",
".",
"F... | https://github.com/perilouswithadollarsign/cstrike15_src/blob/f82112a2388b841d72cb62ca48ab1846dfcc11c8/thirdparty/protobuf-2.5.0/python/google/protobuf/descriptor_pool.py#L140-L153 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/idlelib/PyShell.py | python | PyShell.endexecuting | (self) | Helper for ModifiedInterpreter | Helper for ModifiedInterpreter | [
"Helper",
"for",
"ModifiedInterpreter"
] | def endexecuting(self):
"Helper for ModifiedInterpreter"
self.executing = 0
self.canceled = 0
self.showprompt() | [
"def",
"endexecuting",
"(",
"self",
")",
":",
"self",
".",
"executing",
"=",
"0",
"self",
".",
"canceled",
"=",
"0",
"self",
".",
"showprompt",
"(",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/idlelib/PyShell.py#L972-L976 | ||
gimli-org/gimli | 17aa2160de9b15ababd9ef99e89b1bc3277bbb23 | pygimli/physics/ert/ertModelling.py | python | ERTModelling.createJacobian | (self, mod) | return self._core.createJacobian(mod) | Compute Jacobian matrix and store but not return. | Compute Jacobian matrix and store but not return. | [
"Compute",
"Jacobian",
"matrix",
"and",
"store",
"but",
"not",
"return",
"."
] | def createJacobian(self, mod):
"""Compute Jacobian matrix and store but not return."""
# ensure the mesh is initialized
self.mesh()
if self.complex():
if self._conjImag:
pg.warn("Flipping imaginary part for jacobian calc")
mod = self.flipImagPa... | [
"def",
"createJacobian",
"(",
"self",
",",
"mod",
")",
":",
"# ensure the mesh is initialized",
"self",
".",
"mesh",
"(",
")",
"if",
"self",
".",
"complex",
"(",
")",
":",
"if",
"self",
".",
"_conjImag",
":",
"pg",
".",
"warn",
"(",
"\"Flipping imaginary p... | https://github.com/gimli-org/gimli/blob/17aa2160de9b15ababd9ef99e89b1bc3277bbb23/pygimli/physics/ert/ertModelling.py#L156-L173 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/security/fuzzing/python_fuzzing.py | python | FuzzingHelper.get_random_numeric_tensor | (self,
dtype=None,
min_size=_MIN_SIZE,
max_size=_MAX_SIZE,
min_val=_MIN_INT,
max_val=_MAX_INT) | return tf.random.uniform(
shape=shape, minval=min_val, maxval=max_val, dtype=dtype, seed=seed) | Return a tensor of random shape and values.
Generated tensors are capped at dimension sizes of 8, as 2^32 bytes of
requested memory crashes the fuzzer (see b/34190148).
Returns only type that tf.random.uniform can generate. If you need a
different type, consider using tf.cast.
Args:
dtype: T... | Return a tensor of random shape and values. | [
"Return",
"a",
"tensor",
"of",
"random",
"shape",
"and",
"values",
"."
] | def get_random_numeric_tensor(self,
dtype=None,
min_size=_MIN_SIZE,
max_size=_MAX_SIZE,
min_val=_MIN_INT,
max_val=_MAX_INT):
"""Return a tensor of random sh... | [
"def",
"get_random_numeric_tensor",
"(",
"self",
",",
"dtype",
"=",
"None",
",",
"min_size",
"=",
"_MIN_SIZE",
",",
"max_size",
"=",
"_MAX_SIZE",
",",
"min_val",
"=",
"_MIN_INT",
",",
"max_val",
"=",
"_MAX_INT",
")",
":",
"# Max shape can be 8 in length and random... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/security/fuzzing/python_fuzzing.py#L169-L216 | |
KratosMultiphysics/Kratos | 0000833054ed0503424eb28205d6508d9ca6cbbc | applications/MultilevelMonteCarloApplication/external_libraries/XMC/xmc/classDefs_solverWrapper/oscillator.py | python | VanDerPol.trajectory | (self, forcing: Optional[List[float]] = None) | return x.tolist() | Trajectory of the oscillator, with given forcing.
Solves the oscillator problem with forward Euler scheme and uniform temporal mesh.
:param forcing: list of values of external forcing, as discretised on :py:attr:`~.VanDerPol.mesh` (must have same length). If `None`, no forcing is applied.
:ret... | Trajectory of the oscillator, with given forcing. | [
"Trajectory",
"of",
"the",
"oscillator",
"with",
"given",
"forcing",
"."
] | def trajectory(self, forcing: Optional[List[float]] = None) -> List[float]:
"""Trajectory of the oscillator, with given forcing.
Solves the oscillator problem with forward Euler scheme and uniform temporal mesh.
:param forcing: list of values of external forcing, as discretised on :py:attr:`~.... | [
"def",
"trajectory",
"(",
"self",
",",
"forcing",
":",
"Optional",
"[",
"List",
"[",
"float",
"]",
"]",
"=",
"None",
")",
"->",
"List",
"[",
"float",
"]",
":",
"# Shorthands",
"dt",
"=",
"self",
".",
"timestep",
"nb_dt",
"=",
"self",
".",
"_numberTim... | https://github.com/KratosMultiphysics/Kratos/blob/0000833054ed0503424eb28205d6508d9ca6cbbc/applications/MultilevelMonteCarloApplication/external_libraries/XMC/xmc/classDefs_solverWrapper/oscillator.py#L145-L177 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/cookielib.py | python | CookiePolicy.path_return_ok | (self, path, request) | return True | Return false if cookies should not be returned, given cookie path. | Return false if cookies should not be returned, given cookie path. | [
"Return",
"false",
"if",
"cookies",
"should",
"not",
"be",
"returned",
"given",
"cookie",
"path",
"."
] | def path_return_ok(self, path, request):
"""Return false if cookies should not be returned, given cookie path.
"""
return True | [
"def",
"path_return_ok",
"(",
"self",
",",
"path",
",",
"request",
")",
":",
"return",
"True"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/cookielib.py#L832-L835 | |
mysql/mysql-workbench | 2f35f9034f015cbcd22139a60e1baa2e3e8e795c | modules/db.generic/db_generic_re_grt.py | python | GenericReverseEngineering.find_datatype_object | (cls, catalog, datatype_name) | return (False, None) | Finds the datatype object corresponding to the given datatype name.
Returns: a tuple of the form (is_simple_datatype, datatype) where:
is_simple_datatype: True if the datatype was found among the simple datatypes for
its corresponding RDBMS
datatype: ... | Finds the datatype object corresponding to the given datatype name. | [
"Finds",
"the",
"datatype",
"object",
"corresponding",
"to",
"the",
"given",
"datatype",
"name",
"."
] | def find_datatype_object(cls, catalog, datatype_name):
''' Finds the datatype object corresponding to the given datatype name.
Returns: a tuple of the form (is_simple_datatype, datatype) where:
is_simple_datatype: True if the datatype was found among the simple datatypes for
... | [
"def",
"find_datatype_object",
"(",
"cls",
",",
"catalog",
",",
"datatype_name",
")",
":",
"simple_types",
"=",
"cls",
".",
"_rdbms",
".",
"simpleDatatypes",
"user_types",
"=",
"catalog",
".",
"userDatatypes",
"for",
"simple_type",
"in",
"simple_types",
":",
"if... | https://github.com/mysql/mysql-workbench/blob/2f35f9034f015cbcd22139a60e1baa2e3e8e795c/modules/db.generic/db_generic_re_grt.py#L48-L64 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py3/IPython/core/inputtransformer2.py | python | HelpEnd.find | (cls, tokens_by_line) | Find the first help command (foo?) in the cell. | Find the first help command (foo?) in the cell. | [
"Find",
"the",
"first",
"help",
"command",
"(",
"foo?",
")",
"in",
"the",
"cell",
"."
] | def find(cls, tokens_by_line):
"""Find the first help command (foo?) in the cell.
"""
for line in tokens_by_line:
# Last token is NEWLINE; look at last but one
if len(line) > 2 and line[-2].string == '?':
# Find the first token that's not INDENT/DEDENT
... | [
"def",
"find",
"(",
"cls",
",",
"tokens_by_line",
")",
":",
"for",
"line",
"in",
"tokens_by_line",
":",
"# Last token is NEWLINE; look at last but one",
"if",
"len",
"(",
"line",
")",
">",
"2",
"and",
"line",
"[",
"-",
"2",
"]",
".",
"string",
"==",
"'?'",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py3/IPython/core/inputtransformer2.py#L432-L442 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/propgrid.py | python | PropertyGrid.GetSortFunction | (*args, **kwargs) | return _propgrid.PropertyGrid_GetSortFunction(*args, **kwargs) | GetSortFunction(self) -> PGSortCallback | GetSortFunction(self) -> PGSortCallback | [
"GetSortFunction",
"(",
"self",
")",
"-",
">",
"PGSortCallback"
] | def GetSortFunction(*args, **kwargs):
"""GetSortFunction(self) -> PGSortCallback"""
return _propgrid.PropertyGrid_GetSortFunction(*args, **kwargs) | [
"def",
"GetSortFunction",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PropertyGrid_GetSortFunction",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/propgrid.py#L2284-L2286 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/training/saver.py | python | _get_saver_or_default | () | return saver | Returns the saver from SAVERS collection, or creates a default one.
This method is used by other members of the training module, such as
`Scaffold`, or `CheckpointSaverHook`.
Returns:
`Saver`.
Raises:
RuntimeError: If the SAVERS collection already has more than one items. | Returns the saver from SAVERS collection, or creates a default one. | [
"Returns",
"the",
"saver",
"from",
"SAVERS",
"collection",
"or",
"creates",
"a",
"default",
"one",
"."
] | def _get_saver_or_default():
"""Returns the saver from SAVERS collection, or creates a default one.
This method is used by other members of the training module, such as
`Scaffold`, or `CheckpointSaverHook`.
Returns:
`Saver`.
Raises:
RuntimeError: If the SAVERS collection already has more than one i... | [
"def",
"_get_saver_or_default",
"(",
")",
":",
"collection_key",
"=",
"ops",
".",
"GraphKeys",
".",
"SAVERS",
"savers",
"=",
"ops",
".",
"get_collection",
"(",
"collection_key",
")",
"if",
"savers",
":",
"if",
"len",
"(",
"savers",
")",
">",
"1",
":",
"r... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/training/saver.py#L614-L638 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/asyncio/base_events.py | python | BaseEventLoop._make_write_pipe_transport | (self, pipe, protocol, waiter=None,
extra=None) | Create write pipe transport. | Create write pipe transport. | [
"Create",
"write",
"pipe",
"transport",
"."
] | def _make_write_pipe_transport(self, pipe, protocol, waiter=None,
extra=None):
"""Create write pipe transport."""
raise NotImplementedError | [
"def",
"_make_write_pipe_transport",
"(",
"self",
",",
"pipe",
",",
"protocol",
",",
"waiter",
"=",
"None",
",",
"extra",
"=",
"None",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/asyncio/base_events.py#L453-L456 | ||
intel/ros_object_analytics | eb0208edbb6da67e5d5c4092fd2964a2c8d9838e | object_analytics_visualization/scripts/marker_publisher.py | python | ObjectItem.min_text | (self) | return text | Build text marker to hold min text | Build text marker to hold min text | [
"Build",
"text",
"marker",
"to",
"hold",
"min",
"text"
] | def min_text(self):
"""Build text marker to hold min text
"""
text = Marker()
text.header = self._header
text.type = Marker.TEXT_VIEW_FACING
text.action = Marker.ADD
text.scale.z = 0.05
text.color = self.GREEN
text.pose = deepcopy(self.POSE)
... | [
"def",
"min_text",
"(",
"self",
")",
":",
"text",
"=",
"Marker",
"(",
")",
"text",
".",
"header",
"=",
"self",
".",
"_header",
"text",
".",
"type",
"=",
"Marker",
".",
"TEXT_VIEW_FACING",
"text",
".",
"action",
"=",
"Marker",
".",
"ADD",
"text",
".",... | https://github.com/intel/ros_object_analytics/blob/eb0208edbb6da67e5d5c4092fd2964a2c8d9838e/object_analytics_visualization/scripts/marker_publisher.py#L129-L141 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/dataset/engine/validators.py | python | check_gnn_get_all_nodes | (method) | return new_method | A wrapper that wraps a parameter checker around the GNN `get_all_nodes` function. | A wrapper that wraps a parameter checker around the GNN `get_all_nodes` function. | [
"A",
"wrapper",
"that",
"wraps",
"a",
"parameter",
"checker",
"around",
"the",
"GNN",
"get_all_nodes",
"function",
"."
] | def check_gnn_get_all_nodes(method):
"""A wrapper that wraps a parameter checker around the GNN `get_all_nodes` function."""
@wraps(method)
def new_method(self, *args, **kwargs):
[node_type], _ = parse_user_args(method, *args, **kwargs)
type_check(node_type, (int,), "node_type")
re... | [
"def",
"check_gnn_get_all_nodes",
"(",
"method",
")",
":",
"@",
"wraps",
"(",
"method",
")",
"def",
"new_method",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"[",
"node_type",
"]",
",",
"_",
"=",
"parse_user_args",
"(",
"method",
... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/dataset/engine/validators.py#L1589-L1599 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib2to3/pytree.py | python | WildcardPattern.match | (self, node, results=None) | return self.match_seq([node], results) | Does this pattern exactly match a node? | Does this pattern exactly match a node? | [
"Does",
"this",
"pattern",
"exactly",
"match",
"a",
"node?"
] | def match(self, node, results=None):
"""Does this pattern exactly match a node?"""
return self.match_seq([node], results) | [
"def",
"match",
"(",
"self",
",",
"node",
",",
"results",
"=",
"None",
")",
":",
"return",
"self",
".",
"match_seq",
"(",
"[",
"node",
"]",
",",
"results",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib2to3/pytree.py#L707-L709 | |
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/build/pymake/pymake/parserdata.py | python | parsecommandlineargs | (args) | return stmts, r, ' '.join(overrides) | Given a set of arguments from a command-line invocation of make,
parse out the variable definitions and return (stmts, arglist, overridestr) | Given a set of arguments from a command-line invocation of make,
parse out the variable definitions and return (stmts, arglist, overridestr) | [
"Given",
"a",
"set",
"of",
"arguments",
"from",
"a",
"command",
"-",
"line",
"invocation",
"of",
"make",
"parse",
"out",
"the",
"variable",
"definitions",
"and",
"return",
"(",
"stmts",
"arglist",
"overridestr",
")"
] | def parsecommandlineargs(args):
"""
Given a set of arguments from a command-line invocation of make,
parse out the variable definitions and return (stmts, arglist, overridestr)
"""
overrides = []
stmts = StatementList()
r = []
for i in xrange(0, len(args)):
a = args[i]
... | [
"def",
"parsecommandlineargs",
"(",
"args",
")",
":",
"overrides",
"=",
"[",
"]",
"stmts",
"=",
"StatementList",
"(",
")",
"r",
"=",
"[",
"]",
"for",
"i",
"in",
"xrange",
"(",
"0",
",",
"len",
"(",
"args",
")",
")",
":",
"a",
"=",
"args",
"[",
... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/build/pymake/pymake/parserdata.py#L70-L98 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/champagne-tower.py | python | Solution.champagneTower | (self, poured, query_row, query_glass) | return min(result[query_glass], 1) | :type poured: int
:type query_row: int
:type query_glass: int
:rtype: float | :type poured: int
:type query_row: int
:type query_glass: int
:rtype: float | [
":",
"type",
"poured",
":",
"int",
":",
"type",
"query_row",
":",
"int",
":",
"type",
"query_glass",
":",
"int",
":",
"rtype",
":",
"float"
] | def champagneTower(self, poured, query_row, query_glass):
"""
:type poured: int
:type query_row: int
:type query_glass: int
:rtype: float
"""
result = [poured] + [0] * query_row
for i in xrange(1, query_row+1):
for j in reversed(xrange(i+1)):
... | [
"def",
"champagneTower",
"(",
"self",
",",
"poured",
",",
"query_row",
",",
"query_glass",
")",
":",
"result",
"=",
"[",
"poured",
"]",
"+",
"[",
"0",
"]",
"*",
"query_row",
"for",
"i",
"in",
"xrange",
"(",
"1",
",",
"query_row",
"+",
"1",
")",
":"... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/champagne-tower.py#L5-L17 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py3/setuptools/package_index.py | python | PackageIndex.prescan | (self) | Scan urls scheduled for prescanning (e.g. --find-links) | Scan urls scheduled for prescanning (e.g. --find-links) | [
"Scan",
"urls",
"scheduled",
"for",
"prescanning",
"(",
"e",
".",
"g",
".",
"--",
"find",
"-",
"links",
")"
] | def prescan(self):
"""Scan urls scheduled for prescanning (e.g. --find-links)"""
if self.to_scan:
list(map(self.scan_url, self.to_scan))
self.to_scan = None | [
"def",
"prescan",
"(",
"self",
")",
":",
"if",
"self",
".",
"to_scan",
":",
"list",
"(",
"map",
"(",
"self",
".",
"scan_url",
",",
"self",
".",
"to_scan",
")",
")",
"self",
".",
"to_scan",
"=",
"None"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py3/setuptools/package_index.py#L531-L535 | ||
DLR-SC/tigl | d1c5901e948e33d10b1f9659ff3e22c4717b455f | thirdparty/nsiqcppstyle/nsiqcppstyle_checker.py | python | CppLexerNavigator.GetPrevTokenSkipWhiteSpaceAndComment | (self) | return self.GetPrevToken(True, True) | Get Previous Token skip whitespace and comment.
This method changes the current lex position. | Get Previous Token skip whitespace and comment.
This method changes the current lex position. | [
"Get",
"Previous",
"Token",
"skip",
"whitespace",
"and",
"comment",
".",
"This",
"method",
"changes",
"the",
"current",
"lex",
"position",
"."
] | def GetPrevTokenSkipWhiteSpaceAndComment(self):
"""
Get Previous Token skip whitespace and comment.
This method changes the current lex position.
"""
return self.GetPrevToken(True, True) | [
"def",
"GetPrevTokenSkipWhiteSpaceAndComment",
"(",
"self",
")",
":",
"return",
"self",
".",
"GetPrevToken",
"(",
"True",
",",
"True",
")"
] | https://github.com/DLR-SC/tigl/blob/d1c5901e948e33d10b1f9659ff3e22c4717b455f/thirdparty/nsiqcppstyle/nsiqcppstyle_checker.py#L523-L528 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/signal/windows/windows.py | python | _extend | (M, sym) | Extend window by 1 sample if needed for DFT-even symmetry | Extend window by 1 sample if needed for DFT-even symmetry | [
"Extend",
"window",
"by",
"1",
"sample",
"if",
"needed",
"for",
"DFT",
"-",
"even",
"symmetry"
] | def _extend(M, sym):
"""Extend window by 1 sample if needed for DFT-even symmetry"""
if not sym:
return M + 1, True
else:
return M, False | [
"def",
"_extend",
"(",
"M",
",",
"sym",
")",
":",
"if",
"not",
"sym",
":",
"return",
"M",
"+",
"1",
",",
"True",
"else",
":",
"return",
"M",
",",
"False"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/signal/windows/windows.py#L26-L31 | ||
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Path/PathScripts/PathEngraveGui.py | python | TaskPanelOpPage.taskPanelBaseGeometryPage | (self, obj, features) | return TaskPanelBaseGeometryPage(obj, features) | taskPanelBaseGeometryPage(obj, features) ... return page for adding base geometries. | taskPanelBaseGeometryPage(obj, features) ... return page for adding base geometries. | [
"taskPanelBaseGeometryPage",
"(",
"obj",
"features",
")",
"...",
"return",
"page",
"for",
"adding",
"base",
"geometries",
"."
] | def taskPanelBaseGeometryPage(self, obj, features):
"""taskPanelBaseGeometryPage(obj, features) ... return page for adding base geometries."""
return TaskPanelBaseGeometryPage(obj, features) | [
"def",
"taskPanelBaseGeometryPage",
"(",
"self",
",",
"obj",
",",
"features",
")",
":",
"return",
"TaskPanelBaseGeometryPage",
"(",
"obj",
",",
"features",
")"
] | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Path/PathScripts/PathEngraveGui.py#L162-L164 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/thumbnailctrl.py | python | GetMondrianImage | () | return wx.ImageFromStream(stream) | Returns a default image placeholder as a :class:`Image`. | Returns a default image placeholder as a :class:`Image`. | [
"Returns",
"a",
"default",
"image",
"placeholder",
"as",
"a",
":",
"class",
":",
"Image",
"."
] | def GetMondrianImage():
""" Returns a default image placeholder as a :class:`Image`. """
stream = cStringIO.StringIO(GetMondrianData())
return wx.ImageFromStream(stream) | [
"def",
"GetMondrianImage",
"(",
")",
":",
"stream",
"=",
"cStringIO",
".",
"StringIO",
"(",
"GetMondrianData",
"(",
")",
")",
"return",
"wx",
".",
"ImageFromStream",
"(",
"stream",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/thumbnailctrl.py#L196-L200 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | third_party/bintrees/bintrees/treemixin.py | python | TreeMixin.pop | (self, key, *args) | T.pop(k[,d]) -> v, remove specified key and return the corresponding value
If key is not found, d is returned if given, otherwise KeyError is raised | T.pop(k[,d]) -> v, remove specified key and return the corresponding value
If key is not found, d is returned if given, otherwise KeyError is raised | [
"T",
".",
"pop",
"(",
"k",
"[",
"d",
"]",
")",
"-",
">",
"v",
"remove",
"specified",
"key",
"and",
"return",
"the",
"corresponding",
"value",
"If",
"key",
"is",
"not",
"found",
"d",
"is",
"returned",
"if",
"given",
"otherwise",
"KeyError",
"is",
"rai... | def pop(self, key, *args):
""" T.pop(k[,d]) -> v, remove specified key and return the corresponding value
If key is not found, d is returned if given, otherwise KeyError is raised
"""
if len(args) > 1:
raise TypeError("pop expected at most 2 arguments, got %d" % (1 + len(args... | [
"def",
"pop",
"(",
"self",
",",
"key",
",",
"*",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
">",
"1",
":",
"raise",
"TypeError",
"(",
"\"pop expected at most 2 arguments, got %d\"",
"%",
"(",
"1",
"+",
"len",
"(",
"args",
")",
")",
")",
"try",
... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/third_party/bintrees/bintrees/treemixin.py#L409-L423 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/distribute/distribute_lib.py | python | _require_strategy_scope_extended | (extended) | Verify in a `distribution_strategy.scope()` in this thread. | Verify in a `distribution_strategy.scope()` in this thread. | [
"Verify",
"in",
"a",
"distribution_strategy",
".",
"scope",
"()",
"in",
"this",
"thread",
"."
] | def _require_strategy_scope_extended(extended):
"""Verify in a `distribution_strategy.scope()` in this thread."""
context = _get_per_thread_mode()
if context.strategy.extended is extended: return
# Report error.
strategy = extended._container_strategy() # pylint: disable=protected-access
_wrong_strategy_sc... | [
"def",
"_require_strategy_scope_extended",
"(",
"extended",
")",
":",
"context",
"=",
"_get_per_thread_mode",
"(",
")",
"if",
"context",
".",
"strategy",
".",
"extended",
"is",
"extended",
":",
"return",
"# Report error.",
"strategy",
"=",
"extended",
".",
"_conta... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/distribute/distribute_lib.py#L349-L355 | ||
quarnster/SublimeClang | 6823e7f0904e60680ac9f898108e301582ec5505 | internals/clang/cindex.py | python | Type.is_restrict_qualified | (self) | return Type_is_restrict_qualified(self) | Determine whether a Type has the "restrict" qualifier set,
without looking through typedefs that may have added
"restrict" at a different level. | Determine whether a Type has the "restrict" qualifier set,
without looking through typedefs that may have added
"restrict" at a different level. | [
"Determine",
"whether",
"a",
"Type",
"has",
"the",
"restrict",
"qualifier",
"set",
"without",
"looking",
"through",
"typedefs",
"that",
"may",
"have",
"added",
"restrict",
"at",
"a",
"different",
"level",
"."
] | def is_restrict_qualified(self):
"""
Determine whether a Type has the "restrict" qualifier set,
without looking through typedefs that may have added
"restrict" at a different level.
"""
return Type_is_restrict_qualified(self) | [
"def",
"is_restrict_qualified",
"(",
"self",
")",
":",
"return",
"Type_is_restrict_qualified",
"(",
"self",
")"
] | https://github.com/quarnster/SublimeClang/blob/6823e7f0904e60680ac9f898108e301582ec5505/internals/clang/cindex.py#L1485-L1491 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/python/ops/rnn_cell.py | python | GRUCell.__call__ | (self, inputs, state, scope=None) | return new_h, new_h | Gated recurrent unit (GRU) with nunits cells. | Gated recurrent unit (GRU) with nunits cells. | [
"Gated",
"recurrent",
"unit",
"(",
"GRU",
")",
"with",
"nunits",
"cells",
"."
] | def __call__(self, inputs, state, scope=None):
"""Gated recurrent unit (GRU) with nunits cells."""
with vs.variable_scope(scope or type(self).__name__): # "GRUCell"
with vs.variable_scope("Gates"): # Reset gate and update gate.
# We start with bias of 1.0 to not reset and not update.
r, ... | [
"def",
"__call__",
"(",
"self",
",",
"inputs",
",",
"state",
",",
"scope",
"=",
"None",
")",
":",
"with",
"vs",
".",
"variable_scope",
"(",
"scope",
"or",
"type",
"(",
"self",
")",
".",
"__name__",
")",
":",
"# \"GRUCell\"",
"with",
"vs",
".",
"varia... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/ops/rnn_cell.py#L220-L232 | |
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/contrib/linear_optimizer/python/ops/sdca_ops.py | python | SdcaModel._l1_loss | (self) | Computes the (un-normalized) l1 loss of the model. | Computes the (un-normalized) l1 loss of the model. | [
"Computes",
"the",
"(",
"un",
"-",
"normalized",
")",
"l1",
"loss",
"of",
"the",
"model",
"."
] | def _l1_loss(self):
"""Computes the (un-normalized) l1 loss of the model."""
with name_scope('l1_loss'):
sum = 0.0
for name in ['sparse_features_weights', 'dense_features_weights']:
for weights in self._convert_n_to_tensor(self._variables[name]):
sum += math_ops.reduce_sum(math_ops... | [
"def",
"_l1_loss",
"(",
"self",
")",
":",
"with",
"name_scope",
"(",
"'l1_loss'",
")",
":",
"sum",
"=",
"0.0",
"for",
"name",
"in",
"[",
"'sparse_features_weights'",
",",
"'dense_features_weights'",
"]",
":",
"for",
"weights",
"in",
"self",
".",
"_convert_n_... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/contrib/linear_optimizer/python/ops/sdca_ops.py#L398-L406 | ||
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | third_party/numpy/files/numpy/oldnumeric/ma.py | python | zeros | (shape, dtype=float) | return array(numeric.zeros(shape, dtype)) | zeros(n, dtype=float) =
an array of all zeros of the given length or shape. | zeros(n, dtype=float) =
an array of all zeros of the given length or shape. | [
"zeros",
"(",
"n",
"dtype",
"=",
"float",
")",
"=",
"an",
"array",
"of",
"all",
"zeros",
"of",
"the",
"given",
"length",
"or",
"shape",
"."
] | def zeros (shape, dtype=float):
"""zeros(n, dtype=float) =
an array of all zeros of the given length or shape."""
return array(numeric.zeros(shape, dtype)) | [
"def",
"zeros",
"(",
"shape",
",",
"dtype",
"=",
"float",
")",
":",
"return",
"array",
"(",
"numeric",
".",
"zeros",
"(",
"shape",
",",
"dtype",
")",
")"
] | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/oldnumeric/ma.py#L1552-L1555 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/coremltools_wrap/coremltools/coremltools/models/model.py | python | MLModel.save | (self, filename) | Save the model to a .mlmodel format.
Parameters
----------
filename: str
Target filename for the model.
See Also
--------
coremltools.utils.load_model
Examples
--------
>>> model.save('my_model_file.mlmodel')
>>> loaded_model... | Save the model to a .mlmodel format. | [
"Save",
"the",
"model",
"to",
"a",
".",
"mlmodel",
"format",
"."
] | def save(self, filename):
"""
Save the model to a .mlmodel format.
Parameters
----------
filename: str
Target filename for the model.
See Also
--------
coremltools.utils.load_model
Examples
--------
>>> model.save('my... | [
"def",
"save",
"(",
"self",
",",
"filename",
")",
":",
"filename",
"=",
"_os",
".",
"path",
".",
"expanduser",
"(",
"filename",
")",
"_save_spec",
"(",
"self",
".",
"_spec",
",",
"filename",
")"
] | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/coremltools_wrap/coremltools/coremltools/models/model.py#L266-L285 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/linecache.py | python | updatecache | (filename, module_globals=None) | return lines | Update a cache entry and return its list of lines.
If something's wrong, print a message, discard the cache entry,
and return an empty list. | Update a cache entry and return its list of lines.
If something's wrong, print a message, discard the cache entry,
and return an empty list. | [
"Update",
"a",
"cache",
"entry",
"and",
"return",
"its",
"list",
"of",
"lines",
".",
"If",
"something",
"s",
"wrong",
"print",
"a",
"message",
"discard",
"the",
"cache",
"entry",
"and",
"return",
"an",
"empty",
"list",
"."
] | def updatecache(filename, module_globals=None):
"""Update a cache entry and return its list of lines.
If something's wrong, print a message, discard the cache entry,
and return an empty list."""
if filename in cache:
if len(cache[filename]) != 1:
cache.pop(filename, None)
if not... | [
"def",
"updatecache",
"(",
"filename",
",",
"module_globals",
"=",
"None",
")",
":",
"if",
"filename",
"in",
"cache",
":",
"if",
"len",
"(",
"cache",
"[",
"filename",
"]",
")",
"!=",
"1",
":",
"cache",
".",
"pop",
"(",
"filename",
",",
"None",
")",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/linecache.py#L82-L144 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/training/python/training/training.py | python | clip_gradient_norms_fn | (max_norm) | return clip_norms | Returns a `transform_grads_fn` function for gradient clipping. | Returns a `transform_grads_fn` function for gradient clipping. | [
"Returns",
"a",
"transform_grads_fn",
"function",
"for",
"gradient",
"clipping",
"."
] | def clip_gradient_norms_fn(max_norm):
"""Returns a `transform_grads_fn` function for gradient clipping."""
def clip_norms(gradients_to_variables):
return clip_gradient_norms(gradients_to_variables, max_norm)
return clip_norms | [
"def",
"clip_gradient_norms_fn",
"(",
"max_norm",
")",
":",
"def",
"clip_norms",
"(",
"gradients_to_variables",
")",
":",
"return",
"clip_gradient_norms",
"(",
"gradients_to_variables",
",",
"max_norm",
")",
"return",
"clip_norms"
] | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/training/python/training/training.py#L320-L324 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/ops/distributions/dirichlet_multinomial.py | python | DirichletMultinomial._maybe_assert_valid_sample | (self, counts) | return control_flow_ops.with_dependencies([
check_ops.assert_equal(
self.total_count, math_ops.reduce_sum(counts, -1),
message="counts last-dimension must sum to `self.total_count`"),
], counts) | Check counts for proper shape, values, then return tensor version. | Check counts for proper shape, values, then return tensor version. | [
"Check",
"counts",
"for",
"proper",
"shape",
"values",
"then",
"return",
"tensor",
"version",
"."
] | def _maybe_assert_valid_sample(self, counts):
"""Check counts for proper shape, values, then return tensor version."""
if not self.validate_args:
return counts
counts = distribution_util.embed_check_nonnegative_integer_form(counts)
return control_flow_ops.with_dependencies([
check_ops.asse... | [
"def",
"_maybe_assert_valid_sample",
"(",
"self",
",",
"counts",
")",
":",
"if",
"not",
"self",
".",
"validate_args",
":",
"return",
"counts",
"counts",
"=",
"distribution_util",
".",
"embed_check_nonnegative_integer_form",
"(",
"counts",
")",
"return",
"control_flo... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/distributions/dirichlet_multinomial.py#L334-L343 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/tools/gyp/pylib/gyp/msvs_emulation.py | python | _FindDirectXInstallation | () | return dxsdk_dir | Try to find an installation location for the DirectX SDK. Check for the
standard environment variable, and if that doesn't exist, try to find
via the registry. May return None if not found in either location. | Try to find an installation location for the DirectX SDK. Check for the
standard environment variable, and if that doesn't exist, try to find
via the registry. May return None if not found in either location. | [
"Try",
"to",
"find",
"an",
"installation",
"location",
"for",
"the",
"DirectX",
"SDK",
".",
"Check",
"for",
"the",
"standard",
"environment",
"variable",
"and",
"if",
"that",
"doesn",
"t",
"exist",
"try",
"to",
"find",
"via",
"the",
"registry",
".",
"May",... | def _FindDirectXInstallation():
"""Try to find an installation location for the DirectX SDK. Check for the
standard environment variable, and if that doesn't exist, try to find
via the registry. May return None if not found in either location."""
# Return previously calculated value, if there is one
if hasatt... | [
"def",
"_FindDirectXInstallation",
"(",
")",
":",
"# Return previously calculated value, if there is one",
"if",
"hasattr",
"(",
"_FindDirectXInstallation",
",",
"'dxsdk_dir'",
")",
":",
"return",
"_FindDirectXInstallation",
".",
"dxsdk_dir",
"dxsdk_dir",
"=",
"os",
".",
... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/tools/gyp/pylib/gyp/msvs_emulation.py#L121-L143 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/masked/numctrl.py | python | NumCtrl.SetValue | (self, value) | Sets the value of the control to the value specified.
The resulting actual value of the control may be altered to
conform with the bounds set on the control if limited,
or colored if not limited but the value is out-of-bounds.
A ValueError exception will be raised if an invalid value
... | Sets the value of the control to the value specified.
The resulting actual value of the control may be altered to
conform with the bounds set on the control if limited,
or colored if not limited but the value is out-of-bounds.
A ValueError exception will be raised if an invalid value
... | [
"Sets",
"the",
"value",
"of",
"the",
"control",
"to",
"the",
"value",
"specified",
".",
"The",
"resulting",
"actual",
"value",
"of",
"the",
"control",
"may",
"be",
"altered",
"to",
"conform",
"with",
"the",
"bounds",
"set",
"on",
"the",
"control",
"if",
... | def SetValue(self, value):
"""
Sets the value of the control to the value specified.
The resulting actual value of the control may be altered to
conform with the bounds set on the control if limited,
or colored if not limited but the value is out-of-bounds.
A ValueError e... | [
"def",
"SetValue",
"(",
"self",
",",
"value",
")",
":",
"## dbg('NumCtrl::SetValue(%s)' % value, indent=1)",
"BaseMaskedTextCtrl",
".",
"SetValue",
"(",
"self",
",",
"self",
".",
"_toGUI",
"(",
"value",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/masked/numctrl.py#L1271-L1281 | ||
OSGeo/gdal | 3748fc4ba4fba727492774b2b908a2130c864a83 | swig/python/osgeo/gdal.py | python | GetLastErrorMsg | (*args) | return _gdal.GetLastErrorMsg(*args) | r"""GetLastErrorMsg() -> char const * | r"""GetLastErrorMsg() -> char const * | [
"r",
"GetLastErrorMsg",
"()",
"-",
">",
"char",
"const",
"*"
] | def GetLastErrorMsg(*args):
r"""GetLastErrorMsg() -> char const *"""
return _gdal.GetLastErrorMsg(*args) | [
"def",
"GetLastErrorMsg",
"(",
"*",
"args",
")",
":",
"return",
"_gdal",
".",
"GetLastErrorMsg",
"(",
"*",
"args",
")"
] | https://github.com/OSGeo/gdal/blob/3748fc4ba4fba727492774b2b908a2130c864a83/swig/python/osgeo/gdal.py#L1558-L1560 | |
microsoft/CNTK | e9396480025b9ca457d26b6f33dd07c474c6aa04 | bindings/python/cntk/train/distributed.py | python | Communicator.barrier | (self) | Sync point to make sure all workers reach the same state. | Sync point to make sure all workers reach the same state. | [
"Sync",
"point",
"to",
"make",
"sure",
"all",
"workers",
"reach",
"the",
"same",
"state",
"."
] | def barrier(self):
'''
Sync point to make sure all workers reach the same state.
'''
super(Communicator, self).barrier() | [
"def",
"barrier",
"(",
"self",
")",
":",
"super",
"(",
"Communicator",
",",
"self",
")",
".",
"barrier",
"(",
")"
] | https://github.com/microsoft/CNTK/blob/e9396480025b9ca457d26b6f33dd07c474c6aa04/bindings/python/cntk/train/distributed.py#L67-L71 | ||
trilinos/Trilinos | 6168be6dd51e35e1cd681e9c4b24433e709df140 | packages/seacas/scripts/exodus3.in.py | python | exodus.put_side_set_names | (self, names) | store a list of all side set names ordered by side set *INDEX*;
(see `exodus.get_ids` for explanation of the
difference between side set *ID* and side set *INDEX*)
>>> exo.put_side_set_names(side_set_names)
Parameters
----------
<list<string>> side_set_names | store a list of all side set names ordered by side set *INDEX*;
(see `exodus.get_ids` for explanation of the
difference between side set *ID* and side set *INDEX*) | [
"store",
"a",
"list",
"of",
"all",
"side",
"set",
"names",
"ordered",
"by",
"side",
"set",
"*",
"INDEX",
"*",
";",
"(",
"see",
"exodus",
".",
"get_ids",
"for",
"explanation",
"of",
"the",
"difference",
"between",
"side",
"set",
"*",
"ID",
"*",
"and",
... | def put_side_set_names(self, names):
"""
store a list of all side set names ordered by side set *INDEX*;
(see `exodus.get_ids` for explanation of the
difference between side set *ID* and side set *INDEX*)
>>> exo.put_side_set_names(side_set_names)
Parameters
---... | [
"def",
"put_side_set_names",
"(",
"self",
",",
"names",
")",
":",
"self",
".",
"__ex_put_names",
"(",
"'EX_SIDE_SET'",
",",
"names",
")"
] | https://github.com/trilinos/Trilinos/blob/6168be6dd51e35e1cd681e9c4b24433e709df140/packages/seacas/scripts/exodus3.in.py#L3795-L3807 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/eager/python/metrics_impl.py | python | Metric.result | (self) | Computes and returns a final value for the metric. | Computes and returns a final value for the metric. | [
"Computes",
"and",
"returns",
"a",
"final",
"value",
"for",
"the",
"metric",
"."
] | def result(self): # TODO(josh11b): Add an optional summary_writer parameter.
"""Computes and returns a final value for the metric."""
raise NotImplementedError("Metrics must define a result() member function") | [
"def",
"result",
"(",
"self",
")",
":",
"# TODO(josh11b): Add an optional summary_writer parameter.",
"raise",
"NotImplementedError",
"(",
"\"Metrics must define a result() member function\"",
")"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/eager/python/metrics_impl.py#L213-L215 | ||
deepmind/open_spiel | 4ca53bea32bb2875c7385d215424048ae92f78c8 | open_spiel/python/examples/jpsro.py | python | get_game | (game_name) | return pyspiel.load_game_as_turn_based(game_name, game_kwargs) | Returns the game. | Returns the game. | [
"Returns",
"the",
"game",
"."
] | def get_game(game_name):
"""Returns the game."""
if game_name == "kuhn_poker_2p":
game_name = "kuhn_poker"
game_kwargs = {"players": int(2)}
elif game_name == "kuhn_poker_3p":
game_name = "kuhn_poker"
game_kwargs = {"players": int(3)}
elif game_name == "kuhn_poker_4p":
game_name = "kuhn_pok... | [
"def",
"get_game",
"(",
"game_name",
")",
":",
"if",
"game_name",
"==",
"\"kuhn_poker_2p\"",
":",
"game_name",
"=",
"\"kuhn_poker\"",
"game_kwargs",
"=",
"{",
"\"players\"",
":",
"int",
"(",
"2",
")",
"}",
"elif",
"game_name",
"==",
"\"kuhn_poker_3p\"",
":",
... | https://github.com/deepmind/open_spiel/blob/4ca53bea32bb2875c7385d215424048ae92f78c8/open_spiel/python/examples/jpsro.py#L110-L195 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/core/arrays/datetimelike.py | python | DatetimeLikeArrayMixin._maybe_mask_results | (
self, result: np.ndarray, fill_value=iNaT, convert=None
) | return result | Parameters
----------
result : np.ndarray
fill_value : object, default iNaT
convert : str, dtype or None
Returns
-------
result : ndarray with values replace by the fill_value
mask the result if needed, convert to the provided dtype if its not
No... | Parameters
----------
result : np.ndarray
fill_value : object, default iNaT
convert : str, dtype or None | [
"Parameters",
"----------",
"result",
":",
"np",
".",
"ndarray",
"fill_value",
":",
"object",
"default",
"iNaT",
"convert",
":",
"str",
"dtype",
"or",
"None"
] | def _maybe_mask_results(
self, result: np.ndarray, fill_value=iNaT, convert=None
) -> np.ndarray:
"""
Parameters
----------
result : np.ndarray
fill_value : object, default iNaT
convert : str, dtype or None
Returns
-------
result : nda... | [
"def",
"_maybe_mask_results",
"(",
"self",
",",
"result",
":",
"np",
".",
"ndarray",
",",
"fill_value",
"=",
"iNaT",
",",
"convert",
"=",
"None",
")",
"->",
"np",
".",
"ndarray",
":",
"if",
"self",
".",
"_hasnans",
":",
"if",
"convert",
":",
"result",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/arrays/datetimelike.py#L850-L875 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_gdi.py | python | Brush.SetStipple | (*args, **kwargs) | return _gdi_.Brush_SetStipple(*args, **kwargs) | SetStipple(self, Bitmap stipple)
Sets the stipple `wx.Bitmap`. | SetStipple(self, Bitmap stipple) | [
"SetStipple",
"(",
"self",
"Bitmap",
"stipple",
")"
] | def SetStipple(*args, **kwargs):
"""
SetStipple(self, Bitmap stipple)
Sets the stipple `wx.Bitmap`.
"""
return _gdi_.Brush_SetStipple(*args, **kwargs) | [
"def",
"SetStipple",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"Brush_SetStipple",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_gdi.py#L537-L543 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/valgrind/tsan_analyze.py | python | TsanAnalyzer.__init__ | (self, use_gdb=False) | Reads in a set of files. | Reads in a set of files. | [
"Reads",
"in",
"a",
"set",
"of",
"files",
"."
] | def __init__(self, use_gdb=False):
'''Reads in a set of files.'''
self._use_gdb = use_gdb
self._cur_testcase = None | [
"def",
"__init__",
"(",
"self",
",",
"use_gdb",
"=",
"False",
")",
":",
"self",
".",
"_use_gdb",
"=",
"use_gdb",
"self",
".",
"_cur_testcase",
"=",
"None"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/valgrind/tsan_analyze.py#L62-L66 | ||
priyankchheda/algorithms | c361aa9071573fa9966d5b02d05e524815abcf2b | graph/connected_components.py | python | main | () | operational function | operational function | [
"operational",
"function"
] | def main():
""" operational function """
graph = {
'1': ['2', '3'],
'2': ['3', '1'],
'3': ['1', '2', '4'],
'4': ['3'],
'5': ['7', '6'],
'6': ['5'],
'7': ['5'],
'8': [],
'9': [],
}
print(find_components(graph)) | [
"def",
"main",
"(",
")",
":",
"graph",
"=",
"{",
"'1'",
":",
"[",
"'2'",
",",
"'3'",
"]",
",",
"'2'",
":",
"[",
"'3'",
",",
"'1'",
"]",
",",
"'3'",
":",
"[",
"'1'",
",",
"'2'",
",",
"'4'",
"]",
",",
"'4'",
":",
"[",
"'3'",
"]",
",",
"'5... | https://github.com/priyankchheda/algorithms/blob/c361aa9071573fa9966d5b02d05e524815abcf2b/graph/connected_components.py#L25-L39 | ||
PixarAnimationStudios/USD | faed18ce62c8736b02413635b584a2f637156bad | pxr/usd/usd/usdGenSchema.py | python | _GetTokensPrefix | (layer) | return _GetLibMetadata(layer).get('tokensPrefix',
_GetLibPrefix(layer)) | Return the tokensPrefix defined in layer. | Return the tokensPrefix defined in layer. | [
"Return",
"the",
"tokensPrefix",
"defined",
"in",
"layer",
"."
] | def _GetTokensPrefix(layer):
""" Return the tokensPrefix defined in layer."""
return _GetLibMetadata(layer).get('tokensPrefix',
_GetLibPrefix(layer)) | [
"def",
"_GetTokensPrefix",
"(",
"layer",
")",
":",
"return",
"_GetLibMetadata",
"(",
"layer",
")",
".",
"get",
"(",
"'tokensPrefix'",
",",
"_GetLibPrefix",
"(",
"layer",
")",
")"
] | https://github.com/PixarAnimationStudios/USD/blob/faed18ce62c8736b02413635b584a2f637156bad/pxr/usd/usd/usdGenSchema.py#L214-L218 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/learn/python/learn/ops/seq2seq_ops.py | python | rnn_seq2seq | (encoder_inputs,
decoder_inputs,
encoder_cell,
decoder_cell=None,
dtype=dtypes.float32,
scope=None) | RNN Sequence to Sequence model.
Args:
encoder_inputs: List of tensors, inputs for encoder.
decoder_inputs: List of tensors, inputs for decoder.
encoder_cell: RNN cell to use for encoder.
decoder_cell: RNN cell to use for decoder, if None encoder_cell is used.
dtype: Type to initialize encoder sta... | RNN Sequence to Sequence model. | [
"RNN",
"Sequence",
"to",
"Sequence",
"model",
"."
] | def rnn_seq2seq(encoder_inputs,
decoder_inputs,
encoder_cell,
decoder_cell=None,
dtype=dtypes.float32,
scope=None):
"""RNN Sequence to Sequence model.
Args:
encoder_inputs: List of tensors, inputs for encoder.
decoder_inputs: L... | [
"def",
"rnn_seq2seq",
"(",
"encoder_inputs",
",",
"decoder_inputs",
",",
"encoder_cell",
",",
"decoder_cell",
"=",
"None",
",",
"dtype",
"=",
"dtypes",
".",
"float32",
",",
"scope",
"=",
"None",
")",
":",
"with",
"vs",
".",
"variable_scope",
"(",
"scope",
... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/learn/python/learn/ops/seq2seq_ops.py#L126-L149 | ||
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | python/psutil/psutil/_psmswindows.py | python | virtual_memory | () | return nt_virtmem_info(total, avail, percent, used, free) | System virtual memory as a namedtuple. | System virtual memory as a namedtuple. | [
"System",
"virtual",
"memory",
"as",
"a",
"namedtuple",
"."
] | def virtual_memory():
"""System virtual memory as a namedtuple."""
mem = _psutil_mswindows.get_virtual_mem()
totphys, availphys, totpagef, availpagef, totvirt, freevirt = mem
#
total = totphys
avail = availphys
free = availphys
used = total - avail
percent = usage_percent((total - av... | [
"def",
"virtual_memory",
"(",
")",
":",
"mem",
"=",
"_psutil_mswindows",
".",
"get_virtual_mem",
"(",
")",
"totphys",
",",
"availphys",
",",
"totpagef",
",",
"availpagef",
",",
"totvirt",
",",
"freevirt",
"=",
"mem",
"#",
"total",
"=",
"totphys",
"avail",
... | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/python/psutil/psutil/_psmswindows.py#L105-L115 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | third_party/markdown/extensions/footnotes.py | python | FootnotePreprocessor.detectTabbed | (self, lines) | return items, i | Find indented text and remove indent before further proccesing.
Keyword arguments:
* lines: an array of strings
Returns: a list of post processed items and the index of last line. | Find indented text and remove indent before further proccesing. | [
"Find",
"indented",
"text",
"and",
"remove",
"indent",
"before",
"further",
"proccesing",
"."
] | def detectTabbed(self, lines):
""" Find indented text and remove indent before further proccesing.
Keyword arguments:
* lines: an array of strings
Returns: a list of post processed items and the index of last line.
"""
items = []
blank_line = False # have we e... | [
"def",
"detectTabbed",
"(",
"self",
",",
"lines",
")",
":",
"items",
"=",
"[",
"]",
"blank_line",
"=",
"False",
"# have we encountered a blank line yet?",
"i",
"=",
"0",
"# to keep track of where we are",
"def",
"detab",
"(",
"line",
")",
":",
"match",
"=",
"T... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/third_party/markdown/extensions/footnotes.py#L231-L285 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_gdi.py | python | DC.GetTextForeground | (*args, **kwargs) | return _gdi_.DC_GetTextForeground(*args, **kwargs) | GetTextForeground(self) -> Colour
Gets the current text foreground colour | GetTextForeground(self) -> Colour | [
"GetTextForeground",
"(",
"self",
")",
"-",
">",
"Colour"
] | def GetTextForeground(*args, **kwargs):
"""
GetTextForeground(self) -> Colour
Gets the current text foreground colour
"""
return _gdi_.DC_GetTextForeground(*args, **kwargs) | [
"def",
"GetTextForeground",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"DC_GetTextForeground",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_gdi.py#L4369-L4375 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/calendar.py | python | CalendarDateAttr.SetMark | (*args, **kwargs) | return _calendar.CalendarDateAttr_SetMark(*args, **kwargs) | SetMark(CalendarDateAttr m) | SetMark(CalendarDateAttr m) | [
"SetMark",
"(",
"CalendarDateAttr",
"m",
")"
] | def SetMark(*args, **kwargs):
"""SetMark(CalendarDateAttr m)"""
return _calendar.CalendarDateAttr_SetMark(*args, **kwargs) | [
"def",
"SetMark",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_calendar",
".",
"CalendarDateAttr_SetMark",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/calendar.py#L171-L173 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.