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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/python/turicreate/toolkits/image_classifier/image_classifier.py | python | ImageClassifier.__repr__ | (self) | return out | Print a string description of the model when the model name is entered
in the terminal. | Print a string description of the model when the model name is entered
in the terminal. | [
"Print",
"a",
"string",
"description",
"of",
"the",
"model",
"when",
"the",
"model",
"name",
"is",
"entered",
"in",
"the",
"terminal",
"."
] | def __repr__(self):
"""
Print a string description of the model when the model name is entered
in the terminal.
"""
width = 40
sections, section_titles = self._get_summary_struct()
out = _tkutl._toolkit_repr_print(self, sections, section_titles, width=width)
... | [
"def",
"__repr__",
"(",
"self",
")",
":",
"width",
"=",
"40",
"sections",
",",
"section_titles",
"=",
"self",
".",
"_get_summary_struct",
"(",
")",
"out",
"=",
"_tkutl",
".",
"_toolkit_repr_print",
"(",
"self",
",",
"sections",
",",
"section_titles",
",",
... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/python/turicreate/toolkits/image_classifier/image_classifier.py#L436-L446 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_windows.py | python | SashLayoutWindow.__init__ | (self, *args, **kwargs) | __init__(self, Window parent, int id=-1, Point pos=DefaultPosition,
Size size=DefaultSize, long style=wxCLIP_CHILDREN|wxSW_3D,
String name=SashLayoutNameStr) -> SashLayoutWindow | __init__(self, Window parent, int id=-1, Point pos=DefaultPosition,
Size size=DefaultSize, long style=wxCLIP_CHILDREN|wxSW_3D,
String name=SashLayoutNameStr) -> SashLayoutWindow | [
"__init__",
"(",
"self",
"Window",
"parent",
"int",
"id",
"=",
"-",
"1",
"Point",
"pos",
"=",
"DefaultPosition",
"Size",
"size",
"=",
"DefaultSize",
"long",
"style",
"=",
"wxCLIP_CHILDREN|wxSW_3D",
"String",
"name",
"=",
"SashLayoutNameStr",
")",
"-",
">",
"... | def __init__(self, *args, **kwargs):
"""
__init__(self, Window parent, int id=-1, Point pos=DefaultPosition,
Size size=DefaultSize, long style=wxCLIP_CHILDREN|wxSW_3D,
String name=SashLayoutNameStr) -> SashLayoutWindow
"""
_windows_.SashLayoutWindow_swiginit(se... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_windows_",
".",
"SashLayoutWindow_swiginit",
"(",
"self",
",",
"_windows_",
".",
"new_SashLayoutWindow",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")",
"self",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_windows.py#L2038-L2045 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqt/mantidqt/widgets/plotconfigdialog/__init__.py | python | errorbars_in_ax | (ax) | return any(isinstance(c, ErrorbarContainer) for c in ax.containers) | Return True if there are any ErrorbarContainers in the Axes object | Return True if there are any ErrorbarContainers in the Axes object | [
"Return",
"True",
"if",
"there",
"are",
"any",
"ErrorbarContainers",
"in",
"the",
"Axes",
"object"
] | def errorbars_in_ax(ax):
"""
Return True if there are any ErrorbarContainers in the Axes object
"""
return any(isinstance(c, ErrorbarContainer) for c in ax.containers) | [
"def",
"errorbars_in_ax",
"(",
"ax",
")",
":",
"return",
"any",
"(",
"isinstance",
"(",
"c",
",",
"ErrorbarContainer",
")",
"for",
"c",
"in",
"ax",
".",
"containers",
")"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqt/mantidqt/widgets/plotconfigdialog/__init__.py#L95-L99 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/frame.py | python | DataFrame.mode | (self, axis=0, numeric_only=False, dropna=True) | return data.apply(f, axis=axis) | Get the mode(s) of each element along the selected axis.
The mode of a set of values is the value that appears most often.
It can be multiple values.
Parameters
----------
axis : {0 or 'index', 1 or 'columns'}, default 0
The axis to iterate over while searching for ... | Get the mode(s) of each element along the selected axis. | [
"Get",
"the",
"mode",
"(",
"s",
")",
"of",
"each",
"element",
"along",
"the",
"selected",
"axis",
"."
] | def mode(self, axis=0, numeric_only=False, dropna=True) -> "DataFrame":
"""
Get the mode(s) of each element along the selected axis.
The mode of a set of values is the value that appears most often.
It can be multiple values.
Parameters
----------
axis : {0 or '... | [
"def",
"mode",
"(",
"self",
",",
"axis",
"=",
"0",
",",
"numeric_only",
"=",
"False",
",",
"dropna",
"=",
"True",
")",
"->",
"\"DataFrame\"",
":",
"data",
"=",
"self",
"if",
"not",
"numeric_only",
"else",
"self",
".",
"_get_numeric_data",
"(",
")",
"de... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/frame.py#L8095-L8180 | |
nasa/fprime | 595cf3682d8365943d86c1a6fe7c78f0a116acf0 | Autocoders/Python/src/fprime_ac/utils/pyparsing.py | python | ParseResults.keys | (self) | return list(self.__tokdict.keys()) | Returns all named result keys. | Returns all named result keys. | [
"Returns",
"all",
"named",
"result",
"keys",
"."
] | def keys(self):
"""Returns all named result keys."""
return list(self.__tokdict.keys()) | [
"def",
"keys",
"(",
"self",
")",
":",
"return",
"list",
"(",
"self",
".",
"__tokdict",
".",
"keys",
"(",
")",
")"
] | https://github.com/nasa/fprime/blob/595cf3682d8365943d86c1a6fe7c78f0a116acf0/Autocoders/Python/src/fprime_ac/utils/pyparsing.py#L299-L301 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/python/ops/gradients.py | python | _IndexedSlicesToTensor | (value, dtype=None, name=None, as_ref=False) | return math_ops.unsorted_segment_sum(value.values,
value.indices,
value.dense_shape[0],
name=name) | Converts an IndexedSlices object `value` to a Tensor.
NOTE(mrry): This function is potentially expensive.
Args:
value: An ops.IndexedSlices object.
dtype: The dtype of the Tensor to be returned.
name: Optional name to use for the returned Tensor.
as_ref: True if a ref is requested.
Returns:
... | Converts an IndexedSlices object `value` to a Tensor. | [
"Converts",
"an",
"IndexedSlices",
"object",
"value",
"to",
"a",
"Tensor",
"."
] | def _IndexedSlicesToTensor(value, dtype=None, name=None, as_ref=False):
"""Converts an IndexedSlices object `value` to a Tensor.
NOTE(mrry): This function is potentially expensive.
Args:
value: An ops.IndexedSlices object.
dtype: The dtype of the Tensor to be returned.
name: Optional name to use for... | [
"def",
"_IndexedSlicesToTensor",
"(",
"value",
",",
"dtype",
"=",
"None",
",",
"name",
"=",
"None",
",",
"as_ref",
"=",
"False",
")",
":",
"_",
"=",
"as_ref",
"if",
"dtype",
"and",
"not",
"dtype",
".",
"is_compatible_with",
"(",
"value",
".",
"dtype",
... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/python/ops/gradients.py#L53-L95 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/flatmenu.py | python | FlatMenu.Dismiss | (self, dismissParent, resetOwner) | Dismisses the popup window.
:param bool `dismissParent`: whether to dismiss the parent menu or not;
:param bool `resetOwner`: ``True`` to delete the link between this menu and the
owner menu, ``False`` otherwise. | Dismisses the popup window. | [
"Dismisses",
"the",
"popup",
"window",
"."
] | def Dismiss(self, dismissParent, resetOwner):
"""
Dismisses the popup window.
:param bool `dismissParent`: whether to dismiss the parent menu or not;
:param bool `resetOwner`: ``True`` to delete the link between this menu and the
owner menu, ``False`` otherwise.
... | [
"def",
"Dismiss",
"(",
"self",
",",
"dismissParent",
",",
"resetOwner",
")",
":",
"if",
"self",
".",
"_activeWin",
":",
"self",
".",
"_activeWin",
".",
"PopEventHandler",
"(",
"True",
")",
"self",
".",
"_activeWin",
"=",
"None",
"if",
"self",
".",
"_focu... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/flatmenu.py#L5738-L5762 | ||
tensorflow/deepmath | b5b721f54de1d5d6a02d78f5da5995237f9995f9 | deepmath/premises/model_definition_cnn_flat3.py | python | Model.axiom_embedding | (self, axioms) | return self.make_embedding(axioms) | Compute the embedding for each of the axioms. | Compute the embedding for each of the axioms. | [
"Compute",
"the",
"embedding",
"for",
"each",
"of",
"the",
"axioms",
"."
] | def axiom_embedding(self, axioms):
"""Compute the embedding for each of the axioms."""
return self.make_embedding(axioms) | [
"def",
"axiom_embedding",
"(",
"self",
",",
"axioms",
")",
":",
"return",
"self",
".",
"make_embedding",
"(",
"axioms",
")"
] | https://github.com/tensorflow/deepmath/blob/b5b721f54de1d5d6a02d78f5da5995237f9995f9/deepmath/premises/model_definition_cnn_flat3.py#L59-L61 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/tools/gyp/pylib/gyp/generator/msvs.py | python | _AddConfigurationToMSVS | (p, spec, tools, config, config_type, config_name) | Add to the project file the configuration specified by config.
Arguments:
p: The target project being generated.
spec: the target project dict.
tools: A dictionary of settings; the tool name is the key.
config: The dictionary that defines the special processing to be done
for this configu... | Add to the project file the configuration specified by config. | [
"Add",
"to",
"the",
"project",
"file",
"the",
"configuration",
"specified",
"by",
"config",
"."
] | def _AddConfigurationToMSVS(p, spec, tools, config, config_type, config_name):
"""Add to the project file the configuration specified by config.
Arguments:
p: The target project being generated.
spec: the target project dict.
tools: A dictionary of settings; the tool name is the key.
config: The di... | [
"def",
"_AddConfigurationToMSVS",
"(",
"p",
",",
"spec",
",",
"tools",
",",
"config",
",",
"config_type",
",",
"config_name",
")",
":",
"attributes",
"=",
"_GetMSVSAttributes",
"(",
"spec",
",",
"config",
",",
"config_type",
")",
"# Add in this configuration.",
... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/tools/gyp/pylib/gyp/generator/msvs.py#L1422-L1438 | ||
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py | python | QualifyDependencies | (targets) | Make dependency links fully-qualified relative to the current directory.
|targets| is a dict mapping fully-qualified target names to their target
dicts. For each target in this dict, keys known to contain dependency
links are examined, and any dependencies referenced will be rewritten
so that they are fully-q... | Make dependency links fully-qualified relative to the current directory. | [
"Make",
"dependency",
"links",
"fully",
"-",
"qualified",
"relative",
"to",
"the",
"current",
"directory",
"."
] | def QualifyDependencies(targets):
"""Make dependency links fully-qualified relative to the current directory.
|targets| is a dict mapping fully-qualified target names to their target
dicts. For each target in this dict, keys known to contain dependency
links are examined, and any dependencies referenced will ... | [
"def",
"QualifyDependencies",
"(",
"targets",
")",
":",
"all_dependency_sections",
"=",
"[",
"dep",
"+",
"op",
"for",
"dep",
"in",
"dependency_sections",
"for",
"op",
"in",
"(",
"''",
",",
"'!'",
",",
"'/'",
")",
"]",
"for",
"target",
",",
"target_dict",
... | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py#L1366-L1402 | ||
yuxng/PoseCNN | 9f3dd7b7bce21dcafc05e8f18ccc90da3caabd04 | lib/datasets/linemod.py | python | linemod._load_linemod_annotation | (self, index) | return {'image': image_path,
'depth': depth_path,
'label': label_path,
'meta_data': metadata_path,
'video_id': video_id,
'class_colors': self._class_colors,
'class_weights': self._class_weights,
'cls_index': ... | Load class name and meta data | Load class name and meta data | [
"Load",
"class",
"name",
"and",
"meta",
"data"
] | def _load_linemod_annotation(self, index):
"""
Load class name and meta data
"""
# image path
image_path = self.image_path_from_index(index)
# depth path
depth_path = self.depth_path_from_index(index)
# label path
label_path = self.label_path_fro... | [
"def",
"_load_linemod_annotation",
"(",
"self",
",",
"index",
")",
":",
"# image path",
"image_path",
"=",
"self",
".",
"image_path_from_index",
"(",
"index",
")",
"# depth path",
"depth_path",
"=",
"self",
".",
"depth_path_from_index",
"(",
"index",
")",
"# label... | https://github.com/yuxng/PoseCNN/blob/9f3dd7b7bce21dcafc05e8f18ccc90da3caabd04/lib/datasets/linemod.py#L253-L284 | |
wujian16/Cornell-MOE | df299d1be882d2af9796d7a68b3f9505cac7a53e | moe/optimal_learning/python/cpp_wrappers/log_likelihood.py | python | GaussianProcessLogMarginalLikelihood.__init__ | (self, covariance_function, historical_data, noise_variance, derivatives) | Construct a LogLikelihood object configured for Log Marginal Likelihood computation; see superclass ctor for details. | Construct a LogLikelihood object configured for Log Marginal Likelihood computation; see superclass ctor for details. | [
"Construct",
"a",
"LogLikelihood",
"object",
"configured",
"for",
"Log",
"Marginal",
"Likelihood",
"computation",
";",
"see",
"superclass",
"ctor",
"for",
"details",
"."
] | def __init__(self, covariance_function, historical_data, noise_variance, derivatives):
"""Construct a LogLikelihood object configured for Log Marginal Likelihood computation; see superclass ctor for details."""
super(GaussianProcessLogMarginalLikelihood, self).__init__(
covariance_function,
... | [
"def",
"__init__",
"(",
"self",
",",
"covariance_function",
",",
"historical_data",
",",
"noise_variance",
",",
"derivatives",
")",
":",
"super",
"(",
"GaussianProcessLogMarginalLikelihood",
",",
"self",
")",
".",
"__init__",
"(",
"covariance_function",
",",
"histor... | https://github.com/wujian16/Cornell-MOE/blob/df299d1be882d2af9796d7a68b3f9505cac7a53e/moe/optimal_learning/python/cpp_wrappers/log_likelihood.py#L436-L444 | ||
NVIDIAGameWorks/kaolin | e5148d05e9c1e2ce92a07881ce3593b1c5c3f166 | kaolin/ops/mesh/mesh.py | python | adjacency_matrix | (num_vertices, faces, sparse=True) | return adjacency | r"""Calculates a adjacency matrix of a mesh.
Args:
num_vertices (int): Number of vertices of the mesh.
faces (torch.LongTensor):
Faces of shape :math:`(\text{num_faces}, \text{face_size})` of the mesh.
sparse (bool): Whether to return a sparse tensor or not. Default: True.
... | r"""Calculates a adjacency matrix of a mesh. | [
"r",
"Calculates",
"a",
"adjacency",
"matrix",
"of",
"a",
"mesh",
"."
] | def adjacency_matrix(num_vertices, faces, sparse=True):
r"""Calculates a adjacency matrix of a mesh.
Args:
num_vertices (int): Number of vertices of the mesh.
faces (torch.LongTensor):
Faces of shape :math:`(\text{num_faces}, \text{face_size})` of the mesh.
sparse (bool): Wh... | [
"def",
"adjacency_matrix",
"(",
"num_vertices",
",",
"faces",
",",
"sparse",
"=",
"True",
")",
":",
"device",
"=",
"faces",
".",
"device",
"forward_i",
"=",
"torch",
".",
"stack",
"(",
"[",
"faces",
",",
"torch",
".",
"roll",
"(",
"faces",
",",
"1",
... | https://github.com/NVIDIAGameWorks/kaolin/blob/e5148d05e9c1e2ce92a07881ce3593b1c5c3f166/kaolin/ops/mesh/mesh.py#L48-L84 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/decimal.py | python | Decimal.is_nan | (self) | return self._exp in ('n', 'N') | Return True if self is a qNaN or sNaN; otherwise return False. | Return True if self is a qNaN or sNaN; otherwise return False. | [
"Return",
"True",
"if",
"self",
"is",
"a",
"qNaN",
"or",
"sNaN",
";",
"otherwise",
"return",
"False",
"."
] | def is_nan(self):
"""Return True if self is a qNaN or sNaN; otherwise return False."""
return self._exp in ('n', 'N') | [
"def",
"is_nan",
"(",
"self",
")",
":",
"return",
"self",
".",
"_exp",
"in",
"(",
"'n'",
",",
"'N'",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/decimal.py#L3027-L3029 | |
chromiumembedded/cef | 80caf947f3fe2210e5344713c5281d8af9bdc295 | tools/file_util.py | python | get_files_recursive | (directory, pattern) | Returns all files in |directory| matching |pattern| recursively. | Returns all files in |directory| matching |pattern| recursively. | [
"Returns",
"all",
"files",
"in",
"|directory|",
"matching",
"|pattern|",
"recursively",
"."
] | def get_files_recursive(directory, pattern):
""" Returns all files in |directory| matching |pattern| recursively. """
for root, dirs, files in os.walk(directory):
for basename in files:
if fnmatch.fnmatch(basename, pattern):
filename = os.path.join(root, basename)
yield filename | [
"def",
"get_files_recursive",
"(",
"directory",
",",
"pattern",
")",
":",
"for",
"root",
",",
"dirs",
",",
"files",
"in",
"os",
".",
"walk",
"(",
"directory",
")",
":",
"for",
"basename",
"in",
"files",
":",
"if",
"fnmatch",
".",
"fnmatch",
"(",
"basen... | https://github.com/chromiumembedded/cef/blob/80caf947f3fe2210e5344713c5281d8af9bdc295/tools/file_util.py#L174-L180 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_gdi.py | python | Locale.GetName | (*args, **kwargs) | return _gdi_.Locale_GetName(*args, **kwargs) | GetName(self) -> String | GetName(self) -> String | [
"GetName",
"(",
"self",
")",
"-",
">",
"String"
] | def GetName(*args, **kwargs):
"""GetName(self) -> String"""
return _gdi_.Locale_GetName(*args, **kwargs) | [
"def",
"GetName",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"Locale_GetName",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_gdi.py#L3092-L3094 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/urllib3/poolmanager.py | python | ProxyManager._set_proxy_headers | (self, url, headers=None) | return headers_ | Sets headers needed by proxies: specifically, the Accept and Host
headers. Only sets headers not provided by the user. | Sets headers needed by proxies: specifically, the Accept and Host
headers. Only sets headers not provided by the user. | [
"Sets",
"headers",
"needed",
"by",
"proxies",
":",
"specifically",
"the",
"Accept",
"and",
"Host",
"headers",
".",
"Only",
"sets",
"headers",
"not",
"provided",
"by",
"the",
"user",
"."
] | def _set_proxy_headers(self, url, headers=None):
"""
Sets headers needed by proxies: specifically, the Accept and Host
headers. Only sets headers not provided by the user.
"""
headers_ = {'Accept': '*/*'}
netloc = parse_url(url).netloc
if netloc:
head... | [
"def",
"_set_proxy_headers",
"(",
"self",
",",
"url",
",",
"headers",
"=",
"None",
")",
":",
"headers_",
"=",
"{",
"'Accept'",
":",
"'*/*'",
"}",
"netloc",
"=",
"parse_url",
"(",
"url",
")",
".",
"netloc",
"if",
"netloc",
":",
"headers_",
"[",
"'Host'"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/urllib3/poolmanager.py#L410-L423 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/contrib/framework/python/ops/variables.py | python | get_model_variables | (scope=None, suffix=None) | return get_variables(scope, suffix, ops.GraphKeys.MODEL_VARIABLES) | Gets the list of model variables, filtered by scope and/or suffix.
Args:
scope: an optional scope for filtering the variables to return.
suffix: an optional suffix for filtering the variables to return.
Returns:
a list of variables in colelction with scope and suffix. | Gets the list of model variables, filtered by scope and/or suffix. | [
"Gets",
"the",
"list",
"of",
"model",
"variables",
"filtered",
"by",
"scope",
"and",
"/",
"or",
"suffix",
"."
] | def get_model_variables(scope=None, suffix=None):
"""Gets the list of model variables, filtered by scope and/or suffix.
Args:
scope: an optional scope for filtering the variables to return.
suffix: an optional suffix for filtering the variables to return.
Returns:
a list of variables in colelction w... | [
"def",
"get_model_variables",
"(",
"scope",
"=",
"None",
",",
"suffix",
"=",
"None",
")",
":",
"return",
"get_variables",
"(",
"scope",
",",
"suffix",
",",
"ops",
".",
"GraphKeys",
".",
"MODEL_VARIABLES",
")"
] | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/contrib/framework/python/ops/variables.py#L297-L307 | |
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | python/mozbuild/mozbuild/util.py | python | hash_file | (path) | return h.hexdigest() | Hashes a file specified by the path given and returns the hex digest. | Hashes a file specified by the path given and returns the hex digest. | [
"Hashes",
"a",
"file",
"specified",
"by",
"the",
"path",
"given",
"and",
"returns",
"the",
"hex",
"digest",
"."
] | def hash_file(path):
"""Hashes a file specified by the path given and returns the hex digest."""
# If the hashing function changes, this may invalidate lots of cached data.
# Don't change it lightly.
h = hashlib.sha1()
with open(path, 'rb') as fh:
while True:
data = fh.read(819... | [
"def",
"hash_file",
"(",
"path",
")",
":",
"# If the hashing function changes, this may invalidate lots of cached data.",
"# Don't change it lightly.",
"h",
"=",
"hashlib",
".",
"sha1",
"(",
")",
"with",
"open",
"(",
"path",
",",
"'rb'",
")",
"as",
"fh",
":",
"while... | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/python/mozbuild/mozbuild/util.py#L32-L48 | |
NeoGeographyToolkit/StereoPipeline | eedf54a919fb5cce1ab0e280bb0df4050763aa11 | src/asp/IceBridge/regenerate_summary_images.py | python | writeCommandFiles | (missingDemFiles, missingOrthoFiles, outputPrefix, chunkSize) | return commandFiles | Generate conversion commands for each missing summary file and
divide them up into files of a fixed length. Returns the list of
command files that were written. | Generate conversion commands for each missing summary file and
divide them up into files of a fixed length. Returns the list of
command files that were written. | [
"Generate",
"conversion",
"commands",
"for",
"each",
"missing",
"summary",
"file",
"and",
"divide",
"them",
"up",
"into",
"files",
"of",
"a",
"fixed",
"length",
".",
"Returns",
"the",
"list",
"of",
"command",
"files",
"that",
"were",
"written",
"."
] | def writeCommandFiles(missingDemFiles, missingOrthoFiles, outputPrefix, chunkSize):
'''Generate conversion commands for each missing summary file and
divide them up into files of a fixed length. Returns the list of
command files that were written.'''
if (not missingDemFiles) and (not missingOrth... | [
"def",
"writeCommandFiles",
"(",
"missingDemFiles",
",",
"missingOrthoFiles",
",",
"outputPrefix",
",",
"chunkSize",
")",
":",
"if",
"(",
"not",
"missingDemFiles",
")",
"and",
"(",
"not",
"missingOrthoFiles",
")",
":",
"return",
"[",
"]",
"# Open the first file",
... | https://github.com/NeoGeographyToolkit/StereoPipeline/blob/eedf54a919fb5cce1ab0e280bb0df4050763aa11/src/asp/IceBridge/regenerate_summary_images.py#L297-L349 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/optimizer.py | python | AdamaxOptimizer._finish_update | (self, block, parameters_and_grads) | Update Beta1 Power accumulator | Update Beta1 Power accumulator | [
"Update",
"Beta1",
"Power",
"accumulator"
] | def _finish_update(self, block, parameters_and_grads):
"""Update Beta1 Power accumulator
"""
assert isinstance(block, framework.Block)
for param, grad in parameters_and_grads:
if grad is None or param.trainable is False:
continue
with param.block.p... | [
"def",
"_finish_update",
"(",
"self",
",",
"block",
",",
"parameters_and_grads",
")",
":",
"assert",
"isinstance",
"(",
"block",
",",
"framework",
".",
"Block",
")",
"for",
"param",
",",
"grad",
"in",
"parameters_and_grads",
":",
"if",
"grad",
"is",
"None",
... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/optimizer.py#L2845-L2865 | ||
Tencent/CMONGO | c40380caa14e05509f46993aa8b8da966b09b0b5 | src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/cpp.py | python | FunctionEvaluator.__init__ | (self, name, args, expansion) | Squirrels away the arguments and expansion value of a #define
macro function for later evaluation when we must actually expand
a value that uses it. | Squirrels away the arguments and expansion value of a #define
macro function for later evaluation when we must actually expand
a value that uses it. | [
"Squirrels",
"away",
"the",
"arguments",
"and",
"expansion",
"value",
"of",
"a",
"#define",
"macro",
"function",
"for",
"later",
"evaluation",
"when",
"we",
"must",
"actually",
"expand",
"a",
"value",
"that",
"uses",
"it",
"."
] | def __init__(self, name, args, expansion):
"""
Squirrels away the arguments and expansion value of a #define
macro function for later evaluation when we must actually expand
a value that uses it.
"""
self.name = name
self.args = function_arg_separator.split(args)
... | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"args",
",",
"expansion",
")",
":",
"self",
".",
"name",
"=",
"name",
"self",
".",
"args",
"=",
"function_arg_separator",
".",
"split",
"(",
"args",
")",
"try",
":",
"expansion",
"=",
"expansion",
".",
... | https://github.com/Tencent/CMONGO/blob/c40380caa14e05509f46993aa8b8da966b09b0b5/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/cpp.py#L181-L193 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/apiclient/googleapiclient/discovery.py | python | createMethod | (methodName, methodDesc, rootDesc, schema) | return (methodName, method) | Creates a method for attaching to a Resource.
Args:
methodName: string, name of the method to use.
methodDesc: object, fragment of deserialized discovery document that
describes the method.
rootDesc: object, the entire deserialized discovery document.
schema: object, mapping of schema names to ... | Creates a method for attaching to a Resource. | [
"Creates",
"a",
"method",
"for",
"attaching",
"to",
"a",
"Resource",
"."
] | def createMethod(methodName, methodDesc, rootDesc, schema):
"""Creates a method for attaching to a Resource.
Args:
methodName: string, name of the method to use.
methodDesc: object, fragment of deserialized discovery document that
describes the method.
rootDesc: object, the entire deserialized di... | [
"def",
"createMethod",
"(",
"methodName",
",",
"methodDesc",
",",
"rootDesc",
",",
"schema",
")",
":",
"methodName",
"=",
"fix_method_name",
"(",
"methodName",
")",
"(",
"pathUrl",
",",
"httpMethod",
",",
"methodId",
",",
"accept",
",",
"maxSize",
",",
"medi... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/apiclient/googleapiclient/discovery.py#L603-L829 | |
RamadhanAmizudin/malware | 2c6c53c8b0d556f5d8078d6ca0fc4448f4697cf1 | Fuzzbunch/fuzzbunch/pyreadline/console/ironpython_console.py | python | Console.__init__ | (self, newbuffer=0) | Initialize the Console object.
newbuffer=1 will allocate a new buffer so the old content will be restored
on exit. | Initialize the Console object. | [
"Initialize",
"the",
"Console",
"object",
"."
] | def __init__(self, newbuffer=0):
'''Initialize the Console object.
newbuffer=1 will allocate a new buffer so the old content will be restored
on exit.
'''
self.serial=0
self.attr = System.Console.ForegroundColor
self.saveattr = winattr[str(System.Console.Foregrou... | [
"def",
"__init__",
"(",
"self",
",",
"newbuffer",
"=",
"0",
")",
":",
"self",
".",
"serial",
"=",
"0",
"self",
".",
"attr",
"=",
"System",
".",
"Console",
".",
"ForegroundColor",
"self",
".",
"saveattr",
"=",
"winattr",
"[",
"str",
"(",
"System",
"."... | https://github.com/RamadhanAmizudin/malware/blob/2c6c53c8b0d556f5d8078d6ca0fc4448f4697cf1/Fuzzbunch/fuzzbunch/pyreadline/console/ironpython_console.py#L77-L88 | ||
toggl-open-source/toggldesktop | 91865205885531cc8fd9e8d613dad49d625d56e7 | third_party/cpplint/cpplint.py | python | CheckComment | (line, filename, linenum, next_line_start, error) | Checks for common mistakes in comments.
Args:
line: The line in question.
filename: The name of the current file.
linenum: The number of the line to check.
next_line_start: The first non-whitespace column of the next line.
error: The function to call with any errors found. | Checks for common mistakes in comments. | [
"Checks",
"for",
"common",
"mistakes",
"in",
"comments",
"."
] | def CheckComment(line, filename, linenum, next_line_start, error):
"""Checks for common mistakes in comments.
Args:
line: The line in question.
filename: The name of the current file.
linenum: The number of the line to check.
next_line_start: The first non-whitespace column of the next line.
er... | [
"def",
"CheckComment",
"(",
"line",
",",
"filename",
",",
"linenum",
",",
"next_line_start",
",",
"error",
")",
":",
"commentpos",
"=",
"line",
".",
"find",
"(",
"'//'",
")",
"if",
"commentpos",
"!=",
"-",
"1",
":",
"# Check if the // may be in quotes. If so,... | https://github.com/toggl-open-source/toggldesktop/blob/91865205885531cc8fd9e8d613dad49d625d56e7/third_party/cpplint/cpplint.py#L2913-L2966 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py3/IPython/core/display.py | python | Image._repr_mimebundle_ | (self, include=None, exclude=None) | Return the image as a mimebundle
Any new mimetype support should be implemented here. | Return the image as a mimebundle | [
"Return",
"the",
"image",
"as",
"a",
"mimebundle"
] | def _repr_mimebundle_(self, include=None, exclude=None):
"""Return the image as a mimebundle
Any new mimetype support should be implemented here.
"""
if self.embed:
mimetype = self._mimetype
data, metadata = self._data_and_metadata(always_both=True)
i... | [
"def",
"_repr_mimebundle_",
"(",
"self",
",",
"include",
"=",
"None",
",",
"exclude",
"=",
"None",
")",
":",
"if",
"self",
".",
"embed",
":",
"mimetype",
"=",
"self",
".",
"_mimetype",
"data",
",",
"metadata",
"=",
"self",
".",
"_data_and_metadata",
"(",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py3/IPython/core/display.py#L1283-L1295 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_misc.py | python | DateTime.__gt__ | (*args, **kwargs) | return _misc_.DateTime___gt__(*args, **kwargs) | __gt__(self, DateTime other) -> bool | __gt__(self, DateTime other) -> bool | [
"__gt__",
"(",
"self",
"DateTime",
"other",
")",
"-",
">",
"bool"
] | def __gt__(*args, **kwargs):
"""__gt__(self, DateTime other) -> bool"""
return _misc_.DateTime___gt__(*args, **kwargs) | [
"def",
"__gt__",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"DateTime___gt__",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_misc.py#L4114-L4116 | |
google/earthenterprise | 0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9 | earth_enterprise/src/server/wsgi/common/utils.py | python | GetPostgresPassword | () | return None | Get geuser role password for remote connections
Returns:
Password for remote geuser role or None. | Get geuser role password for remote connections | [
"Get",
"geuser",
"role",
"password",
"for",
"remote",
"connections"
] | def GetPostgresPassword():
"""Get geuser role password for remote connections
Returns:
Password for remote geuser role or None.
"""
pattern = r"^\s*pass\s*=\s*(\d{4,})\s*"
match = MatchPattern(POSTGRES_PROPERTIES_PATH, pattern)
if match:
password = match[0]
return password
pattern = r"^\s*pa... | [
"def",
"GetPostgresPassword",
"(",
")",
":",
"pattern",
"=",
"r\"^\\s*pass\\s*=\\s*(\\d{4,})\\s*\"",
"match",
"=",
"MatchPattern",
"(",
"POSTGRES_PROPERTIES_PATH",
",",
"pattern",
")",
"if",
"match",
":",
"password",
"=",
"match",
"[",
"0",
"]",
"return",
"passwor... | https://github.com/google/earthenterprise/blob/0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9/earth_enterprise/src/server/wsgi/common/utils.py#L294-L312 | |
google/fhir | d77f57706c1a168529b0b87ca7ccb1c0113e83c2 | py/google/fhir/primitive_handler.py | python | PrimitiveHandler.positive_int_cls | (self) | An unsigned 32-bit integer.
See more at: https://www.hl7.org/fhir/datatypes.html#positiveInt. | An unsigned 32-bit integer. | [
"An",
"unsigned",
"32",
"-",
"bit",
"integer",
"."
] | def positive_int_cls(self) -> Type[message.Message]:
"""An unsigned 32-bit integer.
See more at: https://www.hl7.org/fhir/datatypes.html#positiveInt.
"""
raise NotImplementedError('Subclasses *must* implement positive_int_cls.') | [
"def",
"positive_int_cls",
"(",
"self",
")",
"->",
"Type",
"[",
"message",
".",
"Message",
"]",
":",
"raise",
"NotImplementedError",
"(",
"'Subclasses *must* implement positive_int_cls.'",
")"
] | https://github.com/google/fhir/blob/d77f57706c1a168529b0b87ca7ccb1c0113e83c2/py/google/fhir/primitive_handler.py#L156-L161 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/ed_main.py | python | MainWindow.OnCommandBar | (self, evt) | Open the Commandbar
@param evt: wx.MenuEvent | Open the Commandbar
@param evt: wx.MenuEvent | [
"Open",
"the",
"Commandbar",
"@param",
"evt",
":",
"wx",
".",
"MenuEvent"
] | def OnCommandBar(self, evt):
"""Open the Commandbar
@param evt: wx.MenuEvent
"""
e_id = evt.Id
if e_id in (ID_QUICK_FIND, ID_GOTO_LINE, ID_COMMAND, ID_SESSION_BAR):
self._mpane.ShowCommandControl(e_id)
else:
evt.Skip() | [
"def",
"OnCommandBar",
"(",
"self",
",",
"evt",
")",
":",
"e_id",
"=",
"evt",
".",
"Id",
"if",
"e_id",
"in",
"(",
"ID_QUICK_FIND",
",",
"ID_GOTO_LINE",
",",
"ID_COMMAND",
",",
"ID_SESSION_BAR",
")",
":",
"self",
".",
"_mpane",
".",
"ShowCommandControl",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/ed_main.py#L1453-L1462 | ||
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | xpcom/idl-parser/xpidl.py | python | IDLParser.p_native | (self, p) | native : attributes NATIVE IDENTIFIER afternativeid '(' NATIVEID ')' '; | native : attributes NATIVE IDENTIFIER afternativeid '(' NATIVEID ')' '; | [
"native",
":",
"attributes",
"NATIVE",
"IDENTIFIER",
"afternativeid",
"(",
"NATIVEID",
")",
";"
] | def p_native(self, p):
"""native : attributes NATIVE IDENTIFIER afternativeid '(' NATIVEID ')' ';'"""
p[0] = Native(name=p[3],
nativename=p[6],
attlist=p[1]['attlist'],
location=self.getLocation(p, 2)) | [
"def",
"p_native",
"(",
"self",
",",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"Native",
"(",
"name",
"=",
"p",
"[",
"3",
"]",
",",
"nativename",
"=",
"p",
"[",
"6",
"]",
",",
"attlist",
"=",
"p",
"[",
"1",
"]",
"[",
"'attlist'",
"]",
",",
... | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/xpcom/idl-parser/xpidl.py#L1123-L1128 | ||
H-uru/Plasma | c2140ea046e82e9c199e257a7f2e7edb42602871 | Scripts/Python/xSimpleImager.py | python | xSimpleImager.OnTimer | (self,id) | Timer event, for the fade stuff | Timer event, for the fade stuff | [
"Timer",
"event",
"for",
"the",
"fade",
"stuff"
] | def OnTimer(self,id):
"Timer event, for the fade stuff"
global ImagerContents
global CurrentContentIdx
global kFlipImagesTimerCurrent
if id == kFlipImagesTimerCurrent:
if len(ImagerContents) > 0:
CurrentContentIdx += 1
if Curre... | [
"def",
"OnTimer",
"(",
"self",
",",
"id",
")",
":",
"global",
"ImagerContents",
"global",
"CurrentContentIdx",
"global",
"kFlipImagesTimerCurrent",
"if",
"id",
"==",
"kFlipImagesTimerCurrent",
":",
"if",
"len",
"(",
"ImagerContents",
")",
">",
"0",
":",
"Current... | https://github.com/H-uru/Plasma/blob/c2140ea046e82e9c199e257a7f2e7edb42602871/Scripts/Python/xSimpleImager.py#L216-L228 | ||
bulletphysics/bullet3 | f0f2a952e146f016096db6f85cf0c44ed75b0b9a | examples/pybullet/gym/pybullet_envs/minitaur/envs/env_randomizers/minitaur_terrain_randomizer.py | python | PoissonDisc2D._point_to_index_2d | (self, point) | return x_index, y_index | Computes the 2D index (aka cell ID) of a point in the grid.
Args:
point: A 2D point (list) described by its coordinates (x, y).
Returns:
x_index: The x index of the cell the point belongs to.
y_index: The y index of the cell the point belongs to. | Computes the 2D index (aka cell ID) of a point in the grid. | [
"Computes",
"the",
"2D",
"index",
"(",
"aka",
"cell",
"ID",
")",
"of",
"a",
"point",
"in",
"the",
"grid",
"."
] | def _point_to_index_2d(self, point):
"""Computes the 2D index (aka cell ID) of a point in the grid.
Args:
point: A 2D point (list) described by its coordinates (x, y).
Returns:
x_index: The x index of the cell the point belongs to.
y_index: The y index of the cell the point belongs to.
... | [
"def",
"_point_to_index_2d",
"(",
"self",
",",
"point",
")",
":",
"x_index",
"=",
"int",
"(",
"point",
"[",
"0",
"]",
"/",
"self",
".",
"_cell_length",
")",
"y_index",
"=",
"int",
"(",
"point",
"[",
"1",
"]",
"/",
"self",
".",
"_cell_length",
")",
... | https://github.com/bulletphysics/bullet3/blob/f0f2a952e146f016096db6f85cf0c44ed75b0b9a/examples/pybullet/gym/pybullet_envs/minitaur/envs/env_randomizers/minitaur_terrain_randomizer.py#L82-L94 | |
wyrover/book-code | 7f4883d9030d553bc6bcfa3da685e34789839900 | 3rdparty/protobuf/python/google/protobuf/descriptor.py | python | DescriptorBase._SetOptions | (self, options, options_class_name) | Sets the descriptor's options
This function is used in generated proto2 files to update descriptor
options. It must not be used outside proto2. | Sets the descriptor's options | [
"Sets",
"the",
"descriptor",
"s",
"options"
] | def _SetOptions(self, options, options_class_name):
"""Sets the descriptor's options
This function is used in generated proto2 files to update descriptor
options. It must not be used outside proto2.
"""
self._options = options
self._options_class_name = options_class_name
# Does this descr... | [
"def",
"_SetOptions",
"(",
"self",
",",
"options",
",",
"options_class_name",
")",
":",
"self",
".",
"_options",
"=",
"options",
"self",
".",
"_options_class_name",
"=",
"options_class_name",
"# Does this descriptor have non-default options?",
"self",
".",
"has_options"... | https://github.com/wyrover/book-code/blob/7f4883d9030d553bc6bcfa3da685e34789839900/3rdparty/protobuf/python/google/protobuf/descriptor.py#L106-L116 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/statistics.py | python | _fail_neg | (values, errmsg='negative value') | Iterate over values, failing if any are less than zero. | Iterate over values, failing if any are less than zero. | [
"Iterate",
"over",
"values",
"failing",
"if",
"any",
"are",
"less",
"than",
"zero",
"."
] | def _fail_neg(values, errmsg='negative value'):
"""Iterate over values, failing if any are less than zero."""
for x in values:
if x < 0:
raise StatisticsError(errmsg)
yield x | [
"def",
"_fail_neg",
"(",
"values",
",",
"errmsg",
"=",
"'negative value'",
")",
":",
"for",
"x",
"in",
"values",
":",
"if",
"x",
"<",
"0",
":",
"raise",
"StatisticsError",
"(",
"errmsg",
")",
"yield",
"x"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/statistics.py#L280-L285 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/singledispatch_helpers.py | python | ChainMap.popitem | (self) | Remove and return an item pair from maps[0]. Raise KeyError is maps[0] is empty. | Remove and return an item pair from maps[0]. Raise KeyError is maps[0] is empty. | [
"Remove",
"and",
"return",
"an",
"item",
"pair",
"from",
"maps",
"[",
"0",
"]",
".",
"Raise",
"KeyError",
"is",
"maps",
"[",
"0",
"]",
"is",
"empty",
"."
] | def popitem(self):
'Remove and return an item pair from maps[0]. Raise KeyError is maps[0] is empty.'
try:
return self.maps[0].popitem()
except KeyError:
raise KeyError('No keys found in the first mapping.') | [
"def",
"popitem",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"maps",
"[",
"0",
"]",
".",
"popitem",
"(",
")",
"except",
"KeyError",
":",
"raise",
"KeyError",
"(",
"'No keys found in the first mapping.'",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/singledispatch_helpers.py#L133-L138 | ||
garbear/kodi-steamlink | 3f8e5970b01607cdb3c2688fbaa78e08f2d9c561 | tools/EventClients/Clients/PS3SixaxisController/ps3d.py | python | PS3RemoteThread.zeroconf_service_handler | (self, event, service) | return | Zeroconf event handler | Zeroconf event handler | [
"Zeroconf",
"event",
"handler"
] | def zeroconf_service_handler(self, event, service):
"""
Zeroconf event handler
"""
if event == zeroconf.SERVICE_FOUND: # new xbmc service detected
self.services.append( service )
elif event == zeroconf.SERVICE_LOST: # xbmc service lost
try:
... | [
"def",
"zeroconf_service_handler",
"(",
"self",
",",
"event",
",",
"service",
")",
":",
"if",
"event",
"==",
"zeroconf",
".",
"SERVICE_FOUND",
":",
"# new xbmc service detected",
"self",
".",
"services",
".",
"append",
"(",
"service",
")",
"elif",
"event",
"==... | https://github.com/garbear/kodi-steamlink/blob/3f8e5970b01607cdb3c2688fbaa78e08f2d9c561/tools/EventClients/Clients/PS3SixaxisController/ps3d.py#L230-L247 | |
mysql/mysql-workbench | 2f35f9034f015cbcd22139a60e1baa2e3e8e795c | ext/scintilla/scripts/Dependencies.py | python | UpdateDependencies | (filepath, dependencies, comment="") | Write a dependencies file if different from dependencies. | Write a dependencies file if different from dependencies. | [
"Write",
"a",
"dependencies",
"file",
"if",
"different",
"from",
"dependencies",
"."
] | def UpdateDependencies(filepath, dependencies, comment=""):
""" Write a dependencies file if different from dependencies. """
FileGenerator.UpdateFile(os.path.abspath(filepath), comment.rstrip() + os.linesep +
TextFromDependencies(dependencies)) | [
"def",
"UpdateDependencies",
"(",
"filepath",
",",
"dependencies",
",",
"comment",
"=",
"\"\"",
")",
":",
"FileGenerator",
".",
"UpdateFile",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"filepath",
")",
",",
"comment",
".",
"rstrip",
"(",
")",
"+",
"os"... | https://github.com/mysql/mysql-workbench/blob/2f35f9034f015cbcd22139a60e1baa2e3e8e795c/ext/scintilla/scripts/Dependencies.py#L140-L143 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/contextlib.py | python | AsyncExitStack.push_async_callback | (*args, **kwds) | return callback | Registers an arbitrary coroutine function and arguments.
Cannot suppress exceptions. | Registers an arbitrary coroutine function and arguments. | [
"Registers",
"an",
"arbitrary",
"coroutine",
"function",
"and",
"arguments",
"."
] | def push_async_callback(*args, **kwds):
"""Registers an arbitrary coroutine function and arguments.
Cannot suppress exceptions.
"""
if len(args) >= 2:
self, callback, *args = args
elif not args:
raise TypeError("descriptor 'push_async_callback' of "
... | [
"def",
"push_async_callback",
"(",
"*",
"args",
",",
"*",
"*",
"kwds",
")",
":",
"if",
"len",
"(",
"args",
")",
">=",
"2",
":",
"self",
",",
"callback",
",",
"",
"*",
"args",
"=",
"args",
"elif",
"not",
"args",
":",
"raise",
"TypeError",
"(",
"\"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/contextlib.py#L592-L615 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | deps/src/libxml2-2.9.1/python/libxml2class.py | python | xpathParserContext.xpathLangFunction | (self, nargs) | Implement the lang() XPath function boolean lang(string)
The lang function returns true or false depending on
whether the language of the context node as specified by
xml:lang attributes is the same as or is a sublanguage of
the language specified by the argument string. The lang... | Implement the lang() XPath function boolean lang(string)
The lang function returns true or false depending on
whether the language of the context node as specified by
xml:lang attributes is the same as or is a sublanguage of
the language specified by the argument string. The lang... | [
"Implement",
"the",
"lang",
"()",
"XPath",
"function",
"boolean",
"lang",
"(",
"string",
")",
"The",
"lang",
"function",
"returns",
"true",
"or",
"false",
"depending",
"on",
"whether",
"the",
"language",
"of",
"the",
"context",
"node",
"as",
"specified",
"by... | def xpathLangFunction(self, nargs):
"""Implement the lang() XPath function boolean lang(string)
The lang function returns true or false depending on
whether the language of the context node as specified by
xml:lang attributes is the same as or is a sublanguage of
the lang... | [
"def",
"xpathLangFunction",
"(",
"self",
",",
"nargs",
")",
":",
"libxml2mod",
".",
"xmlXPathLangFunction",
"(",
"self",
".",
"_o",
",",
"nargs",
")"
] | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2class.py#L6755-L6767 | ||
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/resmokelib/parser.py | python | parse | (sys_args, usage=None) | return parser, parsed_args | Parse the CLI args. | Parse the CLI args. | [
"Parse",
"the",
"CLI",
"args",
"."
] | def parse(sys_args, usage=None):
"""Parse the CLI args."""
parser = argparse.ArgumentParser(usage=usage)
subparsers = parser.add_subparsers(dest="command")
# Add sub-commands.
for plugin in _PLUGINS:
plugin.add_subcommand(subparsers)
parsed_args = parser.parse_args(sys_args)
retu... | [
"def",
"parse",
"(",
"sys_args",
",",
"usage",
"=",
"None",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"usage",
"=",
"usage",
")",
"subparsers",
"=",
"parser",
".",
"add_subparsers",
"(",
"dest",
"=",
"\"command\"",
")",
"# Add sub-co... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/resmokelib/parser.py#L24-L36 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/rosdep2/dependency_graph.py | python | DependencyGraph.validate | (self) | Performs validations on the dependency graph, like cycle detection and invalid rosdep key detection.
:raises: :exc:`AssertionError` if a cycle is detected.
:raises: :exc:`KeyError` if an invalid rosdep_key is found in the dependency graph. | Performs validations on the dependency graph, like cycle detection and invalid rosdep key detection. | [
"Performs",
"validations",
"on",
"the",
"dependency",
"graph",
"like",
"cycle",
"detection",
"and",
"invalid",
"rosdep",
"key",
"detection",
"."
] | def validate(self):
"""
Performs validations on the dependency graph, like cycle detection and invalid rosdep key detection.
:raises: :exc:`AssertionError` if a cycle is detected.
:raises: :exc:`KeyError` if an invalid rosdep_key is found in the dependency graph.
"""
fo... | [
"def",
"validate",
"(",
"self",
")",
":",
"for",
"rosdep_key",
"in",
"self",
":",
"# Ensure all dependencies have definitions",
"# i.e.: Ensure we aren't pointing to invalid rosdep keys",
"for",
"dependency",
"in",
"self",
"[",
"rosdep_key",
"]",
"[",
"'dependencies'",
"]... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/rosdep2/dependency_graph.py#L79-L95 | ||
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/tools/jinja2/runtime.py | python | Context.derived | (self, locals=None) | return context | Internal helper function to create a derived context. This is
used in situations where the system needs a new context in the same
template that is independent. | Internal helper function to create a derived context. This is
used in situations where the system needs a new context in the same
template that is independent. | [
"Internal",
"helper",
"function",
"to",
"create",
"a",
"derived",
"context",
".",
"This",
"is",
"used",
"in",
"situations",
"where",
"the",
"system",
"needs",
"a",
"new",
"context",
"in",
"the",
"same",
"template",
"that",
"is",
"independent",
"."
] | def derived(self, locals=None):
"""Internal helper function to create a derived context. This is
used in situations where the system needs a new context in the same
template that is independent.
"""
context = new_context(self.environment, self.name, {},
... | [
"def",
"derived",
"(",
"self",
",",
"locals",
"=",
"None",
")",
":",
"context",
"=",
"new_context",
"(",
"self",
".",
"environment",
",",
"self",
".",
"name",
",",
"{",
"}",
",",
"self",
".",
"get_all",
"(",
")",
",",
"True",
",",
"None",
",",
"l... | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/tools/jinja2/runtime.py#L268-L277 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/dygraph/dygraph_to_static/convert_operators.py | python | convert_ifelse | (pred, true_fn, false_fn, true_args, false_args, return_vars) | return _remove_no_value_return_var(out) | A function representation of a Python ``if/else`` statement.
Args:
pred(bool|Tensor): A boolean Tensor which determines whether to return the result of ``true_fn`` or ``false_fn`` .
true_fn(callable): A callable to be performed if ``pred`` is true.
false_fn(callable): A callable to be perfo... | A function representation of a Python ``if/else`` statement. | [
"A",
"function",
"representation",
"of",
"a",
"Python",
"if",
"/",
"else",
"statement",
"."
] | def convert_ifelse(pred, true_fn, false_fn, true_args, false_args, return_vars):
"""
A function representation of a Python ``if/else`` statement.
Args:
pred(bool|Tensor): A boolean Tensor which determines whether to return the result of ``true_fn`` or ``false_fn`` .
true_fn(callable): A cal... | [
"def",
"convert_ifelse",
"(",
"pred",
",",
"true_fn",
",",
"false_fn",
",",
"true_args",
",",
"false_args",
",",
"return_vars",
")",
":",
"if",
"isinstance",
"(",
"pred",
",",
"Variable",
")",
":",
"out",
"=",
"_run_paddle_cond",
"(",
"pred",
",",
"true_fn... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/dygraph/dygraph_to_static/convert_operators.py#L191-L213 | |
microsoft/EdgeML | ef9f8a77f096acbdeb941014791f8eda1c1bc35b | examples/pytorch/vision/Face_Detection/models/RPool_Face_Quant.py | python | S3FD.__init__ | (self, phase, base, head, num_classes) | self.priorbox = PriorBox(size,cfg)
self.priors = Variable(self.priorbox.forward(), volatile=True) | self.priorbox = PriorBox(size,cfg)
self.priors = Variable(self.priorbox.forward(), volatile=True) | [
"self",
".",
"priorbox",
"=",
"PriorBox",
"(",
"size",
"cfg",
")",
"self",
".",
"priors",
"=",
"Variable",
"(",
"self",
".",
"priorbox",
".",
"forward",
"()",
"volatile",
"=",
"True",
")"
] | def __init__(self, phase, base, head, num_classes):
super(S3FD, self).__init__()
self.phase = phase
self.num_classes = num_classes
'''
self.priorbox = PriorBox(size,cfg)
self.priors = Variable(self.priorbox.forward(), volatile=True)
'''
# SSD network
... | [
"def",
"__init__",
"(",
"self",
",",
"phase",
",",
"base",
",",
"head",
",",
"num_classes",
")",
":",
"super",
"(",
"S3FD",
",",
"self",
")",
".",
"__init__",
"(",
")",
"self",
".",
"phase",
"=",
"phase",
"self",
".",
"num_classes",
"=",
"num_classes... | https://github.com/microsoft/EdgeML/blob/ef9f8a77f096acbdeb941014791f8eda1c1bc35b/examples/pytorch/vision/Face_Detection/models/RPool_Face_Quant.py#L38-L65 | ||
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/python/psutil/psutil/_psosx.py | python | cpu_times | () | return scputimes(user, nice, system, idle) | Return system CPU times as a namedtuple. | Return system CPU times as a namedtuple. | [
"Return",
"system",
"CPU",
"times",
"as",
"a",
"namedtuple",
"."
] | def cpu_times():
"""Return system CPU times as a namedtuple."""
user, nice, system, idle = cext.cpu_times()
return scputimes(user, nice, system, idle) | [
"def",
"cpu_times",
"(",
")",
":",
"user",
",",
"nice",
",",
"system",
",",
"idle",
"=",
"cext",
".",
"cpu_times",
"(",
")",
"return",
"scputimes",
"(",
"user",
",",
"nice",
",",
"system",
",",
"idle",
")"
] | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/psutil/psutil/_psosx.py#L91-L94 | |
trilinos/Trilinos | 6168be6dd51e35e1cd681e9c4b24433e709df140 | packages/kokkos/scripts/snapshot.py | python | find_git_commit_information | (options) | return commit_id, commit_log, source_name, source_location | r"""
>>> class fake_options:
... source="."
... verbose_mode=False
... debug_mode=False
>>> myoptions = fake_options()
>>> find_git_commit_information(myoptions)[2:]
('sems', 'software.sandia.gov:/git/sems') | r"""
>>> class fake_options:
... source="."
... verbose_mode=False
... debug_mode=False
>>> myoptions = fake_options()
>>> find_git_commit_information(myoptions)[2:]
('sems', 'software.sandia.gov:/git/sems') | [
"r",
">>>",
"class",
"fake_options",
":",
"...",
"source",
"=",
".",
"...",
"verbose_mode",
"=",
"False",
"...",
"debug_mode",
"=",
"False",
">>>",
"myoptions",
"=",
"fake_options",
"()",
">>>",
"find_git_commit_information",
"(",
"myoptions",
")",
"[",
"2",
... | def find_git_commit_information(options):
r"""
>>> class fake_options:
... source="."
... verbose_mode=False
... debug_mode=False
>>> myoptions = fake_options()
>>> find_git_commit_information(myoptions)[2:]
('sems', 'software.sandia.gov:/git/sems')
"""
git_log_cmd = ["git", "log", "-1"]
ou... | [
"def",
"find_git_commit_information",
"(",
"options",
")",
":",
"git_log_cmd",
"=",
"[",
"\"git\"",
",",
"\"log\"",
",",
"\"-1\"",
"]",
"output",
",",
"error",
"=",
"run_cmd",
"(",
"git_log_cmd",
",",
"options",
",",
"options",
".",
"source",
")",
"commit_ma... | https://github.com/trilinos/Trilinos/blob/6168be6dd51e35e1cd681e9c4b24433e709df140/packages/kokkos/scripts/snapshot.py#L181-L212 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/boto3/docs/collection.py | python | document_collection_object | (section, collection_model,
include_signature=True) | Documents a collection resource object
:param section: The section to write to
:param collection_model: The model of the collection
:param include_signature: Whether or not to include the signature.
It is useful for generating docstrings. | Documents a collection resource object | [
"Documents",
"a",
"collection",
"resource",
"object"
] | def document_collection_object(section, collection_model,
include_signature=True):
"""Documents a collection resource object
:param section: The section to write to
:param collection_model: The model of the collection
:param include_signature: Whether or not to include ... | [
"def",
"document_collection_object",
"(",
"section",
",",
"collection_model",
",",
"include_signature",
"=",
"True",
")",
":",
"if",
"include_signature",
":",
"section",
".",
"style",
".",
"start_sphinx_py_attr",
"(",
"collection_model",
".",
"name",
")",
"section",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/boto3/docs/collection.py#L70-L84 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py2/numpy/core/defchararray.py | python | center | (a, width, fillchar=' ') | return _vec_string(
a_arr, (a_arr.dtype.type, size), 'center', (width_arr, fillchar)) | Return a copy of `a` with its elements centered in a string of
length `width`.
Calls `str.center` element-wise.
Parameters
----------
a : array_like of str or unicode
width : int
The length of the resulting strings
fillchar : str or unicode, optional
The padding character ... | Return a copy of `a` with its elements centered in a string of
length `width`. | [
"Return",
"a",
"copy",
"of",
"a",
"with",
"its",
"elements",
"centered",
"in",
"a",
"string",
"of",
"length",
"width",
"."
] | def center(a, width, fillchar=' '):
"""
Return a copy of `a` with its elements centered in a string of
length `width`.
Calls `str.center` element-wise.
Parameters
----------
a : array_like of str or unicode
width : int
The length of the resulting strings
fillchar : str or ... | [
"def",
"center",
"(",
"a",
",",
"width",
",",
"fillchar",
"=",
"' '",
")",
":",
"a_arr",
"=",
"numpy",
".",
"asarray",
"(",
"a",
")",
"width_arr",
"=",
"numpy",
".",
"asarray",
"(",
"width",
")",
"size",
"=",
"long",
"(",
"numpy",
".",
"max",
"("... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py2/numpy/core/defchararray.py#L429-L462 | |
apache/thrift | 0b29261a4f3c6882ef3b09aae47914f0012b0472 | lib/py/src/TMultiplexedProcessor.py | python | TMultiplexedProcessor.registerDefault | (self, processor) | If a non-multiplexed processor connects to the server and wants to
communicate, use the given processor to handle it. This mechanism
allows servers to upgrade from non-multiplexed to multiplexed in a
backwards-compatible way and still handle old clients. | If a non-multiplexed processor connects to the server and wants to
communicate, use the given processor to handle it. This mechanism
allows servers to upgrade from non-multiplexed to multiplexed in a
backwards-compatible way and still handle old clients. | [
"If",
"a",
"non",
"-",
"multiplexed",
"processor",
"connects",
"to",
"the",
"server",
"and",
"wants",
"to",
"communicate",
"use",
"the",
"given",
"processor",
"to",
"handle",
"it",
".",
"This",
"mechanism",
"allows",
"servers",
"to",
"upgrade",
"from",
"non"... | def registerDefault(self, processor):
"""
If a non-multiplexed processor connects to the server and wants to
communicate, use the given processor to handle it. This mechanism
allows servers to upgrade from non-multiplexed to multiplexed in a
backwards-compatible way and still ha... | [
"def",
"registerDefault",
"(",
"self",
",",
"processor",
")",
":",
"self",
".",
"defaultProcessor",
"=",
"processor"
] | https://github.com/apache/thrift/blob/0b29261a4f3c6882ef3b09aae47914f0012b0472/lib/py/src/TMultiplexedProcessor.py#L30-L37 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_windows.py | python | VarHScrollHelper.GetVisibleColumnsEnd | (*args, **kwargs) | return _windows_.VarHScrollHelper_GetVisibleColumnsEnd(*args, **kwargs) | GetVisibleColumnsEnd(self) -> size_t | GetVisibleColumnsEnd(self) -> size_t | [
"GetVisibleColumnsEnd",
"(",
"self",
")",
"-",
">",
"size_t"
] | def GetVisibleColumnsEnd(*args, **kwargs):
"""GetVisibleColumnsEnd(self) -> size_t"""
return _windows_.VarHScrollHelper_GetVisibleColumnsEnd(*args, **kwargs) | [
"def",
"GetVisibleColumnsEnd",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"VarHScrollHelper_GetVisibleColumnsEnd",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_windows.py#L2352-L2354 | |
microsoft/Azure-Kinect-Sensor-SDK | d87ef578676c05b9a5d23c097502942753bf3777 | examples/calibration_registration/camera_tools.py | python | calibrate_camera | (
imdir:str,
template:str,
init_calfile:str = None,
rms_thr:float = 1.0,
postfix:str = "",
min_detections:int = 30,
min_images:int = 30,
min_quality_images:int = 30,
per_view_threshold:int = 1
) | return rms, k_matrix, dist, img_size, rvecs, tvecs, num_good_images | Calibrate a camera using charuco detector and opencv bundler.
Args:
imdir (str): Image directory.
template (str): Fullpath of the board json_file.
init_calfile (str, optional): Calibration file. Defaults to None.
rms_thr (float, optional): Reprojection threshold. Defaults to 1.0.
postfix (str, op... | Calibrate a camera using charuco detector and opencv bundler. | [
"Calibrate",
"a",
"camera",
"using",
"charuco",
"detector",
"and",
"opencv",
"bundler",
"."
] | def calibrate_camera(
imdir:str,
template:str,
init_calfile:str = None,
rms_thr:float = 1.0,
postfix:str = "",
min_detections:int = 30,
min_images:int = 30,
min_quality_images:int = 30,
per_view_threshold:int = 1
) -> Tuple[float,
np.array,
np.array,
np.array,
... | [
"def",
"calibrate_camera",
"(",
"imdir",
":",
"str",
",",
"template",
":",
"str",
",",
"init_calfile",
":",
"str",
"=",
"None",
",",
"rms_thr",
":",
"float",
"=",
"1.0",
",",
"postfix",
":",
"str",
"=",
"\"\"",
",",
"min_detections",
":",
"int",
"=",
... | https://github.com/microsoft/Azure-Kinect-Sensor-SDK/blob/d87ef578676c05b9a5d23c097502942753bf3777/examples/calibration_registration/camera_tools.py#L517-L642 | |
nasa/astrobee | 9241e67e6692810d6e275abb3165b6d02f4ca5ef | management/sys_monitor/tools/clock_skew.py | python | seconds_from_time_delta | (td) | return td / np.timedelta64(1, "s") | Convert np.timedelta64 to floating point seconds. | Convert np.timedelta64 to floating point seconds. | [
"Convert",
"np",
".",
"timedelta64",
"to",
"floating",
"point",
"seconds",
"."
] | def seconds_from_time_delta(td):
"""
Convert np.timedelta64 to floating point seconds.
"""
return td / np.timedelta64(1, "s") | [
"def",
"seconds_from_time_delta",
"(",
"td",
")",
":",
"return",
"td",
"/",
"np",
".",
"timedelta64",
"(",
"1",
",",
"\"s\"",
")"
] | https://github.com/nasa/astrobee/blob/9241e67e6692810d6e275abb3165b6d02f4ca5ef/management/sys_monitor/tools/clock_skew.py#L59-L63 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/ec2/connection.py | python | EC2Connection.get_password_data | (self, instance_id, dry_run=False) | return rs.passwordData | Get encrypted administrator password for a Windows instance.
:type instance_id: string
:param instance_id: The identifier of the instance to retrieve the
password for.
:type dry_run: bool
:param dry_run: Set to True if the operation should not actually run. | Get encrypted administrator password for a Windows instance. | [
"Get",
"encrypted",
"administrator",
"password",
"for",
"a",
"Windows",
"instance",
"."
] | def get_password_data(self, instance_id, dry_run=False):
"""
Get encrypted administrator password for a Windows instance.
:type instance_id: string
:param instance_id: The identifier of the instance to retrieve the
password for.
:type dry_run: bool
... | [
"def",
"get_password_data",
"(",
"self",
",",
"instance_id",
",",
"dry_run",
"=",
"False",
")",
":",
"params",
"=",
"{",
"'InstanceId'",
":",
"instance_id",
"}",
"if",
"dry_run",
":",
"params",
"[",
"'DryRun'",
"]",
"=",
"'true'",
"rs",
"=",
"self",
".",... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/ec2/connection.py#L4036-L4052 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/gradients_util.py | python | _GradientsHelper | (ys,
xs,
grad_ys=None,
name="gradients",
colocate_gradients_with_ops=False,
gate_gradients=False,
aggregation_method=None,
stop_gradients=None,
unconnec... | return [_GetGrad(grads, x, unconnected_gradients) for x in xs] | Implementation of gradients(). | Implementation of gradients(). | [
"Implementation",
"of",
"gradients",
"()",
"."
] | def _GradientsHelper(ys,
xs,
grad_ys=None,
name="gradients",
colocate_gradients_with_ops=False,
gate_gradients=False,
aggregation_method=None,
stop_gradients=None,
... | [
"def",
"_GradientsHelper",
"(",
"ys",
",",
"xs",
",",
"grad_ys",
"=",
"None",
",",
"name",
"=",
"\"gradients\"",
",",
"colocate_gradients_with_ops",
"=",
"False",
",",
"gate_gradients",
"=",
"False",
",",
"aggregation_method",
"=",
"None",
",",
"stop_gradients",... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/gradients_util.py#L465-L724 | |
DGA-MI-SSI/YaCo | 9b85e6ca1809114c4df1382c11255f7e38408912 | deps/flatbuffers-1.8.0/android/jni/run_flatc.py | python | main | () | return subprocess.call(command) | Script that finds and runs flatc built from source. | Script that finds and runs flatc built from source. | [
"Script",
"that",
"finds",
"and",
"runs",
"flatc",
"built",
"from",
"source",
"."
] | def main():
"""Script that finds and runs flatc built from source."""
if len(sys.argv) < 2:
sys.stderr.write('Usage: run_flatc.py flatbuffers_dir [flatc_args]\n')
return 1
cwd = os.getcwd()
flatc = ''
flatbuffers_dir = sys.argv[1]
for path in FLATC_SEARCH_PATHS:
current = os.path.join(flatbuffer... | [
"def",
"main",
"(",
")",
":",
"if",
"len",
"(",
"sys",
".",
"argv",
")",
"<",
"2",
":",
"sys",
".",
"stderr",
".",
"write",
"(",
"'Usage: run_flatc.py flatbuffers_dir [flatc_args]\\n'",
")",
"return",
"1",
"cwd",
"=",
"os",
".",
"getcwd",
"(",
")",
"fl... | https://github.com/DGA-MI-SSI/YaCo/blob/9b85e6ca1809114c4df1382c11255f7e38408912/deps/flatbuffers-1.8.0/android/jni/run_flatc.py#L25-L43 | |
coinapi/coinapi-sdk | 854f21e7f69ea8599ae35c5403565cf299d8b795 | oeml-sdk/python/openapi_client/model/balance_data.py | python | BalanceData._from_openapi_data | (cls, *args, **kwargs) | return self | BalanceData - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
... | BalanceData - a model defined in OpenAPI | [
"BalanceData",
"-",
"a",
"model",
"defined",
"in",
"OpenAPI"
] | def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
"""BalanceData - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
... | [
"def",
"_from_openapi_data",
"(",
"cls",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# noqa: E501",
"_check_type",
"=",
"kwargs",
".",
"pop",
"(",
"'_check_type'",
",",
"True",
")",
"_spec_property_naming",
"=",
"kwargs",
".",
"pop",
"(",
"'_spec... | https://github.com/coinapi/coinapi-sdk/blob/854f21e7f69ea8599ae35c5403565cf299d8b795/oeml-sdk/python/openapi_client/model/balance_data.py#L123-L200 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/deps/v8/tools/grokdump.py | python | InspectionPadawan.PrintStackTraceMessage | (self, start=None, print_message=True) | return self.TryExtractOldStyleStackTrace(0, start, end,
print_message) | Try to print a possible message from PushStackTraceAndDie.
Returns the first address where the normal stack starts again. | Try to print a possible message from PushStackTraceAndDie.
Returns the first address where the normal stack starts again. | [
"Try",
"to",
"print",
"a",
"possible",
"message",
"from",
"PushStackTraceAndDie",
".",
"Returns",
"the",
"first",
"address",
"where",
"the",
"normal",
"stack",
"starts",
"again",
"."
] | def PrintStackTraceMessage(self, start=None, print_message=True):
"""
Try to print a possible message from PushStackTraceAndDie.
Returns the first address where the normal stack starts again.
"""
# Only look at the first 1k words on the stack
ptr_size = self.reader.PointerSize()
if start is ... | [
"def",
"PrintStackTraceMessage",
"(",
"self",
",",
"start",
"=",
"None",
",",
"print_message",
"=",
"True",
")",
":",
"# Only look at the first 1k words on the stack",
"ptr_size",
"=",
"self",
".",
"reader",
".",
"PointerSize",
"(",
")",
"if",
"start",
"is",
"No... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/deps/v8/tools/grokdump.py#L2115-L2140 | |
GarageGames/Torque2D | 72c8891f192b44d58a8bd5ec2b293a3b48a818f4 | engine/lib/freetype/android/freetype-2.4.12/src/tools/docmaker/content.py | python | DocBlock.get_markup | ( self, tag_name ) | return None | return the DocMarkup corresponding to a given tag in a block | return the DocMarkup corresponding to a given tag in a block | [
"return",
"the",
"DocMarkup",
"corresponding",
"to",
"a",
"given",
"tag",
"in",
"a",
"block"
] | def get_markup( self, tag_name ):
"""return the DocMarkup corresponding to a given tag in a block"""
for m in self.markups:
if m.tag == string.lower( tag_name ):
return m
return None | [
"def",
"get_markup",
"(",
"self",
",",
"tag_name",
")",
":",
"for",
"m",
"in",
"self",
".",
"markups",
":",
"if",
"m",
".",
"tag",
"==",
"string",
".",
"lower",
"(",
"tag_name",
")",
":",
"return",
"m",
"return",
"None"
] | https://github.com/GarageGames/Torque2D/blob/72c8891f192b44d58a8bd5ec2b293a3b48a818f4/engine/lib/freetype/android/freetype-2.4.12/src/tools/docmaker/content.py#L551-L556 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/keras/backend.py | python | dtype | (x) | return x.dtype.base_dtype.name | Returns the dtype of a Keras tensor or variable, as a string.
Arguments:
x: Tensor or variable.
Returns:
String, dtype of `x`.
Examples:
```python
>>> from keras import backend as K
>>> K.dtype(K.placeholder(shape=(2,4,5)))
'float32'
>>> K.dtype(K.placeholder(shape=(2,4,5), dtype='float32... | Returns the dtype of a Keras tensor or variable, as a string. | [
"Returns",
"the",
"dtype",
"of",
"a",
"Keras",
"tensor",
"or",
"variable",
"as",
"a",
"string",
"."
] | def dtype(x):
"""Returns the dtype of a Keras tensor or variable, as a string.
Arguments:
x: Tensor or variable.
Returns:
String, dtype of `x`.
Examples:
```python
>>> from keras import backend as K
>>> K.dtype(K.placeholder(shape=(2,4,5)))
'float32'
>>> K.dtype(K.placeholder(shape=(2,4... | [
"def",
"dtype",
"(",
"x",
")",
":",
"return",
"x",
".",
"dtype",
".",
"base_dtype",
".",
"name"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/keras/backend.py#L1216-L1243 | |
qboticslabs/mastering_ros | d83e78f30acc45b0f18522c1d5fae3a7f52974b9 | chapter_9_codes/chefbot/chefbot/chefbot_bringup/scripts/SerialDataGateway.py | python | SerialDataGateway.__init__ | (self, port="/dev/ttyUSB0", baudrate=115200, lineHandler = _OnLineReceived) | Initializes the receiver class.
port: The serial port to listen to.
receivedLineHandler: The function to call when a line was received. | Initializes the receiver class.
port: The serial port to listen to.
receivedLineHandler: The function to call when a line was received. | [
"Initializes",
"the",
"receiver",
"class",
".",
"port",
":",
"The",
"serial",
"port",
"to",
"listen",
"to",
".",
"receivedLineHandler",
":",
"The",
"function",
"to",
"call",
"when",
"a",
"line",
"was",
"received",
"."
] | def __init__(self, port="/dev/ttyUSB0", baudrate=115200, lineHandler = _OnLineReceived):
'''
Initializes the receiver class.
port: The serial port to listen to.
receivedLineHandler: The function to call when a line was received.
'''
self._Port = port
self._Baudrate = baudrate
self.ReceivedLineHandler =... | [
"def",
"__init__",
"(",
"self",
",",
"port",
"=",
"\"/dev/ttyUSB0\"",
",",
"baudrate",
"=",
"115200",
",",
"lineHandler",
"=",
"_OnLineReceived",
")",
":",
"self",
".",
"_Port",
"=",
"port",
"self",
".",
"_Baudrate",
"=",
"baudrate",
"self",
".",
"Received... | https://github.com/qboticslabs/mastering_ros/blob/d83e78f30acc45b0f18522c1d5fae3a7f52974b9/chapter_9_codes/chefbot/chefbot/chefbot_bringup/scripts/SerialDataGateway.py#L22-L31 | ||
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | toolkit/crashreporter/tools/symbolstore.py | python | Dumper.ProcessFiles | (self, files, after=None, after_arg=None) | Dump symbols from these files into a symbol file, stored
in the proper directory structure in |symbol_path|; processing is performed
asynchronously, and Finish must be called to wait for it complete and cleanup.
All files after the first are fallbacks in case the first file does not process
... | Dump symbols from these files into a symbol file, stored
in the proper directory structure in |symbol_path|; processing is performed
asynchronously, and Finish must be called to wait for it complete and cleanup.
All files after the first are fallbacks in case the first file does not process
... | [
"Dump",
"symbols",
"from",
"these",
"files",
"into",
"a",
"symbol",
"file",
"stored",
"in",
"the",
"proper",
"directory",
"structure",
"in",
"|symbol_path|",
";",
"processing",
"is",
"performed",
"asynchronously",
"and",
"Finish",
"must",
"be",
"called",
"to",
... | def ProcessFiles(self, files, after=None, after_arg=None):
"""Dump symbols from these files into a symbol file, stored
in the proper directory structure in |symbol_path|; processing is performed
asynchronously, and Finish must be called to wait for it complete and cleanup.
All files aft... | [
"def",
"ProcessFiles",
"(",
"self",
",",
"files",
",",
"after",
"=",
"None",
",",
"after_arg",
"=",
"None",
")",
":",
"self",
".",
"output_pid",
"(",
"sys",
".",
"stderr",
",",
"\"Submitting jobs for files: %s\"",
"%",
"str",
"(",
"files",
")",
")",
"# t... | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/toolkit/crashreporter/tools/symbolstore.py#L589-L602 | ||
abseil/abseil-cpp | 73316fc3c565e5998983b0fb502d938ccddcded2 | absl/copts/generate_copts.py | python | generate_copt_file | (style) | Creates a generated copt file using the given style object.
Args:
style: either StarlarkStyle() or CMakeStyle() | Creates a generated copt file using the given style object. | [
"Creates",
"a",
"generated",
"copt",
"file",
"using",
"the",
"given",
"style",
"object",
"."
] | def generate_copt_file(style):
"""Creates a generated copt file using the given style object.
Args:
style: either StarlarkStyle() or CMakeStyle()
"""
with open(relative_filename(style.filename()), "w") as f:
f.write(style.docstring())
f.write("\n")
for var_name, arg_list in sorted(COPT_VARS.ite... | [
"def",
"generate_copt_file",
"(",
"style",
")",
":",
"with",
"open",
"(",
"relative_filename",
"(",
"style",
".",
"filename",
"(",
")",
")",
",",
"\"w\"",
")",
"as",
"f",
":",
"f",
".",
"write",
"(",
"style",
".",
"docstring",
"(",
")",
")",
"f",
"... | https://github.com/abseil/abseil-cpp/blob/73316fc3c565e5998983b0fb502d938ccddcded2/absl/copts/generate_copts.py#L86-L97 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/cython/Cython/Plex/Regexps.py | python | uppercase_range | (code1, code2) | If the range of characters from code1 to code2-1 includes any
lower case letters, return the corresponding upper case range. | If the range of characters from code1 to code2-1 includes any
lower case letters, return the corresponding upper case range. | [
"If",
"the",
"range",
"of",
"characters",
"from",
"code1",
"to",
"code2",
"-",
"1",
"includes",
"any",
"lower",
"case",
"letters",
"return",
"the",
"corresponding",
"upper",
"case",
"range",
"."
] | def uppercase_range(code1, code2):
"""
If the range of characters from code1 to code2-1 includes any
lower case letters, return the corresponding upper case range.
"""
code3 = max(code1, ord('a'))
code4 = min(code2, ord('z') + 1)
if code3 < code4:
d = ord('A') - ord('a')
retu... | [
"def",
"uppercase_range",
"(",
"code1",
",",
"code2",
")",
":",
"code3",
"=",
"max",
"(",
"code1",
",",
"ord",
"(",
"'a'",
")",
")",
"code4",
"=",
"min",
"(",
"code2",
",",
"ord",
"(",
"'z'",
")",
"+",
"1",
")",
"if",
"code3",
"<",
"code4",
":"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/cython/Cython/Plex/Regexps.py#L57-L68 | ||
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | python/mooseutils/VectorPostprocessorReader.py | python | VectorPostprocessorReader.clear | (self) | Remove all data. | Remove all data. | [
"Remove",
"all",
"data",
"."
] | def clear(self):
"""
Remove all data.
"""
self._frames = dict()
self._index = None
self._time = None | [
"def",
"clear",
"(",
"self",
")",
":",
"self",
".",
"_frames",
"=",
"dict",
"(",
")",
"self",
".",
"_index",
"=",
"None",
"self",
".",
"_time",
"=",
"None"
] | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/mooseutils/VectorPostprocessorReader.py#L87-L93 | ||
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/base.py | python | ctypes2numpy_shared | (cptr, shape) | return _np.frombuffer(dbuffer, dtype=_np.float32).reshape(shape) | Convert a ctypes pointer to a numpy array.
The resulting NumPy array shares the memory with the pointer.
Parameters
----------
cptr : ctypes.POINTER(mx_float)
pointer to the memory region
shape : tuple
Shape of target `NDArray`.
Returns
-------
out : numpy_array
... | Convert a ctypes pointer to a numpy array. | [
"Convert",
"a",
"ctypes",
"pointer",
"to",
"a",
"numpy",
"array",
"."
] | def ctypes2numpy_shared(cptr, shape):
"""Convert a ctypes pointer to a numpy array.
The resulting NumPy array shares the memory with the pointer.
Parameters
----------
cptr : ctypes.POINTER(mx_float)
pointer to the memory region
shape : tuple
Shape of target `NDArray`.
Re... | [
"def",
"ctypes2numpy_shared",
"(",
"cptr",
",",
"shape",
")",
":",
"if",
"not",
"isinstance",
"(",
"cptr",
",",
"ctypes",
".",
"POINTER",
"(",
"mx_float",
")",
")",
":",
"raise",
"RuntimeError",
"(",
"'expected float pointer'",
")",
"size",
"=",
"1",
"for"... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/base.py#L489-L513 | |
arangodb/arangodb | 0d658689c7d1b721b314fa3ca27d38303e1570c8 | 3rdParty/V8/v7.9.317/third_party/jinja2/filters.py | python | do_selectattr | (*args, **kwargs) | return select_or_reject(args, kwargs, lambda x: x, True) | Filters a sequence of objects by applying a test to the specified
attribute of each object, and only selecting the objects with the
test succeeding.
If no test is specified, the attribute's value will be evaluated as
a boolean.
Example usage:
.. sourcecode:: jinja
{{ users|selectattr... | Filters a sequence of objects by applying a test to the specified
attribute of each object, and only selecting the objects with the
test succeeding. | [
"Filters",
"a",
"sequence",
"of",
"objects",
"by",
"applying",
"a",
"test",
"to",
"the",
"specified",
"attribute",
"of",
"each",
"object",
"and",
"only",
"selecting",
"the",
"objects",
"with",
"the",
"test",
"succeeding",
"."
] | def do_selectattr(*args, **kwargs):
"""Filters a sequence of objects by applying a test to the specified
attribute of each object, and only selecting the objects with the
test succeeding.
If no test is specified, the attribute's value will be evaluated as
a boolean.
Example usage:
.. sour... | [
"def",
"do_selectattr",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"select_or_reject",
"(",
"args",
",",
"kwargs",
",",
"lambda",
"x",
":",
"x",
",",
"True",
")"
] | https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/V8/v7.9.317/third_party/jinja2/filters.py#L1007-L1024 | |
Tencent/PhoenixGo | fbf67f9aec42531bff9569c44b85eb4c3f37b7be | configure.py | python | set_build_var | (environ_cp,
var_name,
query_item,
option_name,
enabled_by_default,
bazel_config_name=None) | Set if query_item will be enabled for the build.
Ask user if query_item will be enabled. Default is used if no input is given.
Set subprocess environment variable and write to .bazelrc if enabled.
Args:
environ_cp: copy of the os.environ.
var_name: string for name of environment variable, e.g. "TF_NEED_... | Set if query_item will be enabled for the build. | [
"Set",
"if",
"query_item",
"will",
"be",
"enabled",
"for",
"the",
"build",
"."
] | def set_build_var(environ_cp,
var_name,
query_item,
option_name,
enabled_by_default,
bazel_config_name=None):
"""Set if query_item will be enabled for the build.
Ask user if query_item will be enabled. Default is used if no i... | [
"def",
"set_build_var",
"(",
"environ_cp",
",",
"var_name",
",",
"query_item",
",",
"option_name",
",",
"enabled_by_default",
",",
"bazel_config_name",
"=",
"None",
")",
":",
"var",
"=",
"str",
"(",
"int",
"(",
"get_var",
"(",
"environ_cp",
",",
"var_name",
... | https://github.com/Tencent/PhoenixGo/blob/fbf67f9aec42531bff9569c44b85eb4c3f37b7be/configure.py#L357-L388 | ||
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/tools/cpplint.py | python | CheckCStyleCast | (filename, clean_lines, linenum, 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.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
cast_type: The string for the C++ cast to recommend. This is either
reinterpret_cast, static_... | 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, clean_lines, linenum, cast_type, pattern, error):
"""Checks for a C-style cast by looking for the pattern.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
cast_type: The ... | [
"def",
"CheckCStyleCast",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"cast_type",
",",
"pattern",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"match",
"=",
"Search",
"(",
"pattern",
",",
"line",
... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/cpplint.py#L5907-L5957 | |
tomahawk-player/tomahawk-resolvers | 7f827bbe410ccfdb0446f7d6a91acc2199c9cc8d | archive/spotify/breakpad/third_party/protobuf/protobuf/python/google/protobuf/service_reflection.py | python | _ServiceStubBuilder._StubMethod | (self, stub, method_descriptor,
rpc_controller, request, callback) | return stub.rpc_channel.CallMethod(
method_descriptor, rpc_controller, request,
method_descriptor.output_type._concrete_class, callback) | The body of all service methods in the generated stub class.
Args:
stub: Stub instance.
method_descriptor: Descriptor of the invoked method.
rpc_controller: Rpc controller to execute the method.
request: Request protocol message.
callback: A callback to execute when the method finishe... | The body of all service methods in the generated stub class. | [
"The",
"body",
"of",
"all",
"service",
"methods",
"in",
"the",
"generated",
"stub",
"class",
"."
] | def _StubMethod(self, stub, method_descriptor,
rpc_controller, request, callback):
"""The body of all service methods in the generated stub class.
Args:
stub: Stub instance.
method_descriptor: Descriptor of the invoked method.
rpc_controller: Rpc controller to execute the me... | [
"def",
"_StubMethod",
"(",
"self",
",",
"stub",
",",
"method_descriptor",
",",
"rpc_controller",
",",
"request",
",",
"callback",
")",
":",
"return",
"stub",
".",
"rpc_channel",
".",
"CallMethod",
"(",
"method_descriptor",
",",
"rpc_controller",
",",
"request",
... | https://github.com/tomahawk-player/tomahawk-resolvers/blob/7f827bbe410ccfdb0446f7d6a91acc2199c9cc8d/archive/spotify/breakpad/third_party/protobuf/protobuf/python/google/protobuf/service_reflection.py#L269-L284 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/ebmlib/clipboard.py | python | Clipboard.SystemSet | (cls, text) | return ok | Set text into the system clipboard
@param text: string
@return: bool | Set text into the system clipboard
@param text: string
@return: bool | [
"Set",
"text",
"into",
"the",
"system",
"clipboard",
"@param",
"text",
":",
"string",
"@return",
":",
"bool"
] | def SystemSet(cls, text):
"""Set text into the system clipboard
@param text: string
@return: bool
"""
ok = False
if wx.TheClipboard.Open():
wx.TheClipboard.SetData(wx.TextDataObject(text))
wx.TheClipboard.Close()
ok = True
retu... | [
"def",
"SystemSet",
"(",
"cls",
",",
"text",
")",
":",
"ok",
"=",
"False",
"if",
"wx",
".",
"TheClipboard",
".",
"Open",
"(",
")",
":",
"wx",
".",
"TheClipboard",
".",
"SetData",
"(",
"wx",
".",
"TextDataObject",
"(",
"text",
")",
")",
"wx",
".",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/ebmlib/clipboard.py#L140-L151 | |
echronos/echronos | c996f1d2c8af6c6536205eb319c1bf1d4d84569c | external_tools/ply_info/example/ansic/cparse.py | python | p_statement_list_2 | (t) | statement_list : statement_list statement | statement_list : statement_list statement | [
"statement_list",
":",
"statement_list",
"statement"
] | def p_statement_list_2(t):
'statement_list : statement_list statement'
pass | [
"def",
"p_statement_list_2",
"(",
"t",
")",
":",
"pass"
] | https://github.com/echronos/echronos/blob/c996f1d2c8af6c6536205eb319c1bf1d4d84569c/external_tools/ply_info/example/ansic/cparse.py#L507-L509 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/xrc.py | python | XmlDocument.SetVersion | (*args, **kwargs) | return _xrc.XmlDocument_SetVersion(*args, **kwargs) | SetVersion(self, String version) | SetVersion(self, String version) | [
"SetVersion",
"(",
"self",
"String",
"version",
")"
] | def SetVersion(*args, **kwargs):
"""SetVersion(self, String version)"""
return _xrc.XmlDocument_SetVersion(*args, **kwargs) | [
"def",
"SetVersion",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_xrc",
".",
"XmlDocument_SetVersion",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/xrc.py#L555-L557 | |
llvm/llvm-project | ffa6262cb4e2a335d26416fad39a581b4f98c5f4 | clang/bindings/python/clang/cindex.py | python | File.from_name | (translation_unit, file_name) | return File(conf.lib.clang_getFile(translation_unit, fspath(file_name))) | Retrieve a file handle within the given translation unit. | Retrieve a file handle within the given translation unit. | [
"Retrieve",
"a",
"file",
"handle",
"within",
"the",
"given",
"translation",
"unit",
"."
] | def from_name(translation_unit, file_name):
"""Retrieve a file handle within the given translation unit."""
return File(conf.lib.clang_getFile(translation_unit, fspath(file_name))) | [
"def",
"from_name",
"(",
"translation_unit",
",",
"file_name",
")",
":",
"return",
"File",
"(",
"conf",
".",
"lib",
".",
"clang_getFile",
"(",
"translation_unit",
",",
"fspath",
"(",
"file_name",
")",
")",
")"
] | https://github.com/llvm/llvm-project/blob/ffa6262cb4e2a335d26416fad39a581b4f98c5f4/clang/bindings/python/clang/cindex.py#L3097-L3099 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/tarfile.py | python | TarInfo.create_pax_global_header | (cls, pax_headers) | return cls._create_pax_generic_header(pax_headers, XGLTYPE, "utf-8") | Return the object as a pax global header block sequence. | Return the object as a pax global header block sequence. | [
"Return",
"the",
"object",
"as",
"a",
"pax",
"global",
"header",
"block",
"sequence",
"."
] | def create_pax_global_header(cls, pax_headers):
"""Return the object as a pax global header block sequence.
"""
return cls._create_pax_generic_header(pax_headers, XGLTYPE, "utf-8") | [
"def",
"create_pax_global_header",
"(",
"cls",
",",
"pax_headers",
")",
":",
"return",
"cls",
".",
"_create_pax_generic_header",
"(",
"pax_headers",
",",
"XGLTYPE",
",",
"\"utf-8\"",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/tarfile.py#L909-L912 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/python/training/optimizer.py | python | Optimizer.get_slot_names | (self) | return sorted(self._slots.keys()) | Return a list of the names of slots created by the `Optimizer`.
See `get_slot()`.
Returns:
A list of strings. | Return a list of the names of slots created by the `Optimizer`. | [
"Return",
"a",
"list",
"of",
"the",
"names",
"of",
"slots",
"created",
"by",
"the",
"Optimizer",
"."
] | def get_slot_names(self):
"""Return a list of the names of slots created by the `Optimizer`.
See `get_slot()`.
Returns:
A list of strings.
"""
return sorted(self._slots.keys()) | [
"def",
"get_slot_names",
"(",
"self",
")",
":",
"return",
"sorted",
"(",
"self",
".",
"_slots",
".",
"keys",
"(",
")",
")"
] | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/training/optimizer.py#L343-L351 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/tornado/tornado-6/tornado/platform/asyncio.py | python | to_asyncio_future | (tornado_future: asyncio.Future) | return convert_yielded(tornado_future) | Convert a Tornado yieldable object to an `asyncio.Future`.
.. versionadded:: 4.1
.. versionchanged:: 4.3
Now accepts any yieldable object, not just
`tornado.concurrent.Future`.
.. deprecated:: 5.0
Tornado ``Futures`` have been merged with `asyncio.Future`,
so this method is no... | Convert a Tornado yieldable object to an `asyncio.Future`. | [
"Convert",
"a",
"Tornado",
"yieldable",
"object",
"to",
"an",
"asyncio",
".",
"Future",
"."
] | def to_asyncio_future(tornado_future: asyncio.Future) -> asyncio.Future:
"""Convert a Tornado yieldable object to an `asyncio.Future`.
.. versionadded:: 4.1
.. versionchanged:: 4.3
Now accepts any yieldable object, not just
`tornado.concurrent.Future`.
.. deprecated:: 5.0
Tornado... | [
"def",
"to_asyncio_future",
"(",
"tornado_future",
":",
"asyncio",
".",
"Future",
")",
"->",
"asyncio",
".",
"Future",
":",
"return",
"convert_yielded",
"(",
"tornado_future",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/tornado/tornado-6/tornado/platform/asyncio.py#L350-L363 | |
CleverRaven/Cataclysm-DDA | 03e7363df0835ec1b39da973ea29f26f27833b38 | tools/json_tools/generate_overmap_sprites.py | python | split_image | (
image: Image,
om_ids: list,
) | Split image into SIZExSIZE sprites, yield (id, image) pairs | Split image into SIZExSIZE sprites, yield (id, image) pairs | [
"Split",
"image",
"into",
"SIZExSIZE",
"sprites",
"yield",
"(",
"id",
"image",
")",
"pairs"
] | def split_image(
image: Image,
om_ids: list,
) -> tuple:
"""
Split image into SIZExSIZE sprites, yield (id, image) pairs
"""
width, height = image.size
for row in range(height // SIZE):
for col in range(width // SIZE):
box = (col * SIZE, row * SIZE, (col + 1) * SIZE, (row... | [
"def",
"split_image",
"(",
"image",
":",
"Image",
",",
"om_ids",
":",
"list",
",",
")",
"->",
"tuple",
":",
"width",
",",
"height",
"=",
"image",
".",
"size",
"for",
"row",
"in",
"range",
"(",
"height",
"//",
"SIZE",
")",
":",
"for",
"col",
"in",
... | https://github.com/CleverRaven/Cataclysm-DDA/blob/03e7363df0835ec1b39da973ea29f26f27833b38/tools/json_tools/generate_overmap_sprites.py#L119-L131 | ||
TheImagingSource/tiscamera | baacb4cfaa7858c2e6cfb4f1a297b404c4e002f6 | tools/tcam-capture/tcam_capture/TcamView.py | python | TcamView.has_dutils | () | return False | Check to see if the gstreamer module gsttcamdutils is available. | Check to see if the gstreamer module gsttcamdutils is available. | [
"Check",
"to",
"see",
"if",
"the",
"gstreamer",
"module",
"gsttcamdutils",
"is",
"available",
"."
] | def has_dutils():
"""
Check to see if the gstreamer module gsttcamdutils is available.
"""
factory = Gst.ElementFactory.find("tcamdutils")
if factory:
return True
return False | [
"def",
"has_dutils",
"(",
")",
":",
"factory",
"=",
"Gst",
".",
"ElementFactory",
".",
"find",
"(",
"\"tcamdutils\"",
")",
"if",
"factory",
":",
"return",
"True",
"return",
"False"
] | https://github.com/TheImagingSource/tiscamera/blob/baacb4cfaa7858c2e6cfb4f1a297b404c4e002f6/tools/tcam-capture/tcam_capture/TcamView.py#L603-L612 | |
MhLiao/TextBoxes_plusplus | 39d4898de1504c53a2ed3d67966a57b3595836d0 | scripts/cpp_lint.py | python | RemoveMultiLineCommentsFromRange | (lines, begin, end) | Clears a range of lines for multi-line comments. | Clears a range of lines for multi-line comments. | [
"Clears",
"a",
"range",
"of",
"lines",
"for",
"multi",
"-",
"line",
"comments",
"."
] | def RemoveMultiLineCommentsFromRange(lines, begin, end):
"""Clears a range of lines for multi-line comments."""
# Having // dummy comments makes the lines non-empty, so we will not get
# unnecessary blank line warnings later in the code.
for i in range(begin, end):
lines[i] = '// dummy' | [
"def",
"RemoveMultiLineCommentsFromRange",
"(",
"lines",
",",
"begin",
",",
"end",
")",
":",
"# Having // dummy comments makes the lines non-empty, so we will not get",
"# unnecessary blank line warnings later in the code.",
"for",
"i",
"in",
"range",
"(",
"begin",
",",
"end",
... | https://github.com/MhLiao/TextBoxes_plusplus/blob/39d4898de1504c53a2ed3d67966a57b3595836d0/scripts/cpp_lint.py#L1143-L1148 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/ma/core.py | python | inner | (a, b) | return np.inner(fa, fb).view(MaskedArray) | Returns the inner product of a and b for arrays of floating point types.
Like the generic NumPy equivalent the product sum is over the last dimension
of a and b. The first argument is not conjugated. | Returns the inner product of a and b for arrays of floating point types. | [
"Returns",
"the",
"inner",
"product",
"of",
"a",
"and",
"b",
"for",
"arrays",
"of",
"floating",
"point",
"types",
"."
] | def inner(a, b):
"""
Returns the inner product of a and b for arrays of floating point types.
Like the generic NumPy equivalent the product sum is over the last dimension
of a and b. The first argument is not conjugated.
"""
fa = filled(a, 0)
fb = filled(b, 0)
if fa.ndim == 0:
... | [
"def",
"inner",
"(",
"a",
",",
"b",
")",
":",
"fa",
"=",
"filled",
"(",
"a",
",",
"0",
")",
"fb",
"=",
"filled",
"(",
"b",
",",
"0",
")",
"if",
"fa",
".",
"ndim",
"==",
"0",
":",
"fa",
".",
"shape",
"=",
"(",
"1",
",",
")",
"if",
"fb",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/ma/core.py#L7529-L7543 | |
naver/sling | 5671cd445a2caae0b4dd0332299e4cfede05062c | webkit/Tools/Scripts/webkitpy/style/checker.py | python | StyleProcessorConfiguration.is_reportable | (self, category, confidence_in_error, file_path) | return self._filter_configuration.should_check(category, file_path) | Return whether an error is reportable.
An error is reportable if both the confidence in the error is
at least the minimum confidence level and the current filter
says the category should be checked for the given path.
Args:
category: A string that is a style category.
... | Return whether an error is reportable. | [
"Return",
"whether",
"an",
"error",
"is",
"reportable",
"."
] | def is_reportable(self, category, confidence_in_error, file_path):
"""Return whether an error is reportable.
An error is reportable if both the confidence in the error is
at least the minimum confidence level and the current filter
says the category should be checked for the given path.... | [
"def",
"is_reportable",
"(",
"self",
",",
"category",
",",
"confidence_in_error",
",",
"file_path",
")",
":",
"if",
"confidence_in_error",
"<",
"self",
".",
"min_confidence",
":",
"return",
"False",
"return",
"self",
".",
"_filter_configuration",
".",
"should_chec... | https://github.com/naver/sling/blob/5671cd445a2caae0b4dd0332299e4cfede05062c/webkit/Tools/Scripts/webkitpy/style/checker.py#L724-L742 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/ipaddress.py | python | IPv4Address.is_multicast | (self) | return self in self._constants._multicast_network | Test if the address is reserved for multicast use.
Returns:
A boolean, True if the address is multicast.
See RFC 3171 for details. | Test if the address is reserved for multicast use. | [
"Test",
"if",
"the",
"address",
"is",
"reserved",
"for",
"multicast",
"use",
"."
] | def is_multicast(self):
"""Test if the address is reserved for multicast use.
Returns:
A boolean, True if the address is multicast.
See RFC 3171 for details.
"""
return self in self._constants._multicast_network | [
"def",
"is_multicast",
"(",
"self",
")",
":",
"return",
"self",
"in",
"self",
".",
"_constants",
".",
"_multicast_network"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/ipaddress.py#L1363-L1371 | |
SoarGroup/Soar | a1c5e249499137a27da60533c72969eef3b8ab6b | scons/scons-local-4.1.0/SCons/Node/Python.py | python | Value.write | (self, built_value) | Set the value of the node. | Set the value of the node. | [
"Set",
"the",
"value",
"of",
"the",
"node",
"."
] | def write(self, built_value):
"""Set the value of the node."""
self.built_value = built_value | [
"def",
"write",
"(",
"self",
",",
"built_value",
")",
":",
"self",
".",
"built_value",
"=",
"built_value"
] | https://github.com/SoarGroup/Soar/blob/a1c5e249499137a27da60533c72969eef3b8ab6b/scons/scons-local-4.1.0/SCons/Node/Python.py#L121-L123 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/idlelib/editor.py | python | get_line_indent | (line, tabwidth) | return m.end(), len(m.group().expandtabs(tabwidth)) | Return a line's indentation as (# chars, effective # of spaces).
The effective # of spaces is the length after properly "expanding"
the tabs into spaces, as done by str.expandtabs(tabwidth). | Return a line's indentation as (# chars, effective # of spaces). | [
"Return",
"a",
"line",
"s",
"indentation",
"as",
"(",
"#",
"chars",
"effective",
"#",
"of",
"spaces",
")",
"."
] | def get_line_indent(line, tabwidth):
"""Return a line's indentation as (# chars, effective # of spaces).
The effective # of spaces is the length after properly "expanding"
the tabs into spaces, as done by str.expandtabs(tabwidth).
"""
m = _line_indent_re.match(line)
return m.end(), len(m.group(... | [
"def",
"get_line_indent",
"(",
"line",
",",
"tabwidth",
")",
":",
"m",
"=",
"_line_indent_re",
".",
"match",
"(",
"line",
")",
"return",
"m",
".",
"end",
"(",
")",
",",
"len",
"(",
"m",
".",
"group",
"(",
")",
".",
"expandtabs",
"(",
"tabwidth",
")... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/idlelib/editor.py#L1539-L1546 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/telnetlib.py | python | Telnet._read_until_with_select | (self, match, timeout=None) | return self.read_very_lazy() | Read until a given string is encountered or until timeout.
The timeout is implemented using select.select(). | Read until a given string is encountered or until timeout. | [
"Read",
"until",
"a",
"given",
"string",
"is",
"encountered",
"or",
"until",
"timeout",
"."
] | def _read_until_with_select(self, match, timeout=None):
"""Read until a given string is encountered or until timeout.
The timeout is implemented using select.select().
"""
n = len(match)
self.process_rawq()
i = self.cookedq.find(match)
if i >= 0:
i = ... | [
"def",
"_read_until_with_select",
"(",
"self",
",",
"match",
",",
"timeout",
"=",
"None",
")",
":",
"n",
"=",
"len",
"(",
"match",
")",
"self",
".",
"process_rawq",
"(",
")",
"i",
"=",
"self",
".",
"cookedq",
".",
"find",
"(",
"match",
")",
"if",
"... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/telnetlib.py#L342-L376 | |
nyuwireless-unipd/ns3-mmwave | 4ff9e87e8079764e04cbeccd8e85bff15ae16fb3 | utils/check-style.py | python | Patch.add_chunk | (self, chunk) | ! Add chunk
@param self this object
@param chunk chunk
@return none | ! Add chunk | [
"!",
"Add",
"chunk"
] | def add_chunk(self, chunk):
"""! Add chunk
@param self this object
@param chunk chunk
@return none
"""
self.__chunks.append(chunk) | [
"def",
"add_chunk",
"(",
"self",
",",
"chunk",
")",
":",
"self",
".",
"__chunks",
".",
"append",
"(",
"chunk",
")"
] | https://github.com/nyuwireless-unipd/ns3-mmwave/blob/4ff9e87e8079764e04cbeccd8e85bff15ae16fb3/utils/check-style.py#L313-L319 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_windows.py | python | StandardDialogLayoutAdapter_DoMustScroll | (*args, **kwargs) | return _windows_.StandardDialogLayoutAdapter_DoMustScroll(*args, **kwargs) | StandardDialogLayoutAdapter_DoMustScroll(Dialog dialog, Size windowSize, Size displaySize) -> int | StandardDialogLayoutAdapter_DoMustScroll(Dialog dialog, Size windowSize, Size displaySize) -> int | [
"StandardDialogLayoutAdapter_DoMustScroll",
"(",
"Dialog",
"dialog",
"Size",
"windowSize",
"Size",
"displaySize",
")",
"-",
">",
"int"
] | def StandardDialogLayoutAdapter_DoMustScroll(*args, **kwargs):
"""StandardDialogLayoutAdapter_DoMustScroll(Dialog dialog, Size windowSize, Size displaySize) -> int"""
return _windows_.StandardDialogLayoutAdapter_DoMustScroll(*args, **kwargs) | [
"def",
"StandardDialogLayoutAdapter_DoMustScroll",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"StandardDialogLayoutAdapter_DoMustScroll",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_windows.py#L1042-L1044 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/email/iterators.py | python | _structure | (msg, fp=None, level=0, include_default=False) | A handy debugging aid | A handy debugging aid | [
"A",
"handy",
"debugging",
"aid"
] | def _structure(msg, fp=None, level=0, include_default=False):
"""A handy debugging aid"""
if fp is None:
fp = sys.stdout
tab = ' ' * (level * 4)
print >> fp, tab + msg.get_content_type(),
if include_default:
print >> fp, '[%s]' % msg.get_default_type()
else:
print >> fp
... | [
"def",
"_structure",
"(",
"msg",
",",
"fp",
"=",
"None",
",",
"level",
"=",
"0",
",",
"include_default",
"=",
"False",
")",
":",
"if",
"fp",
"is",
"None",
":",
"fp",
"=",
"sys",
".",
"stdout",
"tab",
"=",
"' '",
"*",
"(",
"level",
"*",
"4",
")"... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/email/iterators.py#L61-L73 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/base.py | python | Requirement.project_name | (self) | The "project name" of a requirement.
This is different from ``name`` if this requirement contains extras,
in which case ``name`` would contain the ``[...]`` part, while this
refers to the name of the project. | The "project name" of a requirement. | [
"The",
"project",
"name",
"of",
"a",
"requirement",
"."
] | def project_name(self):
# type: () -> str
"""The "project name" of a requirement.
This is different from ``name`` if this requirement contains extras,
in which case ``name`` would contain the ``[...]`` part, while this
refers to the name of the project.
"""
... | [
"def",
"project_name",
"(",
"self",
")",
":",
"# type: () -> str",
"raise",
"NotImplementedError",
"(",
"\"Subclass should override\"",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/base.py#L141-L157 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/resolvelib/providers.py | python | AbstractProvider.find_matches | (self, requirements) | Find all possible candidates that satisfy the given requirements.
This should try to get candidates based on the requirements' types.
For VCS, local, and archive requirements, the one-and-only match is
returned, and for a "named" requirement, the index(es) should be
consulted to find co... | Find all possible candidates that satisfy the given requirements. | [
"Find",
"all",
"possible",
"candidates",
"that",
"satisfy",
"the",
"given",
"requirements",
"."
] | def find_matches(self, requirements):
"""Find all possible candidates that satisfy the given requirements.
This should try to get candidates based on the requirements' types.
For VCS, local, and archive requirements, the one-and-only match is
returned, and for a "named" requirement, the... | [
"def",
"find_matches",
"(",
"self",
",",
"requirements",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/resolvelib/providers.py#L55-L76 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/ed_pages.py | python | EdPages.UpdateTextControls | (self) | Updates all text controls to use any new settings that have
been changed since initialization.
@postcondition: all stc controls in the notebook are reconfigured
to match profile settings | Updates all text controls to use any new settings that have
been changed since initialization.
@postcondition: all stc controls in the notebook are reconfigured
to match profile settings | [
"Updates",
"all",
"text",
"controls",
"to",
"use",
"any",
"new",
"settings",
"that",
"have",
"been",
"changed",
"since",
"initialization",
".",
"@postcondition",
":",
"all",
"stc",
"controls",
"in",
"the",
"notebook",
"are",
"reconfigured",
"to",
"match",
"pro... | def UpdateTextControls(self):
"""Updates all text controls to use any new settings that have
been changed since initialization.
@postcondition: all stc controls in the notebook are reconfigured
to match profile settings
"""
for control in self.GetTextCont... | [
"def",
"UpdateTextControls",
"(",
"self",
")",
":",
"for",
"control",
"in",
"self",
".",
"GetTextControls",
"(",
")",
":",
"control",
".",
"UpdateAllStyles",
"(",
")",
"control",
".",
"Configure",
"(",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/ed_pages.py#L1275-L1284 | ||
funnyzhou/Adaptive_Feeding | 9c78182331d8c0ea28de47226e805776c638d46f | tools/extra/parse_log.py | python | parse_log | (path_to_log) | return train_dict_list, test_dict_list | Parse log file
Returns (train_dict_list, train_dict_names, test_dict_list, test_dict_names)
train_dict_list and test_dict_list are lists of dicts that define the table
rows
train_dict_names and test_dict_names are ordered tuples of the column names
for the two dict_lists | Parse log file
Returns (train_dict_list, train_dict_names, test_dict_list, test_dict_names) | [
"Parse",
"log",
"file",
"Returns",
"(",
"train_dict_list",
"train_dict_names",
"test_dict_list",
"test_dict_names",
")"
] | def parse_log(path_to_log):
"""Parse log file
Returns (train_dict_list, train_dict_names, test_dict_list, test_dict_names)
train_dict_list and test_dict_list are lists of dicts that define the table
rows
train_dict_names and test_dict_names are ordered tuples of the column names
for the two di... | [
"def",
"parse_log",
"(",
"path_to_log",
")",
":",
"regex_iteration",
"=",
"re",
".",
"compile",
"(",
"'Iteration (\\d+)'",
")",
"regex_train_output",
"=",
"re",
".",
"compile",
"(",
"'Train net output #(\\d+): (\\S+) = ([\\.\\deE+-]+)'",
")",
"regex_test_output",
"=",
... | https://github.com/funnyzhou/Adaptive_Feeding/blob/9c78182331d8c0ea28de47226e805776c638d46f/tools/extra/parse_log.py#L17-L74 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/requests/_internal_utils.py | python | to_native_string | (string, encoding='ascii') | return out | Given a string object, regardless of type, returns a representation of
that string in the native string type, encoding and decoding where
necessary. This assumes ASCII unless told otherwise. | Given a string object, regardless of type, returns a representation of
that string in the native string type, encoding and decoding where
necessary. This assumes ASCII unless told otherwise. | [
"Given",
"a",
"string",
"object",
"regardless",
"of",
"type",
"returns",
"a",
"representation",
"of",
"that",
"string",
"in",
"the",
"native",
"string",
"type",
"encoding",
"and",
"decoding",
"where",
"necessary",
".",
"This",
"assumes",
"ASCII",
"unless",
"to... | def to_native_string(string, encoding='ascii'):
"""Given a string object, regardless of type, returns a representation of
that string in the native string type, encoding and decoding where
necessary. This assumes ASCII unless told otherwise.
"""
if isinstance(string, builtin_str):
out = stri... | [
"def",
"to_native_string",
"(",
"string",
",",
"encoding",
"=",
"'ascii'",
")",
":",
"if",
"isinstance",
"(",
"string",
",",
"builtin_str",
")",
":",
"out",
"=",
"string",
"else",
":",
"if",
"is_py2",
":",
"out",
"=",
"string",
".",
"encode",
"(",
"enc... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/requests/_internal_utils.py#L14-L27 | |
macchina-io/macchina.io | ef24ba0e18379c3dd48fb84e6dbf991101cb8db0 | platform/JS/V8/tools/gyp/pylib/gyp/xcodeproj_file.py | python | XCConfigurationList.GetBuildSetting | (self, key) | return value | Gets the build setting for key.
All child XCConfiguration objects must have the same value set for the
setting, or a ValueError will be raised. | Gets the build setting for key. | [
"Gets",
"the",
"build",
"setting",
"for",
"key",
"."
] | def GetBuildSetting(self, key):
"""Gets the build setting for key.
All child XCConfiguration objects must have the same value set for the
setting, or a ValueError will be raised.
"""
# TODO(mark): This is wrong for build settings that are lists. The list
# contents should be compared (and a l... | [
"def",
"GetBuildSetting",
"(",
"self",
",",
"key",
")",
":",
"# TODO(mark): This is wrong for build settings that are lists. The list",
"# contents should be compared (and a list copy returned?)",
"value",
"=",
"None",
"for",
"configuration",
"in",
"self",
".",
"_properties",
... | https://github.com/macchina-io/macchina.io/blob/ef24ba0e18379c3dd48fb84e6dbf991101cb8db0/platform/JS/V8/tools/gyp/pylib/gyp/xcodeproj_file.py#L1651-L1670 | |
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/python/pyyaml/lib/yaml/__init__.py | python | add_path_resolver | (tag, path, kind=None, Loader=Loader, Dumper=Dumper) | Add a path based resolver for the given tag.
A path is a list of keys that forms a path
to a node in the representation tree.
Keys can be string values, integers, or None. | Add a path based resolver for the given tag.
A path is a list of keys that forms a path
to a node in the representation tree.
Keys can be string values, integers, or None. | [
"Add",
"a",
"path",
"based",
"resolver",
"for",
"the",
"given",
"tag",
".",
"A",
"path",
"is",
"a",
"list",
"of",
"keys",
"that",
"forms",
"a",
"path",
"to",
"a",
"node",
"in",
"the",
"representation",
"tree",
".",
"Keys",
"can",
"be",
"string",
"val... | def add_path_resolver(tag, path, kind=None, Loader=Loader, Dumper=Dumper):
"""
Add a path based resolver for the given tag.
A path is a list of keys that forms a path
to a node in the representation tree.
Keys can be string values, integers, or None.
"""
Loader.add_path_resolver(tag, path, k... | [
"def",
"add_path_resolver",
"(",
"tag",
",",
"path",
",",
"kind",
"=",
"None",
",",
"Loader",
"=",
"Loader",
",",
"Dumper",
"=",
"Dumper",
")",
":",
"Loader",
".",
"add_path_resolver",
"(",
"tag",
",",
"path",
",",
"kind",
")",
"Dumper",
".",
"add_path... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/pyyaml/lib/yaml/__init__.py#L231-L239 | ||
facebookincubator/BOLT | 88c70afe9d388ad430cc150cc158641701397f70 | mlir/python/mlir/dialects/linalg/opdsl/lang/affine.py | python | AffineExprDef.visit_affine_exprs | (self, callback) | Visits all AffineExprDefs including self. | Visits all AffineExprDefs including self. | [
"Visits",
"all",
"AffineExprDefs",
"including",
"self",
"."
] | def visit_affine_exprs(self, callback):
"""Visits all AffineExprDefs including self."""
callback(self) | [
"def",
"visit_affine_exprs",
"(",
"self",
",",
"callback",
")",
":",
"callback",
"(",
"self",
")"
] | https://github.com/facebookincubator/BOLT/blob/88c70afe9d388ad430cc150cc158641701397f70/mlir/python/mlir/dialects/linalg/opdsl/lang/affine.py#L169-L171 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/HFIR_4Circle_Reduction/mplgraphicsview3d.py | python | MplPlot3dCanvas.plot_scatter_auto | (self, data_key, base_color=None) | Plot data in scatter plot in an automatic mode
:param data_key: key to locate the data stored to this class
:param base_color: None or a list of 3 elements from 0 to 1 for RGB
:return: | Plot data in scatter plot in an automatic mode
:param data_key: key to locate the data stored to this class
:param base_color: None or a list of 3 elements from 0 to 1 for RGB
:return: | [
"Plot",
"data",
"in",
"scatter",
"plot",
"in",
"an",
"automatic",
"mode",
":",
"param",
"data_key",
":",
"key",
"to",
"locate",
"the",
"data",
"stored",
"to",
"this",
"class",
":",
"param",
"base_color",
":",
"None",
"or",
"a",
"list",
"of",
"3",
"elem... | def plot_scatter_auto(self, data_key, base_color=None):
"""
Plot data in scatter plot in an automatic mode
:param data_key: key to locate the data stored to this class
:param base_color: None or a list of 3 elements from 0 to 1 for RGB
:return:
"""
# Check
... | [
"def",
"plot_scatter_auto",
"(",
"self",
",",
"data_key",
",",
"base_color",
"=",
"None",
")",
":",
"# Check",
"assert",
"isinstance",
"(",
"data_key",
",",
"int",
")",
"and",
"data_key",
">=",
"0",
"assert",
"base_color",
"is",
"None",
"or",
"len",
"(",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/HFIR_4Circle_Reduction/mplgraphicsview3d.py#L159-L225 | ||
microsoft/ivy | 9f3c7ecc0b2383129fdd0953e10890d98d09a82d | ivy/ivy_parser.py | python | p_proofseq_proofseq_semi_proofstep | (p) | proofseq : proofseq optsemi proofstep | proofseq : proofseq optsemi proofstep | [
"proofseq",
":",
"proofseq",
"optsemi",
"proofstep"
] | def p_proofseq_proofseq_semi_proofstep(p):
'proofseq : proofseq optsemi proofstep'
p[0] = ComposeTactics(p[1],p[3])
p[0].lineno = get_lineno(p,2) | [
"def",
"p_proofseq_proofseq_semi_proofstep",
"(",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"ComposeTactics",
"(",
"p",
"[",
"1",
"]",
",",
"p",
"[",
"3",
"]",
")",
"p",
"[",
"0",
"]",
".",
"lineno",
"=",
"get_lineno",
"(",
"p",
",",
"2",
")"
] | https://github.com/microsoft/ivy/blob/9f3c7ecc0b2383129fdd0953e10890d98d09a82d/ivy/ivy_parser.py#L1167-L1170 | ||
google/ml-metadata | b60196492d2ea2bcd8e4ddff0f3757e5fd710e4d | ml_metadata/metadata_store/types.py | python | Artifact.set_property | (self, attr, value: typing.Union[int, float, Text, None]) | Sets a property of the underlying artifact (wrapping the value). | Sets a property of the underlying artifact (wrapping the value). | [
"Sets",
"a",
"property",
"of",
"the",
"underlying",
"artifact",
"(",
"wrapping",
"the",
"value",
")",
"."
] | def set_property(self, attr, value: typing.Union[int, float, Text, None]):
"""Sets a property of the underlying artifact (wrapping the value)."""
if attr == "uri":
self.artifact.uri = value
else:
super(Artifact, self).set_property(attr, value) | [
"def",
"set_property",
"(",
"self",
",",
"attr",
",",
"value",
":",
"typing",
".",
"Union",
"[",
"int",
",",
"float",
",",
"Text",
",",
"None",
"]",
")",
":",
"if",
"attr",
"==",
"\"uri\"",
":",
"self",
".",
"artifact",
".",
"uri",
"=",
"value",
... | https://github.com/google/ml-metadata/blob/b60196492d2ea2bcd8e4ddff0f3757e5fd710e4d/ml_metadata/metadata_store/types.py#L483-L488 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.