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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
generalized-intelligence/GAAS | 29ab17d3e8a4ba18edef3a57c36d8db6329fac73 | deprecated/algorithms/scene_retrieving/src/nlohmann_json/benchmarks/thirdparty/benchmark/mingw.py | python | str2ver | (string) | return version | Converts a version string into a tuple | Converts a version string into a tuple | [
"Converts",
"a",
"version",
"string",
"into",
"a",
"tuple"
] | def str2ver(string):
'''
Converts a version string into a tuple
'''
try:
version = tuple(int(v) for v in string.split('.'))
if len(version) is not 3:
raise ValueError()
except ValueError:
raise argparse.ArgumentTypeError(
'please provide a three digit ... | [
"def",
"str2ver",
"(",
"string",
")",
":",
"try",
":",
"version",
"=",
"tuple",
"(",
"int",
"(",
"v",
")",
"for",
"v",
"in",
"string",
".",
"split",
"(",
"'.'",
")",
")",
"if",
"len",
"(",
"version",
")",
"is",
"not",
"3",
":",
"raise",
"ValueE... | https://github.com/generalized-intelligence/GAAS/blob/29ab17d3e8a4ba18edef3a57c36d8db6329fac73/deprecated/algorithms/scene_retrieving/src/nlohmann_json/benchmarks/thirdparty/benchmark/mingw.py#L248-L259 | |
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/contrib/distributions/python/ops/operator_pd_cholesky.py | python | OperatorPDCholesky.verify_pd | (self) | return self._verify_pd | Whether to verify that this `Operator` is positive definite. | Whether to verify that this `Operator` is positive definite. | [
"Whether",
"to",
"verify",
"that",
"this",
"Operator",
"is",
"positive",
"definite",
"."
] | def verify_pd(self):
"""Whether to verify that this `Operator` is positive definite."""
return self._verify_pd | [
"def",
"verify_pd",
"(",
"self",
")",
":",
"return",
"self",
".",
"_verify_pd"
] | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/contrib/distributions/python/ops/operator_pd_cholesky.py#L91-L93 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/botocore/loaders.py | python | Loader.determine_latest_version | (self, service_name, type_name) | return max(self.list_api_versions(service_name, type_name)) | Find the latest API version available for a service.
:type service_name: str
:param service_name: The name of the service.
:type type_name: str
:param type_name: The type of the service (service-2,
paginators-1, waiters-2, etc). This is needed because
the lates... | Find the latest API version available for a service. | [
"Find",
"the",
"latest",
"API",
"version",
"available",
"for",
"a",
"service",
"."
] | def determine_latest_version(self, service_name, type_name):
"""Find the latest API version available for a service.
:type service_name: str
:param service_name: The name of the service.
:type type_name: str
:param type_name: The type of the service (service-2,
pagi... | [
"def",
"determine_latest_version",
"(",
"self",
",",
"service_name",
",",
"type_name",
")",
":",
"return",
"max",
"(",
"self",
".",
"list_api_versions",
"(",
"service_name",
",",
"type_name",
")",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/botocore/loaders.py#L290-L310 | |
rdkit/rdkit | ede860ae316d12d8568daf5ee800921c3389c84e | rdkit/sping/PDF/pdfutils.py | python | _AsciiBase85Decode | (input) | return outstream.read() | This is not used - Acrobat Reader decodes for you - but a round
trip is essential for testing. | This is not used - Acrobat Reader decodes for you - but a round
trip is essential for testing. | [
"This",
"is",
"not",
"used",
"-",
"Acrobat",
"Reader",
"decodes",
"for",
"you",
"-",
"but",
"a",
"round",
"trip",
"is",
"essential",
"for",
"testing",
"."
] | def _AsciiBase85Decode(input):
"""This is not used - Acrobat Reader decodes for you - but a round
trip is essential for testing."""
outstream = StringIO()
# strip all whitespace
stripped = ''.join(input.split(), '')
# check end
assert stripped[-2:] == '~>', 'Invalid terminator for Ascii Ba... | [
"def",
"_AsciiBase85Decode",
"(",
"input",
")",
":",
"outstream",
"=",
"StringIO",
"(",
")",
"# strip all whitespace",
"stripped",
"=",
"''",
".",
"join",
"(",
"input",
".",
"split",
"(",
")",
",",
"''",
")",
"# check end",
"assert",
"stripped",
"[",
"-",
... | https://github.com/rdkit/rdkit/blob/ede860ae316d12d8568daf5ee800921c3389c84e/rdkit/sping/PDF/pdfutils.py#L223-L292 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/saved_model/function_deserialization.py | python | _call_concrete_function | (function, inputs) | return result | Calls a restored Function with structured inputs.
This differs from `function.__call__` in that inputs and outputs are
structured and that it casts inputs to tensors if needed.
Note: this does not checks that non-tensor inputs match. That should be
done before via `_concrete_function_callable_with`.
Args:
... | Calls a restored Function with structured inputs. | [
"Calls",
"a",
"restored",
"Function",
"with",
"structured",
"inputs",
"."
] | def _call_concrete_function(function, inputs):
"""Calls a restored Function with structured inputs.
This differs from `function.__call__` in that inputs and outputs are
structured and that it casts inputs to tensors if needed.
Note: this does not checks that non-tensor inputs match. That should be
done befo... | [
"def",
"_call_concrete_function",
"(",
"function",
",",
"inputs",
")",
":",
"expected_structure",
"=",
"function",
".",
"graph",
".",
"structured_input_signature",
"flatten_inputs",
"=",
"nest",
".",
"flatten_up_to",
"(",
"expected_structure",
",",
"inputs",
",",
"e... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/saved_model/function_deserialization.py#L48-L79 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/nn/optim/lazyadam.py | python | LazyAdam.target | (self, value) | If the input value is set to "CPU", the parameters will be updated on the host using the Fused
optimizer operation. | If the input value is set to "CPU", the parameters will be updated on the host using the Fused
optimizer operation. | [
"If",
"the",
"input",
"value",
"is",
"set",
"to",
"CPU",
"the",
"parameters",
"will",
"be",
"updated",
"on",
"the",
"host",
"using",
"the",
"Fused",
"optimizer",
"operation",
"."
] | def target(self, value):
"""
If the input value is set to "CPU", the parameters will be updated on the host using the Fused
optimizer operation.
"""
self._set_base_target(value) | [
"def",
"target",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"_set_base_target",
"(",
"value",
")"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/nn/optim/lazyadam.py#L292-L297 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/distributions/kullback_leibler.py | python | cross_entropy | (ref, other,
allow_nan_stats=True, name=None) | Computes the (Shannon) cross entropy.
Denote two distributions by `P` (`ref`) and `Q` (`other`). Assuming `P, Q`
are absolutely continuous with respect to one another and permit densities
`p(x) dr(x)` and `q(x) dr(x)`, (Shanon) cross entropy is defined as:
```none
H[P, Q] = E_p[-log q(X)] = -int_F p(x) log ... | Computes the (Shannon) cross entropy. | [
"Computes",
"the",
"(",
"Shannon",
")",
"cross",
"entropy",
"."
] | def cross_entropy(ref, other,
allow_nan_stats=True, name=None):
"""Computes the (Shannon) cross entropy.
Denote two distributions by `P` (`ref`) and `Q` (`other`). Assuming `P, Q`
are absolutely continuous with respect to one another and permit densities
`p(x) dr(x)` and `q(x) dr(x)`, (Shanon... | [
"def",
"cross_entropy",
"(",
"ref",
",",
"other",
",",
"allow_nan_stats",
"=",
"True",
",",
"name",
"=",
"None",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"name",
",",
"\"cross_entropy\"",
")",
":",
"return",
"ref",
".",
"entropy",
"(",
")",
"+"... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/distributions/kullback_leibler.py#L132-L161 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/turtle.py | python | TNavigator._go | (self, distance) | move turtle forward by specified distance | move turtle forward by specified distance | [
"move",
"turtle",
"forward",
"by",
"specified",
"distance"
] | def _go(self, distance):
"""move turtle forward by specified distance"""
ende = self._position + self._orient * distance
self._goto(ende) | [
"def",
"_go",
"(",
"self",
",",
"distance",
")",
":",
"ende",
"=",
"self",
".",
"_position",
"+",
"self",
".",
"_orient",
"*",
"distance",
"self",
".",
"_goto",
"(",
"ende",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/turtle.py#L1602-L1605 | ||
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | scripts/Python/static-binding/lldb.py | python | SBTarget.FindSymbols | (self, *args) | return _lldb.SBTarget_FindSymbols(self, *args) | FindSymbols(SBTarget self, char const * name, lldb::SymbolType type) -> SBSymbolContextList
FindSymbols(SBTarget self, char const * name) -> SBSymbolContextList | FindSymbols(SBTarget self, char const * name, lldb::SymbolType type) -> SBSymbolContextList
FindSymbols(SBTarget self, char const * name) -> SBSymbolContextList | [
"FindSymbols",
"(",
"SBTarget",
"self",
"char",
"const",
"*",
"name",
"lldb",
"::",
"SymbolType",
"type",
")",
"-",
">",
"SBSymbolContextList",
"FindSymbols",
"(",
"SBTarget",
"self",
"char",
"const",
"*",
"name",
")",
"-",
">",
"SBSymbolContextList"
] | def FindSymbols(self, *args):
"""
FindSymbols(SBTarget self, char const * name, lldb::SymbolType type) -> SBSymbolContextList
FindSymbols(SBTarget self, char const * name) -> SBSymbolContextList
"""
return _lldb.SBTarget_FindSymbols(self, *args) | [
"def",
"FindSymbols",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_lldb",
".",
"SBTarget_FindSymbols",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L11225-L11230 | |
DanielSWolf/rhubarb-lip-sync | 5cface0af3b6e4e58c0b829c51561d784fb9f52f | rhubarb/lib/webrtc-8d2248ff/webrtc/tools/barcode_tools/barcode_encoder.py | python | overlay_yuv_files | (barcode_width, barcode_height, base_width, base_height,
barcodes_file_name, base_file_name, output_file_name) | Overlays two YUV files starting from the upper left corner of both.
Args:
barcode_width(int): The width of the barcode (to be overlaid).
barcode_height(int): The height of the barcode (to be overlaid).
base_width(int): The width of a frame of the base file.
base_height(int): The height of a frame of ... | Overlays two YUV files starting from the upper left corner of both. | [
"Overlays",
"two",
"YUV",
"files",
"starting",
"from",
"the",
"upper",
"left",
"corner",
"of",
"both",
"."
] | def overlay_yuv_files(barcode_width, barcode_height, base_width, base_height,
barcodes_file_name, base_file_name, output_file_name):
"""Overlays two YUV files starting from the upper left corner of both.
Args:
barcode_width(int): The width of the barcode (to be overlaid).
barcode_heig... | [
"def",
"overlay_yuv_files",
"(",
"barcode_width",
",",
"barcode_height",
",",
"base_width",
",",
"base_height",
",",
"barcodes_file_name",
",",
"base_file_name",
",",
"output_file_name",
")",
":",
"# Component sizes = [Y_sizes, U_sizes, V_sizes]",
"barcodes_component_sizes",
... | https://github.com/DanielSWolf/rhubarb-lip-sync/blob/5cface0af3b6e4e58c0b829c51561d784fb9f52f/rhubarb/lib/webrtc-8d2248ff/webrtc/tools/barcode_tools/barcode_encoder.py#L204-L240 | ||
gromacs/gromacs | 7dec3a3f99993cf5687a122de3e12de31c21c399 | docs/doxygen/gmxtree.py | python | GromacsTree.find_define_file_uses | (self) | Find files that use defines from config.h. | Find files that use defines from config.h. | [
"Find",
"files",
"that",
"use",
"defines",
"from",
"config",
".",
"h",
"."
] | def find_define_file_uses(self):
"""Find files that use defines from config.h."""
# Executing git grep is substantially faster than using the define_re
# directly on the contents of the file in Python.
for define_file in self.get_checked_define_files():
excluded_files = set([... | [
"def",
"find_define_file_uses",
"(",
"self",
")",
":",
"# Executing git grep is substantially faster than using the define_re",
"# directly on the contents of the file in Python.",
"for",
"define_file",
"in",
"self",
".",
"get_checked_define_files",
"(",
")",
":",
"excluded_files",... | https://github.com/gromacs/gromacs/blob/7dec3a3f99993cf5687a122de3e12de31c21c399/docs/doxygen/gmxtree.py#L968-L990 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_misc.py | python | UIActionSimulator.MouseMove | (*args) | return _misc_.UIActionSimulator_MouseMove(*args) | MouseMove(self, long x, long y) -> bool
MouseMove(self, Point point) -> bool | MouseMove(self, long x, long y) -> bool
MouseMove(self, Point point) -> bool | [
"MouseMove",
"(",
"self",
"long",
"x",
"long",
"y",
")",
"-",
">",
"bool",
"MouseMove",
"(",
"self",
"Point",
"point",
")",
"-",
">",
"bool"
] | def MouseMove(*args):
"""
MouseMove(self, long x, long y) -> bool
MouseMove(self, Point point) -> bool
"""
return _misc_.UIActionSimulator_MouseMove(*args) | [
"def",
"MouseMove",
"(",
"*",
"args",
")",
":",
"return",
"_misc_",
".",
"UIActionSimulator_MouseMove",
"(",
"*",
"args",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_misc.py#L6960-L6965 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/protobuf/py3/google/protobuf/descriptor_pool.py | python | DescriptorPool._InternalAddFileDescriptor | (self, file_desc) | Adds a FileDescriptor to the pool, non-recursively.
If the FileDescriptor contains messages or enums, the caller must explicitly
register them.
Args:
file_desc: A FileDescriptor. | Adds a FileDescriptor to the pool, non-recursively. | [
"Adds",
"a",
"FileDescriptor",
"to",
"the",
"pool",
"non",
"-",
"recursively",
"."
] | def _InternalAddFileDescriptor(self, file_desc):
"""Adds a FileDescriptor to the pool, non-recursively.
If the FileDescriptor contains messages or enums, the caller must explicitly
register them.
Args:
file_desc: A FileDescriptor.
"""
self._AddFileDescriptor(file_desc)
# TODO(jieluo... | [
"def",
"_InternalAddFileDescriptor",
"(",
"self",
",",
"file_desc",
")",
":",
"self",
".",
"_AddFileDescriptor",
"(",
"file_desc",
")",
"# TODO(jieluo): This is a temporary solution for FieldDescriptor.file.",
"# FieldDescriptor.file is added in code gen. Remove this solution after",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/protobuf/py3/google/protobuf/descriptor_pool.py#L359-L375 | ||
eclipse/sumo | 7132a9b8b6eea734bdec38479026b4d8c4336d03 | tools/contributed/sumopy/coremodules/demand/virtualpop.py | python | StageTypeMixin.get_times | (self, id_mode) | return self._timesmap[id_mode] | Returns a vector mapping id_edge to edge travel times
for given mode id_mode | Returns a vector mapping id_edge to edge travel times
for given mode id_mode | [
"Returns",
"a",
"vector",
"mapping",
"id_edge",
"to",
"edge",
"travel",
"times",
"for",
"given",
"mode",
"id_mode"
] | def get_times(self, id_mode):
"""
Returns a vector mapping id_edge to edge travel times
for given mode id_mode
"""
print 'get_times', self._timesmap.keys()
if not self._timesmap.has_key(id_mode):
edges = self.get_virtualpop().get_scenario().net.edges
... | [
"def",
"get_times",
"(",
"self",
",",
"id_mode",
")",
":",
"print",
"'get_times'",
",",
"self",
".",
"_timesmap",
".",
"keys",
"(",
")",
"if",
"not",
"self",
".",
"_timesmap",
".",
"has_key",
"(",
"id_mode",
")",
":",
"edges",
"=",
"self",
".",
"get_... | https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/contributed/sumopy/coremodules/demand/virtualpop.py#L4435-L4448 | |
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/buildscripts/resmokelib/logging/handlers.py | python | BufferedHandler.process_record | (self, record) | return record | Applies a transformation to the record before it gets added to
the buffer.
The default implementation returns 'record' unmodified. | Applies a transformation to the record before it gets added to
the buffer. | [
"Applies",
"a",
"transformation",
"to",
"the",
"record",
"before",
"it",
"gets",
"added",
"to",
"the",
"buffer",
"."
] | def process_record(self, record):
"""
Applies a transformation to the record before it gets added to
the buffer.
The default implementation returns 'record' unmodified.
"""
return record | [
"def",
"process_record",
"(",
"self",
",",
"record",
")",
":",
"return",
"record"
] | https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/buildscripts/resmokelib/logging/handlers.py#L79-L87 | |
indutny/candor | 48e7260618f5091c80a3416828e2808cad3ea22e | tools/gyp/pylib/gyp/msvs_emulation.py | python | MsvsSettings.GetRcflags | (self, config, gyp_to_ninja_path) | return rcflags | Returns the flags that need to be added to invocations of the resource
compiler. | Returns the flags that need to be added to invocations of the resource
compiler. | [
"Returns",
"the",
"flags",
"that",
"need",
"to",
"be",
"added",
"to",
"invocations",
"of",
"the",
"resource",
"compiler",
"."
] | def GetRcflags(self, config, gyp_to_ninja_path):
"""Returns the flags that need to be added to invocations of the resource
compiler."""
config = self._RealConfig(config)
rcflags = []
rc = self._GetWrapper(self, self.msvs_settings[config],
'VCResourceCompilerTool', append=rcflags)
rc('Add... | [
"def",
"GetRcflags",
"(",
"self",
",",
"config",
",",
"gyp_to_ninja_path",
")",
":",
"config",
"=",
"self",
".",
"_RealConfig",
"(",
"config",
")",
"rcflags",
"=",
"[",
"]",
"rc",
"=",
"self",
".",
"_GetWrapper",
"(",
"self",
",",
"self",
".",
"msvs_se... | https://github.com/indutny/candor/blob/48e7260618f5091c80a3416828e2808cad3ea22e/tools/gyp/pylib/gyp/msvs_emulation.py#L473-L485 | |
hakuna-m/wubiuefi | caec1af0a09c78fd5a345180ada1fe45e0c63493 | src/wubi/application.py | python | Wubi.run_installer | (self) | Runs the installer | Runs the installer | [
"Runs",
"the",
"installer"
] | def run_installer(self):
'''
Runs the installer
'''
#TBD add non_interactive mode
#TBD add cd_boot mode
if self.info.previous_target_dir \
and os.path.isdir(self.info.previous_target_dir):
log.info("Already installed, running the uninstaller...")
... | [
"def",
"run_installer",
"(",
"self",
")",
":",
"#TBD add non_interactive mode",
"#TBD add cd_boot mode",
"if",
"self",
".",
"info",
".",
"previous_target_dir",
"and",
"os",
".",
"path",
".",
"isdir",
"(",
"self",
".",
"info",
".",
"previous_target_dir",
")",
":"... | https://github.com/hakuna-m/wubiuefi/blob/caec1af0a09c78fd5a345180ada1fe45e0c63493/src/wubi/application.py#L135-L164 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/xrc.py | python | XmlResource.LoadToolBar | (*args, **kwargs) | return _xrc.XmlResource_LoadToolBar(*args, **kwargs) | LoadToolBar(self, Window parent, String name) -> wxToolBar | LoadToolBar(self, Window parent, String name) -> wxToolBar | [
"LoadToolBar",
"(",
"self",
"Window",
"parent",
"String",
"name",
")",
"-",
">",
"wxToolBar"
] | def LoadToolBar(*args, **kwargs):
"""LoadToolBar(self, Window parent, String name) -> wxToolBar"""
return _xrc.XmlResource_LoadToolBar(*args, **kwargs) | [
"def",
"LoadToolBar",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_xrc",
".",
"XmlResource_LoadToolBar",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/xrc.py#L131-L133 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py3/sklearn/decomposition/_lda.py | python | LatentDirichletAllocation.perplexity | (self, X, sub_sampling=False) | return self._perplexity_precomp_distr(X, sub_sampling=sub_sampling) | Calculate approximate perplexity for data X.
Perplexity is defined as exp(-1. * log-likelihood per word)
.. versionchanged:: 0.19
*doc_topic_distr* argument has been deprecated and is ignored
because user no longer has access to unnormalized distribution
Parameters
... | Calculate approximate perplexity for data X. | [
"Calculate",
"approximate",
"perplexity",
"for",
"data",
"X",
"."
] | def perplexity(self, X, sub_sampling=False):
"""Calculate approximate perplexity for data X.
Perplexity is defined as exp(-1. * log-likelihood per word)
.. versionchanged:: 0.19
*doc_topic_distr* argument has been deprecated and is ignored
because user no longer has acces... | [
"def",
"perplexity",
"(",
"self",
",",
"X",
",",
"sub_sampling",
"=",
"False",
")",
":",
"return",
"self",
".",
"_perplexity_precomp_distr",
"(",
"X",
",",
"sub_sampling",
"=",
"sub_sampling",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/decomposition/_lda.py#L792-L814 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/contrib/metrics/python/ops/set_ops.py | python | set_size | (a, validate_indices=True) | return _set_ops.set_size(a.indices, a.values, a.shape, validate_indices) | Compute number of unique elements along last dimension of `a`.
Args:
a: `SparseTensor`, with indices sorted in row-major order.
validate_indices: Whether to validate the order and range of sparse indices
in `a`.
Returns:
For `a` ranked `n`, this is a `Tensor` with rank `n-1`, and the same 1st
... | Compute number of unique elements along last dimension of `a`. | [
"Compute",
"number",
"of",
"unique",
"elements",
"along",
"last",
"dimension",
"of",
"a",
"."
] | def set_size(a, validate_indices=True):
"""Compute number of unique elements along last dimension of `a`.
Args:
a: `SparseTensor`, with indices sorted in row-major order.
validate_indices: Whether to validate the order and range of sparse indices
in `a`.
Returns:
For `a` ranked `n`, this is a... | [
"def",
"set_size",
"(",
"a",
",",
"validate_indices",
"=",
"True",
")",
":",
"a",
"=",
"tensor_util",
".",
"convert_to_tensor_or_sparse_tensor",
"(",
"a",
",",
"name",
"=",
"\"a\"",
")",
"if",
"not",
"isinstance",
"(",
"a",
",",
"ops",
".",
"SparseTensor",... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/contrib/metrics/python/ops/set_ops.py#L44-L66 | |
sdhash/sdhash | b9eff63e4e5867e910f41fd69032bbb1c94a2a5e | external/tools/build/v2/build/feature.py | python | expand_composites | (properties) | return result | Expand all composite properties in the set so that all components
are explicitly expressed. | Expand all composite properties in the set so that all components
are explicitly expressed. | [
"Expand",
"all",
"composite",
"properties",
"in",
"the",
"set",
"so",
"that",
"all",
"components",
"are",
"explicitly",
"expressed",
"."
] | def expand_composites (properties):
""" Expand all composite properties in the set so that all components
are explicitly expressed.
"""
explicit_features = set(p.feature() for p in properties)
result = []
# now expand composite features
for p in properties:
expanded = expand_co... | [
"def",
"expand_composites",
"(",
"properties",
")",
":",
"explicit_features",
"=",
"set",
"(",
"p",
".",
"feature",
"(",
")",
"for",
"p",
"in",
"properties",
")",
"result",
"=",
"[",
"]",
"# now expand composite features",
"for",
"p",
"in",
"properties",
":"... | https://github.com/sdhash/sdhash/blob/b9eff63e4e5867e910f41fd69032bbb1c94a2a5e/external/tools/build/v2/build/feature.py#L576-L610 | |
okex/V3-Open-API-SDK | c5abb0db7e2287718e0055e17e57672ce0ec7fd9 | okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_vendor/pep517/_in_process.py | python | build_wheel | (wheel_directory, config_settings, metadata_directory=None) | return _build_backend().build_wheel(wheel_directory, config_settings,
metadata_directory) | Invoke the mandatory build_wheel hook.
If a wheel was already built in the
prepare_metadata_for_build_wheel fallback, this
will copy it rather than rebuilding the wheel. | Invoke the mandatory build_wheel hook. | [
"Invoke",
"the",
"mandatory",
"build_wheel",
"hook",
"."
] | def build_wheel(wheel_directory, config_settings, metadata_directory=None):
"""Invoke the mandatory build_wheel hook.
If a wheel was already built in the
prepare_metadata_for_build_wheel fallback, this
will copy it rather than rebuilding the wheel.
"""
prebuilt_whl = _find_already_built_wheel(m... | [
"def",
"build_wheel",
"(",
"wheel_directory",
",",
"config_settings",
",",
"metadata_directory",
"=",
"None",
")",
":",
"prebuilt_whl",
"=",
"_find_already_built_wheel",
"(",
"metadata_directory",
")",
"if",
"prebuilt_whl",
":",
"shutil",
".",
"copy2",
"(",
"prebuil... | 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/pep517/_in_process.py#L128-L141 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_controls.py | python | AnyButton.GetBitmapPressed | (*args, **kwargs) | return _controls_.AnyButton_GetBitmapPressed(*args, **kwargs) | GetBitmapPressed(self) -> Bitmap | GetBitmapPressed(self) -> Bitmap | [
"GetBitmapPressed",
"(",
"self",
")",
"-",
">",
"Bitmap"
] | def GetBitmapPressed(*args, **kwargs):
"""GetBitmapPressed(self) -> Bitmap"""
return _controls_.AnyButton_GetBitmapPressed(*args, **kwargs) | [
"def",
"GetBitmapPressed",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"AnyButton_GetBitmapPressed",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_controls.py#L104-L106 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/calendar.py | python | TextCalendar.formatday | (self, day, weekday, width) | return s.center(width) | Returns a formatted day. | Returns a formatted day. | [
"Returns",
"a",
"formatted",
"day",
"."
] | def formatday(self, day, weekday, width):
"""
Returns a formatted day.
"""
if day == 0:
s = ''
else:
s = '%2i' % day # right-align single-digit days
return s.center(width) | [
"def",
"formatday",
"(",
"self",
",",
"day",
",",
"weekday",
",",
"width",
")",
":",
"if",
"day",
"==",
"0",
":",
"s",
"=",
"''",
"else",
":",
"s",
"=",
"'%2i'",
"%",
"day",
"# right-align single-digit days",
"return",
"s",
".",
"center",
"(",
"width... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/calendar.py#L305-L313 | |
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/resmokelib/utils/jscomment.py | python | get_tags | (pathname) | return [] | Return the list of tags found in the (JS-style) comments of 'pathname'.
The definition can span multiple lines, use unquoted,
single-quoted, or double-quoted strings, and use the '#' character
for inline commenting.
e.g.
/**
* @tags: [ "tag1", # double quoted
* 'tag2' # s... | Return the list of tags found in the (JS-style) comments of 'pathname'. | [
"Return",
"the",
"list",
"of",
"tags",
"found",
"in",
"the",
"(",
"JS",
"-",
"style",
")",
"comments",
"of",
"pathname",
"."
] | def get_tags(pathname):
"""Return the list of tags found in the (JS-style) comments of 'pathname'.
The definition can span multiple lines, use unquoted,
single-quoted, or double-quoted strings, and use the '#' character
for inline commenting.
e.g.
/**
* @tags: [ "tag1", # double quote... | [
"def",
"get_tags",
"(",
"pathname",
")",
":",
"with",
"io",
".",
"open",
"(",
"pathname",
",",
"'r'",
",",
"encoding",
"=",
"'utf-8'",
")",
"as",
"fp",
":",
"match",
"=",
"_JSTEST_TAGS_RE",
".",
"match",
"(",
"fp",
".",
"read",
"(",
")",
")",
"if",... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/resmokelib/utils/jscomment.py#L11-L44 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/targets/arrayobj.py | python | _get_borrowing_getitem | (context, seqty) | return wrap | Return a getitem() implementation that doesn't incref its result. | Return a getitem() implementation that doesn't incref its result. | [
"Return",
"a",
"getitem",
"()",
"implementation",
"that",
"doesn",
"t",
"incref",
"its",
"result",
"."
] | def _get_borrowing_getitem(context, seqty):
"""
Return a getitem() implementation that doesn't incref its result.
"""
retty = seqty.dtype
getitem_impl = context.get_function(operator.getitem,
signature(retty, seqty, types.intp))
def wrap(builder, args):
... | [
"def",
"_get_borrowing_getitem",
"(",
"context",
",",
"seqty",
")",
":",
"retty",
"=",
"seqty",
".",
"dtype",
"getitem_impl",
"=",
"context",
".",
"get_function",
"(",
"operator",
".",
"getitem",
",",
"signature",
"(",
"retty",
",",
"seqty",
",",
"types",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/targets/arrayobj.py#L4192-L4206 | |
qboticslabs/mastering_ros | d83e78f30acc45b0f18522c1d5fae3a7f52974b9 | chapter_10_codes/seven_dof_arm_gazebo/scripts/pick_and_place.py | python | Pick_Place._generate_places | (self, target) | return places | Generate places (place locations), based on
https://github.com/davetcoleman/baxter_cpp/blob/hydro-devel/
baxter_pick_place/src/block_pick_place.cpp | Generate places (place locations), based on
https://github.com/davetcoleman/baxter_cpp/blob/hydro-devel/
baxter_pick_place/src/block_pick_place.cpp | [
"Generate",
"places",
"(",
"place",
"locations",
")",
"based",
"on",
"https",
":",
"//",
"github",
".",
"com",
"/",
"davetcoleman",
"/",
"baxter_cpp",
"/",
"blob",
"/",
"hydro",
"-",
"devel",
"/",
"baxter_pick_place",
"/",
"src",
"/",
"block_pick_place",
"... | def _generate_places(self, target):
"""
Generate places (place locations), based on
https://github.com/davetcoleman/baxter_cpp/blob/hydro-devel/
baxter_pick_place/src/block_pick_place.cpp
"""
# Generate places:
places = []
now = rospy.Time.now()
f... | [
"def",
"_generate_places",
"(",
"self",
",",
"target",
")",
":",
"# Generate places:",
"places",
"=",
"[",
"]",
"now",
"=",
"rospy",
".",
"Time",
".",
"now",
"(",
")",
"for",
"angle",
"in",
"numpy",
".",
"arange",
"(",
"0.0",
",",
"numpy",
".",
"deg2... | https://github.com/qboticslabs/mastering_ros/blob/d83e78f30acc45b0f18522c1d5fae3a7f52974b9/chapter_10_codes/seven_dof_arm_gazebo/scripts/pick_and_place.py#L191-L243 | |
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py | python | uCSIsLatinExtendedB | (code) | return ret | Check whether the character is part of LatinExtended-B UCS
Block | Check whether the character is part of LatinExtended-B UCS
Block | [
"Check",
"whether",
"the",
"character",
"is",
"part",
"of",
"LatinExtended",
"-",
"B",
"UCS",
"Block"
] | def uCSIsLatinExtendedB(code):
"""Check whether the character is part of LatinExtended-B UCS
Block """
ret = libxml2mod.xmlUCSIsLatinExtendedB(code)
return ret | [
"def",
"uCSIsLatinExtendedB",
"(",
"code",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlUCSIsLatinExtendedB",
"(",
"code",
")",
"return",
"ret"
] | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py#L1900-L1904 | |
smilehao/xlua-framework | a03801538be2b0e92d39332d445b22caca1ef61f | ConfigData/trunk/tools/protobuf-2.5.0/protobuf-2.5.0/python/google/protobuf/text_format.py | python | Merge | (text, message) | Merges an ASCII representation of a protocol message into a message.
Args:
text: Message ASCII representation.
message: A protocol buffer message to merge into.
Raises:
ParseError: On ASCII parsing problems. | Merges an ASCII representation of a protocol message into a message. | [
"Merges",
"an",
"ASCII",
"representation",
"of",
"a",
"protocol",
"message",
"into",
"a",
"message",
"."
] | def Merge(text, message):
"""Merges an ASCII representation of a protocol message into a message.
Args:
text: Message ASCII representation.
message: A protocol buffer message to merge into.
Raises:
ParseError: On ASCII parsing problems.
"""
tokenizer = _Tokenizer(text)
while not tokenizer.AtEn... | [
"def",
"Merge",
"(",
"text",
",",
"message",
")",
":",
"tokenizer",
"=",
"_Tokenizer",
"(",
"text",
")",
"while",
"not",
"tokenizer",
".",
"AtEnd",
"(",
")",
":",
"_MergeField",
"(",
"tokenizer",
",",
"message",
")"
] | https://github.com/smilehao/xlua-framework/blob/a03801538be2b0e92d39332d445b22caca1ef61f/ConfigData/trunk/tools/protobuf-2.5.0/protobuf-2.5.0/python/google/protobuf/text_format.py#L146-L158 | ||
twhui/LiteFlowNet | 00925aebf2db9ac50f4b1666f718688b10dd10d1 | python/caffe/io.py | python | Transformer.set_mean | (self, in_, mean) | Set the mean to subtract for centering the data.
Parameters
----------
in_ : which input to assign this mean.
mean : mean ndarray (input dimensional or broadcastable) | Set the mean to subtract for centering the data. | [
"Set",
"the",
"mean",
"to",
"subtract",
"for",
"centering",
"the",
"data",
"."
] | def set_mean(self, in_, mean):
"""
Set the mean to subtract for centering the data.
Parameters
----------
in_ : which input to assign this mean.
mean : mean ndarray (input dimensional or broadcastable)
"""
self.__check_input(in_)
ms = mean.shape
... | [
"def",
"set_mean",
"(",
"self",
",",
"in_",
",",
"mean",
")",
":",
"self",
".",
"__check_input",
"(",
"in_",
")",
"ms",
"=",
"mean",
".",
"shape",
"if",
"mean",
".",
"ndim",
"==",
"1",
":",
"# broadcast channels",
"if",
"ms",
"[",
"0",
"]",
"!=",
... | https://github.com/twhui/LiteFlowNet/blob/00925aebf2db9ac50f4b1666f718688b10dd10d1/python/caffe/io.py#L236-L260 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py3/sklearn/ensemble/_hist_gradient_boosting/binning.py | python | _BinMapper.transform | (self, X) | return binned | Bin data X.
Missing values will be mapped to the last bin.
Parameters
----------
X : array-like, shape (n_samples, n_features)
The data to bin.
Returns
-------
X_binned : array-like, shape (n_samples, n_features)
The binned data (fortran... | Bin data X. | [
"Bin",
"data",
"X",
"."
] | def transform(self, X):
"""Bin data X.
Missing values will be mapped to the last bin.
Parameters
----------
X : array-like, shape (n_samples, n_features)
The data to bin.
Returns
-------
X_binned : array-like, shape (n_samples, n_features)
... | [
"def",
"transform",
"(",
"self",
",",
"X",
")",
":",
"X",
"=",
"check_array",
"(",
"X",
",",
"dtype",
"=",
"[",
"X_DTYPE",
"]",
",",
"force_all_finite",
"=",
"False",
")",
"check_is_fitted",
"(",
"self",
")",
"if",
"X",
".",
"shape",
"[",
"1",
"]",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/ensemble/_hist_gradient_boosting/binning.py#L175-L201 | |
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | third_party/numpy/files/numpy/ma/extras.py | python | _covhelper | (x, y=None, rowvar=True, allow_masked=True) | return (x, xnotmask, rowvar) | Private function for the computation of covariance and correlation
coefficients. | Private function for the computation of covariance and correlation
coefficients. | [
"Private",
"function",
"for",
"the",
"computation",
"of",
"covariance",
"and",
"correlation",
"coefficients",
"."
] | def _covhelper(x, y=None, rowvar=True, allow_masked=True):
"""
Private function for the computation of covariance and correlation
coefficients.
"""
x = ma.array(x, ndmin=2, copy=True, dtype=float)
xmask = ma.getmaskarray(x)
# Quick exit if we can't process masked data
if not allow_maske... | [
"def",
"_covhelper",
"(",
"x",
",",
"y",
"=",
"None",
",",
"rowvar",
"=",
"True",
",",
"allow_masked",
"=",
"True",
")",
":",
"x",
"=",
"ma",
".",
"array",
"(",
"x",
",",
"ndmin",
"=",
"2",
",",
"copy",
"=",
"True",
",",
"dtype",
"=",
"float",
... | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/ma/extras.py#L1209-L1249 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Path/PathScripts/PathLog.py | python | untrackAllModules | () | In addition to stop tracking all modules it also clears the tracking flag for all individual modules. | In addition to stop tracking all modules it also clears the tracking flag for all individual modules. | [
"In",
"addition",
"to",
"stop",
"tracking",
"all",
"modules",
"it",
"also",
"clears",
"the",
"tracking",
"flag",
"for",
"all",
"individual",
"modules",
"."
] | def untrackAllModules():
"""In addition to stop tracking all modules it also clears the tracking flag for all individual modules."""
global _trackAll # pylint: disable=global-statement
global _trackModule # pylint: disable=global-statement
_trackAll = False
_trackModule = { } | [
"def",
"untrackAllModules",
"(",
")",
":",
"global",
"_trackAll",
"# pylint: disable=global-statement",
"global",
"_trackModule",
"# pylint: disable=global-statement",
"_trackAll",
"=",
"False",
"_trackModule",
"=",
"{",
"}"
] | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Path/PathScripts/PathLog.py#L131-L136 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/plat-mac/lib-scriptpackages/Netscape/Standard_Suite.py | python | Standard_Suite_Events.close | (self, _object, _attributes={}, **_arguments) | close: Close an object
Required argument: the objects to close
Keyword argument _attributes: AppleEvent attribute dictionary | close: Close an object
Required argument: the objects to close
Keyword argument _attributes: AppleEvent attribute dictionary | [
"close",
":",
"Close",
"an",
"object",
"Required",
"argument",
":",
"the",
"objects",
"to",
"close",
"Keyword",
"argument",
"_attributes",
":",
"AppleEvent",
"attribute",
"dictionary"
] | def close(self, _object, _attributes={}, **_arguments):
"""close: Close an object
Required argument: the objects to close
Keyword argument _attributes: AppleEvent attribute dictionary
"""
_code = 'core'
_subcode = 'clos'
if _arguments: raise TypeError, 'No option... | [
"def",
"close",
"(",
"self",
",",
"_object",
",",
"_attributes",
"=",
"{",
"}",
",",
"*",
"*",
"_arguments",
")",
":",
"_code",
"=",
"'core'",
"_subcode",
"=",
"'clos'",
"if",
"_arguments",
":",
"raise",
"TypeError",
",",
"'No optional args expected'",
"_a... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/plat-mac/lib-scriptpackages/Netscape/Standard_Suite.py#L16-L34 | ||
apache/incubator-weex | 5c25f0b59f7ac90703c363e7261f60bd06356dbe | weex_core/tools/cpplint.py | python | FilesBelongToSameModule | (filename_cc, filename_h) | return files_belong_to_same_module, common_path | Check if these two filenames belong to the same module.
The concept of a 'module' here is a as follows:
foo.h, foo-inl.h, foo.cc, foo_test.cc and foo_unittest.cc belong to the
same 'module' if they are in the same directory.
some/path/public/xyzzy and some/path/internal/xyzzy are also considered
to belong to... | Check if these two filenames belong to the same module. | [
"Check",
"if",
"these",
"two",
"filenames",
"belong",
"to",
"the",
"same",
"module",
"."
] | def FilesBelongToSameModule(filename_cc, filename_h):
"""Check if these two filenames belong to the same module.
The concept of a 'module' here is a as follows:
foo.h, foo-inl.h, foo.cc, foo_test.cc and foo_unittest.cc belong to the
same 'module' if they are in the same directory.
some/path/public/xyzzy and ... | [
"def",
"FilesBelongToSameModule",
"(",
"filename_cc",
",",
"filename_h",
")",
":",
"fileinfo",
"=",
"FileInfo",
"(",
"filename_cc",
")",
"if",
"not",
"fileinfo",
".",
"IsSource",
"(",
")",
":",
"return",
"(",
"False",
",",
"''",
")",
"filename_cc",
"=",
"f... | https://github.com/apache/incubator-weex/blob/5c25f0b59f7ac90703c363e7261f60bd06356dbe/weex_core/tools/cpplint.py#L5416-L5468 | |
flexflow/FlexFlow | 581fad8ba8d10a16a3102ee2b406b0319586df24 | python/flexflow/core/flexflow_cffi.py | python | FFModel.__init__ | (self, ffconfig) | Constructor of FFModel.
:param ffconfig: configurations of FlexFlow and the created model.
:type ffconfig: FFConfig
:returns: FFModel -- the model. | Constructor of FFModel.
:param ffconfig: configurations of FlexFlow and the created model.
:type ffconfig: FFConfig | [
"Constructor",
"of",
"FFModel",
".",
":",
"param",
"ffconfig",
":",
"configurations",
"of",
"FlexFlow",
"and",
"the",
"created",
"model",
".",
":",
"type",
"ffconfig",
":",
"FFConfig"
] | def __init__(self, ffconfig):
"""Constructor of FFModel.
:param ffconfig: configurations of FlexFlow and the created model.
:type ffconfig: FFConfig
:returns: FFModel -- the model.
"""
self.handle = ffc.flexflow_model_create(ffconfig.handle)
self._handle = ffi.gc(self.handle, f... | [
"def",
"__init__",
"(",
"self",
",",
"ffconfig",
")",
":",
"self",
".",
"handle",
"=",
"ffc",
".",
"flexflow_model_create",
"(",
"ffconfig",
".",
"handle",
")",
"self",
".",
"_handle",
"=",
"ffi",
".",
"gc",
"(",
"self",
".",
"handle",
",",
"ffc",
".... | https://github.com/flexflow/FlexFlow/blob/581fad8ba8d10a16a3102ee2b406b0319586df24/python/flexflow/core/flexflow_cffi.py#L741-L757 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/gan/python/losses/python/losses_impl.py | python | least_squares_discriminator_loss | (
discriminator_real_outputs,
discriminator_gen_outputs,
real_label=1,
fake_label=0,
real_weights=1.0,
generated_weights=1.0,
scope=None,
loss_collection=ops.GraphKeys.LOSSES,
reduction=losses.Reduction.SUM_BY_NONZERO_WEIGHTS,
add_summaries=False) | return loss | Least squares generator loss.
This loss comes from `Least Squares Generative Adversarial Networks`
(https://arxiv.org/abs/1611.04076).
L = 1/2 * (D(x) - `real`) ** 2 +
1/2 * (D(G(z)) - `fake_label`) ** 2
where D(y) are discriminator logits.
Args:
discriminator_real_outputs: Discriminator output ... | Least squares generator loss. | [
"Least",
"squares",
"generator",
"loss",
"."
] | def least_squares_discriminator_loss(
discriminator_real_outputs,
discriminator_gen_outputs,
real_label=1,
fake_label=0,
real_weights=1.0,
generated_weights=1.0,
scope=None,
loss_collection=ops.GraphKeys.LOSSES,
reduction=losses.Reduction.SUM_BY_NONZERO_WEIGHTS,
add_summaries=Fal... | [
"def",
"least_squares_discriminator_loss",
"(",
"discriminator_real_outputs",
",",
"discriminator_gen_outputs",
",",
"real_label",
"=",
"1",
",",
"fake_label",
"=",
"0",
",",
"real_weights",
"=",
"1.0",
",",
"generated_weights",
"=",
"1.0",
",",
"scope",
"=",
"None"... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/gan/python/losses/python/losses_impl.py#L653-L721 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/SANS/sans/common/general_functions.py | python | get_log_value | (run, log_name, log_type) | return output | Find a log value.
There are two options here. Either the log is a scalar or a vector. In the case of a scalar there is not much
left to do. In the case of a vector we select the first element whose time_stamp is after the start time of the run
:param run: a Run object.
:param log_name: the name of the ... | Find a log value. | [
"Find",
"a",
"log",
"value",
"."
] | def get_log_value(run, log_name, log_type):
"""
Find a log value.
There are two options here. Either the log is a scalar or a vector. In the case of a scalar there is not much
left to do. In the case of a vector we select the first element whose time_stamp is after the start time of the run
:param ... | [
"def",
"get_log_value",
"(",
"run",
",",
"log_name",
",",
"log_type",
")",
":",
"try",
":",
"# Scalar case",
"output",
"=",
"log_type",
"(",
"run",
".",
"getLogData",
"(",
"log_name",
")",
".",
"value",
")",
"except",
"TypeError",
":",
"# We must be dealing ... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/SANS/sans/common/general_functions.py#L38-L79 | |
gem5/gem5 | 141cc37c2d4b93959d4c249b8f7e6a8b2ef75338 | util/update_copyright/__init__.py | python | _update_copyright_years | (m, cur_year, org_bytes) | return b' Copyright (c) %b %b\n' % (new_years_string, org_bytes) | Does e.g.: b'2016, 2018-2019' -> b'2016, 2018-2020'.
:param m: match containing only the years part of the string
:type m: re.Match
:param cur_year: the current year to update the copyright to
:type cur_year: int
:return: the new years part of the string
:rtype: bytes | Does e.g.: b'2016, 2018-2019' -> b'2016, 2018-2020'. | [
"Does",
"e",
".",
"g",
".",
":",
"b",
"2016",
"2018",
"-",
"2019",
"-",
">",
"b",
"2016",
"2018",
"-",
"2020",
"."
] | def _update_copyright_years(m, cur_year, org_bytes):
'''
Does e.g.: b'2016, 2018-2019' -> b'2016, 2018-2020'.
:param m: match containing only the years part of the string
:type m: re.Match
:param cur_year: the current year to update the copyright to
:type cur_year: int
:return: the new year... | [
"def",
"_update_copyright_years",
"(",
"m",
",",
"cur_year",
",",
"org_bytes",
")",
":",
"global",
"_update_copyright_year_regexp",
"cur_year_bytes",
"=",
"str",
"(",
"cur_year",
")",
".",
"encode",
"(",
")",
"m",
"=",
"_update_copyright_year_regexp",
".",
"match"... | https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/util/update_copyright/__init__.py#L49-L76 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/share/gdb/python/gdb/command/pretty_printers.py | python | register_pretty_printer_commands | () | Call from a top level script to install the pretty-printer commands. | Call from a top level script to install the pretty-printer commands. | [
"Call",
"from",
"a",
"top",
"level",
"script",
"to",
"install",
"the",
"pretty",
"-",
"printer",
"commands",
"."
] | def register_pretty_printer_commands():
"""Call from a top level script to install the pretty-printer commands."""
InfoPrettyPrinter()
EnablePrettyPrinter()
DisablePrettyPrinter() | [
"def",
"register_pretty_printer_commands",
"(",
")",
":",
"InfoPrettyPrinter",
"(",
")",
"EnablePrettyPrinter",
"(",
")",
"DisablePrettyPrinter",
"(",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/share/gdb/python/gdb/command/pretty_printers.py#L362-L366 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/nn/optim/thor.py | python | ThorGpu.get_frequency | (self) | return self.frequency | get thor frequency | get thor frequency | [
"get",
"thor",
"frequency"
] | def get_frequency(self):
"""get thor frequency"""
return self.frequency | [
"def",
"get_frequency",
"(",
"self",
")",
":",
"return",
"self",
".",
"frequency"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/nn/optim/thor.py#L405-L407 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/optimize/_linprog_util.py | python | _postprocess | (x, c, A_ub=None, b_ub=None, A_eq=None, b_eq=None, bounds=None,
complete=False, undo=[], status=0, message="", tol=1e-8,
iteration=None, disp=False) | return x, fun, slack, con, status, message | Given solution x to presolved, standard form linear program x, add
fixed variables back into the problem and undo the variable substitutions
to get solution to original linear program. Also, calculate the objective
function value, slack in original upper bound constraints, and residuals
in original equa... | Given solution x to presolved, standard form linear program x, add
fixed variables back into the problem and undo the variable substitutions
to get solution to original linear program. Also, calculate the objective
function value, slack in original upper bound constraints, and residuals
in original equa... | [
"Given",
"solution",
"x",
"to",
"presolved",
"standard",
"form",
"linear",
"program",
"x",
"add",
"fixed",
"variables",
"back",
"into",
"the",
"problem",
"and",
"undo",
"the",
"variable",
"substitutions",
"to",
"get",
"solution",
"to",
"original",
"linear",
"p... | def _postprocess(x, c, A_ub=None, b_ub=None, A_eq=None, b_eq=None, bounds=None,
complete=False, undo=[], status=0, message="", tol=1e-8,
iteration=None, disp=False):
"""
Given solution x to presolved, standard form linear program x, add
fixed variables back into the problem... | [
"def",
"_postprocess",
"(",
"x",
",",
"c",
",",
"A_ub",
"=",
"None",
",",
"b_ub",
"=",
"None",
",",
"A_eq",
"=",
"None",
",",
"b_eq",
"=",
"None",
",",
"bounds",
"=",
"None",
",",
"complete",
"=",
"False",
",",
"undo",
"=",
"[",
"]",
",",
"stat... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/optimize/_linprog_util.py#L1240-L1328 | |
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/python/mozversioncontrol/mozversioncontrol/__init__.py | python | get_hg_version | (hg) | return LooseVersion(match.group(1)) | Obtain the version of the Mercurial client. | Obtain the version of the Mercurial client. | [
"Obtain",
"the",
"version",
"of",
"the",
"Mercurial",
"client",
"."
] | def get_hg_version(hg):
"""Obtain the version of the Mercurial client."""
env = os.environ.copy()
env[b'HGPLAIN'] = b'1'
info = subprocess.check_output([hg, '--version'], env=env)
match = re.search('version ([^\+\)]+)', info)
if not match:
raise Exception('Unable to identify Mercurial ... | [
"def",
"get_hg_version",
"(",
"hg",
")",
":",
"env",
"=",
"os",
".",
"environ",
".",
"copy",
"(",
")",
"env",
"[",
"b'HGPLAIN'",
"]",
"=",
"b'1'",
"info",
"=",
"subprocess",
".",
"check_output",
"(",
"[",
"hg",
",",
"'--version'",
"]",
",",
"env",
... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/mozversioncontrol/mozversioncontrol/__init__.py#L13-L24 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/onnx/mx2onnx/_op_translations/_op_translations_opset13.py | python | convert_npi_mean | (node, **kwargs) | return nodes, (dtype,) | Map MXNet's mean operator attributes to onnx's ReduceMean operator
and return the created node. | Map MXNet's mean operator attributes to onnx's ReduceMean operator
and return the created node. | [
"Map",
"MXNet",
"s",
"mean",
"operator",
"attributes",
"to",
"onnx",
"s",
"ReduceMean",
"operator",
"and",
"return",
"the",
"created",
"node",
"."
] | def convert_npi_mean(node, **kwargs):
"""Map MXNet's mean operator attributes to onnx's ReduceMean operator
and return the created node.
"""
from onnx.helper import make_node
name, input_nodes, attrs = get_inputs(node, kwargs)
dtype = np.dtype('float32')
dtype_t = onnx.mapping.NP_TYPE_TO_TE... | [
"def",
"convert_npi_mean",
"(",
"node",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"onnx",
".",
"helper",
"import",
"make_node",
"name",
",",
"input_nodes",
",",
"attrs",
"=",
"get_inputs",
"(",
"node",
",",
"kwargs",
")",
"dtype",
"=",
"np",
".",
"dty... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/onnx/mx2onnx/_op_translations/_op_translations_opset13.py#L1864-L1911 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/HFIR_4Circle_Reduction/reduce4circleControl.py | python | CWSCDReductionControl.get_experiment | (self) | return self._expNumber | Get experiment number
:return: | Get experiment number
:return: | [
"Get",
"experiment",
"number",
":",
"return",
":"
] | def get_experiment(self):
"""
Get experiment number
:return:
"""
return self._expNumber | [
"def",
"get_experiment",
"(",
"self",
")",
":",
"return",
"self",
".",
"_expNumber"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/HFIR_4Circle_Reduction/reduce4circleControl.py#L1187-L1192 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/scipy/misc/common.py | python | face | (gray=False) | return face | Get a 1024 x 768, color image of a raccoon face.
raccoon-procyon-lotor.jpg at http://www.public-domain-image.com
Parameters
----------
gray : bool, optional
If True return 8-bit grey-scale image, otherwise return a color image
Returns
-------
face : ndarray
image of a raco... | Get a 1024 x 768, color image of a raccoon face. | [
"Get",
"a",
"1024",
"x",
"768",
"color",
"image",
"of",
"a",
"raccoon",
"face",
"."
] | def face(gray=False):
"""
Get a 1024 x 768, color image of a raccoon face.
raccoon-procyon-lotor.jpg at http://www.public-domain-image.com
Parameters
----------
gray : bool, optional
If True return 8-bit grey-scale image, otherwise return a color image
Returns
-------
face... | [
"def",
"face",
"(",
"gray",
"=",
"False",
")",
":",
"import",
"bz2",
"import",
"os",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
",",
"'face.dat'",
")",
",",
"'rb'",
")",
"as"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/misc/common.py#L377-L419 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_core.py | python | Rect2D.Union | (*args, **kwargs) | return _core_.Rect2D_Union(*args, **kwargs) | Union(self, Rect2D otherRect) | Union(self, Rect2D otherRect) | [
"Union",
"(",
"self",
"Rect2D",
"otherRect",
")"
] | def Union(*args, **kwargs):
"""Union(self, Rect2D otherRect)"""
return _core_.Rect2D_Union(*args, **kwargs) | [
"def",
"Union",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Rect2D_Union",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_core.py#L2014-L2016 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/distributions/python/ops/onehot_categorical.py | python | OneHotCategorical.probs | (self) | return self._probs | Vector of coordinatewise probabilities. | Vector of coordinatewise probabilities. | [
"Vector",
"of",
"coordinatewise",
"probabilities",
"."
] | def probs(self):
"""Vector of coordinatewise probabilities."""
return self._probs | [
"def",
"probs",
"(",
"self",
")",
":",
"return",
"self",
".",
"_probs"
] | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/distributions/python/ops/onehot_categorical.py#L158-L160 | |
OSGeo/gdal | 3748fc4ba4fba727492774b2b908a2130c864a83 | swig/python/osgeo/gdal.py | python | Driver.CopyFiles | (self, *args) | return _gdal.Driver_CopyFiles(self, *args) | r"""CopyFiles(Driver self, char const * newName, char const * oldName) -> CPLErr | r"""CopyFiles(Driver self, char const * newName, char const * oldName) -> CPLErr | [
"r",
"CopyFiles",
"(",
"Driver",
"self",
"char",
"const",
"*",
"newName",
"char",
"const",
"*",
"oldName",
")",
"-",
">",
"CPLErr"
] | def CopyFiles(self, *args):
r"""CopyFiles(Driver self, char const * newName, char const * oldName) -> CPLErr"""
return _gdal.Driver_CopyFiles(self, *args) | [
"def",
"CopyFiles",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_gdal",
".",
"Driver_CopyFiles",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/OSGeo/gdal/blob/3748fc4ba4fba727492774b2b908a2130c864a83/swig/python/osgeo/gdal.py#L1933-L1935 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/html2.py | python | WebView.PreNew | (*args, **kwargs) | return _html2.WebView_PreNew(*args, **kwargs) | PreNew(String backend=wxWebViewBackendDefault) -> WebView | PreNew(String backend=wxWebViewBackendDefault) -> WebView | [
"PreNew",
"(",
"String",
"backend",
"=",
"wxWebViewBackendDefault",
")",
"-",
">",
"WebView"
] | def PreNew(*args, **kwargs):
"""PreNew(String backend=wxWebViewBackendDefault) -> WebView"""
return _html2.WebView_PreNew(*args, **kwargs) | [
"def",
"PreNew",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_html2",
".",
"WebView_PreNew",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/html2.py#L138-L140 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/debug/cli/cli_shared.py | python | get_error_intro | (tf_error) | return out | Generate formatted intro for TensorFlow run-time error.
Args:
tf_error: (errors.OpError) TensorFlow run-time error object.
Returns:
(RichTextLines) Formatted intro message about the run-time OpError, with
sample commands for debugging. | Generate formatted intro for TensorFlow run-time error. | [
"Generate",
"formatted",
"intro",
"for",
"TensorFlow",
"run",
"-",
"time",
"error",
"."
] | def get_error_intro(tf_error):
"""Generate formatted intro for TensorFlow run-time error.
Args:
tf_error: (errors.OpError) TensorFlow run-time error object.
Returns:
(RichTextLines) Formatted intro message about the run-time OpError, with
sample commands for debugging.
"""
op_name = tf_error.... | [
"def",
"get_error_intro",
"(",
"tf_error",
")",
":",
"op_name",
"=",
"tf_error",
".",
"op",
".",
"name",
"intro_lines",
"=",
"[",
"\"--------------------------------------\"",
",",
"RL",
"(",
"\"!!! An error occurred during the run !!!\"",
",",
"\"blink\"",
")",
",",
... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/debug/cli/cli_shared.py#L472-L525 | |
protocolbuffers/protobuf | b5ab0b7a18b7336c60130f4ddb2d97c51792f896 | python/google/protobuf/json_format.py | python | _Parser._ConvertStructMessage | (self, value, message) | return | Convert a JSON representation into Struct message. | Convert a JSON representation into Struct message. | [
"Convert",
"a",
"JSON",
"representation",
"into",
"Struct",
"message",
"."
] | def _ConvertStructMessage(self, value, message):
"""Convert a JSON representation into Struct message."""
if not isinstance(value, dict):
raise ParseError(
'Struct must be in a dict which is {0}.'.format(value))
# Clear will mark the struct as modified so it will be created even if
# the... | [
"def",
"_ConvertStructMessage",
"(",
"self",
",",
"value",
",",
"message",
")",
":",
"if",
"not",
"isinstance",
"(",
"value",
",",
"dict",
")",
":",
"raise",
"ParseError",
"(",
"'Struct must be in a dict which is {0}.'",
".",
"format",
"(",
"value",
")",
")",
... | https://github.com/protocolbuffers/protobuf/blob/b5ab0b7a18b7336c60130f4ddb2d97c51792f896/python/google/protobuf/json_format.py#L657-L667 | |
mapequation/infomap | 5f56b94fe0f956483f61a03ef07e94d8def2205e | interfaces/python/infomap.py | python | Infomap.num_nodes | (self) | return self.network.numNodes() | The number of state nodes if we have a higher order network, or the
number of physical nodes.
See Also
--------
num_physical_nodes
Returns
-------
int
The number of nodes | The number of state nodes if we have a higher order network, or the
number of physical nodes. | [
"The",
"number",
"of",
"state",
"nodes",
"if",
"we",
"have",
"a",
"higher",
"order",
"network",
"or",
"the",
"number",
"of",
"physical",
"nodes",
"."
] | def num_nodes(self):
"""The number of state nodes if we have a higher order network, or the
number of physical nodes.
See Also
--------
num_physical_nodes
Returns
-------
int
The number of nodes
"""
return self.network.numNode... | [
"def",
"num_nodes",
"(",
"self",
")",
":",
"return",
"self",
".",
"network",
".",
"numNodes",
"(",
")"
] | https://github.com/mapequation/infomap/blob/5f56b94fe0f956483f61a03ef07e94d8def2205e/interfaces/python/infomap.py#L2007-L2020 | |
whai362/PSENet | 4d95395658662f2223805c36dcd573d9e190ce26 | models/backbone/resnet.py | python | conv3x3 | (in_planes, out_planes, stride=1) | return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=1, bias=False) | 3x3 convolution with padding | 3x3 convolution with padding | [
"3x3",
"convolution",
"with",
"padding"
] | def conv3x3(in_planes, out_planes, stride=1):
"3x3 convolution with padding"
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=1, bias=False) | [
"def",
"conv3x3",
"(",
"in_planes",
",",
"out_planes",
",",
"stride",
"=",
"1",
")",
":",
"return",
"nn",
".",
"Conv2d",
"(",
"in_planes",
",",
"out_planes",
",",
"kernel_size",
"=",
"3",
",",
"stride",
"=",
"stride",
",",
"padding",
"=",
"1",
",",
"... | https://github.com/whai362/PSENet/blob/4d95395658662f2223805c36dcd573d9e190ce26/models/backbone/resnet.py#L21-L24 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/core/algorithms.py | python | _sort_tuples | (values: np.ndarray) | return values[indexer] | Convert array of tuples (1d) to array or array (2d).
We need to keep the columns separately as they contain different types and
nans (can't use `np.sort` as it may fail when str and nan are mixed in a
column as types cannot be compared). | Convert array of tuples (1d) to array or array (2d).
We need to keep the columns separately as they contain different types and
nans (can't use `np.sort` as it may fail when str and nan are mixed in a
column as types cannot be compared). | [
"Convert",
"array",
"of",
"tuples",
"(",
"1d",
")",
"to",
"array",
"or",
"array",
"(",
"2d",
")",
".",
"We",
"need",
"to",
"keep",
"the",
"columns",
"separately",
"as",
"they",
"contain",
"different",
"types",
"and",
"nans",
"(",
"can",
"t",
"use",
"... | def _sort_tuples(values: np.ndarray) -> np.ndarray:
"""
Convert array of tuples (1d) to array or array (2d).
We need to keep the columns separately as they contain different types and
nans (can't use `np.sort` as it may fail when str and nan are mixed in a
column as types cannot be compared).
""... | [
"def",
"_sort_tuples",
"(",
"values",
":",
"np",
".",
"ndarray",
")",
"->",
"np",
".",
"ndarray",
":",
"from",
"pandas",
".",
"core",
".",
"internals",
".",
"construction",
"import",
"to_arrays",
"from",
"pandas",
".",
"core",
".",
"sorting",
"import",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/algorithms.py#L1865-L1877 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/robotsim.py | python | SimRobotController.setPIDGains | (self, kP, kI, kD) | return _robotsim.SimRobotController_setPIDGains(self, kP, kI, kD) | setPIDGains(SimRobotController self, doubleVector kP, doubleVector kI, doubleVector kD)
Sets the PID gains. Arguments have size model().numDrivers(). | setPIDGains(SimRobotController self, doubleVector kP, doubleVector kI, doubleVector kD) | [
"setPIDGains",
"(",
"SimRobotController",
"self",
"doubleVector",
"kP",
"doubleVector",
"kI",
"doubleVector",
"kD",
")"
] | def setPIDGains(self, kP, kI, kD):
"""
setPIDGains(SimRobotController self, doubleVector kP, doubleVector kI, doubleVector kD)
Sets the PID gains. Arguments have size model().numDrivers().
"""
return _robotsim.SimRobotController_setPIDGains(self, kP, kI, kD) | [
"def",
"setPIDGains",
"(",
"self",
",",
"kP",
",",
"kI",
",",
"kD",
")",
":",
"return",
"_robotsim",
".",
"SimRobotController_setPIDGains",
"(",
"self",
",",
"kP",
",",
"kI",
",",
"kD",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/robotsim.py#L7776-L7785 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/Pygments/py2/pygments/lexer.py | python | RegexLexerMeta._process_new_state | (cls, new_state, unprocessed, processed) | Preprocess the state transition action of a token definition. | Preprocess the state transition action of a token definition. | [
"Preprocess",
"the",
"state",
"transition",
"action",
"of",
"a",
"token",
"definition",
"."
] | def _process_new_state(cls, new_state, unprocessed, processed):
"""Preprocess the state transition action of a token definition."""
if isinstance(new_state, str):
# an existing state
if new_state == '#pop':
return -1
elif new_state in unprocessed:
... | [
"def",
"_process_new_state",
"(",
"cls",
",",
"new_state",
",",
"unprocessed",
",",
"processed",
")",
":",
"if",
"isinstance",
"(",
"new_state",
",",
"str",
")",
":",
"# an existing state",
"if",
"new_state",
"==",
"'#pop'",
":",
"return",
"-",
"1",
"elif",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/Pygments/py2/pygments/lexer.py#L435-L468 | ||
xournalpp/xournalpp | 27acdbb1d9217f21fb40c33ee52f40ca51d296d9 | scripts/compare_license.py | python | get_files_containing_copyright_or_license | () | return (lc_files & xpp_files) | Find all files containing either
- copyright
- license
(case insensitive)
Exluding .po files as they create only false positives | Find all files containing either
- copyright
- license
(case insensitive)
Exluding .po files as they create only false positives | [
"Find",
"all",
"files",
"containing",
"either",
"-",
"copyright",
"-",
"license",
"(",
"case",
"insensitive",
")",
"Exluding",
".",
"po",
"files",
"as",
"they",
"create",
"only",
"false",
"positives"
] | def get_files_containing_copyright_or_license():
"""Find all files containing either
- copyright
- license
(case insensitive)
Exluding .po files as they create only false positives
"""
stdout = os.popen('rg -i -e "copyright" -e "license" -l | rg -v "\.po"').readlines()
files = [f.strip... | [
"def",
"get_files_containing_copyright_or_license",
"(",
")",
":",
"stdout",
"=",
"os",
".",
"popen",
"(",
"'rg -i -e \"copyright\" -e \"license\" -l | rg -v \"\\.po\"'",
")",
".",
"readlines",
"(",
")",
"files",
"=",
"[",
"f",
".",
"strip",
"(",
")",
"for",
"f",
... | https://github.com/xournalpp/xournalpp/blob/27acdbb1d9217f21fb40c33ee52f40ca51d296d9/scripts/compare_license.py#L52-L66 | |
h2oai/deepwater | 80e345c582e6ef912a31f42707a2f31c01b064da | docs/sphinxext/apigen.py | python | ApiDocWriter.write_index | (self, outdir, froot='gen', relative_to=None) | Make a reST API index file from written files
Parameters
----------
path : string
Filename to write index to
outdir : string
Directory to which to write generated index file
froot : string, optional
root (filename without extension) of filenam... | Make a reST API index file from written files | [
"Make",
"a",
"reST",
"API",
"index",
"file",
"from",
"written",
"files"
] | def write_index(self, outdir, froot='gen', relative_to=None):
"""Make a reST API index file from written files
Parameters
----------
path : string
Filename to write index to
outdir : string
Directory to which to write generated index file
froot : ... | [
"def",
"write_index",
"(",
"self",
",",
"outdir",
",",
"froot",
"=",
"'gen'",
",",
"relative_to",
"=",
"None",
")",
":",
"if",
"self",
".",
"written_modules",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'No modules written'",
")",
"# Get full filename path... | https://github.com/h2oai/deepwater/blob/80e345c582e6ef912a31f42707a2f31c01b064da/docs/sphinxext/apigen.py#L394-L427 | ||
deepmind/open_spiel | 4ca53bea32bb2875c7385d215424048ae92f78c8 | open_spiel/python/algorithms/psro_v2/utils.py | python | get_alpharank_marginals | (payoff_tables, pi) | Returns marginal strategy rankings for each player given joint rankings pi.
Args:
payoff_tables: List of meta-game payoff tables for a K-player game, where
each table has dim [n_strategies_player_1 x ... x n_strategies_player_K].
These payoff tables may be asymmetric.
pi: The vector of joint rank... | Returns marginal strategy rankings for each player given joint rankings pi. | [
"Returns",
"marginal",
"strategy",
"rankings",
"for",
"each",
"player",
"given",
"joint",
"rankings",
"pi",
"."
] | def get_alpharank_marginals(payoff_tables, pi):
"""Returns marginal strategy rankings for each player given joint rankings pi.
Args:
payoff_tables: List of meta-game payoff tables for a K-player game, where
each table has dim [n_strategies_player_1 x ... x n_strategies_player_K].
These payoff table... | [
"def",
"get_alpharank_marginals",
"(",
"payoff_tables",
",",
"pi",
")",
":",
"num_populations",
"=",
"len",
"(",
"payoff_tables",
")",
"if",
"num_populations",
"==",
"1",
":",
"return",
"pi",
"else",
":",
"num_strats_per_population",
"=",
"alpharank_utils",
".",
... | https://github.com/deepmind/open_spiel/blob/4ca53bea32bb2875c7385d215424048ae92f78c8/open_spiel/python/algorithms/psro_v2/utils.py#L161-L192 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/data/ops/readers.py | python | _FixedLengthRecordDataset.__init__ | (self,
filenames,
record_bytes,
header_bytes=None,
footer_bytes=None,
buffer_size=None,
compression_type=None) | Creates a `FixedLengthRecordDataset`.
Args:
filenames: A `tf.string` tensor containing one or more filenames.
record_bytes: A `tf.int64` scalar representing the number of bytes in
each record.
header_bytes: (Optional.) A `tf.int64` scalar representing the number of
bytes to skip a... | Creates a `FixedLengthRecordDataset`. | [
"Creates",
"a",
"FixedLengthRecordDataset",
"."
] | def __init__(self,
filenames,
record_bytes,
header_bytes=None,
footer_bytes=None,
buffer_size=None,
compression_type=None):
"""Creates a `FixedLengthRecordDataset`.
Args:
filenames: A `tf.string` tensor containing o... | [
"def",
"__init__",
"(",
"self",
",",
"filenames",
",",
"record_bytes",
",",
"header_bytes",
"=",
"None",
",",
"footer_bytes",
"=",
"None",
",",
"buffer_size",
"=",
"None",
",",
"compression_type",
"=",
"None",
")",
":",
"self",
".",
"_filenames",
"=",
"fil... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/data/ops/readers.py#L364-L403 | ||
dmlc/xgboost | 2775c2a1abd4b5b759ff517617434c8b9aeb4cc0 | demo/guide-python/custom_rmsle.py | python | native_rmse | (dtrain: xgb.DMatrix,
dtest: xgb.DMatrix) | return results | Train using native implementation of Root Mean Squared Loss. | Train using native implementation of Root Mean Squared Loss. | [
"Train",
"using",
"native",
"implementation",
"of",
"Root",
"Mean",
"Squared",
"Loss",
"."
] | def native_rmse(dtrain: xgb.DMatrix,
dtest: xgb.DMatrix) -> Dict[str, Dict[str, List[float]]]:
'''Train using native implementation of Root Mean Squared Loss.'''
print('Squared Error')
squared_error = {
'objective': 'reg:squarederror',
'eval_metric': 'rmse',
'tree_met... | [
"def",
"native_rmse",
"(",
"dtrain",
":",
"xgb",
".",
"DMatrix",
",",
"dtest",
":",
"xgb",
".",
"DMatrix",
")",
"->",
"Dict",
"[",
"str",
",",
"Dict",
"[",
"str",
",",
"List",
"[",
"float",
"]",
"]",
"]",
":",
"print",
"(",
"'Squared Error'",
")",
... | https://github.com/dmlc/xgboost/blob/2775c2a1abd4b5b759ff517617434c8b9aeb4cc0/demo/guide-python/custom_rmsle.py#L66-L84 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/results_tab_widget/results_tab_view.py | python | ResultsTabView.show_warning | (self, msg) | Display a warning on that something went wrong
:param msg: The message to include | Display a warning on that something went wrong
:param msg: The message to include | [
"Display",
"a",
"warning",
"on",
"that",
"something",
"went",
"wrong",
":",
"param",
"msg",
":",
"The",
"message",
"to",
"include"
] | def show_warning(self, msg):
"""
Display a warning on that something went wrong
:param msg: The message to include
"""
warning(msg, self) | [
"def",
"show_warning",
"(",
"self",
",",
"msg",
")",
":",
"warning",
"(",
"msg",
",",
"self",
")"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/results_tab_widget/results_tab_view.py#L131-L136 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/losses/python/losses/loss_ops.py | python | _safe_div | (numerator, denominator, name="value") | return array_ops.where(
math_ops.greater(denominator, 0),
math_ops.div(numerator, array_ops.where(
math_ops.equal(denominator, 0),
array_ops.ones_like(denominator), denominator)),
array_ops.zeros_like(numerator),
name=name) | Computes a safe divide which returns 0 if the denominator is zero.
Note that the function contains an additional conditional check that is
necessary for avoiding situations where the loss is zero causing NaNs to
creep into the gradient computation.
Args:
numerator: An arbitrary `Tensor`.
denominator: ... | Computes a safe divide which returns 0 if the denominator is zero. | [
"Computes",
"a",
"safe",
"divide",
"which",
"returns",
"0",
"if",
"the",
"denominator",
"is",
"zero",
"."
] | def _safe_div(numerator, denominator, name="value"):
"""Computes a safe divide which returns 0 if the denominator is zero.
Note that the function contains an additional conditional check that is
necessary for avoiding situations where the loss is zero causing NaNs to
creep into the gradient computation.
Arg... | [
"def",
"_safe_div",
"(",
"numerator",
",",
"denominator",
",",
"name",
"=",
"\"value\"",
")",
":",
"return",
"array_ops",
".",
"where",
"(",
"math_ops",
".",
"greater",
"(",
"denominator",
",",
"0",
")",
",",
"math_ops",
".",
"div",
"(",
"numerator",
","... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/losses/python/losses/loss_ops.py#L74-L96 | |
glotzerlab/hoomd-blue | f7f97abfa3fcc2522fa8d458d65d0aeca7ba781a | hoomd/wall.py | python | Plane.to_dict | (self) | return {"origin": self.origin, "normal": self.axis, "open": self.open} | Convert the wall geometry to a dictionary defining the plane.
Returns:
dict: The geometry in a Python dictionary. | Convert the wall geometry to a dictionary defining the plane. | [
"Convert",
"the",
"wall",
"geometry",
"to",
"a",
"dictionary",
"defining",
"the",
"plane",
"."
] | def to_dict(self):
"""Convert the wall geometry to a dictionary defining the plane.
Returns:
dict: The geometry in a Python dictionary.
"""
return {"origin": self.origin, "normal": self.axis, "open": self.open} | [
"def",
"to_dict",
"(",
"self",
")",
":",
"return",
"{",
"\"origin\"",
":",
"self",
".",
"origin",
",",
"\"normal\"",
":",
"self",
".",
"axis",
",",
"\"open\"",
":",
"self",
".",
"open",
"}"
] | https://github.com/glotzerlab/hoomd-blue/blob/f7f97abfa3fcc2522fa8d458d65d0aeca7ba781a/hoomd/wall.py#L287-L293 | |
francinexue/xuefu | b6ff79747a42e020588c0c0a921048e08fe4680c | ctpx/ctp3/ctptd.py | python | CtpTd.onRspQryCFMMCTradingAccountKey | (self, CFMMCTradingAccountKeyField, RspInfoField, requestId, final) | 查询保证金监管系统经纪公司资金账户密钥响应 | 查询保证金监管系统经纪公司资金账户密钥响应 | [
"查询保证金监管系统经纪公司资金账户密钥响应"
] | def onRspQryCFMMCTradingAccountKey(self, CFMMCTradingAccountKeyField, RspInfoField, requestId, final):
"""查询保证金监管系统经纪公司资金账户密钥响应"""
pass | [
"def",
"onRspQryCFMMCTradingAccountKey",
"(",
"self",
",",
"CFMMCTradingAccountKeyField",
",",
"RspInfoField",
",",
"requestId",
",",
"final",
")",
":",
"pass"
] | https://github.com/francinexue/xuefu/blob/b6ff79747a42e020588c0c0a921048e08fe4680c/ctpx/ctp3/ctptd.py#L262-L264 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/client/timeline.py | python | Timeline._emit_tensor_snapshot | (self, tensor, timestamp, pid, tid, value) | Generate Chrome Trace snapshot event for a computed Tensor.
Args:
tensor: A 'TensorTracker' object.
timestamp: The timestamp of this snapshot as a long integer.
pid: The pid assigned for showing the device where this op ran.
tid: The tid of the thread computing the tensor snapshot.
v... | Generate Chrome Trace snapshot event for a computed Tensor. | [
"Generate",
"Chrome",
"Trace",
"snapshot",
"event",
"for",
"a",
"computed",
"Tensor",
"."
] | def _emit_tensor_snapshot(self, tensor, timestamp, pid, tid, value):
"""Generate Chrome Trace snapshot event for a computed Tensor.
Args:
tensor: A 'TensorTracker' object.
timestamp: The timestamp of this snapshot as a long integer.
pid: The pid assigned for showing the device where this op ... | [
"def",
"_emit_tensor_snapshot",
"(",
"self",
",",
"tensor",
",",
"timestamp",
",",
"pid",
",",
"tid",
",",
"value",
")",
":",
"desc",
"=",
"str",
"(",
"value",
".",
"tensor_description",
")",
".",
"replace",
"(",
"'\"'",
",",
"''",
")",
"snapshot",
"="... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/client/timeline.py#L443-L456 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/asyncio/tasks.py | python | gather | (*coros_or_futures, loop=None, return_exceptions=False) | return outer | Return a future aggregating results from the given coroutines/futures.
Coroutines will be wrapped in a future and scheduled in the event
loop. They will not necessarily be scheduled in the same order as
passed in.
All futures must share the same event loop. If all the tasks are
done successfully,... | Return a future aggregating results from the given coroutines/futures. | [
"Return",
"a",
"future",
"aggregating",
"results",
"from",
"the",
"given",
"coroutines",
"/",
"futures",
"."
] | def gather(*coros_or_futures, loop=None, return_exceptions=False):
"""Return a future aggregating results from the given coroutines/futures.
Coroutines will be wrapped in a future and scheduled in the event
loop. They will not necessarily be scheduled in the same order as
passed in.
All futures mu... | [
"def",
"gather",
"(",
"*",
"coros_or_futures",
",",
"loop",
"=",
"None",
",",
"return_exceptions",
"=",
"False",
")",
":",
"if",
"not",
"coros_or_futures",
":",
"if",
"loop",
"is",
"None",
":",
"loop",
"=",
"events",
".",
"get_event_loop",
"(",
")",
"out... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/asyncio/tasks.py#L661-L767 | |
baidu/bigflow | 449245016c0df7d1252e85581e588bfc60cefad3 | bigflow_python/python/bigflow/core/entity.py | python | BucketPartitioner.get_entity_name | (self) | return "BucketPartitioner" | inner functor | inner functor | [
"inner",
"functor"
] | def get_entity_name(self):
""" inner functor """
return "BucketPartitioner" | [
"def",
"get_entity_name",
"(",
"self",
")",
":",
"return",
"\"BucketPartitioner\""
] | https://github.com/baidu/bigflow/blob/449245016c0df7d1252e85581e588bfc60cefad3/bigflow_python/python/bigflow/core/entity.py#L317-L319 | |
koth/kcws | 88efbd36a7022de4e6e90f5a1fb880cf87cfae9f | third_party/python/cpplint/cpplint.py | python | CheckForHeaderGuard | (filename, clean_lines, error) | Checks that the file contains a header guard.
Logs an error if no #ifndef header guard is present. For other
headers, checks that the full pathname is used.
Args:
filename: The name of the C++ header file.
clean_lines: A CleansedLines instance containing the file.
error: The function to call with a... | Checks that the file contains a header guard. | [
"Checks",
"that",
"the",
"file",
"contains",
"a",
"header",
"guard",
"."
] | def CheckForHeaderGuard(filename, clean_lines, error):
"""Checks that the file contains a header guard.
Logs an error if no #ifndef header guard is present. For other
headers, checks that the full pathname is used.
Args:
filename: The name of the C++ header file.
clean_lines: A CleansedLines instance... | [
"def",
"CheckForHeaderGuard",
"(",
"filename",
",",
"clean_lines",
",",
"error",
")",
":",
"# Don't check for header guards if there are error suppression",
"# comments somewhere in this file.",
"#",
"# Because this is silencing a warning for a nonexistent line, we",
"# only support the ... | https://github.com/koth/kcws/blob/88efbd36a7022de4e6e90f5a1fb880cf87cfae9f/third_party/python/cpplint/cpplint.py#L1678-L1773 | ||
SpaceNetChallenge/BuildingDetectors | 3def3c44b5847c744cd2f3356182892d92496579 | qinhaifang/src/caffe-mnc/tools/extra/parse_log.py | python | write_csv | (output_filename, dict_list, delimiter, verbose=False) | Write a CSV file | Write a CSV file | [
"Write",
"a",
"CSV",
"file"
] | def write_csv(output_filename, dict_list, delimiter, verbose=False):
"""Write a CSV file
"""
dialect = csv.excel
dialect.delimiter = delimiter
with open(output_filename, 'w') as f:
dict_writer = csv.DictWriter(f, fieldnames=dict_list[0].keys(),
dialect=... | [
"def",
"write_csv",
"(",
"output_filename",
",",
"dict_list",
",",
"delimiter",
",",
"verbose",
"=",
"False",
")",
":",
"dialect",
"=",
"csv",
".",
"excel",
"dialect",
".",
"delimiter",
"=",
"delimiter",
"with",
"open",
"(",
"output_filename",
",",
"'w'",
... | https://github.com/SpaceNetChallenge/BuildingDetectors/blob/3def3c44b5847c744cd2f3356182892d92496579/qinhaifang/src/caffe-mnc/tools/extra/parse_log.py#L148-L161 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/core/shape_base.py | python | block | (arrays) | Assemble an nd-array from nested lists of blocks.
Blocks in the innermost lists are concatenated (see `concatenate`) along
the last dimension (-1), then these are concatenated along the
second-last dimension (-2), and so on until the outermost list is reached.
Blocks can be of any dimension, but will ... | Assemble an nd-array from nested lists of blocks. | [
"Assemble",
"an",
"nd",
"-",
"array",
"from",
"nested",
"lists",
"of",
"blocks",
"."
] | def block(arrays):
"""
Assemble an nd-array from nested lists of blocks.
Blocks in the innermost lists are concatenated (see `concatenate`) along
the last dimension (-1), then these are concatenated along the
second-last dimension (-2), and so on until the outermost list is reached.
Blocks can... | [
"def",
"block",
"(",
"arrays",
")",
":",
"arrays",
",",
"list_ndim",
",",
"result_ndim",
",",
"final_size",
"=",
"_block_setup",
"(",
"arrays",
")",
"# It was found through benchmarking that making an array of final size",
"# around 256x256 was faster by straight concatenation ... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/core/shape_base.py#L688-L855 | ||
hpi-xnor/BMXNet | ed0b201da6667887222b8e4b5f997c4f6b61943d | example/image-classification/common/fit.py | python | add_fit_args | (parser) | return train | parser : argparse.ArgumentParser
return a parser added with args required by fit | parser : argparse.ArgumentParser
return a parser added with args required by fit | [
"parser",
":",
"argparse",
".",
"ArgumentParser",
"return",
"a",
"parser",
"added",
"with",
"args",
"required",
"by",
"fit"
] | def add_fit_args(parser):
"""
parser : argparse.ArgumentParser
return a parser added with args required by fit
"""
train = parser.add_argument_group('Training', 'model training')
train.add_argument('--network', type=str,
help='the neural network to use')
train.add_argu... | [
"def",
"add_fit_args",
"(",
"parser",
")",
":",
"train",
"=",
"parser",
".",
"add_argument_group",
"(",
"'Training'",
",",
"'model training'",
")",
"train",
".",
"add_argument",
"(",
"'--network'",
",",
"type",
"=",
"str",
",",
"help",
"=",
"'the neural networ... | https://github.com/hpi-xnor/BMXNet/blob/ed0b201da6667887222b8e4b5f997c4f6b61943d/example/image-classification/common/fit.py#L62-L111 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/perf/page_sets/pregenerated_profile_shared_state.py | python | PregeneratedProfileSharedState._ShouldDownloadPregeneratedProfileArchive | (self) | return True | Whether to download a pre-generated profile archive. | Whether to download a pre-generated profile archive. | [
"Whether",
"to",
"download",
"a",
"pre",
"-",
"generated",
"profile",
"archive",
"."
] | def _ShouldDownloadPregeneratedProfileArchive(self):
"""Whether to download a pre-generated profile archive."""
if not self._pregenerated_profile_archive_dir:
return False
if self._finder_options.browser_options.profile_dir:
logging.warning("Profile directory specified on command line: %s, this... | [
"def",
"_ShouldDownloadPregeneratedProfileArchive",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_pregenerated_profile_archive_dir",
":",
"return",
"False",
"if",
"self",
".",
"_finder_options",
".",
"browser_options",
".",
"profile_dir",
":",
"logging",
".",
"... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/perf/page_sets/pregenerated_profile_shared_state.py#L41-L55 | |
eclipse/sumo | 7132a9b8b6eea734bdec38479026b4d8c4336d03 | tools/traci/_trafficlight.py | python | TrafficLightDomain.getPhase | (self, tlsID) | return self._getUniversal(tc.TL_CURRENT_PHASE, tlsID) | getPhase(string) -> integer
Returns the index of the current phase within the list of all phases of
the current program. | getPhase(string) -> integer | [
"getPhase",
"(",
"string",
")",
"-",
">",
"integer"
] | def getPhase(self, tlsID):
"""getPhase(string) -> integer
Returns the index of the current phase within the list of all phases of
the current program.
"""
return self._getUniversal(tc.TL_CURRENT_PHASE, tlsID) | [
"def",
"getPhase",
"(",
"self",
",",
"tlsID",
")",
":",
"return",
"self",
".",
"_getUniversal",
"(",
"tc",
".",
"TL_CURRENT_PHASE",
",",
"tlsID",
")"
] | https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/traci/_trafficlight.py#L207-L213 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/asyncio/events.py | python | AbstractEventLoop.run_forever | (self) | Run the event loop until stop() is called. | Run the event loop until stop() is called. | [
"Run",
"the",
"event",
"loop",
"until",
"stop",
"()",
"is",
"called",
"."
] | def run_forever(self):
"""Run the event loop until stop() is called."""
raise NotImplementedError | [
"def",
"run_forever",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/asyncio/events.py#L209-L211 | ||
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | example/capsnet/capsulenet.py | python | MNISTCustomIter.set_is_train | (self, is_train) | Set training flag | Set training flag | [
"Set",
"training",
"flag"
] | def set_is_train(self, is_train):
"""Set training flag"""
self.is_train = is_train | [
"def",
"set_is_train",
"(",
"self",
",",
"is_train",
")",
":",
"self",
".",
"is_train",
"=",
"is_train"
] | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/example/capsnet/capsulenet.py#L300-L302 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/PIL/ImageFont.py | python | FreeTypeFont.get_variation_axes | (self) | return axes | :returns: A list of the axes in a variation font.
:exception IOError: If the font is not a variation font. | :returns: A list of the axes in a variation font.
:exception IOError: If the font is not a variation font. | [
":",
"returns",
":",
"A",
"list",
"of",
"the",
"axes",
"in",
"a",
"variation",
"font",
".",
":",
"exception",
"IOError",
":",
"If",
"the",
"font",
"is",
"not",
"a",
"variation",
"font",
"."
] | def get_variation_axes(self):
"""
:returns: A list of the axes in a variation font.
:exception IOError: If the font is not a variation font.
"""
try:
axes = self.font.getvaraxes()
except AttributeError:
raise NotImplementedError("FreeType 2.9.1 or ... | [
"def",
"get_variation_axes",
"(",
"self",
")",
":",
"try",
":",
"axes",
"=",
"self",
".",
"font",
".",
"getvaraxes",
"(",
")",
"except",
"AttributeError",
":",
"raise",
"NotImplementedError",
"(",
"\"FreeType 2.9.1 or greater is required\"",
")",
"for",
"axis",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/PIL/ImageFont.py#L529-L540 | |
vtraag/leidenalg | b53366829360e10922a2dbf57eb405a516c23bc9 | setup.py | python | BuildConfiguration.build_ext | (self) | return custom_build_ext | Returns a class that can be used as a replacement for the
``build_ext`` command in ``setuptools`` and that will compile the C core
of igraph before compiling the Python extension. | Returns a class that can be used as a replacement for the
``build_ext`` command in ``setuptools`` and that will compile the C core
of igraph before compiling the Python extension. | [
"Returns",
"a",
"class",
"that",
"can",
"be",
"used",
"as",
"a",
"replacement",
"for",
"the",
"build_ext",
"command",
"in",
"setuptools",
"and",
"that",
"will",
"compile",
"the",
"C",
"core",
"of",
"igraph",
"before",
"compiling",
"the",
"Python",
"extension... | def build_ext(self):
"""Returns a class that can be used as a replacement for the
``build_ext`` command in ``setuptools`` and that will compile the C core
of igraph before compiling the Python extension.
"""
from setuptools.command.build_ext import build_ext
from distutil... | [
"def",
"build_ext",
"(",
"self",
")",
":",
"from",
"setuptools",
".",
"command",
".",
"build_ext",
"import",
"build_ext",
"from",
"distutils",
".",
"sysconfig",
"import",
"get_python_inc",
"buildcfg",
"=",
"self",
"class",
"custom_build_ext",
"(",
"build_ext",
"... | https://github.com/vtraag/leidenalg/blob/b53366829360e10922a2dbf57eb405a516c23bc9/setup.py#L345-L443 | |
ucbrise/confluo | 578883a4f7fbbb4aea78c342d366f5122ef598f7 | pyclient/confluo/rpc/rpc_service.py | python | Client.load_atomic_multilog | (self, name) | return self.recv_load_atomic_multilog() | Parameters:
- name | Parameters:
- name | [
"Parameters",
":",
"-",
"name"
] | def load_atomic_multilog(self, name):
"""
Parameters:
- name
"""
self.send_load_atomic_multilog(name)
return self.recv_load_atomic_multilog() | [
"def",
"load_atomic_multilog",
"(",
"self",
",",
"name",
")",
":",
"self",
".",
"send_load_atomic_multilog",
"(",
"name",
")",
"return",
"self",
".",
"recv_load_atomic_multilog",
"(",
")"
] | https://github.com/ucbrise/confluo/blob/578883a4f7fbbb4aea78c342d366f5122ef598f7/pyclient/confluo/rpc/rpc_service.py#L375-L382 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/idlelib/debugger_r.py | python | start_remote_debugger | (rpcclt, pyshell) | return gui | Start the subprocess debugger, initialize the debugger GUI and RPC link
Request the RPCServer start the Python subprocess debugger and link. Set
up the Idle side of the split debugger by instantiating the IdbProxy,
debugger GUI, and debugger GUIAdapter objects and linking them together.
Register the ... | Start the subprocess debugger, initialize the debugger GUI and RPC link | [
"Start",
"the",
"subprocess",
"debugger",
"initialize",
"the",
"debugger",
"GUI",
"and",
"RPC",
"link"
] | def start_remote_debugger(rpcclt, pyshell):
"""Start the subprocess debugger, initialize the debugger GUI and RPC link
Request the RPCServer start the Python subprocess debugger and link. Set
up the Idle side of the split debugger by instantiating the IdbProxy,
debugger GUI, and debugger GUIAdapter ob... | [
"def",
"start_remote_debugger",
"(",
"rpcclt",
",",
"pyshell",
")",
":",
"global",
"idb_adap_oid",
"idb_adap_oid",
"=",
"rpcclt",
".",
"remotecall",
"(",
"\"exec\"",
",",
"\"start_the_debugger\"",
",",
"(",
"gui_adap_oid",
",",
")",
",",
"{",
"}",
")",
"idb_pr... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/idlelib/debugger_r.py#L346-L368 | |
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | scripts/Python/static-binding/lldb.py | python | SBTarget.IsValid | (self) | return _lldb.SBTarget_IsValid(self) | IsValid(SBTarget self) -> bool | IsValid(SBTarget self) -> bool | [
"IsValid",
"(",
"SBTarget",
"self",
")",
"-",
">",
"bool"
] | def IsValid(self):
"""IsValid(SBTarget self) -> bool"""
return _lldb.SBTarget_IsValid(self) | [
"def",
"IsValid",
"(",
"self",
")",
":",
"return",
"_lldb",
".",
"SBTarget_IsValid",
"(",
"self",
")"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L10290-L10292 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/syntax/_ada.py | python | SyntaxData.GetSyntaxSpec | (self) | return SYNTAX_ITEMS | Syntax Specifications | Syntax Specifications | [
"Syntax",
"Specifications"
] | def GetSyntaxSpec(self):
"""Syntax Specifications"""
return SYNTAX_ITEMS | [
"def",
"GetSyntaxSpec",
"(",
"self",
")",
":",
"return",
"SYNTAX_ITEMS"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/syntax/_ada.py#L72-L74 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/richtext.py | python | RichTextParagraphLayoutBox.SetListStyle | (*args) | return _richtext.RichTextParagraphLayoutBox_SetListStyle(*args) | SetListStyle(self, RichTextRange range, wxRichTextListStyleDefinition def,
int flags=RICHTEXT_SETSTYLE_WITH_UNDO, int startFrom=1,
int specifiedLevel=-1) -> bool
SetListStyle(self, RichTextRange range, String defName, int flags=RICHTEXT_SETSTYLE_WITH_UNDO,
int startFrom=1,... | SetListStyle(self, RichTextRange range, wxRichTextListStyleDefinition def,
int flags=RICHTEXT_SETSTYLE_WITH_UNDO, int startFrom=1,
int specifiedLevel=-1) -> bool
SetListStyle(self, RichTextRange range, String defName, int flags=RICHTEXT_SETSTYLE_WITH_UNDO,
int startFrom=1,... | [
"SetListStyle",
"(",
"self",
"RichTextRange",
"range",
"wxRichTextListStyleDefinition",
"def",
"int",
"flags",
"=",
"RICHTEXT_SETSTYLE_WITH_UNDO",
"int",
"startFrom",
"=",
"1",
"int",
"specifiedLevel",
"=",
"-",
"1",
")",
"-",
">",
"bool",
"SetListStyle",
"(",
"se... | def SetListStyle(*args):
"""
SetListStyle(self, RichTextRange range, wxRichTextListStyleDefinition def,
int flags=RICHTEXT_SETSTYLE_WITH_UNDO, int startFrom=1,
int specifiedLevel=-1) -> bool
SetListStyle(self, RichTextRange range, String defName, int flags=RICHTEXT_SETS... | [
"def",
"SetListStyle",
"(",
"*",
"args",
")",
":",
"return",
"_richtext",
".",
"RichTextParagraphLayoutBox_SetListStyle",
"(",
"*",
"args",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/richtext.py#L1755-L1763 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_internal/utils/misc.py | python | protect_pip_from_modification_on_windows | (modifying_pip) | Protection of pip.exe from modification on Windows
On Windows, any operation modifying pip should be run as:
python -m pip ... | Protection of pip.exe from modification on Windows | [
"Protection",
"of",
"pip",
".",
"exe",
"from",
"modification",
"on",
"Windows"
] | def protect_pip_from_modification_on_windows(modifying_pip):
# type: (bool) -> None
"""Protection of pip.exe from modification on Windows
On Windows, any operation modifying pip should be run as:
python -m pip ...
"""
pip_names = [
"pip.exe",
"pip{}.exe".format(sys.version_i... | [
"def",
"protect_pip_from_modification_on_windows",
"(",
"modifying_pip",
")",
":",
"# type: (bool) -> None",
"pip_names",
"=",
"[",
"\"pip.exe\"",
",",
"\"pip{}.exe\"",
".",
"format",
"(",
"sys",
".",
"version_info",
"[",
"0",
"]",
")",
",",
"\"pip{}.{}.exe\"",
".",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_internal/utils/misc.py#L840-L867 | ||
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/metrics.py | python | CompositeMetric.eval | (self) | return ans | Calculate the results of all metrics sequentially.
Returns:
list: results of all added metrics.
The shape and dtype of each result depend on the definition of its metric. | Calculate the results of all metrics sequentially. | [
"Calculate",
"the",
"results",
"of",
"all",
"metrics",
"sequentially",
"."
] | def eval(self):
"""
Calculate the results of all metrics sequentially.
Returns:
list: results of all added metrics.
The shape and dtype of each result depend on the definition of its metric.
"""
ans = []
for m in self._metrics:
ans.ap... | [
"def",
"eval",
"(",
"self",
")",
":",
"ans",
"=",
"[",
"]",
"for",
"m",
"in",
"self",
".",
"_metrics",
":",
"ans",
".",
"append",
"(",
"m",
".",
"eval",
"(",
")",
")",
"return",
"ans"
] | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/metrics.py#L258-L269 | |
google/iree | 1224bbdbe65b0d1fdf40e7324f60f68beeaf7c76 | build_tools/benchmarks/common/benchmark_definition.py | python | execute_cmd | (args: Sequence[str],
verbose: bool = False,
**kwargs) | return subprocess.run(args, check=True, text=True, **kwargs) | Executes a command and returns the completed process.
A thin wrapper around subprocess.run that sets some useful defaults and
optionally prints out the command being run.
Raises:
CalledProcessError if the command fails. | Executes a command and returns the completed process. | [
"Executes",
"a",
"command",
"and",
"returns",
"the",
"completed",
"process",
"."
] | def execute_cmd(args: Sequence[str],
verbose: bool = False,
**kwargs) -> subprocess.CompletedProcess:
"""Executes a command and returns the completed process.
A thin wrapper around subprocess.run that sets some useful defaults and
optionally prints out the command being run.
Ra... | [
"def",
"execute_cmd",
"(",
"args",
":",
"Sequence",
"[",
"str",
"]",
",",
"verbose",
":",
"bool",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
"->",
"subprocess",
".",
"CompletedProcess",
":",
"if",
"verbose",
":",
"cmd",
"=",
"\" \"",
".",
"join",
"(... | https://github.com/google/iree/blob/1224bbdbe65b0d1fdf40e7324f60f68beeaf7c76/build_tools/benchmarks/common/benchmark_definition.py#L41-L55 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/indexes/interval.py | python | _new_IntervalIndex | (cls, d) | return cls.from_arrays(**d) | This is called upon unpickling, rather than the default which doesn't have
arguments and breaks __new__. | This is called upon unpickling, rather than the default which doesn't have
arguments and breaks __new__. | [
"This",
"is",
"called",
"upon",
"unpickling",
"rather",
"than",
"the",
"default",
"which",
"doesn",
"t",
"have",
"arguments",
"and",
"breaks",
"__new__",
"."
] | def _new_IntervalIndex(cls, d):
"""
This is called upon unpickling, rather than the default which doesn't have
arguments and breaks __new__.
"""
return cls.from_arrays(**d) | [
"def",
"_new_IntervalIndex",
"(",
"cls",
",",
"d",
")",
":",
"return",
"cls",
".",
"from_arrays",
"(",
"*",
"*",
"d",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/indexes/interval.py#L107-L112 | |
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Editor/Python/windows/Lib/site-packages/pip/_vendor/requests/models.py | python | PreparedRequest.prepare_auth | (self, auth, url='') | Prepares the given HTTP auth data. | Prepares the given HTTP auth data. | [
"Prepares",
"the",
"given",
"HTTP",
"auth",
"data",
"."
] | def prepare_auth(self, auth, url=''):
"""Prepares the given HTTP auth data."""
# If no Auth is explicitly provided, extract it from the URL first.
if auth is None:
url_auth = get_auth_from_url(self.url)
auth = url_auth if any(url_auth) else None
if auth:
... | [
"def",
"prepare_auth",
"(",
"self",
",",
"auth",
",",
"url",
"=",
"''",
")",
":",
"# If no Auth is explicitly provided, extract it from the URL first.",
"if",
"auth",
"is",
"None",
":",
"url_auth",
"=",
"get_auth_from_url",
"(",
"self",
".",
"url",
")",
"auth",
... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Editor/Python/windows/Lib/site-packages/pip/_vendor/requests/models.py#L482-L502 | ||
giuspen/cherrytree | 84712f206478fcf9acf30174009ad28c648c6344 | pygtk2/modules/imports.py | python | KeynoteHandler.get_cherrytree_xml | (self, file_descriptor) | return self.dom.toxml() | Returns a CherryTree string Containing the Treepad Nodes | Returns a CherryTree string Containing the Treepad Nodes | [
"Returns",
"a",
"CherryTree",
"string",
"Containing",
"the",
"Treepad",
"Nodes"
] | def get_cherrytree_xml(self, file_descriptor):
"""Returns a CherryTree string Containing the Treepad Nodes"""
self.dom = xml.dom.minidom.Document()
self.nodes_list = [self.dom.createElement(cons.APP_NAME)]
self.dom.appendChild(self.nodes_list[0])
self.curr_attributes = {}
... | [
"def",
"get_cherrytree_xml",
"(",
"self",
",",
"file_descriptor",
")",
":",
"self",
".",
"dom",
"=",
"xml",
".",
"dom",
".",
"minidom",
".",
"Document",
"(",
")",
"self",
".",
"nodes_list",
"=",
"[",
"self",
".",
"dom",
".",
"createElement",
"(",
"cons... | https://github.com/giuspen/cherrytree/blob/84712f206478fcf9acf30174009ad28c648c6344/pygtk2/modules/imports.py#L2054-L2063 | |
trailofbits/llvm-sanitizer-tutorial | d29dfeec7f51fbf234fd0080f28f2b30cd0b6e99 | llvm/utils/collect_and_build_with_pgo.py | python | _run_benchmark | (env, out_dir, include_debug_info) | The 'benchmark' we run to generate profile data. | The 'benchmark' we run to generate profile data. | [
"The",
"benchmark",
"we",
"run",
"to",
"generate",
"profile",
"data",
"."
] | def _run_benchmark(env, out_dir, include_debug_info):
"""The 'benchmark' we run to generate profile data."""
target_dir = env.output_subdir('instrumentation_run')
# `check-llvm` and `check-clang` are cheap ways to increase coverage. The
# former lets us touch on the non-x86 backends a bit if configured... | [
"def",
"_run_benchmark",
"(",
"env",
",",
"out_dir",
",",
"include_debug_info",
")",
":",
"target_dir",
"=",
"env",
".",
"output_subdir",
"(",
"'instrumentation_run'",
")",
"# `check-llvm` and `check-clang` are cheap ways to increase coverage. The",
"# former lets us touch on t... | https://github.com/trailofbits/llvm-sanitizer-tutorial/blob/d29dfeec7f51fbf234fd0080f28f2b30cd0b6e99/llvm/utils/collect_and_build_with_pgo.py#L34-L57 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/xml/etree/ElementTree.py | python | iselement | (element) | return hasattr(element, 'tag') | Return True if *element* appears to be an Element. | Return True if *element* appears to be an Element. | [
"Return",
"True",
"if",
"*",
"element",
"*",
"appears",
"to",
"be",
"an",
"Element",
"."
] | def iselement(element):
"""Return True if *element* appears to be an Element."""
return hasattr(element, 'tag') | [
"def",
"iselement",
"(",
"element",
")",
":",
"return",
"hasattr",
"(",
"element",
",",
"'tag'",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/xml/etree/ElementTree.py#L119-L121 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_core.py | python | Window.GetSizer | (*args, **kwargs) | return _core_.Window_GetSizer(*args, **kwargs) | GetSizer(self) -> Sizer
Return the sizer associated with the window by a previous call to
SetSizer or None if there isn't one. | GetSizer(self) -> Sizer | [
"GetSizer",
"(",
"self",
")",
"-",
">",
"Sizer"
] | def GetSizer(*args, **kwargs):
"""
GetSizer(self) -> Sizer
Return the sizer associated with the window by a previous call to
SetSizer or None if there isn't one.
"""
return _core_.Window_GetSizer(*args, **kwargs) | [
"def",
"GetSizer",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Window_GetSizer",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_core.py#L11520-L11527 | |
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Code/Tools/waf-1.7.13/crywaflib/default_settings.py | python | use_incredibuild | (ctx, section_name, option_name, value) | return value | If Incredibuild should be used, check for required packages | If Incredibuild should be used, check for required packages | [
"If",
"Incredibuild",
"should",
"be",
"used",
"check",
"for",
"required",
"packages"
] | def use_incredibuild(ctx, section_name, option_name, value):
""" If Incredibuild should be used, check for required packages """
(isValid, warning, error) = ATTRIBUTE_VERIFICATION_CALLBACKS['verify_use_incredibuild'](ctx, option_name, value)
if not isValid:
return 'False'
return value | [
"def",
"use_incredibuild",
"(",
"ctx",
",",
"section_name",
",",
"option_name",
",",
"value",
")",
":",
"(",
"isValid",
",",
"warning",
",",
"error",
")",
"=",
"ATTRIBUTE_VERIFICATION_CALLBACKS",
"[",
"'verify_use_incredibuild'",
"]",
"(",
"ctx",
",",
"option_na... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Code/Tools/waf-1.7.13/crywaflib/default_settings.py#L230-L235 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/preprocessing/label.py | python | MultiLabelBinarizer.inverse_transform | (self, yt) | Transform the given indicator matrix into label sets
Parameters
----------
yt : array or sparse matrix of shape (n_samples, n_classes)
A matrix containing only 1s ands 0s.
Returns
-------
y : list of tuples
The set of labels for each sample such ... | Transform the given indicator matrix into label sets | [
"Transform",
"the",
"given",
"indicator",
"matrix",
"into",
"label",
"sets"
] | def inverse_transform(self, yt):
"""Transform the given indicator matrix into label sets
Parameters
----------
yt : array or sparse matrix of shape (n_samples, n_classes)
A matrix containing only 1s ands 0s.
Returns
-------
y : list of tuples
... | [
"def",
"inverse_transform",
"(",
"self",
",",
"yt",
")",
":",
"check_is_fitted",
"(",
"self",
",",
"'classes_'",
")",
"if",
"yt",
".",
"shape",
"[",
"1",
"]",
"!=",
"len",
"(",
"self",
".",
"classes_",
")",
":",
"raise",
"ValueError",
"(",
"'Expected i... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/preprocessing/label.py#L794-L826 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/lib-tk/Tkinter.py | python | XView.xview_moveto | (self, fraction) | Adjusts the view in the window so that FRACTION of the
total width of the canvas is off-screen to the left. | Adjusts the view in the window so that FRACTION of the
total width of the canvas is off-screen to the left. | [
"Adjusts",
"the",
"view",
"in",
"the",
"window",
"so",
"that",
"FRACTION",
"of",
"the",
"total",
"width",
"of",
"the",
"canvas",
"is",
"off",
"-",
"screen",
"to",
"the",
"left",
"."
] | def xview_moveto(self, fraction):
"""Adjusts the view in the window so that FRACTION of the
total width of the canvas is off-screen to the left."""
self.tk.call(self._w, 'xview', 'moveto', fraction) | [
"def",
"xview_moveto",
"(",
"self",
",",
"fraction",
")",
":",
"self",
".",
"tk",
".",
"call",
"(",
"self",
".",
"_w",
",",
"'xview'",
",",
"'moveto'",
",",
"fraction",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/lib-tk/Tkinter.py#L1487-L1490 | ||
Cisco-Talos/moflow | ed71dfb0540d9e0d7a4c72f0881b58958d573728 | BAP-0.7-moflow/libtracewrap/libtrace/protobuf/python/google/protobuf/internal/encoder.py | python | GroupSizer | (field_number, is_repeated, is_packed) | Returns a sizer for a group field. | Returns a sizer for a group field. | [
"Returns",
"a",
"sizer",
"for",
"a",
"group",
"field",
"."
] | def GroupSizer(field_number, is_repeated, is_packed):
"""Returns a sizer for a group field."""
tag_size = _TagSize(field_number) * 2
assert not is_packed
if is_repeated:
def RepeatedFieldSize(value):
result = tag_size * len(value)
for element in value:
result += element.ByteSize()
... | [
"def",
"GroupSizer",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"tag_size",
"=",
"_TagSize",
"(",
"field_number",
")",
"*",
"2",
"assert",
"not",
"is_packed",
"if",
"is_repeated",
":",
"def",
"RepeatedFieldSize",
"(",
"value",
")",
... | https://github.com/Cisco-Talos/moflow/blob/ed71dfb0540d9e0d7a4c72f0881b58958d573728/BAP-0.7-moflow/libtracewrap/libtrace/protobuf/python/google/protobuf/internal/encoder.py#L271-L286 | ||
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TCh.Save | (self, *args) | return _snap.TCh_Save(self, *args) | Save(TCh self, TSOut SOut)
Parameters:
SOut: TSOut & | Save(TCh self, TSOut SOut) | [
"Save",
"(",
"TCh",
"self",
"TSOut",
"SOut",
")"
] | def Save(self, *args):
"""
Save(TCh self, TSOut SOut)
Parameters:
SOut: TSOut &
"""
return _snap.TCh_Save(self, *args) | [
"def",
"Save",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_snap",
".",
"TCh_Save",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L12382-L12390 | |
BitMEX/api-connectors | 37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812 | auto-generated/python/swagger_client/api/trade_api.py | python | TradeApi.trade_get_with_http_info | (self, **kwargs) | return self.api_client.call_api(
'/trade', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='list[Trade]', # noqa: E501
auth_settin... | Get Trades. # noqa: E501
Please note that indices (symbols starting with `.`) post trades at intervals to the trade feed. These have a `size` of 0 and are used only to indicate a changing price. See [the FIX Spec](http://www.onixs.biz/fix-dictionary/5.0.SP2/msgType_AE_6569.html) for explanations of these fie... | Get Trades. # noqa: E501 | [
"Get",
"Trades",
".",
"#",
"noqa",
":",
"E501"
] | def trade_get_with_http_info(self, **kwargs): # noqa: E501
"""Get Trades. # noqa: E501
Please note that indices (symbols starting with `.`) post trades at intervals to the trade feed. These have a `size` of 0 and are used only to indicate a changing price. See [the FIX Spec](http://www.onixs.biz/fix... | [
"def",
"trade_get_with_http_info",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# noqa: E501",
"all_params",
"=",
"[",
"'symbol'",
",",
"'filter'",
",",
"'columns'",
",",
"'count'",
",",
"'start'",
",",
"'reverse'",
",",
"'start_time'",
",",
"'end_time'",
... | https://github.com/BitMEX/api-connectors/blob/37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812/auto-generated/python/swagger_client/api/trade_api.py#L65-L157 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/_collections_abc.py | python | MutableSequence.extend | (self, values) | S.extend(iterable) -- extend sequence by appending elements from the iterable | S.extend(iterable) -- extend sequence by appending elements from the iterable | [
"S",
".",
"extend",
"(",
"iterable",
")",
"--",
"extend",
"sequence",
"by",
"appending",
"elements",
"from",
"the",
"iterable"
] | def extend(self, values):
'S.extend(iterable) -- extend sequence by appending elements from the iterable'
for v in values:
self.append(v) | [
"def",
"extend",
"(",
"self",
",",
"values",
")",
":",
"for",
"v",
"in",
"values",
":",
"self",
".",
"append",
"(",
"v",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/_collections_abc.py#L987-L990 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.