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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
gem5/gem5 | 141cc37c2d4b93959d4c249b8f7e6a8b2ef75338 | src/python/gem5/components/boards/abstract_board.py | python | AbstractBoard.get_memory | (self) | return self.memory | Get the memory (RAM) connected to the board.
:returns: The memory system. | Get the memory (RAM) connected to the board. | [
"Get",
"the",
"memory",
"(",
"RAM",
")",
"connected",
"to",
"the",
"board",
"."
] | def get_memory(self) -> "AbstractMemory":
"""Get the memory (RAM) connected to the board.
:returns: The memory system.
"""
return self.memory | [
"def",
"get_memory",
"(",
"self",
")",
"->",
"\"AbstractMemory\"",
":",
"return",
"self",
".",
"memory"
] | https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/src/python/gem5/components/boards/abstract_board.py#L105-L110 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/framework/meta_graph.py | python | _get_kind_name | (item) | return kind | Returns the kind name in CollectionDef.
Args:
item: A data item.
Returns:
The string representation of the kind in CollectionDef. | Returns the kind name in CollectionDef. | [
"Returns",
"the",
"kind",
"name",
"in",
"CollectionDef",
"."
] | def _get_kind_name(item):
"""Returns the kind name in CollectionDef.
Args:
item: A data item.
Returns:
The string representation of the kind in CollectionDef.
"""
if isinstance(item, (six.string_types, six.binary_type)):
kind = "bytes_list"
elif isinstance(item, six.integer_types):
kind = ... | [
"def",
"_get_kind_name",
"(",
"item",
")",
":",
"if",
"isinstance",
"(",
"item",
",",
"(",
"six",
".",
"string_types",
",",
"six",
".",
"binary_type",
")",
")",
":",
"kind",
"=",
"\"bytes_list\"",
"elif",
"isinstance",
"(",
"item",
",",
"six",
".",
"in... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/framework/meta_graph.py#L203-L222 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_core.py | python | BookCtrlBase.GetPageImage | (*args, **kwargs) | return _core_.BookCtrlBase_GetPageImage(*args, **kwargs) | GetPageImage(self, size_t n) -> int | GetPageImage(self, size_t n) -> int | [
"GetPageImage",
"(",
"self",
"size_t",
"n",
")",
"-",
">",
"int"
] | def GetPageImage(*args, **kwargs):
"""GetPageImage(self, size_t n) -> int"""
return _core_.BookCtrlBase_GetPageImage(*args, **kwargs) | [
"def",
"GetPageImage",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"BookCtrlBase_GetPageImage",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_core.py#L13562-L13564 | |
ApolloAuto/apollo | 463fb82f9e979d02dcb25044e60931293ab2dba0 | modules/tools/record_parse_save/record_parse_save.py | python | read_parameters | (yaml_file) | return parse_dict | function to read YAML parameter file and define output destinations | function to read YAML parameter file and define output destinations | [
"function",
"to",
"read",
"YAML",
"parameter",
"file",
"and",
"define",
"output",
"destinations"
] | def read_parameters(yaml_file):
"""
function to read YAML parameter file and define output destinations
"""
with open(yaml_file, 'r') as f:
params = yaml.safe_load(f)
# record file params
RECORD_FOLDER = params['records']['filepath']
parse_type = params['parse']
# define destina... | [
"def",
"read_parameters",
"(",
"yaml_file",
")",
":",
"with",
"open",
"(",
"yaml_file",
",",
"'r'",
")",
"as",
"f",
":",
"params",
"=",
"yaml",
".",
"safe_load",
"(",
"f",
")",
"# record file params",
"RECORD_FOLDER",
"=",
"params",
"[",
"'records'",
"]",
... | https://github.com/ApolloAuto/apollo/blob/463fb82f9e979d02dcb25044e60931293ab2dba0/modules/tools/record_parse_save/record_parse_save.py#L46-L71 | |
uber-research/jpeg2dct | ced1906d0cb8be5f5b1c096846258425887f3215 | jpeg2dct/tensorflow/__init__.py | python | _load_library | (name, op_list=None) | return library | Loads a .so file containing the specified operators.
Args:
name: The name of the .so file to load.
op_list: A list of names of operators that the library should have. If None
then the .so file's contents will not be verified.
Raises:
NameError if one of the required ops is missing.... | Loads a .so file containing the specified operators. | [
"Loads",
"a",
".",
"so",
"file",
"containing",
"the",
"specified",
"operators",
"."
] | def _load_library(name, op_list=None):
"""Loads a .so file containing the specified operators.
Args:
name: The name of the .so file to load.
op_list: A list of names of operators that the library should have. If None
then the .so file's contents will not be verified.
Raises:
Na... | [
"def",
"_load_library",
"(",
"name",
",",
"op_list",
"=",
"None",
")",
":",
"filename",
"=",
"resource_loader",
".",
"get_path_to_datafile",
"(",
"name",
")",
"library",
"=",
"load_library",
".",
"load_op_library",
"(",
"filename",
")",
"for",
"expected_op",
"... | https://github.com/uber-research/jpeg2dct/blob/ced1906d0cb8be5f5b1c096846258425887f3215/jpeg2dct/tensorflow/__init__.py#L38-L60 | |
intel/llvm | e6d0547e9d99b5a56430c4749f6c7e328bf221ab | clang/tools/scan-build-py/lib/libscanbuild/report.py | python | parse_crash | (filename) | Parse out the crash information from the report file. | Parse out the crash information from the report file. | [
"Parse",
"out",
"the",
"crash",
"information",
"from",
"the",
"report",
"file",
"."
] | def parse_crash(filename):
""" Parse out the crash information from the report file. """
match = re.match(r'(.*)\.info\.txt', filename)
name = match.group(1) if match else None
with open(filename, mode='rb') as handler:
# this is a workaround to fix windows read '\r\n' as new lines.
lin... | [
"def",
"parse_crash",
"(",
"filename",
")",
":",
"match",
"=",
"re",
".",
"match",
"(",
"r'(.*)\\.info\\.txt'",
",",
"filename",
")",
"name",
"=",
"match",
".",
"group",
"(",
"1",
")",
"if",
"match",
"else",
"None",
"with",
"open",
"(",
"filename",
","... | https://github.com/intel/llvm/blob/e6d0547e9d99b5a56430c4749f6c7e328bf221ab/clang/tools/scan-build-py/lib/libscanbuild/report.py#L438-L452 | ||
sdhash/sdhash | b9eff63e4e5867e910f41fd69032bbb1c94a2a5e | external/tools/build/v2/build/targets.py | python | ProjectTarget.targets_to_build | (self) | return result | Computes and returns a list of AbstractTarget instances which
must be built when this project is built. | Computes and returns a list of AbstractTarget instances which
must be built when this project is built. | [
"Computes",
"and",
"returns",
"a",
"list",
"of",
"AbstractTarget",
"instances",
"which",
"must",
"be",
"built",
"when",
"this",
"project",
"is",
"built",
"."
] | def targets_to_build (self):
""" Computes and returns a list of AbstractTarget instances which
must be built when this project is built.
"""
result = []
if not self.built_main_targets_:
self.build_main_targets ()
# Collect all main target... | [
"def",
"targets_to_build",
"(",
"self",
")",
":",
"result",
"=",
"[",
"]",
"if",
"not",
"self",
".",
"built_main_targets_",
":",
"self",
".",
"build_main_targets",
"(",
")",
"# Collect all main targets here, except for \"explicit\" ones.",
"for",
"n",
",",
"t",
"i... | https://github.com/sdhash/sdhash/blob/b9eff63e4e5867e910f41fd69032bbb1c94a2a5e/external/tools/build/v2/build/targets.py#L420-L439 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | current/deps/v8/third_party/jinja2/environment.py | python | Environment.compile_templates | (self, target, extensions=None, filter_func=None,
zip='deflated', log_function=None,
ignore_errors=True, py_compile=False) | Finds all the templates the loader can find, compiles them
and stores them in `target`. If `zip` is `None`, instead of in a
zipfile, the templates will be stored in a directory.
By default a deflate zip algorithm is used. To switch to
the stored algorithm, `zip` can be set to ``'stored'... | Finds all the templates the loader can find, compiles them
and stores them in `target`. If `zip` is `None`, instead of in a
zipfile, the templates will be stored in a directory.
By default a deflate zip algorithm is used. To switch to
the stored algorithm, `zip` can be set to ``'stored'... | [
"Finds",
"all",
"the",
"templates",
"the",
"loader",
"can",
"find",
"compiles",
"them",
"and",
"stores",
"them",
"in",
"target",
".",
"If",
"zip",
"is",
"None",
"instead",
"of",
"in",
"a",
"zipfile",
"the",
"templates",
"will",
"be",
"stored",
"in",
"a",... | def compile_templates(self, target, extensions=None, filter_func=None,
zip='deflated', log_function=None,
ignore_errors=True, py_compile=False):
"""Finds all the templates the loader can find, compiles them
and stores them in `target`. If `zip` is `No... | [
"def",
"compile_templates",
"(",
"self",
",",
"target",
",",
"extensions",
"=",
"None",
",",
"filter_func",
"=",
"None",
",",
"zip",
"=",
"'deflated'",
",",
"log_function",
"=",
"None",
",",
"ignore_errors",
"=",
"True",
",",
"py_compile",
"=",
"False",
")... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/current/deps/v8/third_party/jinja2/environment.py#L638-L731 | ||
zhaoweicai/mscnn | 534bcac5710a579d60827f192035f7eef6d8c585 | scripts/cpp_lint.py | python | _NestingState.InnermostClass | (self) | return None | Get class info on the top of the stack.
Returns:
A _ClassInfo object if we are inside a class, or None otherwise. | Get class info on the top of the stack. | [
"Get",
"class",
"info",
"on",
"the",
"top",
"of",
"the",
"stack",
"."
] | def InnermostClass(self):
"""Get class info on the top of the stack.
Returns:
A _ClassInfo object if we are inside a class, or None otherwise.
"""
for i in range(len(self.stack), 0, -1):
classinfo = self.stack[i - 1]
if isinstance(classinfo, _ClassInfo):
return classinfo
r... | [
"def",
"InnermostClass",
"(",
"self",
")",
":",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"self",
".",
"stack",
")",
",",
"0",
",",
"-",
"1",
")",
":",
"classinfo",
"=",
"self",
".",
"stack",
"[",
"i",
"-",
"1",
"]",
"if",
"isinstance",
"(",
... | https://github.com/zhaoweicai/mscnn/blob/534bcac5710a579d60827f192035f7eef6d8c585/scripts/cpp_lint.py#L2160-L2170 | |
plaidml/plaidml | f3c6681db21460e5fdc11ae651d6d7b6c27f8262 | plaidml/edsl/__init__.py | python | TensorDim.__radd__ | (self, other) | return TensorDim(_dim_op(lib.PLAIDML_INT_OP_ADD, other, self)) | Performs an addition between a TensorDim and another operand in a
polynomial expression.
Example:
>>> N, M = TensorDims(2)
>>> A = Placeholder(DType.FLOAT32, [3, 3])
>>> A.bind_dims(N, M)
>>> R = Contraction().outShape(5 + N) | Performs an addition between a TensorDim and another operand in a
polynomial expression. | [
"Performs",
"an",
"addition",
"between",
"a",
"TensorDim",
"and",
"another",
"operand",
"in",
"a",
"polynomial",
"expression",
"."
] | def __radd__(self, other):
"""Performs an addition between a TensorDim and another operand in a
polynomial expression.
Example:
>>> N, M = TensorDims(2)
>>> A = Placeholder(DType.FLOAT32, [3, 3])
>>> A.bind_dims(N, M)
>>> R = Contraction().outShap... | [
"def",
"__radd__",
"(",
"self",
",",
"other",
")",
":",
"return",
"TensorDim",
"(",
"_dim_op",
"(",
"lib",
".",
"PLAIDML_INT_OP_ADD",
",",
"other",
",",
"self",
")",
")"
] | https://github.com/plaidml/plaidml/blob/f3c6681db21460e5fdc11ae651d6d7b6c27f8262/plaidml/edsl/__init__.py#L67-L77 | |
plumonito/dtslam | 5994bb9cf7a11981b830370db206bceb654c085d | 3rdparty/opencv-git/3rdparty/jinja2/compiler.py | python | CodeGenerator.visit_Block | (self, node, frame) | Call a block and register it for the template. | Call a block and register it for the template. | [
"Call",
"a",
"block",
"and",
"register",
"it",
"for",
"the",
"template",
"."
] | def visit_Block(self, node, frame):
"""Call a block and register it for the template."""
level = 1
if frame.toplevel:
# if we know that we are a child template, there is no need to
# check if we are one
if self.has_known_extends:
return
... | [
"def",
"visit_Block",
"(",
"self",
",",
"node",
",",
"frame",
")",
":",
"level",
"=",
"1",
"if",
"frame",
".",
"toplevel",
":",
"# if we know that we are a child template, there is no need to",
"# check if we are one",
"if",
"self",
".",
"has_known_extends",
":",
"r... | https://github.com/plumonito/dtslam/blob/5994bb9cf7a11981b830370db206bceb654c085d/3rdparty/opencv-git/3rdparty/jinja2/compiler.py#L856-L873 | ||
nsnam/ns-3-dev-git | efdb2e21f45c0a87a60b47c547b68fa140a7b686 | utils/grid.py | python | TimelineDataRange.__init__ | (self, name = '') | return | ! Initializer
@param self this object
@param name name | ! Initializer | [
"!",
"Initializer"
] | def __init__(self, name = ''):
"""! Initializer
@param self this object
@param name name
"""
self.name = name
self.ranges = []
return | [
"def",
"__init__",
"(",
"self",
",",
"name",
"=",
"''",
")",
":",
"self",
".",
"name",
"=",
"name",
"self",
".",
"ranges",
"=",
"[",
"]",
"return"
] | https://github.com/nsnam/ns-3-dev-git/blob/efdb2e21f45c0a87a60b47c547b68fa140a7b686/utils/grid.py#L92-L99 | |
klzgrad/naiveproxy | ed2c513637c77b18721fe428d7ed395b4d284c83 | src/tools/grit/grit/pseudolocales.py | python | Node.ToString | (self) | return u'%s%s%s' % (self.text, children, self.after) | Returns a string representation of the tree suitable for creating a
translation from. | Returns a string representation of the tree suitable for creating a
translation from. | [
"Returns",
"a",
"string",
"representation",
"of",
"the",
"tree",
"suitable",
"for",
"creating",
"a",
"translation",
"from",
"."
] | def ToString(self):
"""Returns a string representation of the tree suitable for creating a
translation from.
"""
children = ''.join(c.ToString() for c in self.children)
return u'%s%s%s' % (self.text, children, self.after) | [
"def",
"ToString",
"(",
"self",
")",
":",
"children",
"=",
"''",
".",
"join",
"(",
"c",
".",
"ToString",
"(",
")",
"for",
"c",
"in",
"self",
".",
"children",
")",
"return",
"u'%s%s%s'",
"%",
"(",
"self",
".",
"text",
",",
"children",
",",
"self",
... | https://github.com/klzgrad/naiveproxy/blob/ed2c513637c77b18721fe428d7ed395b4d284c83/src/tools/grit/grit/pseudolocales.py#L98-L103 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/drill/view/DrillTableWidget.py | python | DrillTableWidget.delRowLabel | (self, row) | Delete the row label.
Args:
ros (int): row index | Delete the row label. | [
"Delete",
"the",
"row",
"label",
"."
] | def delRowLabel(self, row):
"""
Delete the row label.
Args:
ros (int): row index
"""
self.setVerticalHeaderItem(row, None)
self.verticalHeader().headerDataChanged(Qt.Vertical, row, row) | [
"def",
"delRowLabel",
"(",
"self",
",",
"row",
")",
":",
"self",
".",
"setVerticalHeaderItem",
"(",
"row",
",",
"None",
")",
"self",
".",
"verticalHeader",
"(",
")",
".",
"headerDataChanged",
"(",
"Qt",
".",
"Vertical",
",",
"row",
",",
"row",
")"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/drill/view/DrillTableWidget.py#L414-L422 | ||
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py | python | NinjaWriter.GetPostbuildCommand | (self, spec, output, output_binary, is_command_start) | Returns a shell command that runs all the postbuilds, and removes
|output| if any of them fails. If |is_command_start| is False, then the
returned string will start with ' && '. | Returns a shell command that runs all the postbuilds, and removes
|output| if any of them fails. If |is_command_start| is False, then the
returned string will start with ' && '. | [
"Returns",
"a",
"shell",
"command",
"that",
"runs",
"all",
"the",
"postbuilds",
"and",
"removes",
"|output|",
"if",
"any",
"of",
"them",
"fails",
".",
"If",
"|is_command_start|",
"is",
"False",
"then",
"the",
"returned",
"string",
"will",
"start",
"with",
"&... | def GetPostbuildCommand(self, spec, output, output_binary, is_command_start):
"""Returns a shell command that runs all the postbuilds, and removes
|output| if any of them fails. If |is_command_start| is False, then the
returned string will start with ' && '."""
if not self.xcode_settings or spec['type']... | [
"def",
"GetPostbuildCommand",
"(",
"self",
",",
"spec",
",",
"output",
",",
"output_binary",
",",
"is_command_start",
")",
":",
"if",
"not",
"self",
".",
"xcode_settings",
"or",
"spec",
"[",
"'type'",
"]",
"==",
"'none'",
"or",
"not",
"output",
":",
"retur... | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py#L1373-L1407 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/py/pseudo.py | python | PseudoKeyword.__init__ | (self, method) | Create a callable object that executes method when called. | Create a callable object that executes method when called. | [
"Create",
"a",
"callable",
"object",
"that",
"executes",
"method",
"when",
"called",
"."
] | def __init__(self, method):
"""Create a callable object that executes method when called."""
if callable(method):
self.method = method
else:
raise ValueError, 'method must be callable' | [
"def",
"__init__",
"(",
"self",
",",
"method",
")",
":",
"if",
"callable",
"(",
"method",
")",
":",
"self",
".",
"method",
"=",
"method",
"else",
":",
"raise",
"ValueError",
",",
"'method must be callable'"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/py/pseudo.py#L28-L34 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/AudioEngineWwise/Tools/WwiseConfig/setup_wwise_config.py | python | generate_game_wwise_config | (project_path) | Create a JSON object and update it according to Platform information already obtained.
Write this object to the final output destination.
:param project_path: Path to the game project. | Create a JSON object and update it according to Platform information already obtained.
Write this object to the final output destination.
:param project_path: Path to the game project. | [
"Create",
"a",
"JSON",
"object",
"and",
"update",
"it",
"according",
"to",
"Platform",
"information",
"already",
"obtained",
".",
"Write",
"this",
"object",
"to",
"the",
"final",
"output",
"destination",
".",
":",
"param",
"project_path",
":",
"Path",
"to",
... | def generate_game_wwise_config(project_path):
"""
Create a JSON object and update it according to Platform information already obtained.
Write this object to the final output destination.
:param project_path: Path to the game project.
"""
# Get the Platform sub-path relative to the directory whe... | [
"def",
"generate_game_wwise_config",
"(",
"project_path",
")",
":",
"# Get the Platform sub-path relative to the directory where *this script* file resides...",
"platforms_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/AudioEngineWwise/Tools/WwiseConfig/setup_wwise_config.py#L219-L260 | ||
kushview/Element | 1cc16380caa2ab79461246ba758b9de1f46db2a5 | waflib/Tools/c_config.py | python | validate_cfg | (self, kw) | Searches for the program *pkg-config* if missing, and validates the
parameters to pass to :py:func:`waflib.Tools.c_config.exec_cfg`.
:param path: the **-config program to use** (default is *pkg-config*)
:type path: list of string
:param msg: message to display to describe the test executed
:type msg: string
:par... | Searches for the program *pkg-config* if missing, and validates the
parameters to pass to :py:func:`waflib.Tools.c_config.exec_cfg`. | [
"Searches",
"for",
"the",
"program",
"*",
"pkg",
"-",
"config",
"*",
"if",
"missing",
"and",
"validates",
"the",
"parameters",
"to",
"pass",
"to",
":",
"py",
":",
"func",
":",
"waflib",
".",
"Tools",
".",
"c_config",
".",
"exec_cfg",
"."
] | def validate_cfg(self, kw):
"""
Searches for the program *pkg-config* if missing, and validates the
parameters to pass to :py:func:`waflib.Tools.c_config.exec_cfg`.
:param path: the **-config program to use** (default is *pkg-config*)
:type path: list of string
:param msg: message to display to describe the test... | [
"def",
"validate_cfg",
"(",
"self",
",",
"kw",
")",
":",
"if",
"not",
"'path'",
"in",
"kw",
":",
"if",
"not",
"self",
".",
"env",
".",
"PKGCONFIG",
":",
"self",
".",
"find_program",
"(",
"'pkg-config'",
",",
"var",
"=",
"'PKGCONFIG'",
")",
"kw",
"[",... | https://github.com/kushview/Element/blob/1cc16380caa2ab79461246ba758b9de1f46db2a5/waflib/Tools/c_config.py#L196-L245 | ||
zerollzeng/tiny-tensorrt | e7bdb8f82934342a0f22ce68dfefdb8e15eb72b2 | third_party/pybind11/tools/clang/cindex.py | python | Config.set_library_file | (filename) | Set the exact location of libclang | Set the exact location of libclang | [
"Set",
"the",
"exact",
"location",
"of",
"libclang"
] | def set_library_file(filename):
"""Set the exact location of libclang"""
if Config.loaded:
raise Exception("library file must be set before before using " \
"any other functionalities in libclang.")
Config.library_file = filename | [
"def",
"set_library_file",
"(",
"filename",
")",
":",
"if",
"Config",
".",
"loaded",
":",
"raise",
"Exception",
"(",
"\"library file must be set before before using \"",
"\"any other functionalities in libclang.\"",
")",
"Config",
".",
"library_file",
"=",
"filename"
] | https://github.com/zerollzeng/tiny-tensorrt/blob/e7bdb8f82934342a0f22ce68dfefdb8e15eb72b2/third_party/pybind11/tools/clang/cindex.py#L3780-L3786 | ||
brave/brave-core | ceaa3de4735789d355b6fa80c21d4709e2c1d0e8 | script/json2xunit.py | python | pick_iteration | (test_case, iterations) | return sorted(iterations, key=score, reverse=True)[0] | Pick the test iteration that provides the most relevant feedback | Pick the test iteration that provides the most relevant feedback | [
"Pick",
"the",
"test",
"iteration",
"that",
"provides",
"the",
"most",
"relevant",
"feedback"
] | def pick_iteration(test_case, iterations):
"""Pick the test iteration that provides the most relevant feedback"""
def score(iteration):
score = 1000000 if iteration['status'] == 'SUCCESS' else 0
score += len(iteration['output_snippet'])
started_this_test = re.compile(
r'\[ R... | [
"def",
"pick_iteration",
"(",
"test_case",
",",
"iterations",
")",
":",
"def",
"score",
"(",
"iteration",
")",
":",
"score",
"=",
"1000000",
"if",
"iteration",
"[",
"'status'",
"]",
"==",
"'SUCCESS'",
"else",
"0",
"score",
"+=",
"len",
"(",
"iteration",
... | https://github.com/brave/brave-core/blob/ceaa3de4735789d355b6fa80c21d4709e2c1d0e8/script/json2xunit.py#L26-L39 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/ma/extras.py | python | compress_cols | (a) | return compress_rowcols(a, 1) | Suppress whole columns of a 2-D array that contain masked values.
This is equivalent to ``np.ma.compress_rowcols(a, 1)``, see
`extras.compress_rowcols` for details.
See Also
--------
extras.compress_rowcols | Suppress whole columns of a 2-D array that contain masked values. | [
"Suppress",
"whole",
"columns",
"of",
"a",
"2",
"-",
"D",
"array",
"that",
"contain",
"masked",
"values",
"."
] | def compress_cols(a):
"""
Suppress whole columns of a 2-D array that contain masked values.
This is equivalent to ``np.ma.compress_rowcols(a, 1)``, see
`extras.compress_rowcols` for details.
See Also
--------
extras.compress_rowcols
"""
a = asarray(a)
if a.ndim != 2:
r... | [
"def",
"compress_cols",
"(",
"a",
")",
":",
"a",
"=",
"asarray",
"(",
"a",
")",
"if",
"a",
".",
"ndim",
"!=",
"2",
":",
"raise",
"NotImplementedError",
"(",
"\"compress_cols works for 2D arrays only.\"",
")",
"return",
"compress_rowcols",
"(",
"a",
",",
"1",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/ma/extras.py#L923-L938 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | deps/src/libxml2-2.9.1/python/libxml2class.py | python | URI.setQueryRaw | (self, query_raw) | Set the raw query part of an URI (i.e. the unescaped form). | Set the raw query part of an URI (i.e. the unescaped form). | [
"Set",
"the",
"raw",
"query",
"part",
"of",
"an",
"URI",
"(",
"i",
".",
"e",
".",
"the",
"unescaped",
"form",
")",
"."
] | def setQueryRaw(self, query_raw):
"""Set the raw query part of an URI (i.e. the unescaped form). """
libxml2mod.xmlURISetQueryRaw(self._o, query_raw) | [
"def",
"setQueryRaw",
"(",
"self",
",",
"query_raw",
")",
":",
"libxml2mod",
".",
"xmlURISetQueryRaw",
"(",
"self",
".",
"_o",
",",
"query_raw",
")"
] | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2class.py#L6249-L6251 | ||
llvm-mirror/libcxx | 78d6a7767ed57b50122a161b91f59f19c9bd0d19 | utils/google-benchmark/tools/gbench/util.py | python | is_executable_file | (filename) | Return 'True' if 'filename' names a valid file which is likely
an executable. A file is considered an executable if it starts with the
magic bytes for a EXE, Mach O, or ELF file. | Return 'True' if 'filename' names a valid file which is likely
an executable. A file is considered an executable if it starts with the
magic bytes for a EXE, Mach O, or ELF file. | [
"Return",
"True",
"if",
"filename",
"names",
"a",
"valid",
"file",
"which",
"is",
"likely",
"an",
"executable",
".",
"A",
"file",
"is",
"considered",
"an",
"executable",
"if",
"it",
"starts",
"with",
"the",
"magic",
"bytes",
"for",
"a",
"EXE",
"Mach",
"O... | def is_executable_file(filename):
"""
Return 'True' if 'filename' names a valid file which is likely
an executable. A file is considered an executable if it starts with the
magic bytes for a EXE, Mach O, or ELF file.
"""
if not os.path.isfile(filename):
return False
with open(filenam... | [
"def",
"is_executable_file",
"(",
"filename",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"filename",
")",
":",
"return",
"False",
"with",
"open",
"(",
"filename",
",",
"mode",
"=",
"'rb'",
")",
"as",
"f",
":",
"magic_bytes",
"=",
"... | https://github.com/llvm-mirror/libcxx/blob/78d6a7767ed57b50122a161b91f59f19c9bd0d19/utils/google-benchmark/tools/gbench/util.py#L17-L39 | ||
klzgrad/naiveproxy | ed2c513637c77b18721fe428d7ed395b4d284c83 | src/tools/grit/grit/clique.py | python | UberClique.MissingTranslationsReport | (self) | return '\n'.join(lines) | Returns a string suitable for printing to report missing
and fallback translations to the user. | Returns a string suitable for printing to report missing
and fallback translations to the user. | [
"Returns",
"a",
"string",
"suitable",
"for",
"printing",
"to",
"report",
"missing",
"and",
"fallback",
"translations",
"to",
"the",
"user",
"."
] | def MissingTranslationsReport(self):
'''Returns a string suitable for printing to report missing
and fallback translations to the user.
'''
def ReportTranslation(clique, langs):
text = clique.GetMessage().GetPresentableContent()
# The text 'error' (usually 'Error:' but we are conservative)
... | [
"def",
"MissingTranslationsReport",
"(",
"self",
")",
":",
"def",
"ReportTranslation",
"(",
"clique",
",",
"langs",
")",
":",
"text",
"=",
"clique",
".",
"GetMessage",
"(",
")",
".",
"GetPresentableContent",
"(",
")",
"# The text 'error' (usually 'Error:' but we are... | https://github.com/klzgrad/naiveproxy/blob/ed2c513637c77b18721fe428d7ed395b4d284c83/src/tools/grit/grit/clique.py#L59-L91 | |
pybox2d/pybox2d | 09643321fd363f0850087d1bde8af3f4afd82163 | library/Box2D/examples/pgu/gui/widget.py | python | Widget.event | (self,e) | return | Called when an event is passed to this object.
Please note that if you use an event, returning the value True
will stop parent containers from also using the event. (For example, if
your widget handles TABs or arrow keys, and you don't want those to
also alter the focus.)
... | Called when an event is passed to this object.
Please note that if you use an event, returning the value True
will stop parent containers from also using the event. (For example, if
your widget handles TABs or arrow keys, and you don't want those to
also alter the focus.) | [
"Called",
"when",
"an",
"event",
"is",
"passed",
"to",
"this",
"object",
".",
"Please",
"note",
"that",
"if",
"you",
"use",
"an",
"event",
"returning",
"the",
"value",
"True",
"will",
"stop",
"parent",
"containers",
"from",
"also",
"using",
"the",
"event",... | def event(self,e):
"""Called when an event is passed to this object.
Please note that if you use an event, returning the value True
will stop parent containers from also using the event. (For example, if
your widget handles TABs or arrow keys, and you don't want those to
... | [
"def",
"event",
"(",
"self",
",",
"e",
")",
":",
"return"
] | https://github.com/pybox2d/pybox2d/blob/09643321fd363f0850087d1bde8af3f4afd82163/library/Box2D/examples/pgu/gui/widget.py#L321-L332 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_core.py | python | Window.HasTransparentBackground | (*args, **kwargs) | return _core_.Window_HasTransparentBackground(*args, **kwargs) | HasTransparentBackground(self) -> bool
Returns True if this window's background is transparent (as, for
example, for `wx.StaticText`) and should show the parent window's
background.
This method is mostly used internally by the library itself and you
normally shouldn't have to c... | HasTransparentBackground(self) -> bool | [
"HasTransparentBackground",
"(",
"self",
")",
"-",
">",
"bool"
] | def HasTransparentBackground(*args, **kwargs):
"""
HasTransparentBackground(self) -> bool
Returns True if this window's background is transparent (as, for
example, for `wx.StaticText`) and should show the parent window's
background.
This method is mostly used internally... | [
"def",
"HasTransparentBackground",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Window_HasTransparentBackground",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_core.py#L10943-L10956 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/ragged/ragged_getitem.py | python | _expand_ellipsis | (key_list, num_remaining_dims) | Expands the ellipsis at the start of `key_list`.
Assumes that the first element of `key_list` is Ellipsis. This will either
remove the Ellipsis (if it corresponds to zero indices) or prepend a new
`slice(None, None, None)` (if it corresponds to more than zero indices).
Args:
key_list: The arguments to `_... | Expands the ellipsis at the start of `key_list`. | [
"Expands",
"the",
"ellipsis",
"at",
"the",
"start",
"of",
"key_list",
"."
] | def _expand_ellipsis(key_list, num_remaining_dims):
"""Expands the ellipsis at the start of `key_list`.
Assumes that the first element of `key_list` is Ellipsis. This will either
remove the Ellipsis (if it corresponds to zero indices) or prepend a new
`slice(None, None, None)` (if it corresponds to more than ... | [
"def",
"_expand_ellipsis",
"(",
"key_list",
",",
"num_remaining_dims",
")",
":",
"if",
"num_remaining_dims",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"Ellipsis not supported for unknown shape RaggedTensors\"",
")",
"num_indices",
"=",
"sum",
"(",
"1",
"for",
"... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/ragged/ragged_getitem.py#L366-L391 | ||
NVIDIA/DALI | bf16cc86ba8f091b145f91962f21fe1b6aff243d | qa/setup_packages.py | python | get_install_string | (idx, packages, cuda_version) | return " ".join(ret) | Creates pip install string for given cuda version, variant number and package list | Creates pip install string for given cuda version, variant number and package list | [
"Creates",
"pip",
"install",
"string",
"for",
"given",
"cuda",
"version",
"variant",
"number",
"and",
"package",
"list"
] | def get_install_string(idx, packages, cuda_version):
"""Creates pip install string for given cuda version, variant number and package list"""
ret = for_all_pckg(packages, lambda pckg: pckg.get_install_string(idx, cuda_version))
# add all remaining used packages with default versions
return " ".join(ret) | [
"def",
"get_install_string",
"(",
"idx",
",",
"packages",
",",
"cuda_version",
")",
":",
"ret",
"=",
"for_all_pckg",
"(",
"packages",
",",
"lambda",
"pckg",
":",
"pckg",
".",
"get_install_string",
"(",
"idx",
",",
"cuda_version",
")",
")",
"# add all remaining... | https://github.com/NVIDIA/DALI/blob/bf16cc86ba8f091b145f91962f21fe1b6aff243d/qa/setup_packages.py#L510-L514 | |
facebook/ThreatExchange | 31914a51820c73c8a0daffe62ccca29a6e3d359e | python-threatexchange/threatexchange/api.py | python | ThreatExchangeAPI._get_session | (self) | return session | Custom requests sesson
Ideally, should be used within a context manager:
```
with self._get_session() as session:
session.get()...
```
If using without a context manager, ensure you end up calling close() on
the returned value. | Custom requests sesson | [
"Custom",
"requests",
"sesson"
] | def _get_session(self):
"""
Custom requests sesson
Ideally, should be used within a context manager:
```
with self._get_session() as session:
session.get()...
```
If using without a context manager, ensure you end up calling close() on
the re... | [
"def",
"_get_session",
"(",
"self",
")",
":",
"session",
"=",
"requests",
".",
"Session",
"(",
")",
"session",
".",
"mount",
"(",
"self",
".",
"_base_url",
",",
"adapter",
"=",
"TimeoutHTTPAdapter",
"(",
"timeout",
"=",
"60",
",",
"max_retries",
"=",
"Re... | https://github.com/facebook/ThreatExchange/blob/31914a51820c73c8a0daffe62ccca29a6e3d359e/python-threatexchange/threatexchange/api.py#L127-L153 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/rpcMixin.py | python | rpcMixin.RPCQuit | (self) | shuts down everything, including the rpc server | shuts down everything, including the rpc server | [
"shuts",
"down",
"everything",
"including",
"the",
"rpc",
"server"
] | def RPCQuit(self):
""" shuts down everything, including the rpc server
"""
self.RPCOnClose(None) | [
"def",
"RPCQuit",
"(",
"self",
")",
":",
"self",
".",
"RPCOnClose",
"(",
"None",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/rpcMixin.py#L292-L296 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/traitlets/py3/traitlets/config/configurable.py | python | Configurable.class_get_trait_help | (cls, trait, inst=None, helptext=None) | return '\n'.join(lines) | Get the helptext string for a single trait.
:param inst:
If given, it's current trait values will be used in place of
the class default.
:param helptext:
If not given, uses the `help` attribute of the current trait. | Get the helptext string for a single trait. | [
"Get",
"the",
"helptext",
"string",
"for",
"a",
"single",
"trait",
"."
] | def class_get_trait_help(cls, trait, inst=None, helptext=None):
"""Get the helptext string for a single trait.
:param inst:
If given, it's current trait values will be used in place of
the class default.
:param helptext:
If not given, uses the `help` attribut... | [
"def",
"class_get_trait_help",
"(",
"cls",
",",
"trait",
",",
"inst",
"=",
"None",
",",
"helptext",
"=",
"None",
")",
":",
"assert",
"inst",
"is",
"None",
"or",
"isinstance",
"(",
"inst",
",",
"cls",
")",
"lines",
"=",
"[",
"]",
"header",
"=",
"\"--%... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/traitlets/py3/traitlets/config/configurable.py#L247-L296 | |
kismetwireless/kismet | a7c0dc270c960fb1f58bd9cec4601c201885fd4e | capture_sdr_rtladsb/KismetCaptureRtladsb/kismetexternal/__init__.py | python | ExternalInterface.add_uri_handler | (self, method, uri, handler) | Register a URI handler with Kismet; this will be called whenever that URI is
triggered on the Kismet REST interface. A URI should be a complete path, and
include the file extension.
:param method: HTTP method (GET or POST)
:param uri: Full URI
:param handler: Handler function, ... | Register a URI handler with Kismet; this will be called whenever that URI is
triggered on the Kismet REST interface. A URI should be a complete path, and
include the file extension. | [
"Register",
"a",
"URI",
"handler",
"with",
"Kismet",
";",
"this",
"will",
"be",
"called",
"whenever",
"that",
"URI",
"is",
"triggered",
"on",
"the",
"Kismet",
"REST",
"interface",
".",
"A",
"URI",
"should",
"be",
"a",
"complete",
"path",
"and",
"include",
... | def add_uri_handler(self, method, uri, handler):
"""
Register a URI handler with Kismet; this will be called whenever that URI is
triggered on the Kismet REST interface. A URI should be a complete path, and
include the file extension.
:param method: HTTP method (GET or POST)
... | [
"def",
"add_uri_handler",
"(",
"self",
",",
"method",
",",
"uri",
",",
"handler",
")",
":",
"if",
"method",
"not",
"in",
"self",
".",
"uri_handlers",
":",
"self",
".",
"uri_handlers",
"[",
"method",
"]",
"=",
"{",
"}",
"if",
"uri",
"not",
"in",
"self... | https://github.com/kismetwireless/kismet/blob/a7c0dc270c960fb1f58bd9cec4601c201885fd4e/capture_sdr_rtladsb/KismetCaptureRtladsb/kismetexternal/__init__.py#L445-L467 | ||
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | third_party/Python/module/ptyprocess-0.6.0/ptyprocess/ptyprocess.py | python | PtyProcess.setecho | (self, state) | This sets the terminal echo mode on or off. Note that anything the
child sent before the echo will be lost, so you should be sure that
your input buffer is empty before you call setecho(). For example, the
following will work as expected::
p = pexpect.spawn('cat') # Echo is on by de... | This sets the terminal echo mode on or off. Note that anything the
child sent before the echo will be lost, so you should be sure that
your input buffer is empty before you call setecho(). For example, the
following will work as expected:: | [
"This",
"sets",
"the",
"terminal",
"echo",
"mode",
"on",
"or",
"off",
".",
"Note",
"that",
"anything",
"the",
"child",
"sent",
"before",
"the",
"echo",
"will",
"be",
"lost",
"so",
"you",
"should",
"be",
"sure",
"that",
"your",
"input",
"buffer",
"is",
... | def setecho(self, state):
'''This sets the terminal echo mode on or off. Note that anything the
child sent before the echo will be lost, so you should be sure that
your input buffer is empty before you call setecho(). For example, the
following will work as expected::
p = pe... | [
"def",
"setecho",
"(",
"self",
",",
"state",
")",
":",
"_setecho",
"(",
"self",
".",
"fd",
",",
"state",
")",
"self",
".",
"echo",
"=",
"state"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/third_party/Python/module/ptyprocess-0.6.0/ptyprocess/ptyprocess.py#L467-L501 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/WebOb/webob/util.py | python | strings_differ | (string1, string2, compare_digest=compare_digest) | return invalid_bits != 0 | Check whether two strings differ while avoiding timing attacks.
This function returns True if the given strings differ and False
if they are equal. It's careful not to leak information about *where*
they differ as a result of its running time, which can be very important
to avoid certain timing-relate... | Check whether two strings differ while avoiding timing attacks. | [
"Check",
"whether",
"two",
"strings",
"differ",
"while",
"avoiding",
"timing",
"attacks",
"."
] | def strings_differ(string1, string2, compare_digest=compare_digest):
"""Check whether two strings differ while avoiding timing attacks.
This function returns True if the given strings differ and False
if they are equal. It's careful not to leak information about *where*
they differ as a result of its ... | [
"def",
"strings_differ",
"(",
"string1",
",",
"string2",
",",
"compare_digest",
"=",
"compare_digest",
")",
":",
"len_eq",
"=",
"len",
"(",
"string1",
")",
"==",
"len",
"(",
"string2",
")",
"if",
"len_eq",
":",
"invalid_bits",
"=",
"0",
"left",
"=",
"str... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/WebOb/webob/util.py#L139-L168 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/_osx_support.py | python | get_platform_osx | (_config_vars, osname, release, machine) | return (osname, release, machine) | Filter values for get_platform() | Filter values for get_platform() | [
"Filter",
"values",
"for",
"get_platform",
"()"
] | def get_platform_osx(_config_vars, osname, release, machine):
"""Filter values for get_platform()"""
# called from get_platform() in sysconfig and distutils.util
#
# For our purposes, we'll assume that the system version from
# distutils' perspective is what MACOSX_DEPLOYMENT_TARGET is set
# to.... | [
"def",
"get_platform_osx",
"(",
"_config_vars",
",",
"osname",
",",
"release",
",",
"machine",
")",
":",
"# called from get_platform() in sysconfig and distutils.util",
"#",
"# For our purposes, we'll assume that the system version from",
"# distutils' perspective is what MACOSX_DEPLOY... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/_osx_support.py#L423-L488 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/ast.py | python | iter_fields | (node) | Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields``
that is present on *node*. | Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields``
that is present on *node*. | [
"Yield",
"a",
"tuple",
"of",
"(",
"fieldname",
"value",
")",
"for",
"each",
"field",
"in",
"node",
".",
"_fields",
"that",
"is",
"present",
"on",
"*",
"node",
"*",
"."
] | def iter_fields(node):
"""
Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields``
that is present on *node*.
"""
for field in node._fields:
try:
yield field, getattr(node, field)
except AttributeError:
pass | [
"def",
"iter_fields",
"(",
"node",
")",
":",
"for",
"field",
"in",
"node",
".",
"_fields",
":",
"try",
":",
"yield",
"field",
",",
"getattr",
"(",
"node",
",",
"field",
")",
"except",
"AttributeError",
":",
"pass"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/ast.py#L161-L170 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_controls.py | python | TreeCtrl.SetItemState | (*args, **kwargs) | return _controls_.TreeCtrl_SetItemState(*args, **kwargs) | SetItemState(self, TreeItemId item, int state) | SetItemState(self, TreeItemId item, int state) | [
"SetItemState",
"(",
"self",
"TreeItemId",
"item",
"int",
"state",
")"
] | def SetItemState(*args, **kwargs):
"""SetItemState(self, TreeItemId item, int state)"""
return _controls_.TreeCtrl_SetItemState(*args, **kwargs) | [
"def",
"SetItemState",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"TreeCtrl_SetItemState",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_controls.py#L5327-L5329 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/richtext.py | python | RichTextCtrl.GetBasicStyle | (*args, **kwargs) | return _richtext.RichTextCtrl_GetBasicStyle(*args, **kwargs) | GetBasicStyle(self) -> RichTextAttr
Get basic (overall) style | GetBasicStyle(self) -> RichTextAttr | [
"GetBasicStyle",
"(",
"self",
")",
"-",
">",
"RichTextAttr"
] | def GetBasicStyle(*args, **kwargs):
"""
GetBasicStyle(self) -> RichTextAttr
Get basic (overall) style
"""
return _richtext.RichTextCtrl_GetBasicStyle(*args, **kwargs) | [
"def",
"GetBasicStyle",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextCtrl_GetBasicStyle",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/richtext.py#L3303-L3309 | |
protocolbuffers/protobuf | b5ab0b7a18b7336c60130f4ddb2d97c51792f896 | python/google/protobuf/text_encoding.py | python | CUnescape | (text) | return (result.encode('utf-8') # Make it bytes to allow decode.
.decode('unicode_escape')
# Make it bytes again to return the proper type.
.encode('raw_unicode_escape')) | Unescape a text string with C-style escape sequences to UTF-8 bytes.
Args:
text: The data to parse in a str.
Returns:
A byte string. | Unescape a text string with C-style escape sequences to UTF-8 bytes. | [
"Unescape",
"a",
"text",
"string",
"with",
"C",
"-",
"style",
"escape",
"sequences",
"to",
"UTF",
"-",
"8",
"bytes",
"."
] | def CUnescape(text):
# type: (str) -> bytes
"""Unescape a text string with C-style escape sequences to UTF-8 bytes.
Args:
text: The data to parse in a str.
Returns:
A byte string.
"""
def ReplaceHex(m):
# Only replace the match if the number of leading back slashes is odd. i.e.
# the slash... | [
"def",
"CUnescape",
"(",
"text",
")",
":",
"# type: (str) -> bytes",
"def",
"ReplaceHex",
"(",
"m",
")",
":",
"# Only replace the match if the number of leading back slashes is odd. i.e.",
"# the slash itself is not escaped.",
"if",
"len",
"(",
"m",
".",
"group",
"(",
"1"... | https://github.com/protocolbuffers/protobuf/blob/b5ab0b7a18b7336c60130f4ddb2d97c51792f896/python/google/protobuf/text_encoding.py#L86-L110 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/contrib/losses/python/losses/loss_ops.py | python | cosine_distance | (predictions, targets, dim, weight=1.0, scope=None) | Adds a cosine-distance loss to the training procedure.
Note that the function assumes that the predictions and targets are already
unit-normalized.
Args:
predictions: An arbitrary matrix.
targets: A `Tensor` whose shape matches 'predictions'
dim: The dimension along which the cosine distance is comp... | Adds a cosine-distance loss to the training procedure. | [
"Adds",
"a",
"cosine",
"-",
"distance",
"loss",
"to",
"the",
"training",
"procedure",
"."
] | def cosine_distance(predictions, targets, dim, weight=1.0, scope=None):
"""Adds a cosine-distance loss to the training procedure.
Note that the function assumes that the predictions and targets are already
unit-normalized.
Args:
predictions: An arbitrary matrix.
targets: A `Tensor` whose shape matches... | [
"def",
"cosine_distance",
"(",
"predictions",
",",
"targets",
",",
"dim",
",",
"weight",
"=",
"1.0",
",",
"scope",
"=",
"None",
")",
":",
"with",
"ops",
".",
"op_scope",
"(",
"[",
"predictions",
",",
"targets",
"]",
",",
"scope",
",",
"\"cosine_distance_... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/contrib/losses/python/losses/loss_ops.py#L556-L589 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/httplib2/upload-diffs.py | python | ParseSubversionPropertyValues | (props) | return key_value_pairs | Parse the given property value which comes from [auto-props] section and
returns a list whose element is a (svn_prop_key, svn_prop_value) pair.
See the following doctest for example.
>>> ParseSubversionPropertyValues('svn:eol-style=LF')
[('svn:eol-style', 'LF')]
>>> ParseSubversionPropertyValues('svn:mime-t... | Parse the given property value which comes from [auto-props] section and
returns a list whose element is a (svn_prop_key, svn_prop_value) pair. | [
"Parse",
"the",
"given",
"property",
"value",
"which",
"comes",
"from",
"[",
"auto",
"-",
"props",
"]",
"section",
"and",
"returns",
"a",
"list",
"whose",
"element",
"is",
"a",
"(",
"svn_prop_key",
"svn_prop_value",
")",
"pair",
"."
] | def ParseSubversionPropertyValues(props):
"""Parse the given property value which comes from [auto-props] section and
returns a list whose element is a (svn_prop_key, svn_prop_value) pair.
See the following doctest for example.
>>> ParseSubversionPropertyValues('svn:eol-style=LF')
[('svn:eol-style', 'LF')]
... | [
"def",
"ParseSubversionPropertyValues",
"(",
"props",
")",
":",
"key_value_pairs",
"=",
"[",
"]",
"for",
"prop",
"in",
"props",
".",
"split",
"(",
"\";\"",
")",
":",
"key_value",
"=",
"prop",
".",
"split",
"(",
"\"=\"",
")",
"assert",
"len",
"(",
"key_va... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/httplib2/upload-diffs.py#L2118-L2140 | |
espressomd/espresso | 7e29f9052e710fe1ebf0f5d2a8076b32921fbc6a | src/python/espressomd/checkpointing.py | python | Checkpoint.unregister | (self, *args) | Unregister python objects for checkpointing.
Parameters
----------
args : list of :obj:`str`
Names of python objects to be unregistered for checkpointing. | Unregister python objects for checkpointing. | [
"Unregister",
"python",
"objects",
"for",
"checkpointing",
"."
] | def unregister(self, *args):
"""Unregister python objects for checkpointing.
Parameters
----------
args : list of :obj:`str`
Names of python objects to be unregistered for checkpointing.
"""
for a in args:
if not isinstance(a, str) or a not in se... | [
"def",
"unregister",
"(",
"self",
",",
"*",
"args",
")",
":",
"for",
"a",
"in",
"args",
":",
"if",
"not",
"isinstance",
"(",
"a",
",",
"str",
")",
"or",
"a",
"not",
"in",
"self",
".",
"checkpoint_objects",
":",
"raise",
"KeyError",
"(",
"f\"The given... | https://github.com/espressomd/espresso/blob/7e29f9052e710fe1ebf0f5d2a8076b32921fbc6a/src/python/espressomd/checkpointing.py#L147-L161 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/cookielib.py | python | CookieJar.extract_cookies | (self, response, request) | Extract cookies from response, where allowable given the request. | Extract cookies from response, where allowable given the request. | [
"Extract",
"cookies",
"from",
"response",
"where",
"allowable",
"given",
"the",
"request",
"."
] | def extract_cookies(self, response, request):
"""Extract cookies from response, where allowable given the request."""
_debug("extract_cookies: %s", response.info())
self._cookies_lock.acquire()
try:
self._policy._now = self._now = int(time.time())
for cookie in s... | [
"def",
"extract_cookies",
"(",
"self",
",",
"response",
",",
"request",
")",
":",
"_debug",
"(",
"\"extract_cookies: %s\"",
",",
"response",
".",
"info",
"(",
")",
")",
"self",
".",
"_cookies_lock",
".",
"acquire",
"(",
")",
"try",
":",
"self",
".",
"_po... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/cookielib.py#L1651-L1663 | ||
okex/V3-Open-API-SDK | c5abb0db7e2287718e0055e17e57672ce0ec7fd9 | okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_vendor/distlib/util.py | python | Cache.clear | (self) | return not_removed | Clear the cache. | Clear the cache. | [
"Clear",
"the",
"cache",
"."
] | def clear(self):
"""
Clear the cache.
"""
not_removed = []
for fn in os.listdir(self.base):
fn = os.path.join(self.base, fn)
try:
if os.path.islink(fn) or os.path.isfile(fn):
os.remove(fn)
elif os.path.is... | [
"def",
"clear",
"(",
"self",
")",
":",
"not_removed",
"=",
"[",
"]",
"for",
"fn",
"in",
"os",
".",
"listdir",
"(",
"self",
".",
"base",
")",
":",
"fn",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"base",
",",
"fn",
")",
"try",
":",... | https://github.com/okex/V3-Open-API-SDK/blob/c5abb0db7e2287718e0055e17e57672ce0ec7fd9/okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_vendor/distlib/util.py#L964-L978 | |
stereolabs/zed-examples | ed3f068301fbdf3898f7c42de864dc578467e061 | object detection/birds eye viewer/python/batch_system_handler.py | python | BatchSystemHandler.clear | (self) | clear
Clears the remaining data in queue (free memory).
Make sure it is called before zed is closes, otherwise you will have memory leaks | clear
Clears the remaining data in queue (free memory).
Make sure it is called before zed is closes, otherwise you will have memory leaks | [
"clear",
"Clears",
"the",
"remaining",
"data",
"in",
"queue",
"(",
"free",
"memory",
")",
".",
"Make",
"sure",
"it",
"is",
"called",
"before",
"zed",
"is",
"closes",
"otherwise",
"you",
"will",
"have",
"memory",
"leaks"
] | def clear(self):
'''
clear
Clears the remaining data in queue (free memory).
Make sure it is called before zed is closes, otherwise you will have memory leaks
'''
self.objects_tracked_queue.clear()
self.cam_world_pose_map_ms.clear()
self.cam_local_... | [
"def",
"clear",
"(",
"self",
")",
":",
"self",
".",
"objects_tracked_queue",
".",
"clear",
"(",
")",
"self",
".",
"cam_world_pose_map_ms",
".",
"clear",
"(",
")",
"self",
".",
"cam_local_pose_map_ms",
".",
"clear",
"(",
")",
"for",
"key",
"in",
"list",
"... | https://github.com/stereolabs/zed-examples/blob/ed3f068301fbdf3898f7c42de864dc578467e061/object detection/birds eye viewer/python/batch_system_handler.py#L41-L57 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/aui.py | python | AuiNotebook.SetArtProvider | (*args, **kwargs) | return _aui.AuiNotebook_SetArtProvider(*args, **kwargs) | SetArtProvider(self, AuiTabArt art) | SetArtProvider(self, AuiTabArt art) | [
"SetArtProvider",
"(",
"self",
"AuiTabArt",
"art",
")"
] | def SetArtProvider(*args, **kwargs):
"""SetArtProvider(self, AuiTabArt art)"""
return _aui.AuiNotebook_SetArtProvider(*args, **kwargs) | [
"def",
"SetArtProvider",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_aui",
".",
"AuiNotebook_SetArtProvider",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/aui.py#L1305-L1307 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | samples/ide/activegrid/tool/STCTextEditor.py | python | TextView.OnCreatePrintout | (self) | return TextPrintout(self, self.GetDocument().GetPrintableName()) | for Print Preview and Print | for Print Preview and Print | [
"for",
"Print",
"Preview",
"and",
"Print"
] | def OnCreatePrintout(self):
""" for Print Preview and Print """
return TextPrintout(self, self.GetDocument().GetPrintableName()) | [
"def",
"OnCreatePrintout",
"(",
"self",
")",
":",
"return",
"TextPrintout",
"(",
"self",
",",
"self",
".",
"GetDocument",
"(",
")",
".",
"GetPrintableName",
"(",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/samples/ide/activegrid/tool/STCTextEditor.py#L138-L140 | |
bundy-dns/bundy | 3d41934996b82b0cd2fe22dd74d2abc1daba835d | src/lib/python/bundy/config/config_data.py | python | MultiConfigData.remove_specification | (self, module_name) | Removes the specification with the given module name. Does nothing if it wasn't there. | Removes the specification with the given module name. Does nothing if it wasn't there. | [
"Removes",
"the",
"specification",
"with",
"the",
"given",
"module",
"name",
".",
"Does",
"nothing",
"if",
"it",
"wasn",
"t",
"there",
"."
] | def remove_specification(self, module_name):
"""Removes the specification with the given module name. Does nothing if it wasn't there."""
if module_name in self._specifications:
del self._specifications[module_name] | [
"def",
"remove_specification",
"(",
"self",
",",
"module_name",
")",
":",
"if",
"module_name",
"in",
"self",
".",
"_specifications",
":",
"del",
"self",
".",
"_specifications",
"[",
"module_name",
"]"
] | https://github.com/bundy-dns/bundy/blob/3d41934996b82b0cd2fe22dd74d2abc1daba835d/src/lib/python/bundy/config/config_data.py#L425-L428 | ||
cvxpy/cvxpy | 5165b4fb750dfd237de8659383ef24b4b2e33aaf | cvxpy/atoms/elementwise/log.py | python | log.is_atom_log_log_convex | (self) | return False | Is the atom log-log convex? | Is the atom log-log convex? | [
"Is",
"the",
"atom",
"log",
"-",
"log",
"convex?"
] | def is_atom_log_log_convex(self) -> bool:
"""Is the atom log-log convex?
"""
return False | [
"def",
"is_atom_log_log_convex",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"False"
] | https://github.com/cvxpy/cvxpy/blob/5165b4fb750dfd237de8659383ef24b4b2e33aaf/cvxpy/atoms/elementwise/log.py#L53-L56 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/_grad/grad_implementations.py | python | bprop_reshape | (xs, shp, out, dout) | return F.reshape(dout, F.shape(xs)), C.zeros_like(shp) | Backpropagator for primitive `reshape`. | Backpropagator for primitive `reshape`. | [
"Backpropagator",
"for",
"primitive",
"reshape",
"."
] | def bprop_reshape(xs, shp, out, dout):
"""Backpropagator for primitive `reshape`."""
return F.reshape(dout, F.shape(xs)), C.zeros_like(shp) | [
"def",
"bprop_reshape",
"(",
"xs",
",",
"shp",
",",
"out",
",",
"dout",
")",
":",
"return",
"F",
".",
"reshape",
"(",
"dout",
",",
"F",
".",
"shape",
"(",
"xs",
")",
")",
",",
"C",
".",
"zeros_like",
"(",
"shp",
")"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/_grad/grad_implementations.py#L185-L187 | |
SoarGroup/Soar | a1c5e249499137a27da60533c72969eef3b8ab6b | scons/scons-local-4.1.0/SCons/Tool/cvf.py | python | generate | (env) | Add Builders and construction variables for compaq visual fortran to an Environment. | Add Builders and construction variables for compaq visual fortran to an Environment. | [
"Add",
"Builders",
"and",
"construction",
"variables",
"for",
"compaq",
"visual",
"fortran",
"to",
"an",
"Environment",
"."
] | def generate(env):
"""Add Builders and construction variables for compaq visual fortran to an Environment."""
fortran.generate(env)
env['FORTRAN'] = 'f90'
env['FORTRANCOM'] = '$FORTRAN $FORTRANFLAGS $_FORTRANMODFLAG $_FORTRANINCFLAGS /compile_only ${SOURCES.windows} /object:${TARGET.windows... | [
"def",
"generate",
"(",
"env",
")",
":",
"fortran",
".",
"generate",
"(",
"env",
")",
"env",
"[",
"'FORTRAN'",
"]",
"=",
"'f90'",
"env",
"[",
"'FORTRANCOM'",
"]",
"=",
"'$FORTRAN $FORTRANFLAGS $_FORTRANMODFLAG $_FORTRANINCFLAGS /compile_only ${SOURCES.windows} /object:$... | https://github.com/SoarGroup/Soar/blob/a1c5e249499137a27da60533c72969eef3b8ab6b/scons/scons-local-4.1.0/SCons/Tool/cvf.py#L36-L49 | ||
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/python/ops/io_ops.py | python | ReaderBase.num_records_produced | (self, name=None) | return gen_io_ops._reader_num_records_produced(self._reader_ref, name=name) | Returns the number of records this reader has produced.
This is the same as the number of Read executions that have
succeeded.
Args:
name: A name for the operation (optional).
Returns:
An int64 Tensor. | Returns the number of records this reader has produced. | [
"Returns",
"the",
"number",
"of",
"records",
"this",
"reader",
"has",
"produced",
"."
] | def num_records_produced(self, name=None):
"""Returns the number of records this reader has produced.
This is the same as the number of Read executions that have
succeeded.
Args:
name: A name for the operation (optional).
Returns:
An int64 Tensor.
"""
return gen_io_ops._reade... | [
"def",
"num_records_produced",
"(",
"self",
",",
"name",
"=",
"None",
")",
":",
"return",
"gen_io_ops",
".",
"_reader_num_records_produced",
"(",
"self",
".",
"_reader_ref",
",",
"name",
"=",
"name",
")"
] | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/ops/io_ops.py#L365-L378 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/Jinja2/py3/jinja2/filters.py | python | do_xmlattr | (
eval_ctx: "EvalContext", d: t.Mapping[str, t.Any], autospace: bool = True
) | return rv | Create an SGML/XML attribute string based on the items in a dict.
All values that are neither `none` nor `undefined` are automatically
escaped:
.. sourcecode:: html+jinja
<ul{{ {'class': 'my_list', 'missing': none,
'id': 'list-%d'|format(variable)}|xmlattr }}>
...
<... | Create an SGML/XML attribute string based on the items in a dict.
All values that are neither `none` nor `undefined` are automatically
escaped: | [
"Create",
"an",
"SGML",
"/",
"XML",
"attribute",
"string",
"based",
"on",
"the",
"items",
"in",
"a",
"dict",
".",
"All",
"values",
"that",
"are",
"neither",
"none",
"nor",
"undefined",
"are",
"automatically",
"escaped",
":"
] | def do_xmlattr(
eval_ctx: "EvalContext", d: t.Mapping[str, t.Any], autospace: bool = True
) -> str:
"""Create an SGML/XML attribute string based on the items in a dict.
All values that are neither `none` nor `undefined` are automatically
escaped:
.. sourcecode:: html+jinja
<ul{{ {'class': ... | [
"def",
"do_xmlattr",
"(",
"eval_ctx",
":",
"\"EvalContext\"",
",",
"d",
":",
"t",
".",
"Mapping",
"[",
"str",
",",
"t",
".",
"Any",
"]",
",",
"autospace",
":",
"bool",
"=",
"True",
")",
"->",
"str",
":",
"rv",
"=",
"\" \"",
".",
"join",
"(",
"f'{... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/Jinja2/py3/jinja2/filters.py#L275-L312 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | python/mxnet/ndarray/ndarray.py | python | NDArray.sort | (self, *args, **kwargs) | return op.sort(self, *args, **kwargs) | Convenience fluent method for :py:func:`sort`.
The arguments are the same as for :py:func:`sort`, with
this array as data. | Convenience fluent method for :py:func:`sort`. | [
"Convenience",
"fluent",
"method",
"for",
":",
"py",
":",
"func",
":",
"sort",
"."
] | def sort(self, *args, **kwargs):
"""Convenience fluent method for :py:func:`sort`.
The arguments are the same as for :py:func:`sort`, with
this array as data.
"""
return op.sort(self, *args, **kwargs) | [
"def",
"sort",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"op",
".",
"sort",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/ndarray/ndarray.py#L1190-L1196 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/variable_scope.py | python | _VariableStore.get_variable | (self,
name,
shape=None,
dtype=dtypes.float32,
initializer=None,
regularizer=None,
reuse=None,
trainable=None,
collections=None,
caching_device=None,... | Gets an existing variable with these parameters or create a new one.
If a variable with the given name is already stored, we return the stored
variable. Otherwise, we create a new one.
Set `reuse` to `True` when you only want to reuse existing Variables.
Set `reuse` to `False` when you only want to cr... | Gets an existing variable with these parameters or create a new one. | [
"Gets",
"an",
"existing",
"variable",
"with",
"these",
"parameters",
"or",
"create",
"a",
"new",
"one",
"."
] | def get_variable(self,
name,
shape=None,
dtype=dtypes.float32,
initializer=None,
regularizer=None,
reuse=None,
trainable=None,
collections=None,
cach... | [
"def",
"get_variable",
"(",
"self",
",",
"name",
",",
"shape",
"=",
"None",
",",
"dtype",
"=",
"dtypes",
".",
"float32",
",",
"initializer",
"=",
"None",
",",
"regularizer",
"=",
"None",
",",
"reuse",
"=",
"None",
",",
"trainable",
"=",
"None",
",",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/variable_scope.py#L316-L597 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/site.py | python | execsitecustomize | () | Run custom site specific code, if available. | Run custom site specific code, if available. | [
"Run",
"custom",
"site",
"specific",
"code",
"if",
"available",
"."
] | def execsitecustomize():
"""Run custom site specific code, if available."""
try:
try:
import sitecustomize
except ImportError as exc:
if exc.name == 'sitecustomize':
pass
else:
raise
except Exception as err:
if sys.f... | [
"def",
"execsitecustomize",
"(",
")",
":",
"try",
":",
"try",
":",
"import",
"sitecustomize",
"except",
"ImportError",
"as",
"exc",
":",
"if",
"exc",
".",
"name",
"==",
"'sitecustomize'",
":",
"pass",
"else",
":",
"raise",
"except",
"Exception",
"as",
"err... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/site.py#L517-L534 | ||
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | current/deps/v8/third_party/jinja2/lexer.py | python | Lexer.wrap | (self, stream, name=None, filename=None) | This is called with the stream as returned by `tokenize` and wraps
every token in a :class:`Token` and converts the value. | This is called with the stream as returned by `tokenize` and wraps
every token in a :class:`Token` and converts the value. | [
"This",
"is",
"called",
"with",
"the",
"stream",
"as",
"returned",
"by",
"tokenize",
"and",
"wraps",
"every",
"token",
"in",
"a",
":",
"class",
":",
"Token",
"and",
"converts",
"the",
"value",
"."
] | def wrap(self, stream, name=None, filename=None):
"""This is called with the stream as returned by `tokenize` and wraps
every token in a :class:`Token` and converts the value.
"""
for lineno, token, value in stream:
if token in ignored_tokens:
continue
... | [
"def",
"wrap",
"(",
"self",
",",
"stream",
",",
"name",
"=",
"None",
",",
"filename",
"=",
"None",
")",
":",
"for",
"lineno",
",",
"token",
",",
"value",
"in",
"stream",
":",
"if",
"token",
"in",
"ignored_tokens",
":",
"continue",
"elif",
"token",
"=... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/current/deps/v8/third_party/jinja2/lexer.py#L558-L597 | ||
SequoiaDB/SequoiaDB | 2894ed7e5bd6fe57330afc900cf76d0ff0df9f64 | tools/server/php_linux/libxml2/lib/python2.4/site-packages/libxml2.py | python | uCSIsCatPd | (code) | return ret | Check whether the character is part of Pd UCS Category | Check whether the character is part of Pd UCS Category | [
"Check",
"whether",
"the",
"character",
"is",
"part",
"of",
"Pd",
"UCS",
"Category"
] | def uCSIsCatPd(code):
"""Check whether the character is part of Pd UCS Category """
ret = libxml2mod.xmlUCSIsCatPd(code)
return ret | [
"def",
"uCSIsCatPd",
"(",
"code",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlUCSIsCatPd",
"(",
"code",
")",
"return",
"ret"
] | https://github.com/SequoiaDB/SequoiaDB/blob/2894ed7e5bd6fe57330afc900cf76d0ff0df9f64/tools/server/php_linux/libxml2/lib/python2.4/site-packages/libxml2.py#L2301-L2304 | |
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py | python | xmlTextReader.SchemaValidateCtxt | (self, ctxt, options) | return ret | Use W3C XSD schema context to validate the document as it
is processed. Activation is only possible before the first
Read(). If @ctxt is None, then XML Schema validation is
deactivated. | Use W3C XSD schema context to validate the document as it
is processed. Activation is only possible before the first
Read(). If | [
"Use",
"W3C",
"XSD",
"schema",
"context",
"to",
"validate",
"the",
"document",
"as",
"it",
"is",
"processed",
".",
"Activation",
"is",
"only",
"possible",
"before",
"the",
"first",
"Read",
"()",
".",
"If"
] | def SchemaValidateCtxt(self, ctxt, options):
"""Use W3C XSD schema context to validate the document as it
is processed. Activation is only possible before the first
Read(). If @ctxt is None, then XML Schema validation is
deactivated. """
if ctxt is None: ctxt__o = None
... | [
"def",
"SchemaValidateCtxt",
"(",
"self",
",",
"ctxt",
",",
"options",
")",
":",
"if",
"ctxt",
"is",
"None",
":",
"ctxt__o",
"=",
"None",
"else",
":",
"ctxt__o",
"=",
"ctxt",
".",
"_o",
"ret",
"=",
"libxml2mod",
".",
"xmlTextReaderSchemaValidateCtxt",
"(",... | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py#L6109-L6117 | |
chanyn/3Dpose_ssl | 585696676279683a279b1ecca136c0e0d02aef2a | caffe-3dssl/python/caffe/io.py | python | array_to_blobproto | (arr, diff=None) | return blob | Converts a N-dimensional array to blob proto. If diff is given, also
convert the diff. You need to make sure that arr and diff have the same
shape, and this function does not do sanity check. | Converts a N-dimensional array to blob proto. If diff is given, also
convert the diff. You need to make sure that arr and diff have the same
shape, and this function does not do sanity check. | [
"Converts",
"a",
"N",
"-",
"dimensional",
"array",
"to",
"blob",
"proto",
".",
"If",
"diff",
"is",
"given",
"also",
"convert",
"the",
"diff",
".",
"You",
"need",
"to",
"make",
"sure",
"that",
"arr",
"and",
"diff",
"have",
"the",
"same",
"shape",
"and",... | def array_to_blobproto(arr, diff=None):
"""Converts a N-dimensional array to blob proto. If diff is given, also
convert the diff. You need to make sure that arr and diff have the same
shape, and this function does not do sanity check.
"""
blob = caffe_pb2.BlobProto()
blob.shape.dim.extend(arr.sh... | [
"def",
"array_to_blobproto",
"(",
"arr",
",",
"diff",
"=",
"None",
")",
":",
"blob",
"=",
"caffe_pb2",
".",
"BlobProto",
"(",
")",
"blob",
".",
"shape",
".",
"dim",
".",
"extend",
"(",
"arr",
".",
"shape",
")",
"blob",
".",
"data",
".",
"extend",
"... | https://github.com/chanyn/3Dpose_ssl/blob/585696676279683a279b1ecca136c0e0d02aef2a/caffe-3dssl/python/caffe/io.py#L36-L46 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/aui.py | python | AuiManagerEvent.Veto | (*args, **kwargs) | return _aui.AuiManagerEvent_Veto(*args, **kwargs) | Veto(self, bool veto=True) | Veto(self, bool veto=True) | [
"Veto",
"(",
"self",
"bool",
"veto",
"=",
"True",
")"
] | def Veto(*args, **kwargs):
"""Veto(self, bool veto=True)"""
return _aui.AuiManagerEvent_Veto(*args, **kwargs) | [
"def",
"Veto",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_aui",
".",
"AuiManagerEvent_Veto",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/aui.py#L847-L849 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/dataview.py | python | DataViewTreeCtrl.GetNthChild | (*args, **kwargs) | return _dataview.DataViewTreeCtrl_GetNthChild(*args, **kwargs) | GetNthChild(self, DataViewItem parent, unsigned int pos) -> DataViewItem | GetNthChild(self, DataViewItem parent, unsigned int pos) -> DataViewItem | [
"GetNthChild",
"(",
"self",
"DataViewItem",
"parent",
"unsigned",
"int",
"pos",
")",
"-",
">",
"DataViewItem"
] | def GetNthChild(*args, **kwargs):
"""GetNthChild(self, DataViewItem parent, unsigned int pos) -> DataViewItem"""
return _dataview.DataViewTreeCtrl_GetNthChild(*args, **kwargs) | [
"def",
"GetNthChild",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_dataview",
".",
"DataViewTreeCtrl_GetNthChild",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/dataview.py#L2525-L2527 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/richtext.py | python | RichTextRange.ToInternal | (*args, **kwargs) | return _richtext.RichTextRange_ToInternal(*args, **kwargs) | ToInternal(self) -> RichTextRange
Convert to internal form: (n, n) is the range of a single character. | ToInternal(self) -> RichTextRange | [
"ToInternal",
"(",
"self",
")",
"-",
">",
"RichTextRange"
] | def ToInternal(*args, **kwargs):
"""
ToInternal(self) -> RichTextRange
Convert to internal form: (n, n) is the range of a single character.
"""
return _richtext.RichTextRange_ToInternal(*args, **kwargs) | [
"def",
"ToInternal",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextRange_ToInternal",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/richtext.py#L1037-L1043 | |
jiaxiang-wu/quantized-cnn | 4d020e17026df90e40111d219e3eb74e0afb1588 | cpplint.py | python | _CppLintState.RestoreFilters | (self) | Restores filters previously backed up. | Restores filters previously backed up. | [
"Restores",
"filters",
"previously",
"backed",
"up",
"."
] | def RestoreFilters(self):
""" Restores filters previously backed up."""
self.filters = self._filters_backup[:] | [
"def",
"RestoreFilters",
"(",
"self",
")",
":",
"self",
".",
"filters",
"=",
"self",
".",
"_filters_backup",
"[",
":",
"]"
] | https://github.com/jiaxiang-wu/quantized-cnn/blob/4d020e17026df90e40111d219e3eb74e0afb1588/cpplint.py#L822-L824 | ||
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py | python | MakefileWriter.WriteMacInfoPlist | (self, bundle_deps) | Write Makefile code for bundle Info.plist files. | Write Makefile code for bundle Info.plist files. | [
"Write",
"Makefile",
"code",
"for",
"bundle",
"Info",
".",
"plist",
"files",
"."
] | def WriteMacInfoPlist(self, bundle_deps):
"""Write Makefile code for bundle Info.plist files."""
info_plist, out, defines, extra_env = gyp.xcode_emulation.GetMacInfoPlist(
generator_default_variables['PRODUCT_DIR'], self.xcode_settings,
lambda p: Sourceify(self.Absolutify(p)))
if not info_pl... | [
"def",
"WriteMacInfoPlist",
"(",
"self",
",",
"bundle_deps",
")",
":",
"info_plist",
",",
"out",
",",
"defines",
",",
"extra_env",
"=",
"gyp",
".",
"xcode_emulation",
".",
"GetMacInfoPlist",
"(",
"generator_default_variables",
"[",
"'PRODUCT_DIR'",
"]",
",",
"se... | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py#L1169-L1193 | ||
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/idl/idl/syntax.py | python | FieldTypeArray.debug_string | (self) | return f'array<{self.element_type.type_name}>' | Display this field type in error messages. | Display this field type in error messages. | [
"Display",
"this",
"field",
"type",
"in",
"error",
"messages",
"."
] | def debug_string(self):
"""Display this field type in error messages."""
return f'array<{self.element_type.type_name}>' | [
"def",
"debug_string",
"(",
"self",
")",
":",
"return",
"f'array<{self.element_type.type_name}>'"
] | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/idl/idl/syntax.py#L755-L757 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined.py | python | DNNLinearCombinedClassifier.predict | (self, x=None, input_fn=None, batch_size=None, outputs=None,
as_iterable=True) | return super(DNNLinearCombinedClassifier, self).predict(
x=x,
input_fn=input_fn,
batch_size=batch_size,
outputs=outputs,
as_iterable=as_iterable) | Returns predictions for given features.
By default, returns predicted classes. But this default will be dropped
soon. Users should either pass `outputs`, or call `predict_classes` method.
Args:
x: features.
input_fn: Input function. If set, x must be None.
batch_size: Override default ba... | Returns predictions for given features. | [
"Returns",
"predictions",
"for",
"given",
"features",
"."
] | def predict(self, x=None, input_fn=None, batch_size=None, outputs=None,
as_iterable=True):
"""Returns predictions for given features.
By default, returns predicted classes. But this default will be dropped
soon. Users should either pass `outputs`, or call `predict_classes` method.
Args:
... | [
"def",
"predict",
"(",
"self",
",",
"x",
"=",
"None",
",",
"input_fn",
"=",
"None",
",",
"batch_size",
"=",
"None",
",",
"outputs",
"=",
"None",
",",
"as_iterable",
"=",
"True",
")",
":",
"if",
"not",
"outputs",
":",
"return",
"self",
".",
"predict_c... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined.py#L707-L742 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/setuptools/command/easy_install.py | python | ScriptWriter.best | (cls) | Select the best ScriptWriter for this environment. | Select the best ScriptWriter for this environment. | [
"Select",
"the",
"best",
"ScriptWriter",
"for",
"this",
"environment",
"."
] | def best(cls):
"""
Select the best ScriptWriter for this environment.
"""
if sys.platform == 'win32' or (os.name == 'java' and os._name == 'nt'):
return WindowsScriptWriter.best()
else:
return cls | [
"def",
"best",
"(",
"cls",
")",
":",
"if",
"sys",
".",
"platform",
"==",
"'win32'",
"or",
"(",
"os",
".",
"name",
"==",
"'java'",
"and",
"os",
".",
"_name",
"==",
"'nt'",
")",
":",
"return",
"WindowsScriptWriter",
".",
"best",
"(",
")",
"else",
":"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/setuptools/command/easy_install.py#L2140-L2147 | ||
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Node/__init__.py | python | Node.add_ignore | (self, depend) | Adds dependencies to ignore. | Adds dependencies to ignore. | [
"Adds",
"dependencies",
"to",
"ignore",
"."
] | def add_ignore(self, depend):
"""Adds dependencies to ignore."""
try:
self._add_child(self.ignore, self.ignore_set, depend)
except TypeError as e:
e = e.args[0]
if SCons.Util.is_List(e):
s = list(map(str, e))
else:
s... | [
"def",
"add_ignore",
"(",
"self",
",",
"depend",
")",
":",
"try",
":",
"self",
".",
"_add_child",
"(",
"self",
".",
"ignore",
",",
"self",
".",
"ignore_set",
",",
"depend",
")",
"except",
"TypeError",
"as",
"e",
":",
"e",
"=",
"e",
".",
"args",
"["... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Node/__init__.py#L1290-L1300 | ||
DanielSWolf/rhubarb-lip-sync | 5cface0af3b6e4e58c0b829c51561d784fb9f52f | rhubarb/lib/webrtc-8d2248ff/tools/network_emulator/network_emulator.py | python | NetworkEmulator.__init__ | (self, connection_config, port_range) | Constructor.
Args:
connection_config: A config.ConnectionConfig object containing the
characteristics for the connection to be emulation.
port_range: Tuple containing two integers defining the port range. | Constructor. | [
"Constructor",
"."
] | def __init__(self, connection_config, port_range):
"""Constructor.
Args:
connection_config: A config.ConnectionConfig object containing the
characteristics for the connection to be emulation.
port_range: Tuple containing two integers defining the port range.
"""
self._pipe_c... | [
"def",
"__init__",
"(",
"self",
",",
"connection_config",
",",
"port_range",
")",
":",
"self",
".",
"_pipe_counter",
"=",
"0",
"self",
".",
"_rule_counter",
"=",
"0",
"self",
".",
"_port_range",
"=",
"port_range",
"self",
".",
"_connection_config",
"=",
"con... | https://github.com/DanielSWolf/rhubarb-lip-sync/blob/5cface0af3b6e4e58c0b829c51561d784fb9f52f/rhubarb/lib/webrtc-8d2248ff/tools/network_emulator/network_emulator.py#L43-L54 | ||
openthread/openthread | 9fcdbed9c526c70f1556d1ed84099c1535c7cd32 | tools/otci/otci/otci.py | python | OTCI.set_logger | (self, logger: logging.Logger) | Set the logger for the OTCI instance, or None to disable logging. | Set the logger for the OTCI instance, or None to disable logging. | [
"Set",
"the",
"logger",
"for",
"the",
"OTCI",
"instance",
"or",
"None",
"to",
"disable",
"logging",
"."
] | def set_logger(self, logger: logging.Logger):
"""Set the logger for the OTCI instance, or None to disable logging."""
self.__logger = logger | [
"def",
"set_logger",
"(",
"self",
",",
"logger",
":",
"logging",
".",
"Logger",
")",
":",
"self",
".",
"__logger",
"=",
"logger"
] | https://github.com/openthread/openthread/blob/9fcdbed9c526c70f1556d1ed84099c1535c7cd32/tools/otci/otci/otci.py#L148-L150 | ||
naver/sling | 5671cd445a2caae0b4dd0332299e4cfede05062c | webkit/Tools/Scripts/webkitpy/xcode/simulator.py | python | DeviceType.from_name | (cls, name) | return DeviceType(name, identifier) | :param name: The name for the desired device type.
:type name: str
:returns: A `DeviceType` object with the specified identifier or throws a TypeError if it doesn't exist.
:rtype: DeviceType | :param name: The name for the desired device type.
:type name: str
:returns: A `DeviceType` object with the specified identifier or throws a TypeError if it doesn't exist.
:rtype: DeviceType | [
":",
"param",
"name",
":",
"The",
"name",
"for",
"the",
"desired",
"device",
"type",
".",
":",
"type",
"name",
":",
"str",
":",
"returns",
":",
"A",
"DeviceType",
"object",
"with",
"the",
"specified",
"identifier",
"or",
"throws",
"a",
"TypeError",
"if",... | def from_name(cls, name):
"""
:param name: The name for the desired device type.
:type name: str
:returns: A `DeviceType` object with the specified identifier or throws a TypeError if it doesn't exist.
:rtype: DeviceType
"""
identifier = None
for device_ty... | [
"def",
"from_name",
"(",
"cls",
",",
"name",
")",
":",
"identifier",
"=",
"None",
"for",
"device_type",
"in",
"Simulator",
"(",
")",
".",
"device_types",
":",
"if",
"device_type",
".",
"name",
"==",
"name",
":",
"identifier",
"=",
"device_type",
".",
"id... | https://github.com/naver/sling/blob/5671cd445a2caae0b4dd0332299e4cfede05062c/webkit/Tools/Scripts/webkitpy/xcode/simulator.py#L59-L75 | |
microsoft/LightGBM | 904b2d5158703c4900b68008617951dd2f9ff21b | examples/python-guide/dataset_from_multi_hdf5.py | python | HDFSequence.__init__ | (self, hdf_dataset, batch_size) | Construct a sequence object from HDF5 with required interface.
Parameters
----------
hdf_dataset : h5py.Dataset
Dataset in HDF5 file.
batch_size : int
Size of a batch. When reading data to construct lightgbm Dataset, each read reads batch_size rows. | Construct a sequence object from HDF5 with required interface. | [
"Construct",
"a",
"sequence",
"object",
"from",
"HDF5",
"with",
"required",
"interface",
"."
] | def __init__(self, hdf_dataset, batch_size):
"""
Construct a sequence object from HDF5 with required interface.
Parameters
----------
hdf_dataset : h5py.Dataset
Dataset in HDF5 file.
batch_size : int
Size of a batch. When reading data to construct... | [
"def",
"__init__",
"(",
"self",
",",
"hdf_dataset",
",",
"batch_size",
")",
":",
"# We can also open HDF5 file once and get access to",
"self",
".",
"data",
"=",
"hdf_dataset",
"self",
".",
"batch_size",
"=",
"batch_size"
] | https://github.com/microsoft/LightGBM/blob/904b2d5158703c4900b68008617951dd2f9ff21b/examples/python-guide/dataset_from_multi_hdf5.py#L11-L24 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/receptive_field/python/util/parse_layer_parameters.py | python | _padding_size_conv_pool | (node, kernel_size, stride, input_resolution=None) | return total_padding, padding | Computes padding size given a TF convolution or pooling node.
Args:
node: Tensorflow node (NodeDef proto).
kernel_size: Kernel size of node (integer).
stride: Stride size of node (integer).
input_resolution: Input resolution to assume, if not None (integer).
Returns:
total_padding: Total paddi... | Computes padding size given a TF convolution or pooling node. | [
"Computes",
"padding",
"size",
"given",
"a",
"TF",
"convolution",
"or",
"pooling",
"node",
"."
] | def _padding_size_conv_pool(node, kernel_size, stride, input_resolution=None):
"""Computes padding size given a TF convolution or pooling node.
Args:
node: Tensorflow node (NodeDef proto).
kernel_size: Kernel size of node (integer).
stride: Stride size of node (integer).
input_resolution: Input res... | [
"def",
"_padding_size_conv_pool",
"(",
"node",
",",
"kernel_size",
",",
"stride",
",",
"input_resolution",
"=",
"None",
")",
":",
"# In this case, we need to carefully consider the different TF padding modes.",
"# The padding depends on kernel size, and may depend on input size. If it"... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/receptive_field/python/util/parse_layer_parameters.py#L110-L169 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/contrib/learn/python/learn/estimators/composable_model.py | python | _ComposableModel.get_train_step | (self, loss) | return [self._get_optimizer().apply_gradients(zip(grads, my_vars))] | Returns the ops to run to perform a training step on this estimator.
Args:
loss: The loss to use when calculating gradients.
Returns:
The ops to run to perform a training step. | Returns the ops to run to perform a training step on this estimator. | [
"Returns",
"the",
"ops",
"to",
"run",
"to",
"perform",
"a",
"training",
"step",
"on",
"this",
"estimator",
"."
] | def get_train_step(self, loss):
"""Returns the ops to run to perform a training step on this estimator.
Args:
loss: The loss to use when calculating gradients.
Returns:
The ops to run to perform a training step.
"""
my_vars = self._get_vars()
if not (self._get_feature_columns() or ... | [
"def",
"get_train_step",
"(",
"self",
",",
"loss",
")",
":",
"my_vars",
"=",
"self",
".",
"_get_vars",
"(",
")",
"if",
"not",
"(",
"self",
".",
"_get_feature_columns",
"(",
")",
"or",
"my_vars",
")",
":",
"return",
"[",
"]",
"grads",
"=",
"gradients",
... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/contrib/learn/python/learn/estimators/composable_model.py#L93-L109 | |
rdkit/rdkit | ede860ae316d12d8568daf5ee800921c3389c84e | External/pymol/modules/pymol/rpc.py | python | rpcCountAtoms | (what='all') | return cmd.count_atoms(what) | returns the results of cmd.count_atoms(what) | returns the results of cmd.count_atoms(what) | [
"returns",
"the",
"results",
"of",
"cmd",
".",
"count_atoms",
"(",
"what",
")"
] | def rpcCountAtoms(what='all'):
""" returns the results of cmd.count_atoms(what) """
return cmd.count_atoms(what) | [
"def",
"rpcCountAtoms",
"(",
"what",
"=",
"'all'",
")",
":",
"return",
"cmd",
".",
"count_atoms",
"(",
"what",
")"
] | https://github.com/rdkit/rdkit/blob/ede860ae316d12d8568daf5ee800921c3389c84e/External/pymol/modules/pymol/rpc.py#L529-L531 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/grid.py | python | Grid.SetRowAttr | (*args, **kwargs) | return _grid.Grid_SetRowAttr(*args, **kwargs) | SetRowAttr(self, int row, GridCellAttr attr) | SetRowAttr(self, int row, GridCellAttr attr) | [
"SetRowAttr",
"(",
"self",
"int",
"row",
"GridCellAttr",
"attr",
")"
] | def SetRowAttr(*args, **kwargs):
"""SetRowAttr(self, int row, GridCellAttr attr)"""
return _grid.Grid_SetRowAttr(*args, **kwargs) | [
"def",
"SetRowAttr",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_grid",
".",
"Grid_SetRowAttr",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/grid.py#L1714-L1716 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/stringold.py | python | center | (s, width) | return ' '*half + s + ' '*(n-half) | center(s, width) -> string
Return a center version of s, in a field of the specified
width. padded with spaces as needed. The string is never
truncated. | center(s, width) -> string | [
"center",
"(",
"s",
"width",
")",
"-",
">",
"string"
] | def center(s, width):
"""center(s, width) -> string
Return a center version of s, in a field of the specified
width. padded with spaces as needed. The string is never
truncated.
"""
n = width - len(s)
if n <= 0: return s
half = n/2
if n%2 and width%2:
# This ensures that c... | [
"def",
"center",
"(",
"s",
",",
"width",
")",
":",
"n",
"=",
"width",
"-",
"len",
"(",
"s",
")",
"if",
"n",
"<=",
"0",
":",
"return",
"s",
"half",
"=",
"n",
"/",
"2",
"if",
"n",
"%",
"2",
"and",
"width",
"%",
"2",
":",
"# This ensures that ce... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/stringold.py#L291-L305 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/turtle.py | python | TNavigator._setmode | (self, mode=None) | Set turtle-mode to 'standard', 'world' or 'logo'. | Set turtle-mode to 'standard', 'world' or 'logo'. | [
"Set",
"turtle",
"-",
"mode",
"to",
"standard",
"world",
"or",
"logo",
"."
] | def _setmode(self, mode=None):
"""Set turtle-mode to 'standard', 'world' or 'logo'.
"""
if mode is None:
return self._mode
if mode not in ["standard", "logo", "world"]:
return
self._mode = mode
if mode in ["standard", "world"]:
self._an... | [
"def",
"_setmode",
"(",
"self",
",",
"mode",
"=",
"None",
")",
":",
"if",
"mode",
"is",
"None",
":",
"return",
"self",
".",
"_mode",
"if",
"mode",
"not",
"in",
"[",
"\"standard\"",
",",
"\"logo\"",
",",
"\"world\"",
"]",
":",
"return",
"self",
".",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/turtle.py#L1455-L1468 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/ed_editv.py | python | EdEditorView.DoReloadFile | (self) | Reload the current file | Reload the current file | [
"Reload",
"the",
"current",
"file"
] | def DoReloadFile(self):
"""Reload the current file"""
cfile = self.GetFileName()
ret = True
rmsg = u""
try:
ret, rmsg = self.ReloadFile()
except Exception, msg:
# Unexpected error
wx.MessageBox(_("Failed to reload file\n\nError:\n%s") %... | [
"def",
"DoReloadFile",
"(",
"self",
")",
":",
"cfile",
"=",
"self",
".",
"GetFileName",
"(",
")",
"ret",
"=",
"True",
"rmsg",
"=",
"u\"\"",
"try",
":",
"ret",
",",
"rmsg",
"=",
"self",
".",
"ReloadFile",
"(",
")",
"except",
"Exception",
",",
"msg",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/ed_editv.py#L200-L227 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/io/formats/style.py | python | Styler.pipe | (self, func, *args, **kwargs) | return com.pipe(self, func, *args, **kwargs) | Apply ``func(self, *args, **kwargs)``, and return the result.
.. versionadded:: 0.24.0
Parameters
----------
func : function
Function to apply to the Styler. Alternatively, a
``(callable, keyword)`` tuple where ``keyword`` is a string
indicating the... | Apply ``func(self, *args, **kwargs)``, and return the result. | [
"Apply",
"func",
"(",
"self",
"*",
"args",
"**",
"kwargs",
")",
"and",
"return",
"the",
"result",
"."
] | def pipe(self, func, *args, **kwargs):
"""
Apply ``func(self, *args, **kwargs)``, and return the result.
.. versionadded:: 0.24.0
Parameters
----------
func : function
Function to apply to the Styler. Alternatively, a
``(callable, keyword)`` tup... | [
"def",
"pipe",
"(",
"self",
",",
"func",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"com",
".",
"pipe",
"(",
"self",
",",
"func",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/io/formats/style.py#L1391-L1460 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/plugins/Launch/launch/launch.py | python | LaunchWindow.OnLexerChange | (self, msg) | Update the status of the currently associated file
when a file is saved. Used for updating after a file type has
changed due to a save action.
@param msg: Message object | Update the status of the currently associated file
when a file is saved. Used for updating after a file type has
changed due to a save action.
@param msg: Message object | [
"Update",
"the",
"status",
"of",
"the",
"currently",
"associated",
"file",
"when",
"a",
"file",
"is",
"saved",
".",
"Used",
"for",
"updating",
"after",
"a",
"file",
"type",
"has",
"changed",
"due",
"to",
"a",
"save",
"action",
".",
"@param",
"msg",
":",
... | def OnLexerChange(self, msg):
"""Update the status of the currently associated file
when a file is saved. Used for updating after a file type has
changed due to a save action.
@param msg: Message object
"""
self._log("[launch][info] Lexer changed handler - context %d" %
... | [
"def",
"OnLexerChange",
"(",
"self",
",",
"msg",
")",
":",
"self",
".",
"_log",
"(",
"\"[launch][info] Lexer changed handler - context %d\"",
"%",
"self",
".",
"MainWindow",
".",
"GetId",
"(",
")",
")",
"if",
"self",
".",
"Locked",
":",
"return",
"# Mode is lo... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/plugins/Launch/launch/launch.py#L305-L328 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/framework/sparse_tensor.py | python | is_sparse | (x) | return isinstance(x, (SparseTensor, SparseTensorValue)) | Check whether `x` is sparse.
Check whether an object is a `tf.SparseTensor` or
`tf.compat.v1.SparseTensorValue`.
Args:
x: A python object to check.
Returns:
`True` iff `x` is a `tf.SparseTensor` or `tf.compat.v1.SparseTensorValue`. | Check whether `x` is sparse. | [
"Check",
"whether",
"x",
"is",
"sparse",
"."
] | def is_sparse(x):
"""Check whether `x` is sparse.
Check whether an object is a `tf.SparseTensor` or
`tf.compat.v1.SparseTensorValue`.
Args:
x: A python object to check.
Returns:
`True` iff `x` is a `tf.SparseTensor` or `tf.compat.v1.SparseTensorValue`.
"""
return isinstance(x, (SparseTensor, Sp... | [
"def",
"is_sparse",
"(",
"x",
")",
":",
"return",
"isinstance",
"(",
"x",
",",
"(",
"SparseTensor",
",",
"SparseTensorValue",
")",
")"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/framework/sparse_tensor.py#L417-L429 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/quantize/python/quant_ops.py | python | FixedQuantize | (inputs, init_min=-6.0, init_max=6.0, scope=None) | Adds a fake quantize layer with fixed quantization interval.
Args:
inputs: a tensor containing values to be quantized.
init_min: the lower end of quantization interval.
init_max: the upper end of quantization interval.
scope: Optional scope for name_scope.
Returns:
a tensor containing quantized... | Adds a fake quantize layer with fixed quantization interval. | [
"Adds",
"a",
"fake",
"quantize",
"layer",
"with",
"fixed",
"quantization",
"interval",
"."
] | def FixedQuantize(inputs, init_min=-6.0, init_max=6.0, scope=None):
"""Adds a fake quantize layer with fixed quantization interval.
Args:
inputs: a tensor containing values to be quantized.
init_min: the lower end of quantization interval.
init_max: the upper end of quantization interval.
scope: Op... | [
"def",
"FixedQuantize",
"(",
"inputs",
",",
"init_min",
"=",
"-",
"6.0",
",",
"init_max",
"=",
"6.0",
",",
"scope",
"=",
"None",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"scope",
",",
"'FixedQuantize'",
",",
"values",
"=",
"[",
"inputs",
"]",
... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/quantize/python/quant_ops.py#L36-L49 | ||
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/contrib/ndlstm/python/lstm2d.py | python | separable_lstm | (images, num_filters_out, nhidden=None, scope=None) | Run bidirectional LSTMs first horizontally then vertically.
Args:
images: (num_images, height, width, depth) tensor
num_filters_out: output layer depth
nhidden: hidden layer depth
scope: optional scope name
Returns:
(num_images, height, width, num_filters_out) tensor | Run bidirectional LSTMs first horizontally then vertically. | [
"Run",
"bidirectional",
"LSTMs",
"first",
"horizontally",
"then",
"vertically",
"."
] | def separable_lstm(images, num_filters_out, nhidden=None, scope=None):
"""Run bidirectional LSTMs first horizontally then vertically.
Args:
images: (num_images, height, width, depth) tensor
num_filters_out: output layer depth
nhidden: hidden layer depth
scope: optional scope name
Returns:
(n... | [
"def",
"separable_lstm",
"(",
"images",
",",
"num_filters_out",
",",
"nhidden",
"=",
"None",
",",
"scope",
"=",
"None",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"scope",
",",
"\"SeparableLstm\"",
",",
"[",
"images",
"]",
")",
":",
"if",
"nhidd... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/ndlstm/python/lstm2d.py#L93-L113 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqt/mantidqt/widgets/superplot/view.py | python | SuperplotView.set_spectra_list | (self, name, nums) | Set the list of spectrum index for a workspace in the list.
Args:
name (str): name of the workspace
nums (list(int)): list of the spectrum indexes | Set the list of spectrum index for a workspace in the list. | [
"Set",
"the",
"list",
"of",
"spectrum",
"index",
"for",
"a",
"workspace",
"in",
"the",
"list",
"."
] | def set_spectra_list(self, name, nums):
"""
Set the list of spectrum index for a workspace in the list.
Args:
name (str): name of the workspace
nums (list(int)): list of the spectrum indexes
"""
self._side_view.workspacesList.blockSignals(True)
ws... | [
"def",
"set_spectra_list",
"(",
"self",
",",
"name",
",",
"nums",
")",
":",
"self",
".",
"_side_view",
".",
"workspacesList",
".",
"blockSignals",
"(",
"True",
")",
"ws_item",
"=",
"self",
".",
"_side_view",
".",
"workspacesList",
".",
"findItems",
"(",
"n... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqt/mantidqt/widgets/superplot/view.py#L363-L381 | ||
Slicer/Slicer | ba9fadf332cb0303515b68d8d06a344c82e3e3e5 | Modules/Scripted/DICOM/DICOM.py | python | DICOMFileDialog.createDefaultDatabase | () | return False | If DICOM database is invalid then try to create a default one. If fails then show an error message.
This method should only be used when user initiates DICOM import on the GUI, because the error message is
shown in a popup, which would block execution of auomated processing scripts.
Returns True if a valid ... | If DICOM database is invalid then try to create a default one. If fails then show an error message.
This method should only be used when user initiates DICOM import on the GUI, because the error message is
shown in a popup, which would block execution of auomated processing scripts.
Returns True if a valid ... | [
"If",
"DICOM",
"database",
"is",
"invalid",
"then",
"try",
"to",
"create",
"a",
"default",
"one",
".",
"If",
"fails",
"then",
"show",
"an",
"error",
"message",
".",
"This",
"method",
"should",
"only",
"be",
"used",
"when",
"user",
"initiates",
"DICOM",
"... | def createDefaultDatabase():
"""If DICOM database is invalid then try to create a default one. If fails then show an error message.
This method should only be used when user initiates DICOM import on the GUI, because the error message is
shown in a popup, which would block execution of auomated processing s... | [
"def",
"createDefaultDatabase",
"(",
")",
":",
"if",
"slicer",
".",
"dicomDatabase",
"and",
"slicer",
".",
"dicomDatabase",
".",
"isOpen",
":",
"# Valid DICOM database already exists",
"return",
"True",
"# Try to create a database with default settings",
"if",
"slicer",
"... | https://github.com/Slicer/Slicer/blob/ba9fadf332cb0303515b68d8d06a344c82e3e3e5/Modules/Scripted/DICOM/DICOM.py#L473-L497 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | current/tools/gyp/pylib/gyp/xcodeproj_file.py | python | XCObject.Print | (self, file=sys.stdout) | Prints a reprentation of this object to file, adhering to Xcode output
formatting. | Prints a reprentation of this object to file, adhering to Xcode output
formatting. | [
"Prints",
"a",
"reprentation",
"of",
"this",
"object",
"to",
"file",
"adhering",
"to",
"Xcode",
"output",
"formatting",
"."
] | def Print(self, file=sys.stdout):
"""Prints a reprentation of this object to file, adhering to Xcode output
formatting.
"""
self.VerifyHasRequiredProperties()
if self._should_print_single_line:
# When printing an object in a single line, Xcode doesn't put any space
# between the beginn... | [
"def",
"Print",
"(",
"self",
",",
"file",
"=",
"sys",
".",
"stdout",
")",
":",
"self",
".",
"VerifyHasRequiredProperties",
"(",
")",
"if",
"self",
".",
"_should_print_single_line",
":",
"# When printing an object in a single line, Xcode doesn't put any space",
"# betwee... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/current/tools/gyp/pylib/gyp/xcodeproj_file.py#L697-L733 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/importlib/_bootstrap_external.py | python | SourceLoader.get_code | (self, fullname) | return code_object | Concrete implementation of InspectLoader.get_code.
Reading of bytecode requires path_stats to be implemented. To write
bytecode, set_data must also be implemented. | Concrete implementation of InspectLoader.get_code. | [
"Concrete",
"implementation",
"of",
"InspectLoader",
".",
"get_code",
"."
] | def get_code(self, fullname):
"""Concrete implementation of InspectLoader.get_code.
Reading of bytecode requires path_stats to be implemented. To write
bytecode, set_data must also be implemented.
"""
source_path = self.get_filename(fullname)
source_mtime = None
... | [
"def",
"get_code",
"(",
"self",
",",
"fullname",
")",
":",
"source_path",
"=",
"self",
".",
"get_filename",
"(",
"fullname",
")",
"source_mtime",
"=",
"None",
"source_bytes",
"=",
"None",
"source_hash",
"=",
"None",
"hash_based",
"=",
"False",
"check_source",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/importlib/_bootstrap_external.py#L793-L876 | |
ElementsProject/elements | 7d83cc0089345a0646834986c56e58543fd5ee07 | contrib/devtools/security-check.py | python | check_ELF_separate_code | (executable) | return True | Check that sections are appropriately separated in virtual memory,
based on their permissions. This checks for missing -Wl,-z,separate-code
and potentially other problems. | Check that sections are appropriately separated in virtual memory,
based on their permissions. This checks for missing -Wl,-z,separate-code
and potentially other problems. | [
"Check",
"that",
"sections",
"are",
"appropriately",
"separated",
"in",
"virtual",
"memory",
"based",
"on",
"their",
"permissions",
".",
"This",
"checks",
"for",
"missing",
"-",
"Wl",
"-",
"z",
"separate",
"-",
"code",
"and",
"potentially",
"other",
"problems"... | def check_ELF_separate_code(executable):
'''
Check that sections are appropriately separated in virtual memory,
based on their permissions. This checks for missing -Wl,-z,separate-code
and potentially other problems.
'''
EXPECTED_FLAGS = {
# Read + execute
'.init': 'R E',
... | [
"def",
"check_ELF_separate_code",
"(",
"executable",
")",
":",
"EXPECTED_FLAGS",
"=",
"{",
"# Read + execute",
"'.init'",
":",
"'R E'",
",",
"'.plt'",
":",
"'R E'",
",",
"'.plt.got'",
":",
"'R E'",
",",
"'.plt.sec'",
":",
"'R E'",
",",
"'.text'",
":",
"'R E'",... | https://github.com/ElementsProject/elements/blob/7d83cc0089345a0646834986c56e58543fd5ee07/contrib/devtools/security-check.py#L139-L193 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/smtplib.py | python | SMTP.expn | (self, address) | return self.getreply() | SMTP 'expn' command -- expands a mailing list. | SMTP 'expn' command -- expands a mailing list. | [
"SMTP",
"expn",
"command",
"--",
"expands",
"a",
"mailing",
"list",
"."
] | def expn(self, address):
"""SMTP 'expn' command -- expands a mailing list."""
self.putcmd("expn", _addr_only(address))
return self.getreply() | [
"def",
"expn",
"(",
"self",
",",
"address",
")",
":",
"self",
".",
"putcmd",
"(",
"\"expn\"",
",",
"_addr_only",
"(",
"address",
")",
")",
"return",
"self",
".",
"getreply",
"(",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/smtplib.py#L581-L584 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_internal/configuration.py | python | Configuration._load_environment_vars | (self) | Loads configuration from environment variables | Loads configuration from environment variables | [
"Loads",
"configuration",
"from",
"environment",
"variables"
] | def _load_environment_vars(self):
# type: () -> None
"""Loads configuration from environment variables
"""
self._config[kinds.ENV_VAR].update(
self._normalized_keys(":env:", self.get_environ_vars())
) | [
"def",
"_load_environment_vars",
"(",
"self",
")",
":",
"# type: () -> None",
"self",
".",
"_config",
"[",
"kinds",
".",
"ENV_VAR",
"]",
".",
"update",
"(",
"self",
".",
"_normalized_keys",
"(",
"\":env:\"",
",",
"self",
".",
"get_environ_vars",
"(",
")",
")... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_internal/configuration.py#L631-L643 | ||
larroy/clearskies_core | 3574ddf0edc8555454c7044126e786a6c29444dc | tools/gyp/pylib/gyp/common.py | python | EncodePOSIXShellArgument | (argument) | return encoded | Encodes |argument| suitably for consumption by POSIX shells.
argument may be quoted and escaped as necessary to ensure that POSIX shells
treat the returned value as a literal representing the argument passed to
this function. Parameter (variable) expansions beginning with $ are allowed
to remain intact withou... | Encodes |argument| suitably for consumption by POSIX shells. | [
"Encodes",
"|argument|",
"suitably",
"for",
"consumption",
"by",
"POSIX",
"shells",
"."
] | def EncodePOSIXShellArgument(argument):
"""Encodes |argument| suitably for consumption by POSIX shells.
argument may be quoted and escaped as necessary to ensure that POSIX shells
treat the returned value as a literal representing the argument passed to
this function. Parameter (variable) expansions beginning... | [
"def",
"EncodePOSIXShellArgument",
"(",
"argument",
")",
":",
"if",
"not",
"isinstance",
"(",
"argument",
",",
"str",
")",
":",
"argument",
"=",
"str",
"(",
"argument",
")",
"if",
"_quote",
".",
"search",
"(",
"argument",
")",
":",
"quote",
"=",
"'\"'",
... | https://github.com/larroy/clearskies_core/blob/3574ddf0edc8555454c7044126e786a6c29444dc/tools/gyp/pylib/gyp/common.py#L252-L272 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/colourchooser/pypalette.py | python | PyPalette.GeneratePaletteBMP | (self, file_name, granularity=1) | The actual palette drawing algorithm.
This used to be 100% reverse engineered by looking at the
values on the MS map, but has since been redone Correctly(tm)
according to the HSV (hue, saturation, value) colour model by
Charl P. Botha <http://cpbotha.net/>.
Speed is tweakable b... | The actual palette drawing algorithm. | [
"The",
"actual",
"palette",
"drawing",
"algorithm",
"."
] | def GeneratePaletteBMP(self, file_name, granularity=1):
"""The actual palette drawing algorithm.
This used to be 100% reverse engineered by looking at the
values on the MS map, but has since been redone Correctly(tm)
according to the HSV (hue, saturation, value) colour model by
... | [
"def",
"GeneratePaletteBMP",
"(",
"self",
",",
"file_name",
",",
"granularity",
"=",
"1",
")",
":",
"self",
".",
"vertical_step",
"=",
"self",
".",
"VERTICAL_STEP",
"*",
"granularity",
"width",
",",
"height",
"=",
"self",
".",
"GetSize",
"(",
")",
"# simpl... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/colourchooser/pypalette.py#L145-L176 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/dateutil/zoneinfo/__init__.py | python | ZoneInfoFile.get | (self, name, default=None) | return self.zones.get(name, default) | Wrapper for :func:`ZoneInfoFile.zones.get`. This is a convenience method
for retrieving zones from the zone dictionary.
:param name:
The name of the zone to retrieve. (Generally IANA zone names)
:param default:
The value to return in the event of a missing key.
... | Wrapper for :func:`ZoneInfoFile.zones.get`. This is a convenience method
for retrieving zones from the zone dictionary. | [
"Wrapper",
"for",
":",
"func",
":",
"ZoneInfoFile",
".",
"zones",
".",
"get",
".",
"This",
"is",
"a",
"convenience",
"method",
"for",
"retrieving",
"zones",
"from",
"the",
"zone",
"dictionary",
"."
] | def get(self, name, default=None):
"""
Wrapper for :func:`ZoneInfoFile.zones.get`. This is a convenience method
for retrieving zones from the zone dictionary.
:param name:
The name of the zone to retrieve. (Generally IANA zone names)
:param default:
The ... | [
"def",
"get",
"(",
"self",
",",
"name",
",",
"default",
"=",
"None",
")",
":",
"return",
"self",
".",
"zones",
".",
"get",
"(",
"name",
",",
"default",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/dateutil/zoneinfo/__init__.py#L54-L68 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqt/mantidqt/widgets/plotconfigdialog/__init__.py | python | legend_in_figure | (fig) | return False | Return True if there's a legend in the Figure object | Return True if there's a legend in the Figure object | [
"Return",
"True",
"if",
"there",
"s",
"a",
"legend",
"in",
"the",
"Figure",
"object"
] | def legend_in_figure(fig):
"""Return True if there's a legend in the Figure object"""
for ax in fig.get_axes():
if ax.get_legend() and ax.get_legend().get_texts():
return True
return False | [
"def",
"legend_in_figure",
"(",
"fig",
")",
":",
"for",
"ax",
"in",
"fig",
".",
"get_axes",
"(",
")",
":",
"if",
"ax",
".",
"get_legend",
"(",
")",
"and",
"ax",
".",
"get_legend",
"(",
")",
".",
"get_texts",
"(",
")",
":",
"return",
"True",
"return... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqt/mantidqt/widgets/plotconfigdialog/__init__.py#L75-L80 | |
sailing-pmls/bosen | 06cb58902d011fbea5f9428f10ce30e621492204 | style_script/cpplint.py | python | _SetFilters | (filters) | Sets the module's error-message filters.
These filters are applied when deciding whether to emit a given
error message.
Args:
filters: A string of comma-separated filters (eg "whitespace/indent").
Each filter should start with + or -; else we die. | Sets the module's error-message filters. | [
"Sets",
"the",
"module",
"s",
"error",
"-",
"message",
"filters",
"."
] | def _SetFilters(filters):
"""Sets the module's error-message filters.
These filters are applied when deciding whether to emit a given
error message.
Args:
filters: A string of comma-separated filters (eg "whitespace/indent").
Each filter should start with + or -; else we die.
"""
_cpplint... | [
"def",
"_SetFilters",
"(",
"filters",
")",
":",
"_cpplint_state",
".",
"SetFilters",
"(",
"filters",
")"
] | https://github.com/sailing-pmls/bosen/blob/06cb58902d011fbea5f9428f10ce30e621492204/style_script/cpplint.py#L881-L891 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/bayesflow/python/ops/csiszar_divergence_impl.py | python | amari_alpha | (logu, alpha=1., self_normalized=False, name=None) | The Amari-alpha Csiszar-function in log-space.
A Csiszar-function is a member of,
```none
F = { f:R_+ to R : f convex }.
```
When `self_normalized = True`, the Amari-alpha Csiszar-function is:
```none
f(u) = { -log(u) + (u - 1), alpha = 0
{ u log(u) - (u - 1), alpha = 1
{ [(u*... | The Amari-alpha Csiszar-function in log-space. | [
"The",
"Amari",
"-",
"alpha",
"Csiszar",
"-",
"function",
"in",
"log",
"-",
"space",
"."
] | def amari_alpha(logu, alpha=1., self_normalized=False, name=None):
"""The Amari-alpha Csiszar-function in log-space.
A Csiszar-function is a member of,
```none
F = { f:R_+ to R : f convex }.
```
When `self_normalized = True`, the Amari-alpha Csiszar-function is:
```none
f(u) = { -log(u) + (u - 1), ... | [
"def",
"amari_alpha",
"(",
"logu",
",",
"alpha",
"=",
"1.",
",",
"self_normalized",
"=",
"False",
",",
"name",
"=",
"None",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"name",
",",
"\"amari_alpha\"",
",",
"[",
"logu",
"]",
")",
":",
"if",
"alpha... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/bayesflow/python/ops/csiszar_divergence_impl.py#L53-L120 | ||
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/design-a-file-sharing-system.py | python | FileSharing.join | (self, ownedChunks) | return userID | :type ownedChunks: List[int]
:rtype: int | :type ownedChunks: List[int]
:rtype: int | [
":",
"type",
"ownedChunks",
":",
"List",
"[",
"int",
"]",
":",
"rtype",
":",
"int"
] | def join(self, ownedChunks):
"""
:type ownedChunks: List[int]
:rtype: int
"""
if self.__min_heap:
userID = heapq.heappop(self.__min_heap)
else:
userID = len(self.__users)+1
self.__users.append(set())
self.__users[userID-1] = set... | [
"def",
"join",
"(",
"self",
",",
"ownedChunks",
")",
":",
"if",
"self",
".",
"__min_heap",
":",
"userID",
"=",
"heapq",
".",
"heappop",
"(",
"self",
".",
"__min_heap",
")",
"else",
":",
"userID",
"=",
"len",
"(",
"self",
".",
"__users",
")",
"+",
"... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/design-a-file-sharing-system.py#L21-L33 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/richtext.py | python | RichTextBuffer.BeginSuppressUndo | (*args, **kwargs) | return _richtext.RichTextBuffer_BeginSuppressUndo(*args, **kwargs) | BeginSuppressUndo(self) -> bool | BeginSuppressUndo(self) -> bool | [
"BeginSuppressUndo",
"(",
"self",
")",
"-",
">",
"bool"
] | def BeginSuppressUndo(*args, **kwargs):
"""BeginSuppressUndo(self) -> bool"""
return _richtext.RichTextBuffer_BeginSuppressUndo(*args, **kwargs) | [
"def",
"BeginSuppressUndo",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextBuffer_BeginSuppressUndo",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/richtext.py#L2289-L2291 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.