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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/wsgiref/headers.py | python | Headers.add_header | (self, _name, _value, **_params) | Extended header setting.
_name is the header field to add. keyword arguments can be used to set
additional parameters for the header field, with underscores converted
to dashes. Normally the parameter will be added as key="value" unless
value is None, in which case only the key will b... | Extended header setting. | [
"Extended",
"header",
"setting",
"."
] | def add_header(self, _name, _value, **_params):
"""Extended header setting.
_name is the header field to add. keyword arguments can be used to set
additional parameters for the header field, with underscores converted
to dashes. Normally the parameter will be added as key="value" unle... | [
"def",
"add_header",
"(",
"self",
",",
"_name",
",",
"_value",
",",
"*",
"*",
"_params",
")",
":",
"parts",
"=",
"[",
"]",
"if",
"_value",
"is",
"not",
"None",
":",
"parts",
".",
"append",
"(",
"_value",
")",
"for",
"k",
",",
"v",
"in",
"_params"... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/wsgiref/headers.py#L145-L169 | ||
klzgrad/naiveproxy | ed2c513637c77b18721fe428d7ed395b4d284c83 | src/third_party/depot_tools/cpplint.py | python | _CppLintState.SetVerboseLevel | (self, level) | return last_verbose_level | Sets the module's verbosity, and returns the previous setting. | Sets the module's verbosity, and returns the previous setting. | [
"Sets",
"the",
"module",
"s",
"verbosity",
"and",
"returns",
"the",
"previous",
"setting",
"."
] | def SetVerboseLevel(self, level):
"""Sets the module's verbosity, and returns the previous setting."""
last_verbose_level = self.verbose_level
self.verbose_level = level
return last_verbose_level | [
"def",
"SetVerboseLevel",
"(",
"self",
",",
"level",
")",
":",
"last_verbose_level",
"=",
"self",
".",
"verbose_level",
"self",
".",
"verbose_level",
"=",
"level",
"return",
"last_verbose_level"
] | https://github.com/klzgrad/naiveproxy/blob/ed2c513637c77b18721fe428d7ed395b4d284c83/src/third_party/depot_tools/cpplint.py#L849-L853 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/labeled_tensor/python/ops/ops.py | python | tile | (labeled_tensor, multiples, name=None) | Constructs a tensor by tiling a given tensor.
Only axes without tick-labels can be tiled. (Otherwise, axis labels on tiled
tensors would no longer be unique.)
See lt.tile.
Args:
labeled_tensor: The input tensor.
multiples: A mapping where the keys are axis names and the values are the
integer n... | Constructs a tensor by tiling a given tensor. | [
"Constructs",
"a",
"tensor",
"by",
"tiling",
"a",
"given",
"tensor",
"."
] | def tile(labeled_tensor, multiples, name=None):
"""Constructs a tensor by tiling a given tensor.
Only axes without tick-labels can be tiled. (Otherwise, axis labels on tiled
tensors would no longer be unique.)
See lt.tile.
Args:
labeled_tensor: The input tensor.
multiples: A mapping where the keys ... | [
"def",
"tile",
"(",
"labeled_tensor",
",",
"multiples",
",",
"name",
"=",
"None",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"name",
",",
"'lt_tile'",
",",
"[",
"labeled_tensor",
"]",
")",
"as",
"scope",
":",
"labeled_tensor",
"=",
"core",
".",
"... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/labeled_tensor/python/ops/ops.py#L980-L1024 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/urllib3/util/url.py | python | Url.url | (self) | return url | Convert self into a url
This function should more or less round-trip with :func:`.parse_url`. The
returned url may not be exactly the same as the url inputted to
:func:`.parse_url`, but it should be equivalent by the RFC (e.g., urls
with a blank port will have : removed).
Examp... | Convert self into a url | [
"Convert",
"self",
"into",
"a",
"url"
] | def url(self):
"""
Convert self into a url
This function should more or less round-trip with :func:`.parse_url`. The
returned url may not be exactly the same as the url inputted to
:func:`.parse_url`, but it should be equivalent by the RFC (e.g., urls
with a blank port w... | [
"def",
"url",
"(",
"self",
")",
":",
"scheme",
",",
"auth",
",",
"host",
",",
"port",
",",
"path",
",",
"query",
",",
"fragment",
"=",
"self",
"url",
"=",
"u\"\"",
"# We use \"is not None\" we want things to happen with empty strings (or 0 port)",
"if",
"scheme",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/urllib3/util/url.py#L132-L169 | |
timi-liuliang/echo | 40a5a24d430eee4118314459ab7e03afcb3b8719 | thirdparty/protobuf/python/google/protobuf/descriptor.py | python | MakeDescriptor | (desc_proto, package='', build_file_if_cpp=True) | return Descriptor(desc_proto.name, desc_name, None, None, fields,
nested_types.values(), enum_types.values(), []) | Make a protobuf Descriptor given a DescriptorProto protobuf.
Handles nested descriptors. Note that this is limited to the scope of defining
a message inside of another message. Composite fields can currently only be
resolved if the message is defined in the same scope as the field.
Args:
desc_proto: The d... | Make a protobuf Descriptor given a DescriptorProto protobuf. | [
"Make",
"a",
"protobuf",
"Descriptor",
"given",
"a",
"DescriptorProto",
"protobuf",
"."
] | def MakeDescriptor(desc_proto, package='', build_file_if_cpp=True):
"""Make a protobuf Descriptor given a DescriptorProto protobuf.
Handles nested descriptors. Note that this is limited to the scope of defining
a message inside of another message. Composite fields can currently only be
resolved if the message ... | [
"def",
"MakeDescriptor",
"(",
"desc_proto",
",",
"package",
"=",
"''",
",",
"build_file_if_cpp",
"=",
"True",
")",
":",
"if",
"api_implementation",
".",
"Type",
"(",
")",
"==",
"'cpp'",
"and",
"build_file_if_cpp",
":",
"# The C++ implementation requires all descript... | https://github.com/timi-liuliang/echo/blob/40a5a24d430eee4118314459ab7e03afcb3b8719/thirdparty/protobuf/python/google/protobuf/descriptor.py#L757-L849 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/mapreduce/mapreduce/input_readers.py | python | BlobstoreZipLineInputReader.from_json | (cls, json, _reader=blobstore.BlobReader) | return cls(json[cls.BLOB_KEY_PARAM],
json[cls.START_FILE_INDEX_PARAM],
json[cls.END_FILE_INDEX_PARAM],
json[cls.OFFSET_PARAM],
_reader) | Creates an instance of the InputReader for the given input shard state.
Args:
json: The InputReader state as a dict-like object.
_reader: For dependency injection.
Returns:
An instance of the InputReader configured using the values of json. | Creates an instance of the InputReader for the given input shard state. | [
"Creates",
"an",
"instance",
"of",
"the",
"InputReader",
"for",
"the",
"given",
"input",
"shard",
"state",
"."
] | def from_json(cls, json, _reader=blobstore.BlobReader):
"""Creates an instance of the InputReader for the given input shard state.
Args:
json: The InputReader state as a dict-like object.
_reader: For dependency injection.
Returns:
An instance of the InputReader configured using the valu... | [
"def",
"from_json",
"(",
"cls",
",",
"json",
",",
"_reader",
"=",
"blobstore",
".",
"BlobReader",
")",
":",
"return",
"cls",
"(",
"json",
"[",
"cls",
".",
"BLOB_KEY_PARAM",
"]",
",",
"json",
"[",
"cls",
".",
"START_FILE_INDEX_PARAM",
"]",
",",
"json",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/mapreduce/mapreduce/input_readers.py#L1807-L1821 | |
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/resmokelib/powercycle/__init__.py | python | PowercyclePlugin._add_powercycle_commands | (parent_parser) | return run_parser | Add sub-subcommands for powercycle. | Add sub-subcommands for powercycle. | [
"Add",
"sub",
"-",
"subcommands",
"for",
"powercycle",
"."
] | def _add_powercycle_commands(parent_parser):
"""Add sub-subcommands for powercycle."""
sub_parsers = parent_parser.add_subparsers()
setup_parser = sub_parsers.add_parser("setup-host",
help="Step 1. Set up the host for powercycle")
setup_pars... | [
"def",
"_add_powercycle_commands",
"(",
"parent_parser",
")",
":",
"sub_parsers",
"=",
"parent_parser",
".",
"add_subparsers",
"(",
")",
"setup_parser",
"=",
"sub_parsers",
".",
"add_parser",
"(",
"\"setup-host\"",
",",
"help",
"=",
"\"Step 1. Set up the host for powerc... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/resmokelib/powercycle/__init__.py#L79-L104 | |
qt/qtbase | 81b9ee66b8e40ed145185fe46b7c91929688cafd | util/locale_database/cldr.py | python | CldrReader.likelySubTags | (self) | Generator for likely subtag information.
Yields pairs (have, give) of 4-tuples; if what you have
matches the left member, giving the right member is probably
sensible. Each 4-tuple's entries are the full names of a
language, a script, a territory (usually a country) and a
varian... | Generator for likely subtag information. | [
"Generator",
"for",
"likely",
"subtag",
"information",
"."
] | def likelySubTags(self):
"""Generator for likely subtag information.
Yields pairs (have, give) of 4-tuples; if what you have
matches the left member, giving the right member is probably
sensible. Each 4-tuple's entries are the full names of a
language, a script, a territory (usu... | [
"def",
"likelySubTags",
"(",
"self",
")",
":",
"skips",
"=",
"[",
"]",
"for",
"got",
",",
"use",
"in",
"self",
".",
"root",
".",
"likelySubTags",
"(",
")",
":",
"try",
":",
"have",
"=",
"self",
".",
"__parseTags",
"(",
"got",
")",
"give",
"=",
"s... | https://github.com/qt/qtbase/blob/81b9ee66b8e40ed145185fe46b7c91929688cafd/util/locale_database/cldr.py#L65-L100 | ||
trailofbits/llvm-sanitizer-tutorial | d29dfeec7f51fbf234fd0080f28f2b30cd0b6e99 | llvm/projects/compiler-rt/lib/sanitizer_common/scripts/cpplint.py | python | ResetNolintSuppressions | () | Resets the set of NOLINT suppressions to empty. | Resets the set of NOLINT suppressions to empty. | [
"Resets",
"the",
"set",
"of",
"NOLINT",
"suppressions",
"to",
"empty",
"."
] | def ResetNolintSuppressions():
"Resets the set of NOLINT suppressions to empty."
_error_suppressions.clear() | [
"def",
"ResetNolintSuppressions",
"(",
")",
":",
"_error_suppressions",
".",
"clear",
"(",
")"
] | https://github.com/trailofbits/llvm-sanitizer-tutorial/blob/d29dfeec7f51fbf234fd0080f28f2b30cd0b6e99/llvm/projects/compiler-rt/lib/sanitizer_common/scripts/cpplint.py#L389-L391 | ||
cyberbotics/webots | af7fa7d68dcf7b4550f1f2e132092b41e83698fc | projects/default/controllers/sumo_supervisor/SumoDisplay.py | python | SumoDisplay.step | (self, step) | Update the Display image. | Update the Display image. | [
"Update",
"the",
"Display",
"image",
"."
] | def step(self, step):
"""Update the Display image."""
if not pilFound:
return
self.timeCounter += step
if self.timeCounter >= self.refreshRate:
imageFilename = self.directory + '/screeshot_' + str(self.screeshotID) + '.jpg'
self.traci.gui.screenshot(se... | [
"def",
"step",
"(",
"self",
",",
"step",
")",
":",
"if",
"not",
"pilFound",
":",
"return",
"self",
".",
"timeCounter",
"+=",
"step",
"if",
"self",
".",
"timeCounter",
">=",
"self",
".",
"refreshRate",
":",
"imageFilename",
"=",
"self",
".",
"directory",
... | https://github.com/cyberbotics/webots/blob/af7fa7d68dcf7b4550f1f2e132092b41e83698fc/projects/default/controllers/sumo_supervisor/SumoDisplay.py#L50-L78 | ||
nvdla/sw | 79538ba1b52b040a4a4645f630e457fa01839e90 | umd/external/protobuf-2.6/python/google/protobuf/text_format.py | python | PrintFieldValue | (field, value, out, indent=0, as_utf8=False,
as_one_line=False, pointy_brackets=False,
float_format=None) | Print a single field value (not including name). For repeated fields,
the value should be a single element. | Print a single field value (not including name). For repeated fields,
the value should be a single element. | [
"Print",
"a",
"single",
"field",
"value",
"(",
"not",
"including",
"name",
")",
".",
"For",
"repeated",
"fields",
"the",
"value",
"should",
"be",
"a",
"single",
"element",
"."
] | def PrintFieldValue(field, value, out, indent=0, as_utf8=False,
as_one_line=False, pointy_brackets=False,
float_format=None):
"""Print a single field value (not including name). For repeated fields,
the value should be a single element."""
if pointy_brackets:
openb = ... | [
"def",
"PrintFieldValue",
"(",
"field",
",",
"value",
",",
"out",
",",
"indent",
"=",
"0",
",",
"as_utf8",
"=",
"False",
",",
"as_one_line",
"=",
"False",
",",
"pointy_brackets",
"=",
"False",
",",
"float_format",
"=",
"None",
")",
":",
"if",
"pointy_bra... | https://github.com/nvdla/sw/blob/79538ba1b52b040a4a4645f630e457fa01839e90/umd/external/protobuf-2.6/python/google/protobuf/text_format.py#L158-L211 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/py/py/_path/svnwc.py | python | SvnWCCommandPath.dirpath | (self, *args) | return self.__class__(self.localpath.dirpath(*args), auth=self.auth) | return the directory Path of the current Path. | return the directory Path of the current Path. | [
"return",
"the",
"directory",
"Path",
"of",
"the",
"current",
"Path",
"."
] | def dirpath(self, *args):
""" return the directory Path of the current Path. """
return self.__class__(self.localpath.dirpath(*args), auth=self.auth) | [
"def",
"dirpath",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"self",
".",
"__class__",
"(",
"self",
".",
"localpath",
".",
"dirpath",
"(",
"*",
"args",
")",
",",
"auth",
"=",
"self",
".",
"auth",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/py/py/_path/svnwc.py#L529-L531 | |
ptrkrysik/gr-gsm | 2de47e28ce1fb9a518337bfc0add36c8e3cff5eb | docs/doxygen/swig_doc.py | python | make_class_entry | (klass, description=None, ignored_methods=[], params=None) | return "\n\n".join(output) | Create a class docstring for a swig interface file. | Create a class docstring for a swig interface file. | [
"Create",
"a",
"class",
"docstring",
"for",
"a",
"swig",
"interface",
"file",
"."
] | def make_class_entry(klass, description=None, ignored_methods=[], params=None):
"""
Create a class docstring for a swig interface file.
"""
if params is None:
params = klass.params
output = []
output.append(make_entry(klass, description=description, params=params))
for func in klass.... | [
"def",
"make_class_entry",
"(",
"klass",
",",
"description",
"=",
"None",
",",
"ignored_methods",
"=",
"[",
"]",
",",
"params",
"=",
"None",
")",
":",
"if",
"params",
"is",
"None",
":",
"params",
"=",
"klass",
".",
"params",
"output",
"=",
"[",
"]",
... | https://github.com/ptrkrysik/gr-gsm/blob/2de47e28ce1fb9a518337bfc0add36c8e3cff5eb/docs/doxygen/swig_doc.py#L168-L180 | |
fossephate/JoyCon-Driver | 857e4e76e26f05d72400ae5d9f2a22cae88f3548 | joycon-driver/full/wxWidgets-3.0.3/build/bakefiles/wxwin.py | python | headersOnly | (files) | return utils.substitute2(files, callback) | Filters 'files' so that only headers are left. Used with
<msvc-project-files> to add headers to VC++ projects but not files such
as arrimpl.cpp. | Filters 'files' so that only headers are left. Used with
<msvc-project-files> to add headers to VC++ projects but not files such
as arrimpl.cpp. | [
"Filters",
"files",
"so",
"that",
"only",
"headers",
"are",
"left",
".",
"Used",
"with",
"<msvc",
"-",
"project",
"-",
"files",
">",
"to",
"add",
"headers",
"to",
"VC",
"++",
"projects",
"but",
"not",
"files",
"such",
"as",
"arrimpl",
".",
"cpp",
"."
] | def headersOnly(files):
"""Filters 'files' so that only headers are left. Used with
<msvc-project-files> to add headers to VC++ projects but not files such
as arrimpl.cpp."""
def callback(cond, sources):
prf = suf = ''
if sources[0].isspace(): prf=' '
if sources[-1].is... | [
"def",
"headersOnly",
"(",
"files",
")",
":",
"def",
"callback",
"(",
"cond",
",",
"sources",
")",
":",
"prf",
"=",
"suf",
"=",
"''",
"if",
"sources",
"[",
"0",
"]",
".",
"isspace",
"(",
")",
":",
"prf",
"=",
"' '",
"if",
"sources",
"[",
"-",
"... | https://github.com/fossephate/JoyCon-Driver/blob/857e4e76e26f05d72400ae5d9f2a22cae88f3548/joycon-driver/full/wxWidgets-3.0.3/build/bakefiles/wxwin.py#L135-L149 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/pbr/packaging.py | python | _get_revno_and_last_tag | (git_dir) | return "", row_count | Return the commit data about the most recent tag.
We use git-describe to find this out, but if there are no
tags then we fall back to counting commits since the beginning
of time. | Return the commit data about the most recent tag. | [
"Return",
"the",
"commit",
"data",
"about",
"the",
"most",
"recent",
"tag",
"."
] | def _get_revno_and_last_tag(git_dir):
"""Return the commit data about the most recent tag.
We use git-describe to find this out, but if there are no
tags then we fall back to counting commits since the beginning
of time.
"""
changelog = git._iter_log_oneline(git_dir=git_dir)
row_count = 0
... | [
"def",
"_get_revno_and_last_tag",
"(",
"git_dir",
")",
":",
"changelog",
"=",
"git",
".",
"_iter_log_oneline",
"(",
"git_dir",
"=",
"git_dir",
")",
"row_count",
"=",
"0",
"for",
"row_count",
",",
"(",
"ignored",
",",
"tag_set",
",",
"ignored",
")",
"in",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/pbr/packaging.py#L653-L674 | |
jackaudio/jack2 | 21b293dbc37d42446141a08922cdec0d2550c6a0 | waflib/Build.py | python | BuildContext.set_env | (self, val) | Setter for the env property | Setter for the env property | [
"Setter",
"for",
"the",
"env",
"property"
] | def set_env(self, val):
"""Setter for the env property"""
self.all_envs[self.variant] = val | [
"def",
"set_env",
"(",
"self",
",",
"val",
")",
":",
"self",
".",
"all_envs",
"[",
"self",
".",
"variant",
"]",
"=",
"val"
] | https://github.com/jackaudio/jack2/blob/21b293dbc37d42446141a08922cdec0d2550c6a0/waflib/Build.py#L391-L393 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_gdi.py | python | PseudoDC.DrawRoundedRectangle | (*args, **kwargs) | return _gdi_.PseudoDC_DrawRoundedRectangle(*args, **kwargs) | DrawRoundedRectangle(self, int x, int y, int width, int height, double radius)
Draws a rectangle with the given top left corner, and with the given
size. The corners are quarter-circles using the given radius. The
current pen is used for the outline and the current brush for filling
the... | DrawRoundedRectangle(self, int x, int y, int width, int height, double radius) | [
"DrawRoundedRectangle",
"(",
"self",
"int",
"x",
"int",
"y",
"int",
"width",
"int",
"height",
"double",
"radius",
")"
] | def DrawRoundedRectangle(*args, **kwargs):
"""
DrawRoundedRectangle(self, int x, int y, int width, int height, double radius)
Draws a rectangle with the given top left corner, and with the given
size. The corners are quarter-circles using the given radius. The
current pen is use... | [
"def",
"DrawRoundedRectangle",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"PseudoDC_DrawRoundedRectangle",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_gdi.py#L7919-L7935 | |
senlinuc/caffe_ocr | 81642f61ea8f888e360cca30e08e05b7bc6d4556 | examples/pycaffe/layers/pascal_multilabel_datalayers.py | python | print_info | (name, params) | Ouput some info regarding the class | Ouput some info regarding the class | [
"Ouput",
"some",
"info",
"regarding",
"the",
"class"
] | def print_info(name, params):
"""
Ouput some info regarding the class
"""
print "{} initialized for split: {}, with bs: {}, im_shape: {}.".format(
name,
params['split'],
params['batch_size'],
params['im_shape']) | [
"def",
"print_info",
"(",
"name",
",",
"params",
")",
":",
"print",
"\"{} initialized for split: {}, with bs: {}, im_shape: {}.\"",
".",
"format",
"(",
"name",
",",
"params",
"[",
"'split'",
"]",
",",
"params",
"[",
"'batch_size'",
"]",
",",
"params",
"[",
"'im_... | https://github.com/senlinuc/caffe_ocr/blob/81642f61ea8f888e360cca30e08e05b7bc6d4556/examples/pycaffe/layers/pascal_multilabel_datalayers.py#L208-L216 | ||
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/contrib/layers/python/layers/feature_column.py | python | _WeightedSparseColumn.insert_transformed_feature | (self, columns_to_tensors) | Inserts a tuple with the id and weight tensors. | Inserts a tuple with the id and weight tensors. | [
"Inserts",
"a",
"tuple",
"with",
"the",
"id",
"and",
"weight",
"tensors",
"."
] | def insert_transformed_feature(self, columns_to_tensors):
"""Inserts a tuple with the id and weight tensors."""
if self.sparse_id_column not in columns_to_tensors:
self.sparse_id_column.insert_transformed_feature(columns_to_tensors)
columns_to_tensors[self] = tuple([
columns_to_tensors[self.sp... | [
"def",
"insert_transformed_feature",
"(",
"self",
",",
"columns_to_tensors",
")",
":",
"if",
"self",
".",
"sparse_id_column",
"not",
"in",
"columns_to_tensors",
":",
"self",
".",
"sparse_id_column",
".",
"insert_transformed_feature",
"(",
"columns_to_tensors",
")",
"c... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/contrib/layers/python/layers/feature_column.py#L490-L496 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py3/numpy/random/_pickle.py | python | __bit_generator_ctor | (bit_generator_name='MT19937') | return bit_generator() | Pickling helper function that returns a bit generator object
Parameters
----------
bit_generator_name : str
String containing the name of the BitGenerator
Returns
-------
bit_generator: BitGenerator
BitGenerator instance | Pickling helper function that returns a bit generator object | [
"Pickling",
"helper",
"function",
"that",
"returns",
"a",
"bit",
"generator",
"object"
] | def __bit_generator_ctor(bit_generator_name='MT19937'):
"""
Pickling helper function that returns a bit generator object
Parameters
----------
bit_generator_name : str
String containing the name of the BitGenerator
Returns
-------
bit_generator: BitGenerator
BitGenerato... | [
"def",
"__bit_generator_ctor",
"(",
"bit_generator_name",
"=",
"'MT19937'",
")",
":",
"if",
"bit_generator_name",
"in",
"BitGenerators",
":",
"bit_generator",
"=",
"BitGenerators",
"[",
"bit_generator_name",
"]",
"else",
":",
"raise",
"ValueError",
"(",
"str",
"(",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py3/numpy/random/_pickle.py#L40-L60 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/gan/python/train.py | python | get_joint_train_hooks | (train_steps=namedtuples.GANTrainSteps(1, 1)) | return get_hooks | Returns a hooks function for sequential GAN training.
When using these train hooks, IT IS RECOMMENDED TO USE `use_locking=True` ON
ALL OPTIMIZERS TO AVOID RACE CONDITIONS.
The order of steps taken is:
1) Combined generator and discriminator steps
2) Generator only steps, if any remain
3) Discriminator onl... | Returns a hooks function for sequential GAN training. | [
"Returns",
"a",
"hooks",
"function",
"for",
"sequential",
"GAN",
"training",
"."
] | def get_joint_train_hooks(train_steps=namedtuples.GANTrainSteps(1, 1)):
"""Returns a hooks function for sequential GAN training.
When using these train hooks, IT IS RECOMMENDED TO USE `use_locking=True` ON
ALL OPTIMIZERS TO AVOID RACE CONDITIONS.
The order of steps taken is:
1) Combined generator and discri... | [
"def",
"get_joint_train_hooks",
"(",
"train_steps",
"=",
"namedtuples",
".",
"GANTrainSteps",
"(",
"1",
",",
"1",
")",
")",
":",
"g_steps",
"=",
"train_steps",
".",
"generator_train_steps",
"d_steps",
"=",
"train_steps",
".",
"discriminator_train_steps",
"# Get the ... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/gan/python/train.py#L606-L656 | |
gimli-org/gimli | 17aa2160de9b15ababd9ef99e89b1bc3277bbb23 | pygimli/physics/ert/ertModelling.py | python | ERTModellingReference.pointSource | (self, cell, f, userData) | r"""
Define function for the current source term.
:math:`\delta(x-pos), \int f(x) \delta(x-pos)=f(pos)=N(pos)`
Right hand side entries will be shape functions(pos) | r"""
Define function for the current source term. | [
"r",
"Define",
"function",
"for",
"the",
"current",
"source",
"term",
"."
] | def pointSource(self, cell, f, userData):
r"""
Define function for the current source term.
:math:`\delta(x-pos), \int f(x) \delta(x-pos)=f(pos)=N(pos)`
Right hand side entries will be shape functions(pos)
"""
i = userData['i']
sourcePos = userData['sourcePos... | [
"def",
"pointSource",
"(",
"self",
",",
"cell",
",",
"f",
",",
"userData",
")",
":",
"i",
"=",
"userData",
"[",
"'i'",
"]",
"sourcePos",
"=",
"userData",
"[",
"'sourcePos'",
"]",
"[",
"i",
"]",
"if",
"cell",
".",
"shape",
"(",
")",
".",
"isInside",... | https://github.com/gimli-org/gimli/blob/17aa2160de9b15ababd9ef99e89b1bc3277bbb23/pygimli/physics/ert/ertModelling.py#L429-L440 | ||
gimli-org/gimli | 17aa2160de9b15ababd9ef99e89b1bc3277bbb23 | pygimli/physics/ert/ves.py | python | VESModelling.setDataSpace | (self, ab2=None, mn2=None,
am=None, bm=None, an=None, bn=None,
**kwargs) | Set data basis, i.e., arrays for all am, an, bm, bn distances.
Parameters
---------- | Set data basis, i.e., arrays for all am, an, bm, bn distances. | [
"Set",
"data",
"basis",
"i",
".",
"e",
".",
"arrays",
"for",
"all",
"am",
"an",
"bm",
"bn",
"distances",
"."
] | def setDataSpace(self, ab2=None, mn2=None,
am=None, bm=None, an=None, bn=None,
**kwargs):
"""Set data basis, i.e., arrays for all am, an, bm, bn distances.
Parameters
----------
"""
# Sometimes you don't have AB2/MN2 but provide am etc.
... | [
"def",
"setDataSpace",
"(",
"self",
",",
"ab2",
"=",
"None",
",",
"mn2",
"=",
"None",
",",
"am",
"=",
"None",
",",
"bm",
"=",
"None",
",",
"an",
"=",
"None",
",",
"bn",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# Sometimes you don't have AB2... | https://github.com/gimli-org/gimli/blob/17aa2160de9b15ababd9ef99e89b1bc3277bbb23/pygimli/physics/ert/ves.py#L80-L119 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/setuptools/dist.py | python | Distribution.get_command_class | (self, command) | Pluggable version of get_command_class() | Pluggable version of get_command_class() | [
"Pluggable",
"version",
"of",
"get_command_class",
"()"
] | def get_command_class(self, command):
"""Pluggable version of get_command_class()"""
if command in self.cmdclass:
return self.cmdclass[command]
eps = pkg_resources.iter_entry_points('distutils.commands', command)
for ep in eps:
ep.require(installer=self.fetch_bui... | [
"def",
"get_command_class",
"(",
"self",
",",
"command",
")",
":",
"if",
"command",
"in",
"self",
".",
"cmdclass",
":",
"return",
"self",
".",
"cmdclass",
"[",
"command",
"]",
"eps",
"=",
"pkg_resources",
".",
"iter_entry_points",
"(",
"'distutils.commands'",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/setuptools/dist.py#L756-L767 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/statistics.py | python | NormalDist.cdf | (self, x) | return 0.5 * (1.0 + erf((x - self._mu) / (self._sigma * sqrt(2.0)))) | Cumulative distribution function. P(X <= x) | Cumulative distribution function. P(X <= x) | [
"Cumulative",
"distribution",
"function",
".",
"P",
"(",
"X",
"<",
"=",
"x",
")"
] | def cdf(self, x):
"Cumulative distribution function. P(X <= x)"
if not self._sigma:
raise StatisticsError('cdf() not defined when sigma is zero')
return 0.5 * (1.0 + erf((x - self._mu) / (self._sigma * sqrt(2.0)))) | [
"def",
"cdf",
"(",
"self",
",",
"x",
")",
":",
"if",
"not",
"self",
".",
"_sigma",
":",
"raise",
"StatisticsError",
"(",
"'cdf() not defined when sigma is zero'",
")",
"return",
"0.5",
"*",
"(",
"1.0",
"+",
"erf",
"(",
"(",
"x",
"-",
"self",
".",
"_mu"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/statistics.py#L942-L946 | |
bundy-dns/bundy | 3d41934996b82b0cd2fe22dd74d2abc1daba835d | src/lib/python/bundy/ddns/session.py | python | UpdateSession.__do_update_delete_rrs_from_rrset | (self, rrset) | Deletes all resource records in the given rrset from the
zone. Resource records that do not exist are ignored.
If the rrset if of type SOA, it is ignored.
Uses the __ns_deleter_helper if the rrset's name is the
zone's apex, and the type is NS. | Deletes all resource records in the given rrset from the
zone. Resource records that do not exist are ignored.
If the rrset if of type SOA, it is ignored.
Uses the __ns_deleter_helper if the rrset's name is the
zone's apex, and the type is NS. | [
"Deletes",
"all",
"resource",
"records",
"in",
"the",
"given",
"rrset",
"from",
"the",
"zone",
".",
"Resource",
"records",
"that",
"do",
"not",
"exist",
"are",
"ignored",
".",
"If",
"the",
"rrset",
"if",
"of",
"type",
"SOA",
"it",
"is",
"ignored",
".",
... | def __do_update_delete_rrs_from_rrset(self, rrset):
'''Deletes all resource records in the given rrset from the
zone. Resource records that do not exist are ignored.
If the rrset if of type SOA, it is ignored.
Uses the __ns_deleter_helper if the rrset's name is the
zo... | [
"def",
"__do_update_delete_rrs_from_rrset",
"(",
"self",
",",
"rrset",
")",
":",
"# Delete all rrs in the rrset, except if name=self.__zname and type=soa, or",
"# type = ns and there is only one left (...)",
"# The delete does not want class NONE, we would not have gotten here",
"# if it wasn'... | https://github.com/bundy-dns/bundy/blob/3d41934996b82b0cd2fe22dd74d2abc1daba835d/src/lib/python/bundy/ddns/session.py#L763-L787 | ||
alexgkendall/caffe-segnet | 344c113bf1832886f1cbe9f33ffe28a3beeaf412 | scripts/cpp_lint.py | python | CheckForNewlineAtEOF | (filename, lines, error) | Logs an error if there is no newline char at the end of the file.
Args:
filename: The name of the current file.
lines: An array of strings, each representing a line of the file.
error: The function to call with any errors found. | Logs an error if there is no newline char at the end of the file. | [
"Logs",
"an",
"error",
"if",
"there",
"is",
"no",
"newline",
"char",
"at",
"the",
"end",
"of",
"the",
"file",
"."
] | def CheckForNewlineAtEOF(filename, lines, error):
"""Logs an error if there is no newline char at the end of the file.
Args:
filename: The name of the current file.
lines: An array of strings, each representing a line of the file.
error: The function to call with any errors found.
"""
# The array ... | [
"def",
"CheckForNewlineAtEOF",
"(",
"filename",
",",
"lines",
",",
"error",
")",
":",
"# The array lines() was created by adding two newlines to the",
"# original file (go figure), then splitting on \\n.",
"# To verify that the file ends in \\n, we just have to make sure the",
"# last-but-... | https://github.com/alexgkendall/caffe-segnet/blob/344c113bf1832886f1cbe9f33ffe28a3beeaf412/scripts/cpp_lint.py#L1508-L1523 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/graphy/graphy/common.py | python | Axis.__init__ | (self, axis_min=None, axis_max=None) | Construct a new Axis.
Args:
axis_min: smallest value on the axis
axis_max: largest value on the axis | Construct a new Axis. | [
"Construct",
"a",
"new",
"Axis",
"."
] | def __init__(self, axis_min=None, axis_max=None):
"""Construct a new Axis.
Args:
axis_min: smallest value on the axis
axis_max: largest value on the axis
"""
self.min = axis_min
self.max = axis_max
self.labels = []
self.label_positions = []
self.grid_spacing = 0
self.lab... | [
"def",
"__init__",
"(",
"self",
",",
"axis_min",
"=",
"None",
",",
"axis_max",
"=",
"None",
")",
":",
"self",
".",
"min",
"=",
"axis_min",
"self",
".",
"max",
"=",
"axis_max",
"self",
".",
"labels",
"=",
"[",
"]",
"self",
".",
"label_positions",
"=",... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/graphy/graphy/common.py#L188-L200 | ||
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_aarch64/python2.7/dist-packages/rosdep2/sources_list.py | python | parse_sources_file | (filepath) | Parse file on disk
:returns: List of data sources, [:class:`DataSource`]
:raises: :exc:`InvalidData` If any error occurs reading
file, so an I/O error, non-existent file, or invalid format. | Parse file on disk | [
"Parse",
"file",
"on",
"disk"
] | def parse_sources_file(filepath):
"""
Parse file on disk
:returns: List of data sources, [:class:`DataSource`]
:raises: :exc:`InvalidData` If any error occurs reading
file, so an I/O error, non-existent file, or invalid format.
"""
try:
with open(filepath, 'r') as f:
... | [
"def",
"parse_sources_file",
"(",
"filepath",
")",
":",
"try",
":",
"with",
"open",
"(",
"filepath",
",",
"'r'",
")",
"as",
"f",
":",
"return",
"parse_sources_data",
"(",
"f",
".",
"read",
"(",
")",
",",
"origin",
"=",
"filepath",
")",
"except",
"IOErr... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_aarch64/python2.7/dist-packages/rosdep2/sources_list.py#L369-L381 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/signal/signaltools.py | python | _filtfilt_gust | (b, a, x, axis=-1, irlen=None) | return y_opt, x0, x1 | Forward-backward IIR filter that uses Gustafsson's method.
Apply the IIR filter defined by `(b,a)` to `x` twice, first forward
then backward, using Gustafsson's initial conditions [1]_.
Let ``y_fb`` be the result of filtering first forward and then backward,
and let ``y_bf`` be the result of filtering... | Forward-backward IIR filter that uses Gustafsson's method. | [
"Forward",
"-",
"backward",
"IIR",
"filter",
"that",
"uses",
"Gustafsson",
"s",
"method",
"."
] | def _filtfilt_gust(b, a, x, axis=-1, irlen=None):
"""Forward-backward IIR filter that uses Gustafsson's method.
Apply the IIR filter defined by `(b,a)` to `x` twice, first forward
then backward, using Gustafsson's initial conditions [1]_.
Let ``y_fb`` be the result of filtering first forward and then ... | [
"def",
"_filtfilt_gust",
"(",
"b",
",",
"a",
",",
"x",
",",
"axis",
"=",
"-",
"1",
",",
"irlen",
"=",
"None",
")",
":",
"# In the comments, \"Gustafsson's paper\" and [1] refer to the",
"# paper referenced in the docstring.",
"b",
"=",
"np",
".",
"atleast_1d",
"("... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/signal/signaltools.py#L2792-L2968 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/grid.py | python | GridCellBoolEditor_UseStringValues | (*args, **kwargs) | return _grid.GridCellBoolEditor_UseStringValues(*args, **kwargs) | GridCellBoolEditor_UseStringValues(String valueTrue=OneString, String valueFalse=EmptyString) | GridCellBoolEditor_UseStringValues(String valueTrue=OneString, String valueFalse=EmptyString) | [
"GridCellBoolEditor_UseStringValues",
"(",
"String",
"valueTrue",
"=",
"OneString",
"String",
"valueFalse",
"=",
"EmptyString",
")"
] | def GridCellBoolEditor_UseStringValues(*args, **kwargs):
"""GridCellBoolEditor_UseStringValues(String valueTrue=OneString, String valueFalse=EmptyString)"""
return _grid.GridCellBoolEditor_UseStringValues(*args, **kwargs) | [
"def",
"GridCellBoolEditor_UseStringValues",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_grid",
".",
"GridCellBoolEditor_UseStringValues",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/grid.py#L473-L475 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/build/waf-1.7.13/lmbrwaflib/lumberyard_modules.py | python | configure_task_generator | (ctx, target, kw) | Helper function to apply default configurations and to set platform/configuration dependent settings
* Fork of ConfigureTaskGenerator | Helper function to apply default configurations and to set platform/configuration dependent settings
* Fork of ConfigureTaskGenerator | [
"Helper",
"function",
"to",
"apply",
"default",
"configurations",
"and",
"to",
"set",
"platform",
"/",
"configuration",
"dependent",
"settings",
"*",
"Fork",
"of",
"ConfigureTaskGenerator"
] | def configure_task_generator(ctx, target, kw):
"""
Helper function to apply default configurations and to set platform/configuration dependent settings
* Fork of ConfigureTaskGenerator
"""
# Ensure we have a name for lookup purposes
kw.setdefault('name', target)
# Lookup the PlatformConfig... | [
"def",
"configure_task_generator",
"(",
"ctx",
",",
"target",
",",
"kw",
")",
":",
"# Ensure we have a name for lookup purposes",
"kw",
".",
"setdefault",
"(",
"'name'",
",",
"target",
")",
"# Lookup the PlatformConfiguration for the current platform/configuration (if this is a... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/build/waf-1.7.13/lmbrwaflib/lumberyard_modules.py#L318-L382 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/debug/lib/grpc_debug_server.py | python | EventListenerBaseServicer._process_tensor_event_in_chunks | (self, event, tensor_chunks) | Possibly reassemble event chunks.
Due to gRPC's message size limit, a large tensor can be encapsulated in
multiple Event proto chunks to be sent through the debugger stream. This
method keeps track of the chunks that have arrived, reassemble all chunks
corresponding to a tensor when they have arrived a... | Possibly reassemble event chunks. | [
"Possibly",
"reassemble",
"event",
"chunks",
"."
] | def _process_tensor_event_in_chunks(self, event, tensor_chunks):
"""Possibly reassemble event chunks.
Due to gRPC's message size limit, a large tensor can be encapsulated in
multiple Event proto chunks to be sent through the debugger stream. This
method keeps track of the chunks that have arrived, reas... | [
"def",
"_process_tensor_event_in_chunks",
"(",
"self",
",",
"event",
",",
"tensor_chunks",
")",
":",
"value",
"=",
"event",
".",
"summary",
".",
"value",
"[",
"0",
"]",
"debugger_plugin_metadata",
"=",
"json",
".",
"loads",
"(",
"compat",
".",
"as_text",
"("... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/debug/lib/grpc_debug_server.py#L225-L278 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py | python | ParserElement.addParseAction | ( self, *fns, **kwargs ) | return self | Add one or more parse actions to expression's list of parse actions. See L{I{setParseAction}<setParseAction>}.
See examples in L{I{copy}<copy>}. | [] | def addParseAction( self, *fns, **kwargs ):
"""
Add one or more parse actions to expression's list of parse actions. See L{I{setParseAction}<setParseAction>}.
See examples in L{I{copy}<copy>}.
"""
self.parseAction += list(map(_trim_arity, list(fns)))
self.... | [
"def",
"addParseAction",
"(",
"self",
",",
"*",
"fns",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"parseAction",
"+=",
"list",
"(",
"map",
"(",
"_trim_arity",
",",
"list",
"(",
"fns",
")",
")",
")",
"self",
".",
"callDuringTry",
"=",
"self",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py#L2575-L2591 | ||
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | third_party/numpy/files/numpy/lib/financial.py | python | pmt | (rate, nper, pv, fv=0, when='end') | return -(fv + pv*temp) / fact | Compute the payment against loan principal plus interest.
Given:
* a present value, `pv` (e.g., an amount borrowed)
* a future value, `fv` (e.g., 0)
* an interest `rate` compounded once per period, of which
there are
* `nper` total
* and (optional) specification of whether payment i... | Compute the payment against loan principal plus interest. | [
"Compute",
"the",
"payment",
"against",
"loan",
"principal",
"plus",
"interest",
"."
] | def pmt(rate, nper, pv, fv=0, when='end'):
"""
Compute the payment against loan principal plus interest.
Given:
* a present value, `pv` (e.g., an amount borrowed)
* a future value, `fv` (e.g., 0)
* an interest `rate` compounded once per period, of which
there are
* `nper` total
... | [
"def",
"pmt",
"(",
"rate",
",",
"nper",
",",
"pv",
",",
"fv",
"=",
"0",
",",
"when",
"=",
"'end'",
")",
":",
"when",
"=",
"_convert_when",
"(",
"when",
")",
"rate",
",",
"nper",
",",
"pv",
",",
"fv",
",",
"when",
"=",
"map",
"(",
"np",
".",
... | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/lib/financial.py#L116-L205 | |
zju3dv/clean-pvnet | 5870c509e3cc205e1bb28910a7b1a9a3c8add9a8 | lib/utils/data_utils.py | python | draw_heatmap_np | (hm, point, box_size) | return hm | point: [x, y] | point: [x, y] | [
"point",
":",
"[",
"x",
"y",
"]"
] | def draw_heatmap_np(hm, point, box_size):
"""point: [x, y]"""
# radius = gaussian_radius(box_size)
radius = box_size[0]
radius = max(0, int(radius))
ct_int = np.array(point, dtype=np.int32)
draw_umich_gaussian(hm, ct_int, radius)
return hm | [
"def",
"draw_heatmap_np",
"(",
"hm",
",",
"point",
",",
"box_size",
")",
":",
"# radius = gaussian_radius(box_size)",
"radius",
"=",
"box_size",
"[",
"0",
"]",
"radius",
"=",
"max",
"(",
"0",
",",
"int",
"(",
"radius",
")",
")",
"ct_int",
"=",
"np",
".",... | https://github.com/zju3dv/clean-pvnet/blob/5870c509e3cc205e1bb28910a7b1a9a3c8add9a8/lib/utils/data_utils.py#L86-L93 | |
epiqc/ScaffCC | 66a79944ee4cd116b27bc1a69137276885461db8 | clang/tools/scan-build-py/libscanbuild/report.py | python | chop | (prefix, filename) | return filename if not len(prefix) else os.path.relpath(filename, prefix) | Create 'filename' from '/prefix/filename' | Create 'filename' from '/prefix/filename' | [
"Create",
"filename",
"from",
"/",
"prefix",
"/",
"filename"
] | def chop(prefix, filename):
""" Create 'filename' from '/prefix/filename' """
return filename if not len(prefix) else os.path.relpath(filename, prefix) | [
"def",
"chop",
"(",
"prefix",
",",
"filename",
")",
":",
"return",
"filename",
"if",
"not",
"len",
"(",
"prefix",
")",
"else",
"os",
".",
"path",
".",
"relpath",
"(",
"filename",
",",
"prefix",
")"
] | https://github.com/epiqc/ScaffCC/blob/66a79944ee4cd116b27bc1a69137276885461db8/clang/tools/scan-build-py/libscanbuild/report.py#L442-L445 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/model/collide.py | python | WorldCollider.isCollisionEnabled | (self,obj_or_pair) | Returns true if the object or pair of objects are considered for
collision.
Args:
obj_or_pair: either a single body (RobotModelLink,
RigidObjectModel, TerrainModel) in the world, or a pair of
bodies. In the former case, True is returned if the body
... | Returns true if the object or pair of objects are considered for
collision. | [
"Returns",
"true",
"if",
"the",
"object",
"or",
"pair",
"of",
"objects",
"are",
"considered",
"for",
"collision",
"."
] | def isCollisionEnabled(self,obj_or_pair):
"""Returns true if the object or pair of objects are considered for
collision.
Args:
obj_or_pair: either a single body (RobotModelLink,
RigidObjectModel, TerrainModel) in the world, or a pair of
bodies. In t... | [
"def",
"isCollisionEnabled",
"(",
"self",
",",
"obj_or_pair",
")",
":",
"if",
"hasattr",
"(",
"obj_or_pair",
",",
"'__iter__'",
")",
":",
"(",
"a",
",",
"b",
")",
"=",
"obj_or_pair",
"ageom",
"=",
"self",
".",
"_getGeomIndex",
"(",
"a",
")",
"bgeom",
"... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/model/collide.py#L359-L380 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/plugins/Launch/launch/handlers.py | python | _StyleError | (stc, start, txt, regex) | return found_err, more | Style Error message groups
@param stc: OutputBuffer reference
@param start: start of text just added to buffer
@param txt: text that was just added
@param regex: regular expression object for matching the errors
@return: (bool errfound, bool more) | Style Error message groups
@param stc: OutputBuffer reference
@param start: start of text just added to buffer
@param txt: text that was just added
@param regex: regular expression object for matching the errors
@return: (bool errfound, bool more) | [
"Style",
"Error",
"message",
"groups",
"@param",
"stc",
":",
"OutputBuffer",
"reference",
"@param",
"start",
":",
"start",
"of",
"text",
"just",
"added",
"to",
"buffer",
"@param",
"txt",
":",
"text",
"that",
"was",
"just",
"added",
"@param",
"regex",
":",
... | def _StyleError(stc, start, txt, regex):
"""Style Error message groups
@param stc: OutputBuffer reference
@param start: start of text just added to buffer
@param txt: text that was just added
@param regex: regular expression object for matching the errors
@return: (bool errfound, bool more)
... | [
"def",
"_StyleError",
"(",
"stc",
",",
"start",
",",
"txt",
",",
"regex",
")",
":",
"found_err",
"=",
"False",
"more",
"=",
"False",
"sty_e",
"=",
"start",
"for",
"group",
"in",
"regex",
".",
"finditer",
"(",
"txt",
")",
":",
"sty_s",
"=",
"start",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/plugins/Launch/launch/handlers.py#L919-L941 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqt/mantidqt/widgets/plotconfigdialog/presenter.py | python | PlotConfigDialogPresenter.apply_properties | (self) | Attempts to apply properties. Returns a bool denoting whether
there was an error drawing the canvas drawn | Attempts to apply properties. Returns a bool denoting whether
there was an error drawing the canvas drawn | [
"Attempts",
"to",
"apply",
"properties",
".",
"Returns",
"a",
"bool",
"denoting",
"whether",
"there",
"was",
"an",
"error",
"drawing",
"the",
"canvas",
"drawn"
] | def apply_properties(self):
"""Attempts to apply properties. Returns a bool denoting whether
there was an error drawing the canvas drawn"""
for tab in reversed(self.tab_widget_presenters):
if tab:
tab.apply_properties()
try:
self.fig.canvas.draw()
... | [
"def",
"apply_properties",
"(",
"self",
")",
":",
"for",
"tab",
"in",
"reversed",
"(",
"self",
".",
"tab_widget_presenters",
")",
":",
"if",
"tab",
":",
"tab",
".",
"apply_properties",
"(",
")",
"try",
":",
"self",
".",
"fig",
".",
"canvas",
".",
"draw... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqt/mantidqt/widgets/plotconfigdialog/presenter.py#L72-L93 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/corrections_tab_widget/background_corrections_view.py | python | BackgroundCorrectionsView._format_selection | (self) | Formats the selected cell to have the expected number of decimal places. | Formats the selected cell to have the expected number of decimal places. | [
"Formats",
"the",
"selected",
"cell",
"to",
"have",
"the",
"expected",
"number",
"of",
"decimal",
"places",
"."
] | def _format_selection(self) -> None:
"""Formats the selected cell to have the expected number of decimal places."""
if self._selected_row is not None and self._selected_column is not None and self._selected_column != USE_RAW_COLUMN_INDEX:
value = float(self.correction_options_table.item(self... | [
"def",
"_format_selection",
"(",
"self",
")",
"->",
"None",
":",
"if",
"self",
".",
"_selected_row",
"is",
"not",
"None",
"and",
"self",
".",
"_selected_column",
"is",
"not",
"None",
"and",
"self",
".",
"_selected_column",
"!=",
"USE_RAW_COLUMN_INDEX",
":",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/corrections_tab_widget/background_corrections_view.py#L387-L391 | ||
turi-code/SFrame | 796b9bdfb2fa1b881d82080754643c7e68629cd2 | oss_src/unity/python/sframe/data_structures/sframe.py | python | SFrame.export_csv | (self, filename, delimiter=',', line_terminator='\n',
header=True, quote_level=csv.QUOTE_NONNUMERIC, double_quote=True,
escape_char='\\', quote_char='\"', na_rep='',
file_header='', file_footer='', line_prefix='',
_no_prefix_on_first_value=False, **kwargs) | Writes an SFrame to a CSV file.
Parameters
----------
filename : string
The location to save the CSV.
delimiter : string, optional
This describes the delimiter used for writing csv files.
line_terminator: string, optional
The newline charact... | Writes an SFrame to a CSV file. | [
"Writes",
"an",
"SFrame",
"to",
"a",
"CSV",
"file",
"."
] | def export_csv(self, filename, delimiter=',', line_terminator='\n',
header=True, quote_level=csv.QUOTE_NONNUMERIC, double_quote=True,
escape_char='\\', quote_char='\"', na_rep='',
file_header='', file_footer='', line_prefix='',
_no_prefix_on_first_value=False, **kwargs):
... | [
"def",
"export_csv",
"(",
"self",
",",
"filename",
",",
"delimiter",
"=",
"','",
",",
"line_terminator",
"=",
"'\\n'",
",",
"header",
"=",
"True",
",",
"quote_level",
"=",
"csv",
".",
"QUOTE_NONNUMERIC",
",",
"double_quote",
"=",
"True",
",",
"escape_char",
... | https://github.com/turi-code/SFrame/blob/796b9bdfb2fa1b881d82080754643c7e68629cd2/oss_src/unity/python/sframe/data_structures/sframe.py#L3369-L3458 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/array_ops.py | python | size_internal | (input, name=None, optimize=True, out_type=dtypes.int32) | Returns the size of a tensor.
Args:
input: A `Tensor` or `SparseTensor`.
name: A name for the operation (optional).
optimize: if true, encode the size as a constant when possible.
out_type: (Optional) The specified non-quantized numeric output type of the
operation. Defaults to `tf.int32`.
R... | Returns the size of a tensor. | [
"Returns",
"the",
"size",
"of",
"a",
"tensor",
"."
] | def size_internal(input, name=None, optimize=True, out_type=dtypes.int32):
# pylint: disable=redefined-builtin,protected-access
"""Returns the size of a tensor.
Args:
input: A `Tensor` or `SparseTensor`.
name: A name for the operation (optional).
optimize: if true, encode the size as a constant when ... | [
"def",
"size_internal",
"(",
"input",
",",
"name",
"=",
"None",
",",
"optimize",
"=",
"True",
",",
"out_type",
"=",
"dtypes",
".",
"int32",
")",
":",
"# pylint: disable=redefined-builtin,protected-access",
"if",
"(",
"context",
".",
"executing_eagerly",
"(",
")"... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/array_ops.py#L787-L822 | ||
ablab/spades | 3a754192b88540524ce6fb69eef5ea9273a38465 | assembler/ext/src/python_libs/joblib3/pool.py | python | has_shareable_memory | (a) | return _get_backing_memmap(a) is not None | Return True if a is backed by some mmap buffer directly or not | Return True if a is backed by some mmap buffer directly or not | [
"Return",
"True",
"if",
"a",
"is",
"backed",
"by",
"some",
"mmap",
"buffer",
"directly",
"or",
"not"
] | def has_shareable_memory(a):
"""Return True if a is backed by some mmap buffer directly or not"""
return _get_backing_memmap(a) is not None | [
"def",
"has_shareable_memory",
"(",
"a",
")",
":",
"return",
"_get_backing_memmap",
"(",
"a",
")",
"is",
"not",
"None"
] | https://github.com/ablab/spades/blob/3a754192b88540524ce6fb69eef5ea9273a38465/assembler/ext/src/python_libs/joblib3/pool.py#L88-L90 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_core.py | python | IndividualLayoutConstraint.LeftOf | (*args, **kwargs) | return _core_.IndividualLayoutConstraint_LeftOf(*args, **kwargs) | LeftOf(self, Window sibling, int marg=0)
Constrains this edge to be to the left of the given window, with an
optional margin. Implicitly, this is relative to the left edge of the
other window. | LeftOf(self, Window sibling, int marg=0) | [
"LeftOf",
"(",
"self",
"Window",
"sibling",
"int",
"marg",
"=",
"0",
")"
] | def LeftOf(*args, **kwargs):
"""
LeftOf(self, Window sibling, int marg=0)
Constrains this edge to be to the left of the given window, with an
optional margin. Implicitly, this is relative to the left edge of the
other window.
"""
return _core_.IndividualLayoutCon... | [
"def",
"LeftOf",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"IndividualLayoutConstraint_LeftOf",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_core.py#L16136-L16144 | |
nasa/fprime | 595cf3682d8365943d86c1a6fe7c78f0a116acf0 | Autocoders/Python/src/fprime_ac/generators/DictBody.py | python | DictBody.getObj | (self) | return self.__obj | Return the object to the visitor. | Return the object to the visitor. | [
"Return",
"the",
"object",
"to",
"the",
"visitor",
"."
] | def getObj(self):
"""
Return the object to the visitor.
"""
return self.__obj | [
"def",
"getObj",
"(",
"self",
")",
":",
"return",
"self",
".",
"__obj"
] | https://github.com/nasa/fprime/blob/595cf3682d8365943d86c1a6fe7c78f0a116acf0/Autocoders/Python/src/fprime_ac/generators/DictBody.py#L101-L105 | |
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py | python | uCSIsCJKRadicalsSupplement | (code) | return ret | Check whether the character is part of
CJKRadicalsSupplement UCS Block | Check whether the character is part of
CJKRadicalsSupplement UCS Block | [
"Check",
"whether",
"the",
"character",
"is",
"part",
"of",
"CJKRadicalsSupplement",
"UCS",
"Block"
] | def uCSIsCJKRadicalsSupplement(code):
"""Check whether the character is part of
CJKRadicalsSupplement UCS Block """
ret = libxml2mod.xmlUCSIsCJKRadicalsSupplement(code)
return ret | [
"def",
"uCSIsCJKRadicalsSupplement",
"(",
"code",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlUCSIsCJKRadicalsSupplement",
"(",
"code",
")",
"return",
"ret"
] | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py#L1423-L1427 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | current/tools/inspector_protocol/jinja2/environment.py | python | _environment_sanity_check | (environment) | return environment | Perform a sanity check on the environment. | Perform a sanity check on the environment. | [
"Perform",
"a",
"sanity",
"check",
"on",
"the",
"environment",
"."
] | def _environment_sanity_check(environment):
"""Perform a sanity check on the environment."""
assert issubclass(environment.undefined, Undefined), 'undefined must ' \
'be a subclass of undefined because filters depend on it.'
assert environment.block_start_string != \
environment.variable_sta... | [
"def",
"_environment_sanity_check",
"(",
"environment",
")",
":",
"assert",
"issubclass",
"(",
"environment",
".",
"undefined",
",",
"Undefined",
")",
",",
"'undefined must '",
"'be a subclass of undefined because filters depend on it.'",
"assert",
"environment",
".",
"bloc... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/current/tools/inspector_protocol/jinja2/environment.py#L100-L110 | |
neopenx/Dragon | 0e639a7319035ddc81918bd3df059230436ee0a1 | Dragon/python/dragon/core/tensor.py | python | Tensor.copy | (self) | return new_tensor | Return a Tensor with same content. [**Theano Style**]
Returns
-------
Tensor
The copy.
See Also
--------
`ops.Copy(*args, **kwargs)`_ - How to copy A to B. | Return a Tensor with same content. [**Theano Style**] | [
"Return",
"a",
"Tensor",
"with",
"same",
"content",
".",
"[",
"**",
"Theano",
"Style",
"**",
"]"
] | def copy(self):
"""Return a Tensor with same content. [**Theano Style**]
Returns
-------
Tensor
The copy.
See Also
--------
`ops.Copy(*args, **kwargs)`_ - How to copy A to B.
"""
new_tensor = Tensor(self.name + '_copy')
argum... | [
"def",
"copy",
"(",
"self",
")",
":",
"new_tensor",
"=",
"Tensor",
"(",
"self",
".",
"name",
"+",
"'_copy'",
")",
"arguments",
"=",
"{",
"'inputs'",
":",
"self",
",",
"'existing_outputs'",
":",
"new_tensor",
"}",
"self",
".",
"CreateOperator",
"(",
"nout... | https://github.com/neopenx/Dragon/blob/0e639a7319035ddc81918bd3df059230436ee0a1/Dragon/python/dragon/core/tensor.py#L729-L750 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py | python | set_multiarray_ndshape_range | (spec, feature_name, lower_bounds, upper_bounds) | Annotate an input or output MLMultiArray feature in a Neural Network spec
to accommodate a range of shapes.
This is different from "update_multiarray_shape_range", which works with rank 5
SBCHW mapping.
:param spec: MLModel
The MLModel spec containing the feature
:param feature_name: str
... | Annotate an input or output MLMultiArray feature in a Neural Network spec
to accommodate a range of shapes.
This is different from "update_multiarray_shape_range", which works with rank 5
SBCHW mapping. | [
"Annotate",
"an",
"input",
"or",
"output",
"MLMultiArray",
"feature",
"in",
"a",
"Neural",
"Network",
"spec",
"to",
"accommodate",
"a",
"range",
"of",
"shapes",
".",
"This",
"is",
"different",
"from",
"update_multiarray_shape_range",
"which",
"works",
"with",
"r... | def set_multiarray_ndshape_range(spec, feature_name, lower_bounds, upper_bounds):
"""
Annotate an input or output MLMultiArray feature in a Neural Network spec
to accommodate a range of shapes.
This is different from "update_multiarray_shape_range", which works with rank 5
SBCHW mapping.
:param... | [
"def",
"set_multiarray_ndshape_range",
"(",
"spec",
",",
"feature_name",
",",
"lower_bounds",
",",
"upper_bounds",
")",
":",
"if",
"not",
"isinstance",
"(",
"lower_bounds",
",",
"list",
")",
":",
"raise",
"Exception",
"(",
"\"lower_bounds must be a list\"",
")",
"... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py#L578-L661 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/re.py | python | split | (pattern, string, maxsplit=0, flags=0) | return _compile(pattern, flags).split(string, maxsplit) | Split the source string by the occurrences of the pattern,
returning a list containing the resulting substrings. | Split the source string by the occurrences of the pattern,
returning a list containing the resulting substrings. | [
"Split",
"the",
"source",
"string",
"by",
"the",
"occurrences",
"of",
"the",
"pattern",
"returning",
"a",
"list",
"containing",
"the",
"resulting",
"substrings",
"."
] | def split(pattern, string, maxsplit=0, flags=0):
"""Split the source string by the occurrences of the pattern,
returning a list containing the resulting substrings."""
return _compile(pattern, flags).split(string, maxsplit) | [
"def",
"split",
"(",
"pattern",
",",
"string",
",",
"maxsplit",
"=",
"0",
",",
"flags",
"=",
"0",
")",
":",
"return",
"_compile",
"(",
"pattern",
",",
"flags",
")",
".",
"split",
"(",
"string",
",",
"maxsplit",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/re.py#L164-L167 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/memory_inspector/memory_inspector/core/memory_map.py | python | MapEntry.GetRelativeOffset | (self, abs_addr) | return abs_addr - self.start + self.mapped_offset | Converts abs_addr to the corresponding offset in the mapped file. | Converts abs_addr to the corresponding offset in the mapped file. | [
"Converts",
"abs_addr",
"to",
"the",
"corresponding",
"offset",
"in",
"the",
"mapped",
"file",
"."
] | def GetRelativeOffset(self, abs_addr):
"""Converts abs_addr to the corresponding offset in the mapped file."""
assert(abs_addr >= self.start and abs_addr <= self.end)
return abs_addr - self.start + self.mapped_offset | [
"def",
"GetRelativeOffset",
"(",
"self",
",",
"abs_addr",
")",
":",
"assert",
"(",
"abs_addr",
">=",
"self",
".",
"start",
"and",
"abs_addr",
"<=",
"self",
".",
"end",
")",
"return",
"abs_addr",
"-",
"self",
".",
"start",
"+",
"self",
".",
"mapped_offset... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/memory_inspector/memory_inspector/core/memory_map.py#L60-L63 | |
CaoWGG/TensorRT-CenterNet | f949252e37b51e60f873808f46d3683f15735e79 | onnx-tensorrt/third_party/onnx/third_party/benchmark/tools/gbench/util.py | python | run_benchmark | (exe_name, benchmark_flags) | return json_res | Run a benchmark specified by 'exe_name' with the specified
'benchmark_flags'. The benchmark is run directly as a subprocess to preserve
real time console output.
RETURNS: A JSON object representing the benchmark output | Run a benchmark specified by 'exe_name' with the specified
'benchmark_flags'. The benchmark is run directly as a subprocess to preserve
real time console output.
RETURNS: A JSON object representing the benchmark output | [
"Run",
"a",
"benchmark",
"specified",
"by",
"exe_name",
"with",
"the",
"specified",
"benchmark_flags",
".",
"The",
"benchmark",
"is",
"run",
"directly",
"as",
"a",
"subprocess",
"to",
"preserve",
"real",
"time",
"console",
"output",
".",
"RETURNS",
":",
"A",
... | def run_benchmark(exe_name, benchmark_flags):
"""
Run a benchmark specified by 'exe_name' with the specified
'benchmark_flags'. The benchmark is run directly as a subprocess to preserve
real time console output.
RETURNS: A JSON object representing the benchmark output
"""
output_name = find_... | [
"def",
"run_benchmark",
"(",
"exe_name",
",",
"benchmark_flags",
")",
":",
"output_name",
"=",
"find_benchmark_flag",
"(",
"'--benchmark_out='",
",",
"benchmark_flags",
")",
"is_temp_output",
"=",
"False",
"if",
"output_name",
"is",
"None",
":",
"is_temp_output",
"=... | https://github.com/CaoWGG/TensorRT-CenterNet/blob/f949252e37b51e60f873808f46d3683f15735e79/onnx-tensorrt/third_party/onnx/third_party/benchmark/tools/gbench/util.py#L117-L143 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/ed_menu.py | python | EdMenu.InsertAlpha | (self, id_, label=u'', helpstr=u'',
kind=wx.ITEM_NORMAL, after=0, use_bmp=True) | return mitem | Attempts to insert the new menuitem into the menu
alphabetically. The optional parameter 'after' is used
specify an item id to start the alphabetical lookup after.
Otherwise the lookup begins from the first item in the menu.
@param id_: New MenuItem ID
@keyword label: Menu Label
... | Attempts to insert the new menuitem into the menu
alphabetically. The optional parameter 'after' is used
specify an item id to start the alphabetical lookup after.
Otherwise the lookup begins from the first item in the menu.
@param id_: New MenuItem ID
@keyword label: Menu Label
... | [
"Attempts",
"to",
"insert",
"the",
"new",
"menuitem",
"into",
"the",
"menu",
"alphabetically",
".",
"The",
"optional",
"parameter",
"after",
"is",
"used",
"specify",
"an",
"item",
"id",
"to",
"start",
"the",
"alphabetical",
"lookup",
"after",
".",
"Otherwise",... | def InsertAlpha(self, id_, label=u'', helpstr=u'',
kind=wx.ITEM_NORMAL, after=0, use_bmp=True):
"""Attempts to insert the new menuitem into the menu
alphabetically. The optional parameter 'after' is used
specify an item id to start the alphabetical lookup after.
Other... | [
"def",
"InsertAlpha",
"(",
"self",
",",
"id_",
",",
"label",
"=",
"u''",
",",
"helpstr",
"=",
"u''",
",",
"kind",
"=",
"wx",
".",
"ITEM_NORMAL",
",",
"after",
"=",
"0",
",",
"use_bmp",
"=",
"True",
")",
":",
"if",
"after",
":",
"start",
"=",
"Fal... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/ed_menu.py#L162-L204 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/groupby/groupby.py | python | GroupBy.ohlc | (self) | return self._apply_to_column_groupbys(lambda x: x._cython_agg_general("ohlc")) | Compute sum of values, excluding missing values.
For multiple groupings, the result index will be a MultiIndex
Returns
-------
DataFrame
Open, high, low and close values within each group. | Compute sum of values, excluding missing values. | [
"Compute",
"sum",
"of",
"values",
"excluding",
"missing",
"values",
"."
] | def ohlc(self) -> DataFrame:
"""
Compute sum of values, excluding missing values.
For multiple groupings, the result index will be a MultiIndex
Returns
-------
DataFrame
Open, high, low and close values within each group.
"""
return self._ap... | [
"def",
"ohlc",
"(",
"self",
")",
"->",
"DataFrame",
":",
"return",
"self",
".",
"_apply_to_column_groupbys",
"(",
"lambda",
"x",
":",
"x",
".",
"_cython_agg_general",
"(",
"\"ohlc\"",
")",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/groupby/groupby.py#L1428-L1440 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/eager/function.py | python | defun_with_attributes | (func=None,
input_signature=None,
attributes=None,
autograph=True,
experimental_autograph_options=None,
experimental_relax_shapes=False) | return decorated | Compiles a Python function into a callable TensorFlow graph.
This function supports adding extra function attributes. See detailed
documentation in defun(). Currently this is not exposed in public API since we
don't expect user to directly use attributes, and attribute won't work by
itself. This assumption mig... | Compiles a Python function into a callable TensorFlow graph. | [
"Compiles",
"a",
"Python",
"function",
"into",
"a",
"callable",
"TensorFlow",
"graph",
"."
] | def defun_with_attributes(func=None,
input_signature=None,
attributes=None,
autograph=True,
experimental_autograph_options=None,
experimental_relax_shapes=False):
"""Compiles a Python func... | [
"def",
"defun_with_attributes",
"(",
"func",
"=",
"None",
",",
"input_signature",
"=",
"None",
",",
"attributes",
"=",
"None",
",",
"autograph",
"=",
"True",
",",
"experimental_autograph_options",
"=",
"None",
",",
"experimental_relax_shapes",
"=",
"False",
")",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/eager/function.py#L2529-L2594 | |
microsoft/clang | 86d4513d3e0daa4d5a29b0b1de7c854ca15f9fe5 | tools/scan-view/share/ScanView.py | python | ScanViewRequestHandler.do_POST | (self) | Serve a POST request. | Serve a POST request. | [
"Serve",
"a",
"POST",
"request",
"."
] | def do_POST(self):
"""Serve a POST request."""
try:
length = self.headers.getheader('content-length') or "0"
try:
length = int(length)
except:
length = 0
content = self.rfile.read(length)
fields = parse_query(con... | [
"def",
"do_POST",
"(",
"self",
")",
":",
"try",
":",
"length",
"=",
"self",
".",
"headers",
".",
"getheader",
"(",
"'content-length'",
")",
"or",
"\"0\"",
"try",
":",
"length",
"=",
"int",
"(",
"length",
")",
"except",
":",
"length",
"=",
"0",
"conte... | https://github.com/microsoft/clang/blob/86d4513d3e0daa4d5a29b0b1de7c854ca15f9fe5/tools/scan-view/share/ScanView.py#L219-L234 | ||
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/ros_comm/rosgraph/src/rosgraph/names.py | python | resolve_name | (name, namespace_, remappings=None) | Resolve a ROS name to its global, canonical form. Private ~names
are resolved relative to the node name.
@param name: name to resolve.
@type name: str
@param namespace_: node name to resolve relative to.
@type namespace_: str
@param remappings: Map of resolved remappings. Use None to indicat... | Resolve a ROS name to its global, canonical form. Private ~names
are resolved relative to the node name. | [
"Resolve",
"a",
"ROS",
"name",
"to",
"its",
"global",
"canonical",
"form",
".",
"Private",
"~names",
"are",
"resolved",
"relative",
"to",
"the",
"node",
"name",
"."
] | def resolve_name(name, namespace_, remappings=None):
"""
Resolve a ROS name to its global, canonical form. Private ~names
are resolved relative to the node name.
@param name: name to resolve.
@type name: str
@param namespace_: node name to resolve relative to.
@type namespace_: str
@... | [
"def",
"resolve_name",
"(",
"name",
",",
"namespace_",
",",
"remappings",
"=",
"None",
")",
":",
"if",
"not",
"name",
":",
"#empty string resolves to parent of the namespace_",
"return",
"namespace",
"(",
"namespace_",
")",
"name",
"=",
"canonicalize_name",
"(",
"... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros_comm/rosgraph/src/rosgraph/names.py#L260-L292 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/docutils/utils/__init__.py | python | version_identifier | (version_info=None) | return version | Given a `version_info` tuple (default is docutils.__version_info__),
build & return a version identifier string. | Given a `version_info` tuple (default is docutils.__version_info__),
build & return a version identifier string. | [
"Given",
"a",
"version_info",
"tuple",
"(",
"default",
"is",
"docutils",
".",
"__version_info__",
")",
"build",
"&",
"return",
"a",
"version",
"identifier",
"string",
"."
] | def version_identifier(version_info=None):
# to add in Docutils 0.15:
# version_info is a namedtuple, an instance of Docutils.VersionInfo.
"""
Given a `version_info` tuple (default is docutils.__version_info__),
build & return a version identifier string.
"""
if version_info is None:
... | [
"def",
"version_identifier",
"(",
"version_info",
"=",
"None",
")",
":",
"# to add in Docutils 0.15:",
"# version_info is a namedtuple, an instance of Docutils.VersionInfo.",
"if",
"version_info",
"is",
"None",
":",
"version_info",
"=",
"__version_info__",
"if",
"version_info",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/docutils/utils/__init__.py#L777-L807 | |
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Tool/GettextCommon.py | python | _detect_msginit | (env) | return None | Detects *msginit(1)* program. | Detects *msginit(1)* program. | [
"Detects",
"*",
"msginit",
"(",
"1",
")",
"*",
"program",
"."
] | def _detect_msginit(env):
""" Detects *msginit(1)* program. """
if env.has_key('MSGINIT'):
return env['MSGINIT']
msginit = env.Detect('msginit');
if msginit:
return msginit
raise SCons.Errors.StopError(MsginitNotFound, "Could not detect msginit")
return None | [
"def",
"_detect_msginit",
"(",
"env",
")",
":",
"if",
"env",
".",
"has_key",
"(",
"'MSGINIT'",
")",
":",
"return",
"env",
"[",
"'MSGINIT'",
"]",
"msginit",
"=",
"env",
".",
"Detect",
"(",
"'msginit'",
")",
"if",
"msginit",
":",
"return",
"msginit",
"ra... | https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Tool/GettextCommon.py#L364-L372 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/jedi/jedi/api/classes.py | python | BaseDefinition.line | (self) | return start_pos[0] | The line where the definition occurs (starting with 1). | The line where the definition occurs (starting with 1). | [
"The",
"line",
"where",
"the",
"definition",
"occurs",
"(",
"starting",
"with",
"1",
")",
"."
] | def line(self):
"""The line where the definition occurs (starting with 1)."""
start_pos = self._name.start_pos
if start_pos is None:
return None
return start_pos[0] | [
"def",
"line",
"(",
"self",
")",
":",
"start_pos",
"=",
"self",
".",
"_name",
".",
"start_pos",
"if",
"start_pos",
"is",
"None",
":",
"return",
"None",
"return",
"start_pos",
"[",
"0",
"]"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/jedi/jedi/api/classes.py#L209-L214 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py2/numpy/core/defchararray.py | python | array | (obj, itemsize=None, copy=True, unicode=None, order=None) | return val.view(chararray) | Create a `chararray`.
.. note::
This class is provided for numarray backward-compatibility.
New code (not concerned with numarray compatibility) should use
arrays of type `string_` or `unicode_` and use the free functions
in :mod:`numpy.char <numpy.core.defchararray>` for fast
ve... | Create a `chararray`. | [
"Create",
"a",
"chararray",
"."
] | def array(obj, itemsize=None, copy=True, unicode=None, order=None):
"""
Create a `chararray`.
.. note::
This class is provided for numarray backward-compatibility.
New code (not concerned with numarray compatibility) should use
arrays of type `string_` or `unicode_` and use the free fu... | [
"def",
"array",
"(",
"obj",
",",
"itemsize",
"=",
"None",
",",
"copy",
"=",
"True",
",",
"unicode",
"=",
"None",
",",
"order",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"(",
"_bytes",
",",
"_unicode",
")",
")",
":",
"if",
"unico... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py2/numpy/core/defchararray.py#L2634-L2783 | |
llvm/llvm-project | ffa6262cb4e2a335d26416fad39a581b4f98c5f4 | llvm/utils/git/pre-push.py | python | get_dev_null | () | return dev_null_fd | Lazily create a /dev/null fd for use in shell() | Lazily create a /dev/null fd for use in shell() | [
"Lazily",
"create",
"a",
"/",
"dev",
"/",
"null",
"fd",
"for",
"use",
"in",
"shell",
"()"
] | def get_dev_null():
"""Lazily create a /dev/null fd for use in shell()"""
global dev_null_fd
if dev_null_fd is None:
dev_null_fd = open(os.devnull, 'w')
return dev_null_fd | [
"def",
"get_dev_null",
"(",
")",
":",
"global",
"dev_null_fd",
"if",
"dev_null_fd",
"is",
"None",
":",
"dev_null_fd",
"=",
"open",
"(",
"os",
".",
"devnull",
",",
"'w'",
")",
"return",
"dev_null_fd"
] | https://github.com/llvm/llvm-project/blob/ffa6262cb4e2a335d26416fad39a581b4f98c5f4/llvm/utils/git/pre-push.py#L76-L81 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/dataview.py | python | DataViewCtrl.EnsureVisible | (*args, **kwargs) | return _dataview.DataViewCtrl_EnsureVisible(*args, **kwargs) | EnsureVisible(self, DataViewItem item, DataViewColumn column=None) | EnsureVisible(self, DataViewItem item, DataViewColumn column=None) | [
"EnsureVisible",
"(",
"self",
"DataViewItem",
"item",
"DataViewColumn",
"column",
"=",
"None",
")"
] | def EnsureVisible(*args, **kwargs):
"""EnsureVisible(self, DataViewItem item, DataViewColumn column=None)"""
return _dataview.DataViewCtrl_EnsureVisible(*args, **kwargs) | [
"def",
"EnsureVisible",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_dataview",
".",
"DataViewCtrl_EnsureVisible",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/dataview.py#L1812-L1814 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/grid.py | python | Grid.SelectBlock | (*args, **kwargs) | return _grid.Grid_SelectBlock(*args, **kwargs) | SelectBlock(self, int topRow, int leftCol, int bottomRow, int rightCol,
bool addToSelected=False) | SelectBlock(self, int topRow, int leftCol, int bottomRow, int rightCol,
bool addToSelected=False) | [
"SelectBlock",
"(",
"self",
"int",
"topRow",
"int",
"leftCol",
"int",
"bottomRow",
"int",
"rightCol",
"bool",
"addToSelected",
"=",
"False",
")"
] | def SelectBlock(*args, **kwargs):
"""
SelectBlock(self, int topRow, int leftCol, int bottomRow, int rightCol,
bool addToSelected=False)
"""
return _grid.Grid_SelectBlock(*args, **kwargs) | [
"def",
"SelectBlock",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_grid",
".",
"Grid_SelectBlock",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/grid.py#L2034-L2039 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/protobuf/py3/google/protobuf/internal/decoder.py | python | MapDecoder | (field_descriptor, new_default, is_message_map) | return DecodeMap | Returns a decoder for a map field. | Returns a decoder for a map field. | [
"Returns",
"a",
"decoder",
"for",
"a",
"map",
"field",
"."
] | def MapDecoder(field_descriptor, new_default, is_message_map):
"""Returns a decoder for a map field."""
key = field_descriptor
tag_bytes = encoder.TagBytes(field_descriptor.number,
wire_format.WIRETYPE_LENGTH_DELIMITED)
tag_len = len(tag_bytes)
local_DecodeVarint = _DecodeVarin... | [
"def",
"MapDecoder",
"(",
"field_descriptor",
",",
"new_default",
",",
"is_message_map",
")",
":",
"key",
"=",
"field_descriptor",
"tag_bytes",
"=",
"encoder",
".",
"TagBytes",
"(",
"field_descriptor",
".",
"number",
",",
"wire_format",
".",
"WIRETYPE_LENGTH_DELIMIT... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/protobuf/py3/google/protobuf/internal/decoder.py#L864-L904 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/ma/extras.py | python | unique | (ar1, return_index=False, return_inverse=False) | return output | Finds the unique elements of an array.
Masked values are considered the same element (masked). The output array
is always a masked array. See `numpy.unique` for more details.
See Also
--------
numpy.unique : Equivalent function for ndarrays. | Finds the unique elements of an array. | [
"Finds",
"the",
"unique",
"elements",
"of",
"an",
"array",
"."
] | def unique(ar1, return_index=False, return_inverse=False):
"""
Finds the unique elements of an array.
Masked values are considered the same element (masked). The output array
is always a masked array. See `numpy.unique` for more details.
See Also
--------
numpy.unique : Equivalent function... | [
"def",
"unique",
"(",
"ar1",
",",
"return_index",
"=",
"False",
",",
"return_inverse",
"=",
"False",
")",
":",
"output",
"=",
"np",
".",
"unique",
"(",
"ar1",
",",
"return_index",
"=",
"return_index",
",",
"return_inverse",
"=",
"return_inverse",
")",
"if"... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/ma/extras.py#L1042-L1063 | |
raymondlu/super-animation-samples | 04234269112ff0dc32447f27a761dbbb00b8ba17 | samples/cocos2d-x-3.1/CocosLuaGame2/frameworks/cocos2d-x/tools/bindings-generator/backup/clang-llvm-3.3-pybinding/cindex.py | python | Cursor.get_children | (self) | return iter(children) | Return an iterator for accessing the children of this cursor. | Return an iterator for accessing the children of this cursor. | [
"Return",
"an",
"iterator",
"for",
"accessing",
"the",
"children",
"of",
"this",
"cursor",
"."
] | def get_children(self):
"""Return an iterator for accessing the children of this cursor."""
# FIXME: Expose iteration from CIndex, PR6125.
def visitor(child, parent, children):
# FIXME: Document this assertion in API.
# FIXME: There should just be an isNull method.
... | [
"def",
"get_children",
"(",
"self",
")",
":",
"# FIXME: Expose iteration from CIndex, PR6125.",
"def",
"visitor",
"(",
"child",
",",
"parent",
",",
"children",
")",
":",
"# FIXME: Document this assertion in API.",
"# FIXME: There should just be an isNull method.",
"assert",
"... | https://github.com/raymondlu/super-animation-samples/blob/04234269112ff0dc32447f27a761dbbb00b8ba17/samples/cocos2d-x-3.1/CocosLuaGame2/frameworks/cocos2d-x/tools/bindings-generator/backup/clang-llvm-3.3-pybinding/cindex.py#L1291-L1307 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/richtext.py | python | RichTextFileHandler.CanHandle | (*args, **kwargs) | return _richtext.RichTextFileHandler_CanHandle(*args, **kwargs) | CanHandle(self, String filename) -> bool | CanHandle(self, String filename) -> bool | [
"CanHandle",
"(",
"self",
"String",
"filename",
")",
"-",
">",
"bool"
] | def CanHandle(*args, **kwargs):
"""CanHandle(self, String filename) -> bool"""
return _richtext.RichTextFileHandler_CanHandle(*args, **kwargs) | [
"def",
"CanHandle",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextFileHandler_CanHandle",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/richtext.py#L2768-L2770 | |
ValveSoftware/source-sdk-2013 | 0d8dceea4310fde5706b3ce1c70609d72a38efdf | mp/src/thirdparty/protobuf-2.3.0/python/ez_setup.py | python | use_setuptools | (
version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
download_delay=15
) | Automatically find/download setuptools and make it available on sys.path
`version` should be a valid setuptools version number that is available
as an egg for download under the `download_base` URL (which should end with
a '/'). `to_dir` is the directory where setuptools will be downloaded, if
it is n... | Automatically find/download setuptools and make it available on sys.path | [
"Automatically",
"find",
"/",
"download",
"setuptools",
"and",
"make",
"it",
"available",
"on",
"sys",
".",
"path"
] | def use_setuptools(
version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
download_delay=15
):
"""Automatically find/download setuptools and make it available on sys.path
`version` should be a valid setuptools version number that is available
as an egg for download under the `downlo... | [
"def",
"use_setuptools",
"(",
"version",
"=",
"DEFAULT_VERSION",
",",
"download_base",
"=",
"DEFAULT_URL",
",",
"to_dir",
"=",
"os",
".",
"curdir",
",",
"download_delay",
"=",
"15",
")",
":",
"was_imported",
"=",
"'pkg_resources'",
"in",
"sys",
".",
"modules",... | https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/mp/src/thirdparty/protobuf-2.3.0/python/ez_setup.py#L77-L116 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | android_webview/tools/webview_licenses.py | python | GenerateNoticeFile | () | return '\n'.join(content) | Generates the contents of an Android NOTICE file for the third-party code.
This is used by the snapshot tool.
Returns:
The contents of the NOTICE file. | Generates the contents of an Android NOTICE file for the third-party code.
This is used by the snapshot tool.
Returns:
The contents of the NOTICE file. | [
"Generates",
"the",
"contents",
"of",
"an",
"Android",
"NOTICE",
"file",
"for",
"the",
"third",
"-",
"party",
"code",
".",
"This",
"is",
"used",
"by",
"the",
"snapshot",
"tool",
".",
"Returns",
":",
"The",
"contents",
"of",
"the",
"NOTICE",
"file",
"."
] | def GenerateNoticeFile():
"""Generates the contents of an Android NOTICE file for the third-party code.
This is used by the snapshot tool.
Returns:
The contents of the NOTICE file.
"""
third_party_dirs = _FindThirdPartyDirs()
# Don't forget Chromium's LICENSE file
content = [_ReadFile('LICENSE')]
... | [
"def",
"GenerateNoticeFile",
"(",
")",
":",
"third_party_dirs",
"=",
"_FindThirdPartyDirs",
"(",
")",
"# Don't forget Chromium's LICENSE file",
"content",
"=",
"[",
"_ReadFile",
"(",
"'LICENSE'",
")",
"]",
"# We provide attribution for all third-party directories.",
"# TODO(s... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/android_webview/tools/webview_licenses.py#L267-L288 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | third_party/closure_linter/closure_linter/checkerbase.py | python | CheckerBase.HandleError | (self, code, message, token, position=None,
fix_data=None) | Prints out the given error message including a line number.
Args:
code: The error code.
message: The error to print.
token: The token where the error occurred, or None if it was a file-wide
issue.
position: The position of the error, defaults to None.
fix_data: Metadata used... | Prints out the given error message including a line number. | [
"Prints",
"out",
"the",
"given",
"error",
"message",
"including",
"a",
"line",
"number",
"."
] | def HandleError(self, code, message, token, position=None,
fix_data=None):
"""Prints out the given error message including a line number.
Args:
code: The error code.
message: The error to print.
token: The token where the error occurred, or None if it was a file-wide
... | [
"def",
"HandleError",
"(",
"self",
",",
"code",
",",
"message",
",",
"token",
",",
"position",
"=",
"None",
",",
"fix_data",
"=",
"None",
")",
":",
"self",
".",
"_has_errors",
"=",
"True",
"self",
".",
"_error_handler",
".",
"HandleError",
"(",
"error",
... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/third_party/closure_linter/closure_linter/checkerbase.py#L127-L141 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/reduction_gui/widgets/sans/sans_catalog.py | python | SANSCatalogWidget.tableWidgetContext | (self, point) | Create a menu for the tableWidget and associated actions | Create a menu for the tableWidget and associated actions | [
"Create",
"a",
"menu",
"for",
"the",
"tableWidget",
"and",
"associated",
"actions"
] | def tableWidgetContext(self, point):
'''Create a menu for the tableWidget and associated actions'''
tw_menu = QMenu("Menu", self)
tw_menu.addAction(self.copyAction)
tw_menu.exec_(self.mapToGlobal(point)) | [
"def",
"tableWidgetContext",
"(",
"self",
",",
"point",
")",
":",
"tw_menu",
"=",
"QMenu",
"(",
"\"Menu\"",
",",
"self",
")",
"tw_menu",
".",
"addAction",
"(",
"self",
".",
"copyAction",
")",
"tw_menu",
".",
"exec_",
"(",
"self",
".",
"mapToGlobal",
"(",... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/reduction_gui/widgets/sans/sans_catalog.py#L72-L76 | ||
RobotLocomotion/drake | 0e18a34604c45ed65bc9018a54f7610f91cdad5b | doc/styleguide/build.py | python | _add_title | (*, temp_dir, filename, title) | Adds a header to a Markdown file so that we can build it with Jekyll
directly, without using the GitHub Pages infrastructure.
The original file is replaced. | Adds a header to a Markdown file so that we can build it with Jekyll
directly, without using the GitHub Pages infrastructure.
The original file is replaced. | [
"Adds",
"a",
"header",
"to",
"a",
"Markdown",
"file",
"so",
"that",
"we",
"can",
"build",
"it",
"with",
"Jekyll",
"directly",
"without",
"using",
"the",
"GitHub",
"Pages",
"infrastructure",
".",
"The",
"original",
"file",
"is",
"replaced",
"."
] | def _add_title(*, temp_dir, filename, title):
"""Adds a header to a Markdown file so that we can build it with Jekyll
directly, without using the GitHub Pages infrastructure.
The original file is replaced.
"""
temp_dir_filename = join(temp_dir, filename)
with open(temp_dir_filename, "r", encodin... | [
"def",
"_add_title",
"(",
"*",
",",
"temp_dir",
",",
"filename",
",",
"title",
")",
":",
"temp_dir_filename",
"=",
"join",
"(",
"temp_dir",
",",
"filename",
")",
"with",
"open",
"(",
"temp_dir_filename",
",",
"\"r\"",
",",
"encoding",
"=",
"\"utf-8\"",
")"... | https://github.com/RobotLocomotion/drake/blob/0e18a34604c45ed65bc9018a54f7610f91cdad5b/doc/styleguide/build.py#L13-L28 | ||
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | src/ceph-volume/ceph_volume/devices/simple/activate.py | python | Activate.validate_devices | (self, json_config) | ``json_config`` is the loaded dictionary coming from the JSON file. It is usually mixed with
other non-device items, but for sakes of comparison it doesn't really matter. This method is
just making sure that the keys needed exist | ``json_config`` is the loaded dictionary coming from the JSON file. It is usually mixed with
other non-device items, but for sakes of comparison it doesn't really matter. This method is
just making sure that the keys needed exist | [
"json_config",
"is",
"the",
"loaded",
"dictionary",
"coming",
"from",
"the",
"JSON",
"file",
".",
"It",
"is",
"usually",
"mixed",
"with",
"other",
"non",
"-",
"device",
"items",
"but",
"for",
"sakes",
"of",
"comparison",
"it",
"doesn",
"t",
"really",
"matt... | def validate_devices(self, json_config):
"""
``json_config`` is the loaded dictionary coming from the JSON file. It is usually mixed with
other non-device items, but for sakes of comparison it doesn't really matter. This method is
just making sure that the keys needed exist
"""
... | [
"def",
"validate_devices",
"(",
"self",
",",
"json_config",
")",
":",
"devices",
"=",
"json_config",
".",
"keys",
"(",
")",
"try",
":",
"objectstore",
"=",
"json_config",
"[",
"'type'",
"]",
"except",
"KeyError",
":",
"if",
"{",
"'data'",
",",
"'journal'",... | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/src/ceph-volume/ceph_volume/devices/simple/activate.py#L29-L71 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/urllib3/util/timeout.py | python | Timeout.read_timeout | (self) | Get the value for the read timeout.
This assumes some time has elapsed in the connection timeout and
computes the read timeout appropriately.
If self.total is set, the read timeout is dependent on the amount of
time taken by the connect timeout. If the connection time has not bee... | Get the value for the read timeout. | [
"Get",
"the",
"value",
"for",
"the",
"read",
"timeout",
"."
] | def read_timeout(self):
"""Get the value for the read timeout.
This assumes some time has elapsed in the connection timeout and
computes the read timeout appropriately.
If self.total is set, the read timeout is dependent on the amount of
time taken by the connect timeout... | [
"def",
"read_timeout",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"total",
"is",
"not",
"None",
"and",
"self",
".",
"total",
"is",
"not",
"self",
".",
"DEFAULT_TIMEOUT",
"and",
"self",
".",
"_read",
"is",
"not",
"None",
"and",
"self",
".",
"_read... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/urllib3/util/timeout.py#L477-L535 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/src/robotsim.py | python | TransformPoser.__init__ | (self) | r"""
__init__(TransformPoser self) -> TransformPoser | r"""
__init__(TransformPoser self) -> TransformPoser | [
"r",
"__init__",
"(",
"TransformPoser",
"self",
")",
"-",
">",
"TransformPoser"
] | def __init__(self):
r"""
__init__(TransformPoser self) -> TransformPoser
"""
_robotsim.TransformPoser_swiginit(self, _robotsim.new_TransformPoser()) | [
"def",
"__init__",
"(",
"self",
")",
":",
"_robotsim",
".",
"TransformPoser_swiginit",
"(",
"self",
",",
"_robotsim",
".",
"new_TransformPoser",
"(",
")",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/src/robotsim.py#L3544-L3550 | ||
wenwei202/caffe | f54a74abaf6951d8485cbdcfa1d74a4c37839466 | scripts/cpp_lint.py | python | CheckBraces | (filename, clean_lines, linenum, error) | Looks for misplaced braces (e.g. at the end of line).
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found. | Looks for misplaced braces (e.g. at the end of line). | [
"Looks",
"for",
"misplaced",
"braces",
"(",
"e",
".",
"g",
".",
"at",
"the",
"end",
"of",
"line",
")",
"."
] | def CheckBraces(filename, clean_lines, linenum, error):
"""Looks for misplaced braces (e.g. at the end of line).
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any er... | [
"def",
"CheckBraces",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"# get rid of comments and strings",
"if",
"Match",
"(",
"r'\\s*{\\s*$'",
",",
"line",
")",
":",
... | https://github.com/wenwei202/caffe/blob/f54a74abaf6951d8485cbdcfa1d74a4c37839466/scripts/cpp_lint.py#L3069-L3240 | ||
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py | python | SBWatchpoint.GetHardwareIndex | (self) | return _lldb.SBWatchpoint_GetHardwareIndex(self) | GetHardwareIndex(self) -> int32_t
With -1 representing an invalid hardware index. | GetHardwareIndex(self) -> int32_t | [
"GetHardwareIndex",
"(",
"self",
")",
"-",
">",
"int32_t"
] | def GetHardwareIndex(self):
"""
GetHardwareIndex(self) -> int32_t
With -1 representing an invalid hardware index.
"""
return _lldb.SBWatchpoint_GetHardwareIndex(self) | [
"def",
"GetHardwareIndex",
"(",
"self",
")",
":",
"return",
"_lldb",
".",
"SBWatchpoint_GetHardwareIndex",
"(",
"self",
")"
] | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py#L12602-L12608 | |
freesurfer/freesurfer | 6dbe527d43ffa611acb2cd112e9469f9bfec8e36 | python/freesurfer/utils/legacy.py | python | check_subjdirs | () | return os.environ['SUBJECTS_DIR'] | Quit if SUBJECTS_DIR is not defined as an environment variable. This is not
a function which returns a boolean. Execution is stopped if not found.
If found, returns the SUBJECTS_DIR | Quit if SUBJECTS_DIR is not defined as an environment variable. This is not
a function which returns a boolean. Execution is stopped if not found.
If found, returns the SUBJECTS_DIR | [
"Quit",
"if",
"SUBJECTS_DIR",
"is",
"not",
"defined",
"as",
"an",
"environment",
"variable",
".",
"This",
"is",
"not",
"a",
"function",
"which",
"returns",
"a",
"boolean",
".",
"Execution",
"is",
"stopped",
"if",
"not",
"found",
".",
"If",
"found",
"return... | def check_subjdirs():
"""
Quit if SUBJECTS_DIR is not defined as an environment variable. This is not
a function which returns a boolean. Execution is stopped if not found.
If found, returns the SUBJECTS_DIR
"""
if 'SUBJECTS_DIR' not in os.environ:
print('ERROR: SUBJECTS_DIR environment ... | [
"def",
"check_subjdirs",
"(",
")",
":",
"if",
"'SUBJECTS_DIR'",
"not",
"in",
"os",
".",
"environ",
":",
"print",
"(",
"'ERROR: SUBJECTS_DIR environment variable not defined!'",
")",
"sys",
".",
"exit",
"(",
"1",
")",
"return",
"os",
".",
"environ",
"[",
"'SUBJ... | https://github.com/freesurfer/freesurfer/blob/6dbe527d43ffa611acb2cd112e9469f9bfec8e36/python/freesurfer/utils/legacy.py#L40-L49 | |
smilehao/xlua-framework | a03801538be2b0e92d39332d445b22caca1ef61f | ConfigData/trunk/tools/protobuf-2.5.0/protobuf-2.5.0/python/build/lib/google/protobuf/text_format.py | python | _Tokenizer._ConsumeSingleByteString | (self) | return result | Consume one token of a string literal.
String literals (whether bytes or text) can come in multiple adjacent
tokens which are automatically concatenated, like in C or Python. This
method only consumes one token. | Consume one token of a string literal. | [
"Consume",
"one",
"token",
"of",
"a",
"string",
"literal",
"."
] | def _ConsumeSingleByteString(self):
"""Consume one token of a string literal.
String literals (whether bytes or text) can come in multiple adjacent
tokens which are automatically concatenated, like in C or Python. This
method only consumes one token.
"""
text = self.token
if len(text) < 1 ... | [
"def",
"_ConsumeSingleByteString",
"(",
"self",
")",
":",
"text",
"=",
"self",
".",
"token",
"if",
"len",
"(",
"text",
")",
"<",
"1",
"or",
"text",
"[",
"0",
"]",
"not",
"in",
"(",
"'\\''",
",",
"'\"'",
")",
":",
"raise",
"self",
".",
"_ParseError"... | https://github.com/smilehao/xlua-framework/blob/a03801538be2b0e92d39332d445b22caca1ef61f/ConfigData/trunk/tools/protobuf-2.5.0/protobuf-2.5.0/python/build/lib/google/protobuf/text_format.py#L520-L539 | |
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/idl/idl/binder.py | python | _bind_command_type | (ctxt, parsed_spec, command) | return ast_field | Bind the type field in a command as the first field. | Bind the type field in a command as the first field. | [
"Bind",
"the",
"type",
"field",
"in",
"a",
"command",
"as",
"the",
"first",
"field",
"."
] | def _bind_command_type(ctxt, parsed_spec, command):
# type: (errors.ParserContext, syntax.IDLSpec, syntax.Command) -> ast.Field
"""Bind the type field in a command as the first field."""
# pylint: disable=too-many-branches,too-many-statements
ast_field = ast.Field(command.file_name, command.line, comman... | [
"def",
"_bind_command_type",
"(",
"ctxt",
",",
"parsed_spec",
",",
"command",
")",
":",
"# type: (errors.ParserContext, syntax.IDLSpec, syntax.Command) -> ast.Field",
"# pylint: disable=too-many-branches,too-many-statements",
"ast_field",
"=",
"ast",
".",
"Field",
"(",
"command",... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/idl/idl/binder.py#L473-L527 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/imaplib.py | python | IMAP4.socket | (self) | return self.sock | Return socket instance used to connect to IMAP4 server.
socket = <instance>.socket() | Return socket instance used to connect to IMAP4 server. | [
"Return",
"socket",
"instance",
"used",
"to",
"connect",
"to",
"IMAP4",
"server",
"."
] | def socket(self):
"""Return socket instance used to connect to IMAP4 server.
socket = <instance>.socket()
"""
return self.sock | [
"def",
"socket",
"(",
"self",
")",
":",
"return",
"self",
".",
"sock"
] | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/imaplib.py#L254-L259 | |
polyworld/polyworld | eb7e6bbc82fe77ba79e3bc48c3da2ad8c8238c26 | scripts/networkx_extensions.py | python | characteristic_path_length | (G, weighted=False) | Return the characteristic path length.
Parameters
----------
G : NetworkX graph
weighted : bool, optional, default=False
If true use edge weights on path. If False,
use 1 as the edge distance.
Examples
--------
>>> G=nx.path_graph(4)
>>> print nx.average_shortest_path_length(G)
1.25 | Return the characteristic path length. | [
"Return",
"the",
"characteristic",
"path",
"length",
"."
] | def characteristic_path_length(G, weighted=False):
""" Return the characteristic path length.
Parameters
----------
G : NetworkX graph
weighted : bool, optional, default=False
If true use edge weights on path. If False,
use 1 as the edge distance.
Examples
--------
>>> G=nx.path_graph(4)
>>> print... | [
"def",
"characteristic_path_length",
"(",
"G",
",",
"weighted",
"=",
"False",
")",
":",
"if",
"weighted",
":",
"path_length",
"=",
"nx",
".",
"single_source_dijkstra_path_length",
"else",
":",
"path_length",
"=",
"nx",
".",
"single_source_shortest_path_length",
"num... | https://github.com/polyworld/polyworld/blob/eb7e6bbc82fe77ba79e3bc48c3da2ad8c8238c26/scripts/networkx_extensions.py#L137-L172 | ||
qboticslabs/mastering_ros | d83e78f30acc45b0f18522c1d5fae3a7f52974b9 | chapter_4_codes/seven_dof_arm_gazebo/scripts/pick_and_place.py | python | Pick_Place._create_place_goal | (self, group, target, places) | return goal | Create a MoveIt! PlaceGoal | Create a MoveIt! PlaceGoal | [
"Create",
"a",
"MoveIt!",
"PlaceGoal"
] | def _create_place_goal(self, group, target, places):
"""
Create a MoveIt! PlaceGoal
"""
# Create goal:
goal = PlaceGoal()
goal.group_name = group
goal.attached_object_name = target
goal.place_locations.extend(places)
# Configure goal ... | [
"def",
"_create_place_goal",
"(",
"self",
",",
"group",
",",
"target",
",",
"places",
")",
":",
"# Create goal:",
"goal",
"=",
"PlaceGoal",
"(",
")",
"goal",
".",
"group_name",
"=",
"group",
"goal",
".",
"attached_object_name",
"=",
"target",
"goal",
".",
... | https://github.com/qboticslabs/mastering_ros/blob/d83e78f30acc45b0f18522c1d5fae3a7f52974b9/chapter_4_codes/seven_dof_arm_gazebo/scripts/pick_and_place.py#L273-L295 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/_pydecimal.py | python | Context.quantize | (self, a, b) | return a.quantize(b, context=self) | Returns a value equal to 'a' (rounded), having the exponent of 'b'.
The coefficient of the result is derived from that of the left-hand
operand. It may be rounded using the current rounding setting (if the
exponent is being increased), multiplied by a positive power of ten (if
the expo... | Returns a value equal to 'a' (rounded), having the exponent of 'b'. | [
"Returns",
"a",
"value",
"equal",
"to",
"a",
"(",
"rounded",
")",
"having",
"the",
"exponent",
"of",
"b",
"."
] | def quantize(self, a, b):
"""Returns a value equal to 'a' (rounded), having the exponent of 'b'.
The coefficient of the result is derived from that of the left-hand
operand. It may be rounded using the current rounding setting (if the
exponent is being increased), multiplied by a posit... | [
"def",
"quantize",
"(",
"self",
",",
"a",
",",
"b",
")",
":",
"a",
"=",
"_convert_other",
"(",
"a",
",",
"raiseit",
"=",
"True",
")",
"return",
"a",
".",
"quantize",
"(",
"b",
",",
"context",
"=",
"self",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/_pydecimal.py#L5221-L5277 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/external/bazel_tools/third_party/py/gflags/__init__.py | python | _WriteSimpleXMLElement | (outfile, name, value, indent) | Writes a simple XML element.
Args:
outfile: File object we write the XML element to.
name: A string, the name of XML element.
value: A Python object, whose string representation will be used
as the value of the XML element.
indent: A string, prepended to each line of generated output. | Writes a simple XML element. | [
"Writes",
"a",
"simple",
"XML",
"element",
"."
] | def _WriteSimpleXMLElement(outfile, name, value, indent):
"""Writes a simple XML element.
Args:
outfile: File object we write the XML element to.
name: A string, the name of XML element.
value: A Python object, whose string representation will be used
as the value of the XML element.
indent: ... | [
"def",
"_WriteSimpleXMLElement",
"(",
"outfile",
",",
"name",
",",
"value",
",",
"indent",
")",
":",
"value_str",
"=",
"_StrOrUnicode",
"(",
"value",
")",
"if",
"isinstance",
"(",
"value",
",",
"bool",
")",
":",
"# Display boolean values as the C++ flag library do... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/external/bazel_tools/third_party/py/gflags/__init__.py#L1789-L1804 | ||
naver/sling | 5671cd445a2caae0b4dd0332299e4cfede05062c | webkit/Tools/Scripts/webkitpy/thirdparty/mod_pywebsocket/common.py | python | format_extensions | (extension_list) | return ', '.join(formatted_extension_list) | Formats a list of ExtensionParameter objects. | Formats a list of ExtensionParameter objects. | [
"Formats",
"a",
"list",
"of",
"ExtensionParameter",
"objects",
"."
] | def format_extensions(extension_list):
"""Formats a list of ExtensionParameter objects."""
formatted_extension_list = []
for extension in extension_list:
formatted_extension_list.append(format_extension(extension))
return ', '.join(formatted_extension_list) | [
"def",
"format_extensions",
"(",
"extension_list",
")",
":",
"formatted_extension_list",
"=",
"[",
"]",
"for",
"extension",
"in",
"extension_list",
":",
"formatted_extension_list",
".",
"append",
"(",
"format_extension",
"(",
"extension",
")",
")",
"return",
"', '",... | https://github.com/naver/sling/blob/5671cd445a2caae0b4dd0332299e4cfede05062c/webkit/Tools/Scripts/webkitpy/thirdparty/mod_pywebsocket/common.py#L298-L304 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/tools/gyp/pylib/gyp/input.py | python | TurnIntIntoStrInDict | (the_dict) | Given dict the_dict, recursively converts all integers into strings. | Given dict the_dict, recursively converts all integers into strings. | [
"Given",
"dict",
"the_dict",
"recursively",
"converts",
"all",
"integers",
"into",
"strings",
"."
] | def TurnIntIntoStrInDict(the_dict):
"""Given dict the_dict, recursively converts all integers into strings.
"""
# Use items instead of iteritems because there's no need to try to look at
# reinserted keys and their associated values.
for k, v in the_dict.items():
if type(v) is int:
... | [
"def",
"TurnIntIntoStrInDict",
"(",
"the_dict",
")",
":",
"# Use items instead of iteritems because there's no need to try to look at",
"# reinserted keys and their associated values.",
"for",
"k",
",",
"v",
"in",
"the_dict",
".",
"items",
"(",
")",
":",
"if",
"type",
"(",
... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/gyp/pylib/gyp/input.py#L2862-L2878 | ||
google-ar/WebARonTango | e86965d2cbc652156b480e0fcf77c716745578cd | chromium/src/gpu/command_buffer/build_gles2_cmd_buffer.py | python | Argument.GetArgAccessor | (self) | return self.name | Returns the name of the accessor for the argument within the struct. | Returns the name of the accessor for the argument within the struct. | [
"Returns",
"the",
"name",
"of",
"the",
"accessor",
"for",
"the",
"argument",
"within",
"the",
"struct",
"."
] | def GetArgAccessor(self):
"""Returns the name of the accessor for the argument within the struct."""
return self.name | [
"def",
"GetArgAccessor",
"(",
"self",
")",
":",
"return",
"self",
".",
"name"
] | https://github.com/google-ar/WebARonTango/blob/e86965d2cbc652156b480e0fcf77c716745578cd/chromium/src/gpu/command_buffer/build_gles2_cmd_buffer.py#L8587-L8589 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/core/arrays/datetimes.py | python | DatetimeArray.tz_convert | (self, tz) | return self._simple_new(self._ndarray, dtype=dtype, freq=self.freq) | Convert tz-aware Datetime Array/Index from one time zone to another.
Parameters
----------
tz : str, pytz.timezone, dateutil.tz.tzfile or None
Time zone for time. Corresponding timestamps would be converted
to this time zone of the Datetime Array/Index. A `tz` of None wi... | Convert tz-aware Datetime Array/Index from one time zone to another. | [
"Convert",
"tz",
"-",
"aware",
"Datetime",
"Array",
"/",
"Index",
"from",
"one",
"time",
"zone",
"to",
"another",
"."
] | def tz_convert(self, tz) -> DatetimeArray:
"""
Convert tz-aware Datetime Array/Index from one time zone to another.
Parameters
----------
tz : str, pytz.timezone, dateutil.tz.tzfile or None
Time zone for time. Corresponding timestamps would be converted
t... | [
"def",
"tz_convert",
"(",
"self",
",",
"tz",
")",
"->",
"DatetimeArray",
":",
"tz",
"=",
"timezones",
".",
"maybe_get_tz",
"(",
"tz",
")",
"if",
"self",
".",
"tz",
"is",
"None",
":",
"# tz naive, use tz_localize",
"raise",
"TypeError",
"(",
"\"Cannot convert... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/arrays/datetimes.py#L787-L861 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pytz/tzinfo.py | python | StaticTzInfo.localize | (self, dt, is_dst=False) | return dt.replace(tzinfo=self) | Convert naive time to local time | Convert naive time to local time | [
"Convert",
"naive",
"time",
"to",
"local",
"time"
] | def localize(self, dt, is_dst=False):
'''Convert naive time to local time'''
if dt.tzinfo is not None:
raise ValueError('Not naive datetime (tzinfo is already set)')
return dt.replace(tzinfo=self) | [
"def",
"localize",
"(",
"self",
",",
"dt",
",",
"is_dst",
"=",
"False",
")",
":",
"if",
"dt",
".",
"tzinfo",
"is",
"not",
"None",
":",
"raise",
"ValueError",
"(",
"'Not naive datetime (tzinfo is already set)'",
")",
"return",
"dt",
".",
"replace",
"(",
"tz... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pytz/tzinfo.py#L112-L116 | |
ValveSoftware/source-sdk-2013 | 0d8dceea4310fde5706b3ce1c70609d72a38efdf | mp/src/thirdparty/protobuf-2.3.0/python/mox.py | python | MockMethod.MultipleTimes | (self, group_name="default") | return self._CheckAndCreateNewGroup(group_name, MultipleTimesGroup) | Move this method into group of calls which may be called multiple times.
A group of repeating calls must be defined together, and must be executed in
full before the next expected mehtod can be called.
Args:
group_name: the name of the unordered group.
Returns:
self | Move this method into group of calls which may be called multiple times. | [
"Move",
"this",
"method",
"into",
"group",
"of",
"calls",
"which",
"may",
"be",
"called",
"multiple",
"times",
"."
] | def MultipleTimes(self, group_name="default"):
"""Move this method into group of calls which may be called multiple times.
A group of repeating calls must be defined together, and must be executed in
full before the next expected mehtod can be called.
Args:
group_name: the name of the unordered ... | [
"def",
"MultipleTimes",
"(",
"self",
",",
"group_name",
"=",
"\"default\"",
")",
":",
"return",
"self",
".",
"_CheckAndCreateNewGroup",
"(",
"group_name",
",",
"MultipleTimesGroup",
")"
] | https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/mp/src/thirdparty/protobuf-2.3.0/python/mox.py#L704-L716 | |
MegEngine/MegEngine | ce9ad07a27ec909fb8db4dd67943d24ba98fb93a | imperative/python/megengine/functional/tensor.py | python | flatten | (inp: Tensor, start_axis: int = 0, end_axis: int = -1) | return inp.reshape(*target_shape) | r"""Reshapes the tensor by flattening the sub-tensor from dimension ``start_axis`` to dimension ``end_axis``.
Args:
inp: input tensor.
start_axis: start dimension that the sub-tensor to be flattened. Default: 0
end_axis: end dimension that the sub-tensor to be flattened. Default: -1
Re... | r"""Reshapes the tensor by flattening the sub-tensor from dimension ``start_axis`` to dimension ``end_axis``. | [
"r",
"Reshapes",
"the",
"tensor",
"by",
"flattening",
"the",
"sub",
"-",
"tensor",
"from",
"dimension",
"start_axis",
"to",
"dimension",
"end_axis",
"."
] | def flatten(inp: Tensor, start_axis: int = 0, end_axis: int = -1) -> Tensor:
r"""Reshapes the tensor by flattening the sub-tensor from dimension ``start_axis`` to dimension ``end_axis``.
Args:
inp: input tensor.
start_axis: start dimension that the sub-tensor to be flattened. Default: 0
... | [
"def",
"flatten",
"(",
"inp",
":",
"Tensor",
",",
"start_axis",
":",
"int",
"=",
"0",
",",
"end_axis",
":",
"int",
"=",
"-",
"1",
")",
"->",
"Tensor",
":",
"target_shape",
"=",
"tuple",
"(",
"inp",
".",
"shape",
"[",
"i",
"]",
"for",
"i",
"in",
... | https://github.com/MegEngine/MegEngine/blob/ce9ad07a27ec909fb8db4dd67943d24ba98fb93a/imperative/python/megengine/functional/tensor.py#L914-L951 | |
Tencent/CMONGO | c40380caa14e05509f46993aa8b8da966b09b0b5 | buildscripts/cpplint.py | python | IsRValueAllowed | (clean_lines, linenum) | return False | Check if RValue reference is allowed on a particular line.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
Returns:
True if line is within the region where RValue references are allowed. | Check if RValue reference is allowed on a particular line. | [
"Check",
"if",
"RValue",
"reference",
"is",
"allowed",
"on",
"a",
"particular",
"line",
"."
] | def IsRValueAllowed(clean_lines, linenum):
"""Check if RValue reference is allowed on a particular line.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
Returns:
True if line is within the region where RValue references are allowed.
"""
#... | [
"def",
"IsRValueAllowed",
"(",
"clean_lines",
",",
"linenum",
")",
":",
"# Allow region marked by PUSH/POP macros",
"for",
"i",
"in",
"xrange",
"(",
"linenum",
",",
"0",
",",
"-",
"1",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"i",
"]",
"if... | https://github.com/Tencent/CMONGO/blob/c40380caa14e05509f46993aa8b8da966b09b0b5/buildscripts/cpplint.py#L3633-L3672 | |
google/shaka-player-embedded | dabbeb5b47cc257b37b9a254661546352aaf0afe | shaka/tools/webidl/webidl/parser.py | python | IdlParser._check_options | (self, p, idx, feature) | Checks that the given feature is allowed, and adds an error otherwise. | Checks that the given feature is allowed, and adds an error otherwise. | [
"Checks",
"that",
"the",
"given",
"feature",
"is",
"allowed",
"and",
"adds",
"an",
"error",
"otherwise",
"."
] | def _check_options(self, p, idx, feature):
"""Checks that the given feature is allowed, and adds an error otherwise."""
if self.options.has_feature(feature):
return
self._add_error('Feature "%s" is not allowed by options' % feature,
p.lineno(idx), p.lexpos(idx)) | [
"def",
"_check_options",
"(",
"self",
",",
"p",
",",
"idx",
",",
"feature",
")",
":",
"if",
"self",
".",
"options",
".",
"has_feature",
"(",
"feature",
")",
":",
"return",
"self",
".",
"_add_error",
"(",
"'Feature \"%s\" is not allowed by options'",
"%",
"fe... | https://github.com/google/shaka-player-embedded/blob/dabbeb5b47cc257b37b9a254661546352aaf0afe/shaka/tools/webidl/webidl/parser.py#L705-L710 | ||
daijifeng001/caffe-rfcn | 543f8f6a4b7c88256ea1445ae951a12d1ad9cffd | tools/extra/extract_seconds.py | python | get_log_created_year | (input_file) | return log_created_year | Get year from log file system timestamp | Get year from log file system timestamp | [
"Get",
"year",
"from",
"log",
"file",
"system",
"timestamp"
] | def get_log_created_year(input_file):
"""Get year from log file system timestamp
"""
log_created_time = os.path.getctime(input_file)
log_created_year = datetime.datetime.fromtimestamp(log_created_time).year
return log_created_year | [
"def",
"get_log_created_year",
"(",
"input_file",
")",
":",
"log_created_time",
"=",
"os",
".",
"path",
".",
"getctime",
"(",
"input_file",
")",
"log_created_year",
"=",
"datetime",
".",
"datetime",
".",
"fromtimestamp",
"(",
"log_created_time",
")",
".",
"year"... | https://github.com/daijifeng001/caffe-rfcn/blob/543f8f6a4b7c88256ea1445ae951a12d1ad9cffd/tools/extra/extract_seconds.py#L22-L28 | |
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py | python | xmlEntity.handleEntity | (self, ctxt) | Default handling of defined entities, when should we define
a new input stream ? When do we just handle that as a set
of chars ? OBSOLETE: to be removed at some point. | Default handling of defined entities, when should we define
a new input stream ? When do we just handle that as a set
of chars ? OBSOLETE: to be removed at some point. | [
"Default",
"handling",
"of",
"defined",
"entities",
"when",
"should",
"we",
"define",
"a",
"new",
"input",
"stream",
"?",
"When",
"do",
"we",
"just",
"handle",
"that",
"as",
"a",
"set",
"of",
"chars",
"?",
"OBSOLETE",
":",
"to",
"be",
"removed",
"at",
... | def handleEntity(self, ctxt):
"""Default handling of defined entities, when should we define
a new input stream ? When do we just handle that as a set
of chars ? OBSOLETE: to be removed at some point. """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
libxm... | [
"def",
"handleEntity",
"(",
"self",
",",
"ctxt",
")",
":",
"if",
"ctxt",
"is",
"None",
":",
"ctxt__o",
"=",
"None",
"else",
":",
"ctxt__o",
"=",
"ctxt",
".",
"_o",
"libxml2mod",
".",
"xmlHandleEntity",
"(",
"ctxt__o",
",",
"self",
".",
"_o",
")"
] | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py#L5799-L5805 | ||
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py | python | SBLineEntry.__init__ | (self, *args) | __init__(self) -> SBLineEntry
__init__(self, SBLineEntry rhs) -> SBLineEntry | __init__(self) -> SBLineEntry
__init__(self, SBLineEntry rhs) -> SBLineEntry | [
"__init__",
"(",
"self",
")",
"-",
">",
"SBLineEntry",
"__init__",
"(",
"self",
"SBLineEntry",
"rhs",
")",
"-",
">",
"SBLineEntry"
] | def __init__(self, *args):
"""
__init__(self) -> SBLineEntry
__init__(self, SBLineEntry rhs) -> SBLineEntry
"""
this = _lldb.new_SBLineEntry(*args)
try: self.this.append(this)
except: self.this = this | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
")",
":",
"this",
"=",
"_lldb",
".",
"new_SBLineEntry",
"(",
"*",
"args",
")",
"try",
":",
"self",
".",
"this",
".",
"append",
"(",
"this",
")",
"except",
":",
"self",
".",
"this",
"=",
"this"
] | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py#L5612-L5619 | ||
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py | python | Writer.AddConfig | (self, name) | Adds a configuration to the project.
Args:
name: Configuration name. | Adds a configuration to the project. | [
"Adds",
"a",
"configuration",
"to",
"the",
"project",
"."
] | def AddConfig(self, name):
"""Adds a configuration to the project.
Args:
name: Configuration name.
"""
self.configurations[name] = ["Configuration", {"Name": name}] | [
"def",
"AddConfig",
"(",
"self",
",",
"name",
")",
":",
"self",
".",
"configurations",
"[",
"name",
"]",
"=",
"[",
"\"Configuration\"",
",",
"{",
"\"Name\"",
":",
"name",
"}",
"]"
] | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py#L72-L78 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.