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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/platform/tf_logging.py | python | log_if | (level, msg, condition, *args) | Log 'msg % args' at level 'level' only if condition is fulfilled. | Log 'msg % args' at level 'level' only if condition is fulfilled. | [
"Log",
"msg",
"%",
"args",
"at",
"level",
"level",
"only",
"if",
"condition",
"is",
"fulfilled",
"."
] | def log_if(level, msg, condition, *args):
"""Log 'msg % args' at level 'level' only if condition is fulfilled."""
if condition:
vlog(level, msg, *args) | [
"def",
"log_if",
"(",
"level",
",",
"msg",
",",
"condition",
",",
"*",
"args",
")",
":",
"if",
"condition",
":",
"vlog",
"(",
"level",
",",
"msg",
",",
"*",
"args",
")"
] | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/platform/tf_logging.py#L170-L173 | ||
bumptop/BumpTop | 466d23597a07ae738f4265262fa01087fc6e257c | trunk/win/Source/bin/jinja2/visitor.py | python | NodeVisitor.generic_visit | (self, node, *args, **kwargs) | Called if no explicit visitor function exists for a node. | Called if no explicit visitor function exists for a node. | [
"Called",
"if",
"no",
"explicit",
"visitor",
"function",
"exists",
"for",
"a",
"node",
"."
] | def generic_visit(self, node, *args, **kwargs):
"""Called if no explicit visitor function exists for a node."""
for node in node.iter_child_nodes():
self.visit(node, *args, **kwargs) | [
"def",
"generic_visit",
"(",
"self",
",",
"node",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"node",
"in",
"node",
".",
"iter_child_nodes",
"(",
")",
":",
"self",
".",
"visit",
"(",
"node",
",",
"*",
"args",
",",
"*",
"*",
"kwarg... | https://github.com/bumptop/BumpTop/blob/466d23597a07ae738f4265262fa01087fc6e257c/trunk/win/Source/bin/jinja2/visitor.py#L41-L44 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/Paste/paste/url.py | python | URLResource.setvars | (self, **kw) | return self.__class__(self.url, vars=kw.items(),
attrs=self.attrs,
params=self.original_params) | Creates a copy of this URL, but with all the variables set/reset
(like .setvar(), except clears past variables at the same time) | Creates a copy of this URL, but with all the variables set/reset
(like .setvar(), except clears past variables at the same time) | [
"Creates",
"a",
"copy",
"of",
"this",
"URL",
"but",
"with",
"all",
"the",
"variables",
"set",
"/",
"reset",
"(",
"like",
".",
"setvar",
"()",
"except",
"clears",
"past",
"variables",
"at",
"the",
"same",
"time",
")"
] | def setvars(self, **kw):
"""
Creates a copy of this URL, but with all the variables set/reset
(like .setvar(), except clears past variables at the same time)
"""
return self.__class__(self.url, vars=kw.items(),
attrs=self.attrs,
... | [
"def",
"setvars",
"(",
"self",
",",
"*",
"*",
"kw",
")",
":",
"return",
"self",
".",
"__class__",
"(",
"self",
".",
"url",
",",
"vars",
"=",
"kw",
".",
"items",
"(",
")",
",",
"attrs",
"=",
"self",
".",
"attrs",
",",
"params",
"=",
"self",
".",... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/Paste/paste/url.py#L166-L173 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/html.py | python | HtmlHelpController.FindTopLevelWindow | (*args, **kwargs) | return _html.HtmlHelpController_FindTopLevelWindow(*args, **kwargs) | FindTopLevelWindow(self) -> Window | FindTopLevelWindow(self) -> Window | [
"FindTopLevelWindow",
"(",
"self",
")",
"-",
">",
"Window"
] | def FindTopLevelWindow(*args, **kwargs):
"""FindTopLevelWindow(self) -> Window"""
return _html.HtmlHelpController_FindTopLevelWindow(*args, **kwargs) | [
"def",
"FindTopLevelWindow",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_html",
".",
"HtmlHelpController_FindTopLevelWindow",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/html.py#L2006-L2008 | |
arangodb/arangodb | 0d658689c7d1b721b314fa3ca27d38303e1570c8 | 3rdParty/V8/gyp/lib/ninja_syntax.py | python | Writer._line | (self, text, indent=0) | Write 'text' word-wrapped at self.width characters. | Write 'text' word-wrapped at self.width characters. | [
"Write",
"text",
"word",
"-",
"wrapped",
"at",
"self",
".",
"width",
"characters",
"."
] | def _line(self, text, indent=0):
"""Write 'text' word-wrapped at self.width characters."""
leading_space = ' ' * indent
while len(leading_space) + len(text) > self.width:
# The text is too wide; wrap if possible.
# Find the rightmost space that would obey our width cons... | [
"def",
"_line",
"(",
"self",
",",
"text",
",",
"indent",
"=",
"0",
")",
":",
"leading_space",
"=",
"' '",
"*",
"indent",
"while",
"len",
"(",
"leading_space",
")",
"+",
"len",
"(",
"text",
")",
">",
"self",
".",
"width",
":",
"# The text is too wide; ... | https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/V8/gyp/lib/ninja_syntax.py#L111-L145 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/ed_basewin.py | python | EDBaseFileTree.OnDestroy | (self, event) | Cleanup message handlers | Cleanup message handlers | [
"Cleanup",
"message",
"handlers"
] | def OnDestroy(self, event):
"""Cleanup message handlers"""
if self:
ed_msg.Unsubscribe(self.OnActivateMsg)
self.DoOnDestroy()
event.Skip() | [
"def",
"OnDestroy",
"(",
"self",
",",
"event",
")",
":",
"if",
"self",
":",
"ed_msg",
".",
"Unsubscribe",
"(",
"self",
".",
"OnActivateMsg",
")",
"self",
".",
"DoOnDestroy",
"(",
")",
"event",
".",
"Skip",
"(",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/ed_basewin.py#L68-L73 | ||
PrincetonUniversity/athena-public-version | 9c266692b9423743d8e23509b3ab266a232a92d2 | tst/style/cpplint.py | python | CheckForBadCharacters | (filename, lines, error) | Logs an error for each line containing bad characters.
Two kinds of bad characters:
1. Unicode replacement characters: These indicate that either the file
contained invalid UTF-8 (likely) or Unicode replacement characters (which
it shouldn't). Note that it's possible for this to throw off line
nu... | Logs an error for each line containing bad characters. | [
"Logs",
"an",
"error",
"for",
"each",
"line",
"containing",
"bad",
"characters",
"."
] | def CheckForBadCharacters(filename, lines, error):
"""Logs an error for each line containing bad characters.
Two kinds of bad characters:
1. Unicode replacement characters: These indicate that either the file
contained invalid UTF-8 (likely) or Unicode replacement characters (which
it shouldn't). ... | [
"def",
"CheckForBadCharacters",
"(",
"filename",
",",
"lines",
",",
"error",
")",
":",
"for",
"linenum",
",",
"line",
"in",
"enumerate",
"(",
"lines",
")",
":",
"if",
"unicode_escape_decode",
"(",
"'\\ufffd'",
")",
"in",
"line",
":",
"error",
"(",
"filenam... | https://github.com/PrincetonUniversity/athena-public-version/blob/9c266692b9423743d8e23509b3ab266a232a92d2/tst/style/cpplint.py#L2251-L2273 | ||
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | src/pybind/mgr/orchestrator/module.py | python | OrchestratorCli._rgw_add | (self,
svc_id: str,
placement: Optional[str] = None,
_end_positional_: int = 0,
port: Optional[int] = None,
ssl: bool = False,
inbuf: Optional[str] = None) | return self._daemon_add_misc(spec) | Start RGW daemon(s) | Start RGW daemon(s) | [
"Start",
"RGW",
"daemon",
"(",
"s",
")"
] | def _rgw_add(self,
svc_id: str,
placement: Optional[str] = None,
_end_positional_: int = 0,
port: Optional[int] = None,
ssl: bool = False,
inbuf: Optional[str] = None) -> HandleCommandResult:
"""Start RGW daemo... | [
"def",
"_rgw_add",
"(",
"self",
",",
"svc_id",
":",
"str",
",",
"placement",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"_end_positional_",
":",
"int",
"=",
"0",
",",
"port",
":",
"Optional",
"[",
"int",
"]",
"=",
"None",
",",
"ssl",
":",
... | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/src/pybind/mgr/orchestrator/module.py#L893-L910 | |
GJDuck/LowFat | ecf6a0f0fa1b73a27a626cf493cc39e477b6faea | llvm-4.0.0.src/tools/clang/utils/check_cfc/check_cfc.py | python | WrapperCheck.__init__ | (self, output_file_a) | Record the base output file that will be compared against. | Record the base output file that will be compared against. | [
"Record",
"the",
"base",
"output",
"file",
"that",
"will",
"be",
"compared",
"against",
"."
] | def __init__(self, output_file_a):
"""Record the base output file that will be compared against."""
self._output_file_a = output_file_a | [
"def",
"__init__",
"(",
"self",
",",
"output_file_a",
")",
":",
"self",
".",
"_output_file_a",
"=",
"output_file_a"
] | https://github.com/GJDuck/LowFat/blob/ecf6a0f0fa1b73a27a626cf493cc39e477b6faea/llvm-4.0.0.src/tools/clang/utils/check_cfc/check_cfc.py#L247-L249 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/mailbox.py | python | _create_carefully | (path) | Create a file if it doesn't exist and open for reading and writing. | Create a file if it doesn't exist and open for reading and writing. | [
"Create",
"a",
"file",
"if",
"it",
"doesn",
"t",
"exist",
"and",
"open",
"for",
"reading",
"and",
"writing",
"."
] | def _create_carefully(path):
"""Create a file if it doesn't exist and open for reading and writing."""
fd = os.open(path, os.O_CREAT | os.O_EXCL | os.O_RDWR, 0666)
try:
return open(path, 'rb+')
finally:
os.close(fd) | [
"def",
"_create_carefully",
"(",
"path",
")",
":",
"fd",
"=",
"os",
".",
"open",
"(",
"path",
",",
"os",
".",
"O_CREAT",
"|",
"os",
".",
"O_EXCL",
"|",
"os",
".",
"O_RDWR",
",",
"0666",
")",
"try",
":",
"return",
"open",
"(",
"path",
",",
"'rb+'"... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/mailbox.py#L2013-L2019 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/docview.py | python | Document.GetPrintableName | (self) | Copies a suitable document name into the supplied name buffer.
The default function uses the title, or if there is no title, uses the
filename; or if no filename, the string 'Untitled'. | Copies a suitable document name into the supplied name buffer.
The default function uses the title, or if there is no title, uses the
filename; or if no filename, the string 'Untitled'. | [
"Copies",
"a",
"suitable",
"document",
"name",
"into",
"the",
"supplied",
"name",
"buffer",
".",
"The",
"default",
"function",
"uses",
"the",
"title",
"or",
"if",
"there",
"is",
"no",
"title",
"uses",
"the",
"filename",
";",
"or",
"if",
"no",
"filename",
... | def GetPrintableName(self):
"""
Copies a suitable document name into the supplied name buffer.
The default function uses the title, or if there is no title, uses the
filename; or if no filename, the string 'Untitled'.
"""
if self._documentTitle:
return self._d... | [
"def",
"GetPrintableName",
"(",
"self",
")",
":",
"if",
"self",
".",
"_documentTitle",
":",
"return",
"self",
".",
"_documentTitle",
"elif",
"self",
".",
"_documentFile",
":",
"return",
"FileNameFromPath",
"(",
"self",
".",
"_documentFile",
")",
"else",
":",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/docview.py#L584-L595 | ||
google-coral/edgetpu | 5020de9386ff370dcc1f63291a2d0f98eeb98adb | benchmarks/imprinting_benchmarks.py | python | run_benchmark | (model) | return training_time | Measures training time for given model with random data.
Args:
model: string, file name of the input model.
Returns:
float, training time. | Measures training time for given model with random data. | [
"Measures",
"training",
"time",
"for",
"given",
"model",
"with",
"random",
"data",
"."
] | def run_benchmark(model):
"""Measures training time for given model with random data.
Args:
model: string, file name of the input model.
Returns:
float, training time.
"""
input_size = input_tensor_size(model)
engine = ImprintingEngine(test_utils.test_data_path(model), keep_classes=False)
np.ra... | [
"def",
"run_benchmark",
"(",
"model",
")",
":",
"input_size",
"=",
"input_tensor_size",
"(",
"model",
")",
"engine",
"=",
"ImprintingEngine",
"(",
"test_utils",
".",
"test_data_path",
"(",
"model",
")",
",",
"keep_classes",
"=",
"False",
")",
"np",
".",
"ran... | https://github.com/google-coral/edgetpu/blob/5020de9386ff370dcc1f63291a2d0f98eeb98adb/benchmarks/imprinting_benchmarks.py#L33-L62 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/tools/inspector_protocol/jinja2/runtime.py | python | LoopContextBase.cycle | (self, *args) | return args[self.index0 % len(args)] | Cycles among the arguments with the current loop index. | Cycles among the arguments with the current loop index. | [
"Cycles",
"among",
"the",
"arguments",
"with",
"the",
"current",
"loop",
"index",
"."
] | def cycle(self, *args):
"""Cycles among the arguments with the current loop index."""
if not args:
raise TypeError('no items for cycling given')
return args[self.index0 % len(args)] | [
"def",
"cycle",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"not",
"args",
":",
"raise",
"TypeError",
"(",
"'no items for cycling given'",
")",
"return",
"args",
"[",
"self",
".",
"index0",
"%",
"len",
"(",
"args",
")",
"]"
] | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/tools/inspector_protocol/jinja2/runtime.py#L366-L370 | |
SequoiaDB/SequoiaDB | 2894ed7e5bd6fe57330afc900cf76d0ff0df9f64 | tools/server/php_linux/libxml2/lib/python2.4/site-packages/libxml2.py | python | uCSIsSpecials | (code) | return ret | Check whether the character is part of Specials UCS Block | Check whether the character is part of Specials UCS Block | [
"Check",
"whether",
"the",
"character",
"is",
"part",
"of",
"Specials",
"UCS",
"Block"
] | def uCSIsSpecials(code):
"""Check whether the character is part of Specials UCS Block """
ret = libxml2mod.xmlUCSIsSpecials(code)
return ret | [
"def",
"uCSIsSpecials",
"(",
"code",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlUCSIsSpecials",
"(",
"code",
")",
"return",
"ret"
] | https://github.com/SequoiaDB/SequoiaDB/blob/2894ed7e5bd6fe57330afc900cf76d0ff0df9f64/tools/server/php_linux/libxml2/lib/python2.4/site-packages/libxml2.py#L2811-L2814 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pkg_resources/__init__.py | python | Environment.__iadd__ | (self, other) | return self | In-place addition of a distribution or environment | In-place addition of a distribution or environment | [
"In",
"-",
"place",
"addition",
"of",
"a",
"distribution",
"or",
"environment"
] | def __iadd__(self, other):
"""In-place addition of a distribution or environment"""
if isinstance(other, Distribution):
self.add(other)
elif isinstance(other, Environment):
for project in other:
for dist in other[project]:
self.add(dist... | [
"def",
"__iadd__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"Distribution",
")",
":",
"self",
".",
"add",
"(",
"other",
")",
"elif",
"isinstance",
"(",
"other",
",",
"Environment",
")",
":",
"for",
"project",
"in",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pkg_resources/__init__.py#L1086-L1096 | |
TGAC/KAT | e8870331de2b4bb0a1b3b91c6afb8fb9d59e9216 | deps/boost/tools/build/src/build/feature.py | python | set_default | (feature, value) | Sets the default value of the given feature, overriding any previous default.
feature: the name of the feature
value: the default value to assign | Sets the default value of the given feature, overriding any previous default.
feature: the name of the feature
value: the default value to assign | [
"Sets",
"the",
"default",
"value",
"of",
"the",
"given",
"feature",
"overriding",
"any",
"previous",
"default",
".",
"feature",
":",
"the",
"name",
"of",
"the",
"feature",
"value",
":",
"the",
"default",
"value",
"to",
"assign"
] | def set_default (feature, value):
""" Sets the default value of the given feature, overriding any previous default.
feature: the name of the feature
value: the default value to assign
"""
f = __all_features[feature]
bad_attribute = None
if f.free:
bad_attribute = "free"
... | [
"def",
"set_default",
"(",
"feature",
",",
"value",
")",
":",
"f",
"=",
"__all_features",
"[",
"feature",
"]",
"bad_attribute",
"=",
"None",
"if",
"f",
".",
"free",
":",
"bad_attribute",
"=",
"\"free\"",
"elif",
"f",
".",
"optional",
":",
"bad_attribute",
... | https://github.com/TGAC/KAT/blob/e8870331de2b4bb0a1b3b91c6afb8fb9d59e9216/deps/boost/tools/build/src/build/feature.py#L165-L184 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/vis/visualization.py | python | VisualizationScene.listItems | (self,root=None,indent=0) | Prints out all items in the visualization world. | Prints out all items in the visualization world. | [
"Prints",
"out",
"all",
"items",
"in",
"the",
"visualization",
"world",
"."
] | def listItems(self,root=None,indent=0):
"""Prints out all items in the visualization world."""
if root is None:
for name,value in self.items.items():
self.listItems(value,indent)
else:
if isinstance(root,str):
root = self.getItem(root)
... | [
"def",
"listItems",
"(",
"self",
",",
"root",
"=",
"None",
",",
"indent",
"=",
"0",
")",
":",
"if",
"root",
"is",
"None",
":",
"for",
"name",
",",
"value",
"in",
"self",
".",
"items",
".",
"items",
"(",
")",
":",
"self",
".",
"listItems",
"(",
... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/vis/visualization.py#L3462-L3474 | ||
PX4/PX4-Autopilot | 0b9f60a0370be53d683352c63fd92db3d6586e18 | Tools/ecl_ekf/plotting/data_plots.py | python | DataPlot.close | (self) | closes the figure.
:return: | closes the figure.
:return: | [
"closes",
"the",
"figure",
".",
":",
"return",
":"
] | def close(self) -> None:
"""
closes the figure.
:return:
"""
plt.close(self._fig) | [
"def",
"close",
"(",
"self",
")",
"->",
"None",
":",
"plt",
".",
"close",
"(",
"self",
".",
"_fig",
")"
] | https://github.com/PX4/PX4-Autopilot/blob/0b9f60a0370be53d683352c63fd92db3d6586e18/Tools/ecl_ekf/plotting/data_plots.py#L138-L143 | ||
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/contrib/layers/python/layers/feature_column.py | python | _BucketizedColumn.to_weighted_sum | (self,
input_tensor,
num_outputs=1,
weight_collections=None,
trainable=True) | return _create_embedding_lookup(
input_tensor=self.to_sparse_tensor(input_tensor),
weight_tensor=None,
vocab_size=self.length * self.source_column.dimension,
dimension=num_outputs,
weight_collections=_add_variable_collection(weight_collections),
initializer=init_ops.zeros... | Returns a Tensor as linear predictions and a list of created Variable. | Returns a Tensor as linear predictions and a list of created Variable. | [
"Returns",
"a",
"Tensor",
"as",
"linear",
"predictions",
"and",
"a",
"list",
"of",
"created",
"Variable",
"."
] | def to_weighted_sum(self,
input_tensor,
num_outputs=1,
weight_collections=None,
trainable=True):
"""Returns a Tensor as linear predictions and a list of created Variable."""
return _create_embedding_lookup(
input_ten... | [
"def",
"to_weighted_sum",
"(",
"self",
",",
"input_tensor",
",",
"num_outputs",
"=",
"1",
",",
"weight_collections",
"=",
"None",
",",
"trainable",
"=",
"True",
")",
":",
"return",
"_create_embedding_lookup",
"(",
"input_tensor",
"=",
"self",
".",
"to_sparse_ten... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/contrib/layers/python/layers/feature_column.py#L1109-L1124 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/timeseries/python/timeseries/state_space_models/state_space_model.py | python | StateSpaceModel._filtering_step | (self, current_times, current_values, state, predictions) | return (filtered_state, predictions) | Compute posteriors and accumulate one-step-ahead predictions.
Args:
current_times: A [batch size] Tensor for times for each observation.
current_values: A [batch size] Tensor of values for each observaiton.
state: A tuple of (mean, covariance, previous_times) having shapes
mean; [batch ... | Compute posteriors and accumulate one-step-ahead predictions. | [
"Compute",
"posteriors",
"and",
"accumulate",
"one",
"-",
"step",
"-",
"ahead",
"predictions",
"."
] | def _filtering_step(self, current_times, current_values, state, predictions):
"""Compute posteriors and accumulate one-step-ahead predictions.
Args:
current_times: A [batch size] Tensor for times for each observation.
current_values: A [batch size] Tensor of values for each observaiton.
state... | [
"def",
"_filtering_step",
"(",
"self",
",",
"current_times",
",",
"current_values",
",",
"state",
",",
"predictions",
")",
":",
"estimated_state",
",",
"estimated_state_covariance",
",",
"previous_times",
"=",
"state",
"observation_model",
"=",
"self",
".",
"get_bro... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/timeseries/python/timeseries/state_space_models/state_space_model.py#L389-L438 | |
wenwei202/caffe | f54a74abaf6951d8485cbdcfa1d74a4c37839466 | scripts/cpp_lint.py | python | _CppLintState.SetFilters | (self, filters) | Sets the error-message filters.
These filters are applied when deciding whether to emit a given
error message.
Args:
filters: A string of comma-separated filters (eg "+whitespace/indent").
Each filter should start with + or -; else we die.
Raises:
ValueError: The comma-sepa... | Sets the error-message filters. | [
"Sets",
"the",
"error",
"-",
"message",
"filters",
"."
] | def SetFilters(self, filters):
"""Sets the error-message filters.
These filters are applied when deciding whether to emit a given
error message.
Args:
filters: A string of comma-separated filters (eg "+whitespace/indent").
Each filter should start with + or -; else we die.
Ra... | [
"def",
"SetFilters",
"(",
"self",
",",
"filters",
")",
":",
"# Default filters always have less priority than the flag ones.",
"self",
".",
"filters",
"=",
"_DEFAULT_FILTERS",
"[",
":",
"]",
"for",
"filt",
"in",
"filters",
".",
"split",
"(",
"','",
")",
":",
"cl... | https://github.com/wenwei202/caffe/blob/f54a74abaf6951d8485cbdcfa1d74a4c37839466/scripts/cpp_lint.py#L717-L740 | ||
thomaskeck/FastBDT | e67f71525612020acc78721031fca681d173c144 | examples/ugboost.py | python | calculate_cdf_and_pdf | (X) | return numpy.hstack([0.0, cdf, 1.0]), numpy.hstack([0.0, pdf, 0.0]), bins | Calculates cdf and pdf of given sample and adds under/overflow bins
@param X 1-d numpy.array | Calculates cdf and pdf of given sample and adds under/overflow bins | [
"Calculates",
"cdf",
"and",
"pdf",
"of",
"given",
"sample",
"and",
"adds",
"under",
"/",
"overflow",
"bins"
] | def calculate_cdf_and_pdf(X):
"""
Calculates cdf and pdf of given sample and adds under/overflow bins
@param X 1-d numpy.array
"""
pdf, bins = numpy.histogram(X, bins=100, density=True)
cdf = numpy.cumsum(pdf * (bins - numpy.roll(bins, 1))[1:])
return numpy.hstack([0.0, cdf, 1.0]), numpy... | [
"def",
"calculate_cdf_and_pdf",
"(",
"X",
")",
":",
"pdf",
",",
"bins",
"=",
"numpy",
".",
"histogram",
"(",
"X",
",",
"bins",
"=",
"100",
",",
"density",
"=",
"True",
")",
"cdf",
"=",
"numpy",
".",
"cumsum",
"(",
"pdf",
"*",
"(",
"bins",
"-",
"n... | https://github.com/thomaskeck/FastBDT/blob/e67f71525612020acc78721031fca681d173c144/examples/ugboost.py#L14-L21 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py | python | GenerateOutput | (target_list, target_dicts, data, params) | Generate .sln and .vcproj files.
This is the entry point for this generator.
Arguments:
target_list: List of target pairs: 'base/base.gyp:base'.
target_dicts: Dict of target properties keyed on target pair.
data: Dictionary containing per .gyp data. | Generate .sln and .vcproj files. | [
"Generate",
".",
"sln",
"and",
".",
"vcproj",
"files",
"."
] | def GenerateOutput(target_list, target_dicts, data, params):
"""Generate .sln and .vcproj files.
This is the entry point for this generator.
Arguments:
target_list: List of target pairs: 'base/base.gyp:base'.
target_dicts: Dict of target properties keyed on target pair.
data: Dictionary containing pe... | [
"def",
"GenerateOutput",
"(",
"target_list",
",",
"target_dicts",
",",
"data",
",",
"params",
")",
":",
"global",
"fixpath_prefix",
"options",
"=",
"params",
"[",
"'options'",
"]",
"# Get the project file format version back out of where we stashed it in",
"# GeneratorCalcu... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py#L1967-L2045 | ||
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | src/ceph-volume/ceph_volume/util/__init__.py | python | prompt_bool | (question, input_=None) | Interface to prompt a boolean (or boolean-like) response from a user.
Usually a confirmation. | Interface to prompt a boolean (or boolean-like) response from a user.
Usually a confirmation. | [
"Interface",
"to",
"prompt",
"a",
"boolean",
"(",
"or",
"boolean",
"-",
"like",
")",
"response",
"from",
"a",
"user",
".",
"Usually",
"a",
"confirmation",
"."
] | def prompt_bool(question, input_=None):
"""
Interface to prompt a boolean (or boolean-like) response from a user.
Usually a confirmation.
"""
input_prompt = input_ or input
prompt_format = '--> {question} '.format(question=question)
response = input_prompt(prompt_format)
try:
ret... | [
"def",
"prompt_bool",
"(",
"question",
",",
"input_",
"=",
"None",
")",
":",
"input_prompt",
"=",
"input_",
"or",
"input",
"prompt_format",
"=",
"'--> {question} '",
".",
"format",
"(",
"question",
"=",
"question",
")",
"response",
"=",
"input_prompt",
"(",
... | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/src/ceph-volume/ceph_volume/util/__init__.py#L86-L100 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/json_schema_compiler/js_util.py | python | JsUtil.GetLicense | (self) | return (LICENSE % datetime.now().year) | Returns the license text for JS extern and interface files. | Returns the license text for JS extern and interface files. | [
"Returns",
"the",
"license",
"text",
"for",
"JS",
"extern",
"and",
"interface",
"files",
"."
] | def GetLicense(self):
"""Returns the license text for JS extern and interface files.
"""
return (LICENSE % datetime.now().year) | [
"def",
"GetLicense",
"(",
"self",
")",
":",
"return",
"(",
"LICENSE",
"%",
"datetime",
".",
"now",
"(",
")",
".",
"year",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/json_schema_compiler/js_util.py#L23-L26 | |
wang-bin/QtAV | 3b937991afce248648836ae811324d4051b31def | python/configure.py | python | inform | (msg) | Display an information message. msg is the text of the error message. | Display an information message. msg is the text of the error message. | [
"Display",
"an",
"information",
"message",
".",
"msg",
"is",
"the",
"text",
"of",
"the",
"error",
"message",
"."
] | def inform(msg):
""" Display an information message. msg is the text of the error message.
"""
sys.stdout.write(_format(msg) + "\n") | [
"def",
"inform",
"(",
"msg",
")",
":",
"sys",
".",
"stdout",
".",
"write",
"(",
"_format",
"(",
"msg",
")",
"+",
"\"\\n\"",
")"
] | https://github.com/wang-bin/QtAV/blob/3b937991afce248648836ae811324d4051b31def/python/configure.py#L381-L385 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/learn/python/learn/estimators/head.py | python | _logits | (logits_input, logits, logits_dimension) | return logits | Validate logits args, and create `logits` if necessary.
Exactly one of `logits_input` and `logits` must be provided.
Args:
logits_input: `Tensor` input to `logits`.
logits: `Tensor` output.
logits_dimension: Integer, last dimension of `logits`. This is used to
create `logits` from `logits_input`... | Validate logits args, and create `logits` if necessary. | [
"Validate",
"logits",
"args",
"and",
"create",
"logits",
"if",
"necessary",
"."
] | def _logits(logits_input, logits, logits_dimension):
"""Validate logits args, and create `logits` if necessary.
Exactly one of `logits_input` and `logits` must be provided.
Args:
logits_input: `Tensor` input to `logits`.
logits: `Tensor` output.
logits_dimension: Integer, last dimension of `logits`.... | [
"def",
"_logits",
"(",
"logits_input",
",",
"logits",
",",
"logits_dimension",
")",
":",
"if",
"(",
"logits_dimension",
"is",
"None",
")",
"or",
"(",
"logits_dimension",
"<",
"1",
")",
":",
"raise",
"ValueError",
"(",
"\"Invalid logits_dimension %s.\"",
"%",
"... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/learn/python/learn/estimators/head.py#L571-L606 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py3/sklearn/metrics/_plot/precision_recall_curve.py | python | plot_precision_recall_curve | (estimator, X, y,
sample_weight=None, response_method="auto",
name=None, ax=None, **kwargs) | return viz.plot(ax=ax, name=name, **kwargs) | Plot Precision Recall Curve for binary classifiers.
Extra keyword arguments will be passed to matplotlib's `plot`.
Read more in the :ref:`User Guide <precision_recall_f_measure_metrics>`.
Parameters
----------
estimator : estimator instance
Trained classifier.
X : {array-like, sparse... | Plot Precision Recall Curve for binary classifiers. | [
"Plot",
"Precision",
"Recall",
"Curve",
"for",
"binary",
"classifiers",
"."
] | def plot_precision_recall_curve(estimator, X, y,
sample_weight=None, response_method="auto",
name=None, ax=None, **kwargs):
"""Plot Precision Recall Curve for binary classifiers.
Extra keyword arguments will be passed to matplotlib's `plot`.
... | [
"def",
"plot_precision_recall_curve",
"(",
"estimator",
",",
"X",
",",
"y",
",",
"sample_weight",
"=",
"None",
",",
"response_method",
"=",
"\"auto\"",
",",
"name",
"=",
"None",
",",
"ax",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"check_matplotlib_s... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/metrics/_plot/precision_recall_curve.py#L97-L171 | |
NREL/EnergyPlus | fadc5973b85c70e8cc923efb69c144e808a26078 | src/EnergyPlus/api/datatransfer.py | python | DataExchange.today_weather_outdoor_dry_bulb_at_time | (self, state: c_void_p, hour: int, time_step_number: int) | return self.api.todayWeatherOutDryBulbAtTime(state, hour, time_step_number) | Gets the specified weather data at the specified hour and time step index within that hour
:param state: An active EnergyPlus "state" that is returned from a call to `api.state_manager.new_state()`.
:param hour: Integer hour of day (0 to 23)
:param time_step_number: Time step index in hour, fro... | Gets the specified weather data at the specified hour and time step index within that hour | [
"Gets",
"the",
"specified",
"weather",
"data",
"at",
"the",
"specified",
"hour",
"and",
"time",
"step",
"index",
"within",
"that",
"hour"
] | def today_weather_outdoor_dry_bulb_at_time(self, state: c_void_p, hour: int, time_step_number: int) -> float:
"""
Gets the specified weather data at the specified hour and time step index within that hour
:param state: An active EnergyPlus "state" that is returned from a call to `api.state_mana... | [
"def",
"today_weather_outdoor_dry_bulb_at_time",
"(",
"self",
",",
"state",
":",
"c_void_p",
",",
"hour",
":",
"int",
",",
"time_step_number",
":",
"int",
")",
"->",
"float",
":",
"return",
"self",
".",
"api",
".",
"todayWeatherOutDryBulbAtTime",
"(",
"state",
... | https://github.com/NREL/EnergyPlus/blob/fadc5973b85c70e8cc923efb69c144e808a26078/src/EnergyPlus/api/datatransfer.py#L1141-L1150 | |
zeakey/DeepSkeleton | dc70170f8fd2ec8ca1157484ce66129981104486 | scripts/cpp_lint.py | python | _IncludeState.IsInAlphabeticalOrder | (self, clean_lines, linenum, header_path) | return True | Check if a header is in alphabetical order with the previous header.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
header_path: Canonicalized header to be checked.
Returns:
Returns true if the header is in alphabetical order. | Check if a header is in alphabetical order with the previous header. | [
"Check",
"if",
"a",
"header",
"is",
"in",
"alphabetical",
"order",
"with",
"the",
"previous",
"header",
"."
] | def IsInAlphabeticalOrder(self, clean_lines, linenum, header_path):
"""Check if a header is in alphabetical order with the previous header.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
header_path: Canonicalized header to be checke... | [
"def",
"IsInAlphabeticalOrder",
"(",
"self",
",",
"clean_lines",
",",
"linenum",
",",
"header_path",
")",
":",
"# If previous section is different from current section, _last_header will",
"# be reset to empty string, so it's always less than current header.",
"#",
"# If previous line ... | https://github.com/zeakey/DeepSkeleton/blob/dc70170f8fd2ec8ca1157484ce66129981104486/scripts/cpp_lint.py#L612-L631 | |
tensorflow/io | 92b44e180674a8af0e12e405530f7343e3e693e4 | tensorflow_io/python/ops/hdf5_io_tensor_ops.py | python | BaseHDF5GraphIOTensor.to_tensor | (self) | return core_ops.io_hdf5_readable_read(
input=self._filename,
shared=self._filename,
component=self._component,
shape=self._shape,
start=0,
stop=-1,
dtype=self._dtype,
container="HDF5IOTensor",
) | Converts this `IOTensor` into a `tf.Tensor`.
Args:
name: A name prefix for the returned tensors (optional).
Returns:
A `Tensor` with value obtained from this `IOTensor`. | Converts this `IOTensor` into a `tf.Tensor`. | [
"Converts",
"this",
"IOTensor",
"into",
"a",
"tf",
".",
"Tensor",
"."
] | def to_tensor(self):
"""Converts this `IOTensor` into a `tf.Tensor`.
Args:
name: A name prefix for the returned tensors (optional).
Returns:
A `Tensor` with value obtained from this `IOTensor`.
"""
return core_ops.io_hdf5_readable_read(
input... | [
"def",
"to_tensor",
"(",
"self",
")",
":",
"return",
"core_ops",
".",
"io_hdf5_readable_read",
"(",
"input",
"=",
"self",
".",
"_filename",
",",
"shared",
"=",
"self",
".",
"_filename",
",",
"component",
"=",
"self",
".",
"_component",
",",
"shape",
"=",
... | https://github.com/tensorflow/io/blob/92b44e180674a8af0e12e405530f7343e3e693e4/tensorflow_io/python/ops/hdf5_io_tensor_ops.py#L63-L81 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/tkinter/__init__.py | python | _flatten | (seq) | return res | Internal function. | Internal function. | [
"Internal",
"function",
"."
] | def _flatten(seq):
"""Internal function."""
res = ()
for item in seq:
if isinstance(item, (tuple, list)):
res = res + _flatten(item)
elif item is not None:
res = res + (item,)
return res | [
"def",
"_flatten",
"(",
"seq",
")",
":",
"res",
"=",
"(",
")",
"for",
"item",
"in",
"seq",
":",
"if",
"isinstance",
"(",
"item",
",",
"(",
"tuple",
",",
"list",
")",
")",
":",
"res",
"=",
"res",
"+",
"_flatten",
"(",
"item",
")",
"elif",
"item"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/tkinter/__init__.py#L83-L91 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/package/file_structure_representation.py | python | Directory.has_file | (self, filename: str) | return False | Checks if a file is present in a :class:`Directory`.
Args:
filename (str): Path of file to search for.
Returns:
bool: If a :class:`Directory` contains the specified file. | Checks if a file is present in a :class:`Directory`. | [
"Checks",
"if",
"a",
"file",
"is",
"present",
"in",
"a",
":",
"class",
":",
"Directory",
"."
] | def has_file(self, filename: str) -> bool:
"""Checks if a file is present in a :class:`Directory`.
Args:
filename (str): Path of file to search for.
Returns:
bool: If a :class:`Directory` contains the specified file.
"""
lineage = filename.split("/", maxs... | [
"def",
"has_file",
"(",
"self",
",",
"filename",
":",
"str",
")",
"->",
"bool",
":",
"lineage",
"=",
"filename",
".",
"split",
"(",
"\"/\"",
",",
"maxsplit",
"=",
"1",
")",
"child",
"=",
"lineage",
"[",
"0",
"]",
"grandchildren",
"=",
"lineage",
"[",... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/package/file_structure_representation.py#L45-L61 | |
OAID/Caffe-HRT | aae71e498ab842c6f92bcc23fc668423615a4d65 | scripts/cpp_lint.py | python | IsBlankLine | (line) | return not line or line.isspace() | Returns true if the given line is blank.
We consider a line to be blank if the line is empty or consists of
only white spaces.
Args:
line: A line of a string.
Returns:
True, if the given line is blank. | Returns true if the given line is blank. | [
"Returns",
"true",
"if",
"the",
"given",
"line",
"is",
"blank",
"."
] | def IsBlankLine(line):
"""Returns true if the given line is blank.
We consider a line to be blank if the line is empty or consists of
only white spaces.
Args:
line: A line of a string.
Returns:
True, if the given line is blank.
"""
return not line or line.isspace() | [
"def",
"IsBlankLine",
"(",
"line",
")",
":",
"return",
"not",
"line",
"or",
"line",
".",
"isspace",
"(",
")"
] | https://github.com/OAID/Caffe-HRT/blob/aae71e498ab842c6f92bcc23fc668423615a4d65/scripts/cpp_lint.py#L2369-L2381 | |
google-coral/edgetpu | 5020de9386ff370dcc1f63291a2d0f98eeb98adb | edgetpu/learn/backprop/softmax_regression.py | python | SoftmaxRegression.save_as_tflite_model | (self, in_model_path, out_model_path) | Appends learned weights to your TensorFlow Lite model and saves it as a copy.
Beware that learned weights and biases are quantized from float32 to uint8.
Args:
in_model_path (str): Path to the embedding extractor model (``.tflite`` file).
out_model_path (str): Path where you'd like to save the new... | Appends learned weights to your TensorFlow Lite model and saves it as a copy. | [
"Appends",
"learned",
"weights",
"to",
"your",
"TensorFlow",
"Lite",
"model",
"and",
"saves",
"it",
"as",
"a",
"copy",
"."
] | def save_as_tflite_model(self, in_model_path, out_model_path):
"""Appends learned weights to your TensorFlow Lite model and saves it as a copy.
Beware that learned weights and biases are quantized from float32 to uint8.
Args:
in_model_path (str): Path to the embedding extractor model (``.tflite`` fi... | [
"def",
"save_as_tflite_model",
"(",
"self",
",",
"in_model_path",
",",
"out_model_path",
")",
":",
"# Note: this function assumes flattened weights, whose dimension is",
"# num_classes x feature_dim. That's why the transpose is needed.",
"AppendFullyConnectedAndSoftmaxLayerToModel",
"(",
... | https://github.com/google-coral/edgetpu/blob/5020de9386ff370dcc1f63291a2d0f98eeb98adb/edgetpu/learn/backprop/softmax_regression.py#L139-L155 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/html.py | python | HtmlContainerCell.SetBackgroundColour | (*args, **kwargs) | return _html.HtmlContainerCell_SetBackgroundColour(*args, **kwargs) | SetBackgroundColour(self, Colour clr) | SetBackgroundColour(self, Colour clr) | [
"SetBackgroundColour",
"(",
"self",
"Colour",
"clr",
")"
] | def SetBackgroundColour(*args, **kwargs):
"""SetBackgroundColour(self, Colour clr)"""
return _html.HtmlContainerCell_SetBackgroundColour(*args, **kwargs) | [
"def",
"SetBackgroundColour",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_html",
".",
"HtmlContainerCell_SetBackgroundColour",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/html.py#L849-L851 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/idlelib/format.py | python | reformat_comment | (data, limit, comment_header) | return '\n'.join(comment_header+line for line in newdata) + block_suffix | Return data reformatted to specified width with comment header. | Return data reformatted to specified width with comment header. | [
"Return",
"data",
"reformatted",
"to",
"specified",
"width",
"with",
"comment",
"header",
"."
] | def reformat_comment(data, limit, comment_header):
"""Return data reformatted to specified width with comment header."""
# Remove header from the comment lines
lc = len(comment_header)
data = "\n".join(line[lc:] for line in data.split("\n"))
# Reformat to maxformatwidth chars or a 20 char width,
... | [
"def",
"reformat_comment",
"(",
"data",
",",
"limit",
",",
"comment_header",
")",
":",
"# Remove header from the comment lines",
"lc",
"=",
"len",
"(",
"comment_header",
")",
"data",
"=",
"\"\\n\"",
".",
"join",
"(",
"line",
"[",
"lc",
":",
"]",
"for",
"line... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/idlelib/format.py#L156-L176 | |
envoyproxy/envoy | 65541accdafe255e72310b4298d646e091da2d80 | tools/protodoc/protodoc.py | python | format_proto_as_block_comment | (proto) | return '\n\nproto::\n\n' + map_lines(functools.partial(indent, 2), str(proto)) + '\n' | Format a proto as a RST block comment.
Useful in debugging, not usually referenced. | Format a proto as a RST block comment. | [
"Format",
"a",
"proto",
"as",
"a",
"RST",
"block",
"comment",
"."
] | def format_proto_as_block_comment(proto):
"""Format a proto as a RST block comment.
Useful in debugging, not usually referenced.
"""
return '\n\nproto::\n\n' + map_lines(functools.partial(indent, 2), str(proto)) + '\n' | [
"def",
"format_proto_as_block_comment",
"(",
"proto",
")",
":",
"return",
"'\\n\\nproto::\\n\\n'",
"+",
"map_lines",
"(",
"functools",
".",
"partial",
"(",
"indent",
",",
"2",
")",
",",
"str",
"(",
"proto",
")",
")",
"+",
"'\\n'"
] | https://github.com/envoyproxy/envoy/blob/65541accdafe255e72310b4298d646e091da2d80/tools/protodoc/protodoc.py#L691-L696 | |
CaoWGG/TensorRT-CenterNet | f949252e37b51e60f873808f46d3683f15735e79 | onnx-tensorrt/third_party/onnx/onnx/helper.py | python | make_tensor | (
name, # type: Text
data_type, # type: int
dims, # type: Sequence[int]
vals, # type: Any
raw=False # type: bool
) | return tensor | Make a TensorProto with specified arguments. If raw is False, this
function will choose the corresponding proto field to store the
values based on data_type. If raw is True, use "raw_data" proto
field to store the values, and values should be of type bytes in
this case. | Make a TensorProto with specified arguments. If raw is False, this
function will choose the corresponding proto field to store the
values based on data_type. If raw is True, use "raw_data" proto
field to store the values, and values should be of type bytes in
this case. | [
"Make",
"a",
"TensorProto",
"with",
"specified",
"arguments",
".",
"If",
"raw",
"is",
"False",
"this",
"function",
"will",
"choose",
"the",
"corresponding",
"proto",
"field",
"to",
"store",
"the",
"values",
"based",
"on",
"data_type",
".",
"If",
"raw",
"is",... | def make_tensor(
name, # type: Text
data_type, # type: int
dims, # type: Sequence[int]
vals, # type: Any
raw=False # type: bool
): # type: (...) -> TensorProto
'''
Make a TensorProto with specified arguments. If raw is False, this
function will choose the corre... | [
"def",
"make_tensor",
"(",
"name",
",",
"# type: Text",
"data_type",
",",
"# type: int",
"dims",
",",
"# type: Sequence[int]",
"vals",
",",
"# type: Any",
"raw",
"=",
"False",
"# type: bool",
")",
":",
"# type: (...) -> TensorProto",
"tensor",
"=",
"TensorProto",
"(... | https://github.com/CaoWGG/TensorRT-CenterNet/blob/f949252e37b51e60f873808f46d3683f15735e79/onnx-tensorrt/third_party/onnx/onnx/helper.py#L144-L176 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/fsspec/spec.py | python | AbstractBufferedFile.readlines | (self) | Return all data, split by the newline character | Return all data, split by the newline character | [
"Return",
"all",
"data",
"split",
"by",
"the",
"newline",
"character"
] | def readlines(self):
"""Return all data, split by the newline character"""
data = self.read()
lines = data.split(b"\n")
out = [l + b"\n" for l in lines[:-1]]
if data.endswith(b"\n"):
return out
else:
return out + [lines[-1]] | [
"def",
"readlines",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"read",
"(",
")",
"lines",
"=",
"data",
".",
"split",
"(",
"b\"\\n\"",
")",
"out",
"=",
"[",
"l",
"+",
"b\"\\n\"",
"for",
"l",
"in",
"lines",
"[",
":",
"-",
"1",
"]",
"]",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/fsspec/spec.py#L1288-L1296 | ||
SFTtech/openage | d6a08c53c48dc1e157807471df92197f6ca9e04d | openage/convert/processor/conversion/de1/processor.py | python | DE1Processor.convert | (cls, gamespec, args, string_resources, existing_graphics) | return modpacks | Input game specification and media here and get a set of
modpacks back.
:param gamespec: Gamedata from empires.dat read in by the
reader functions.
:type gamespec: class: ...dataformat.value_members.ArrayMember
:returns: A list of modpacks.
:rtype: list | Input game specification and media here and get a set of
modpacks back. | [
"Input",
"game",
"specification",
"and",
"media",
"here",
"and",
"get",
"a",
"set",
"of",
"modpacks",
"back",
"."
] | def convert(cls, gamespec, args, string_resources, existing_graphics):
"""
Input game specification and media here and get a set of
modpacks back.
:param gamespec: Gamedata from empires.dat read in by the
reader functions.
:type gamespec: class: ...dataf... | [
"def",
"convert",
"(",
"cls",
",",
"gamespec",
",",
"args",
",",
"string_resources",
",",
"existing_graphics",
")",
":",
"info",
"(",
"\"Starting conversion...\"",
")",
"# Create a new container for the conversion process",
"dataset",
"=",
"cls",
".",
"_pre_processor",
... | https://github.com/SFTtech/openage/blob/d6a08c53c48dc1e157807471df92197f6ca9e04d/openage/convert/processor/conversion/de1/processor.py#L28-L58 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_gdi.py | python | GraphicsContext.ConcatTransform | (*args, **kwargs) | return _gdi_.GraphicsContext_ConcatTransform(*args, **kwargs) | ConcatTransform(self, GraphicsMatrix matrix)
Concatenates the passed in transform with the current transform of
this context. | ConcatTransform(self, GraphicsMatrix matrix) | [
"ConcatTransform",
"(",
"self",
"GraphicsMatrix",
"matrix",
")"
] | def ConcatTransform(*args, **kwargs):
"""
ConcatTransform(self, GraphicsMatrix matrix)
Concatenates the passed in transform with the current transform of
this context.
"""
return _gdi_.GraphicsContext_ConcatTransform(*args, **kwargs) | [
"def",
"ConcatTransform",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"GraphicsContext_ConcatTransform",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_gdi.py#L6466-L6473 | |
swift/swift | 12d031cf8177fdec0137f9aa7e2912fa23c4416b | 3rdParty/SCons/scons-3.0.1/engine/SCons/Util.py | python | unique | (s) | return u | Return a list of the elements in s, but without duplicates.
For example, unique([1,2,3,1,2,3]) is some permutation of [1,2,3],
unique("abcabc") some permutation of ["a", "b", "c"], and
unique(([1, 2], [2, 3], [1, 2])) some permutation of
[[2, 3], [1, 2]].
For best speed, all sequence elements shou... | Return a list of the elements in s, but without duplicates. | [
"Return",
"a",
"list",
"of",
"the",
"elements",
"in",
"s",
"but",
"without",
"duplicates",
"."
] | def unique(s):
"""Return a list of the elements in s, but without duplicates.
For example, unique([1,2,3,1,2,3]) is some permutation of [1,2,3],
unique("abcabc") some permutation of ["a", "b", "c"], and
unique(([1, 2], [2, 3], [1, 2])) some permutation of
[[2, 3], [1, 2]].
For best speed, all ... | [
"def",
"unique",
"(",
"s",
")",
":",
"n",
"=",
"len",
"(",
"s",
")",
"if",
"n",
"==",
"0",
":",
"return",
"[",
"]",
"# Try using a dict first, as that's the fastest and will usually",
"# work. If it doesn't work, it will usually fail quickly, so it",
"# usually doesn't c... | https://github.com/swift/swift/blob/12d031cf8177fdec0137f9aa7e2912fa23c4416b/3rdParty/SCons/scons-3.0.1/engine/SCons/Util.py#L1155-L1222 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/setuptools/_vendor/pyparsing.py | python | ParseBaseException.markInputline | ( self, markerString = ">!<" ) | return line_str.strip() | Extracts the exception line from the input string, and marks
the location of the exception with a special symbol. | Extracts the exception line from the input string, and marks
the location of the exception with a special symbol. | [
"Extracts",
"the",
"exception",
"line",
"from",
"the",
"input",
"string",
"and",
"marks",
"the",
"location",
"of",
"the",
"exception",
"with",
"a",
"special",
"symbol",
"."
] | def markInputline( self, markerString = ">!<" ):
"""Extracts the exception line from the input string, and marks
the location of the exception with a special symbol.
"""
line_str = self.line
line_column = self.column - 1
if markerString:
line_str = "".join(... | [
"def",
"markInputline",
"(",
"self",
",",
"markerString",
"=",
"\">!<\"",
")",
":",
"line_str",
"=",
"self",
".",
"line",
"line_column",
"=",
"self",
".",
"column",
"-",
"1",
"if",
"markerString",
":",
"line_str",
"=",
"\"\"",
".",
"join",
"(",
"(",
"l... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/setuptools/_vendor/pyparsing.py#L248-L257 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/nccl_ops.py | python | _apply_reduce | (reduction, tensors) | return result | Helper function for reduce_* functions. | Helper function for reduce_* functions. | [
"Helper",
"function",
"for",
"reduce_",
"*",
"functions",
"."
] | def _apply_reduce(reduction, tensors):
"""Helper function for reduce_* functions."""
if not tensors:
raise ValueError('Must pass >0 tensors to reduce operations')
for t in tensors:
_check_device(t)
result = gen_nccl_ops.nccl_reduce(input=tensors, reduction=reduction)
try:
next(t for t in tensors ... | [
"def",
"_apply_reduce",
"(",
"reduction",
",",
"tensors",
")",
":",
"if",
"not",
"tensors",
":",
"raise",
"ValueError",
"(",
"'Must pass >0 tensors to reduce operations'",
")",
"for",
"t",
"in",
"tensors",
":",
"_check_device",
"(",
"t",
")",
"result",
"=",
"g... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/nccl_ops.py#L237-L249 | |
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | tools/python/google/path_utils.py | python | FindAncestor | (start_dir, ancestor) | Finds an ancestor dir in a path.
For example, FindAncestor('c:\foo\bar\baz', 'bar') would return
'c:\foo\bar'. Unlike FindUpward*, this only looks at direct path ancestors. | Finds an ancestor dir in a path. | [
"Finds",
"an",
"ancestor",
"dir",
"in",
"a",
"path",
"."
] | def FindAncestor(start_dir, ancestor):
"""Finds an ancestor dir in a path.
For example, FindAncestor('c:\foo\bar\baz', 'bar') would return
'c:\foo\bar'. Unlike FindUpward*, this only looks at direct path ancestors.
"""
start_dir = os.path.abspath(start_dir)
path = start_dir
while True:
(parent, tail... | [
"def",
"FindAncestor",
"(",
"start_dir",
",",
"ancestor",
")",
":",
"start_dir",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"start_dir",
")",
"path",
"=",
"start_dir",
"while",
"True",
":",
"(",
"parent",
",",
"tail",
")",
"=",
"os",
".",
"path",
"... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/tools/python/google/path_utils.py#L21-L36 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/pipeline/pipeline/pipeline.py | python | After._thread_init | (cls) | Ensure thread local is initialized. | Ensure thread local is initialized. | [
"Ensure",
"thread",
"local",
"is",
"initialized",
"."
] | def _thread_init(cls):
"""Ensure thread local is initialized."""
if not hasattr(cls._local, '_after_all_futures'):
cls._local._after_all_futures = [] | [
"def",
"_thread_init",
"(",
"cls",
")",
":",
"if",
"not",
"hasattr",
"(",
"cls",
".",
"_local",
",",
"'_after_all_futures'",
")",
":",
"cls",
".",
"_local",
".",
"_after_all_futures",
"=",
"[",
"]"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/pipeline/pipeline/pipeline.py#L1175-L1178 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/_op_impl/_custom_op/fused_abs_max1_impl.py | python | shape1 | (tik_instance, input_x_shape, ori_shape, input_x, res) | return tik_instance, res | shape1 | shape1 | [
"shape1"
] | def shape1(tik_instance, input_x_shape, ori_shape, input_x, res):
"""shape1"""
if ori_shape == (147, 147):
phase_1 = 16384
blocks = 32
each_block_element = phase_1 // blocks + 64
with tik_instance.for_range(0, blocks, block_num=blocks) as block_index:
input_x_ub = tik... | [
"def",
"shape1",
"(",
"tik_instance",
",",
"input_x_shape",
",",
"ori_shape",
",",
"input_x",
",",
"res",
")",
":",
"if",
"ori_shape",
"==",
"(",
"147",
",",
"147",
")",
":",
"phase_1",
"=",
"16384",
"blocks",
"=",
"32",
"each_block_element",
"=",
"phase... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/_op_impl/_custom_op/fused_abs_max1_impl.py#L100-L143 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/debug/cli/debugger_cli_common.py | python | RichTextLines.append | (self, line, font_attr_segs=None) | Append a single line of text.
Args:
line: (str) The text to be added to the end.
font_attr_segs: (list of tuples) Font attribute segments of the appended
line. | Append a single line of text. | [
"Append",
"a",
"single",
"line",
"of",
"text",
"."
] | def append(self, line, font_attr_segs=None):
"""Append a single line of text.
Args:
line: (str) The text to be added to the end.
font_attr_segs: (list of tuples) Font attribute segments of the appended
line.
"""
self._lines.append(line)
if font_attr_segs:
self._font_attr_... | [
"def",
"append",
"(",
"self",
",",
"line",
",",
"font_attr_segs",
"=",
"None",
")",
":",
"self",
".",
"_lines",
".",
"append",
"(",
"line",
")",
"if",
"font_attr_segs",
":",
"self",
".",
"_font_attr_segs",
"[",
"len",
"(",
"self",
".",
"_lines",
")",
... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/debug/cli/debugger_cli_common.py#L314-L325 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/valgrind/suppressions.py | python | ValgrindStyleSuppression.__str__ | (self) | return "{\n %s\n}\n" % "\n ".join(lines) | Stringify. | Stringify. | [
"Stringify",
"."
] | def __str__(self):
"""Stringify."""
lines = [self.description, self.type] + self.stack
return "{\n %s\n}\n" % "\n ".join(lines) | [
"def",
"__str__",
"(",
"self",
")",
":",
"lines",
"=",
"[",
"self",
".",
"description",
",",
"self",
".",
"type",
"]",
"+",
"self",
".",
"stack",
"return",
"\"{\\n %s\\n}\\n\"",
"%",
"\"\\n \"",
".",
"join",
"(",
"lines",
")"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/valgrind/suppressions.py#L242-L245 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py2/numpy/polynomial/chebyshev.py | python | chebsub | (c1, c2) | return pu.trimseq(ret) | Subtract one Chebyshev series from another.
Returns the difference of two Chebyshev series `c1` - `c2`. The
sequences of coefficients are from lowest order term to highest, i.e.,
[1,2,3] represents the series ``T_0 + 2*T_1 + 3*T_2``.
Parameters
----------
c1, c2 : array_like
1-D array... | Subtract one Chebyshev series from another. | [
"Subtract",
"one",
"Chebyshev",
"series",
"from",
"another",
"."
] | def chebsub(c1, c2):
"""
Subtract one Chebyshev series from another.
Returns the difference of two Chebyshev series `c1` - `c2`. The
sequences of coefficients are from lowest order term to highest, i.e.,
[1,2,3] represents the series ``T_0 + 2*T_1 + 3*T_2``.
Parameters
----------
c1, ... | [
"def",
"chebsub",
"(",
"c1",
",",
"c2",
")",
":",
"# c1, c2 are trimmed copies",
"[",
"c1",
",",
"c2",
"]",
"=",
"pu",
".",
"as_series",
"(",
"[",
"c1",
",",
"c2",
"]",
")",
"if",
"len",
"(",
"c1",
")",
">",
"len",
"(",
"c2",
")",
":",
"c1",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py2/numpy/polynomial/chebyshev.py#L611-L661 | |
KhronosGroup/SPIRV-LLVM | 1eb85593f3fe2c39379b9a9b088d51eda4f42b8b | utils/llvm-build/llvmbuild/main.py | python | cmake_quote_string | (value) | return value | cmake_quote_string(value) -> str
Return a quoted form of the given value that is suitable for use in CMake
language files. | cmake_quote_string(value) -> str | [
"cmake_quote_string",
"(",
"value",
")",
"-",
">",
"str"
] | def cmake_quote_string(value):
"""
cmake_quote_string(value) -> str
Return a quoted form of the given value that is suitable for use in CMake
language files.
"""
# Currently, we only handle escaping backslashes.
value = value.replace("\\", "\\\\")
return value | [
"def",
"cmake_quote_string",
"(",
"value",
")",
":",
"# Currently, we only handle escaping backslashes.",
"value",
"=",
"value",
".",
"replace",
"(",
"\"\\\\\"",
",",
"\"\\\\\\\\\"",
")",
"return",
"value"
] | https://github.com/KhronosGroup/SPIRV-LLVM/blob/1eb85593f3fe2c39379b9a9b088d51eda4f42b8b/utils/llvm-build/llvmbuild/main.py#L13-L24 | |
OpenXRay/xray-15 | 1390dfb08ed20997d7e8c95147ea8e8cb71f5e86 | cs/sdk/3d_sdk/maya/ver-2008/devkit/plug-ins/scripted/motionTraceCmd.py | python | motionTrace.__jMakeCurve | (self, cvs) | Make a degree 1 curve from the given CVs.
Note that in Python, a double underscore in front of a member name
make the method "private" to the class through name-mangling | Make a degree 1 curve from the given CVs.
Note that in Python, a double underscore in front of a member name
make the method "private" to the class through name-mangling | [
"Make",
"a",
"degree",
"1",
"curve",
"from",
"the",
"given",
"CVs",
".",
"Note",
"that",
"in",
"Python",
"a",
"double",
"underscore",
"in",
"front",
"of",
"a",
"member",
"name",
"make",
"the",
"method",
"private",
"to",
"the",
"class",
"through",
"name",... | def __jMakeCurve(self, cvs):
"""
Make a degree 1 curve from the given CVs.
Note that in Python, a double underscore in front of a member name
make the method "private" to the class through name-mangling
"""
deg = 1
knots = OpenMaya.MDoubleArray()
for i in range(cvs.length()):
knots.append(i)
#... | [
"def",
"__jMakeCurve",
"(",
"self",
",",
"cvs",
")",
":",
"deg",
"=",
"1",
"knots",
"=",
"OpenMaya",
".",
"MDoubleArray",
"(",
")",
"for",
"i",
"in",
"range",
"(",
"cvs",
".",
"length",
"(",
")",
")",
":",
"knots",
".",
"append",
"(",
"i",
")",
... | https://github.com/OpenXRay/xray-15/blob/1390dfb08ed20997d7e8c95147ea8e8cb71f5e86/cs/sdk/3d_sdk/maya/ver-2008/devkit/plug-ins/scripted/motionTraceCmd.py#L173-L189 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/pkg_resources/_vendor/pyparsing.py | python | ParserElement.setResultsName | ( self, name, listAllMatches=False ) | return newself | Define name for referencing matching tokens as a nested attribute
of the returned parse results.
NOTE: this returns a *copy* of the original C{ParserElement} object;
this is so that the client can define a basic element, such as an
integer, and reference it in multiple places with differ... | Define name for referencing matching tokens as a nested attribute
of the returned parse results.
NOTE: this returns a *copy* of the original C{ParserElement} object;
this is so that the client can define a basic element, such as an
integer, and reference it in multiple places with differ... | [
"Define",
"name",
"for",
"referencing",
"matching",
"tokens",
"as",
"a",
"nested",
"attribute",
"of",
"the",
"returned",
"parse",
"results",
".",
"NOTE",
":",
"this",
"returns",
"a",
"*",
"copy",
"*",
"of",
"the",
"original",
"C",
"{",
"ParserElement",
"}"... | def setResultsName( self, name, listAllMatches=False ):
"""
Define name for referencing matching tokens as a nested attribute
of the returned parse results.
NOTE: this returns a *copy* of the original C{ParserElement} object;
this is so that the client can define a basic element,... | [
"def",
"setResultsName",
"(",
"self",
",",
"name",
",",
"listAllMatches",
"=",
"False",
")",
":",
"newself",
"=",
"self",
".",
"copy",
"(",
")",
"if",
"name",
".",
"endswith",
"(",
"\"*\"",
")",
":",
"name",
"=",
"name",
"[",
":",
"-",
"1",
"]",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/pkg_resources/_vendor/pyparsing.py#L1181-L1207 | |
BitMEX/api-connectors | 37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812 | auto-generated/python/swagger_client/models/error.py | python | Error.__init__ | (self, error=None) | Error - a model defined in Swagger | Error - a model defined in Swagger | [
"Error",
"-",
"a",
"model",
"defined",
"in",
"Swagger"
] | def __init__(self, error=None): # noqa: E501
"""Error - a model defined in Swagger""" # noqa: E501
self._error = None
self.discriminator = None
self.error = error | [
"def",
"__init__",
"(",
"self",
",",
"error",
"=",
"None",
")",
":",
"# noqa: E501",
"# noqa: E501",
"self",
".",
"_error",
"=",
"None",
"self",
".",
"discriminator",
"=",
"None",
"self",
".",
"error",
"=",
"error"
] | https://github.com/BitMEX/api-connectors/blob/37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812/auto-generated/python/swagger_client/models/error.py#L41-L47 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/ops/linalg/linear_operator.py | python | LinearOperator.log_abs_determinant | (self, name="log_abs_det") | Log absolute value of determinant for every batch member.
Args:
name: A name for this `Op.
Returns:
`Tensor` with shape `self.batch_shape` and same `dtype` as `self`.
Raises:
NotImplementedError: If `self.is_square` is `False`. | Log absolute value of determinant for every batch member. | [
"Log",
"absolute",
"value",
"of",
"determinant",
"for",
"every",
"batch",
"member",
"."
] | def log_abs_determinant(self, name="log_abs_det"):
"""Log absolute value of determinant for every batch member.
Args:
name: A name for this `Op.
Returns:
`Tensor` with shape `self.batch_shape` and same `dtype` as `self`.
Raises:
NotImplementedError: If `self.is_square` is `False`.... | [
"def",
"log_abs_determinant",
"(",
"self",
",",
"name",
"=",
"\"log_abs_det\"",
")",
":",
"if",
"self",
".",
"is_square",
"is",
"False",
":",
"raise",
"NotImplementedError",
"(",
"\"Determinant not implemented for an operator that is expected to \"",
"\"not be square.\"",
... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/linalg/linear_operator.py#L699-L716 | ||
PX4/PX4-Autopilot | 0b9f60a0370be53d683352c63fd92db3d6586e18 | src/lib/mixer/MultirotorMixer/geometries/tools/px_generate_mixers.py | python | geometry_to_thrust_matrix | (geometry) | return At | Compute thrust matrix At from geometry dictionnary
At is a 3xN matrix where N is the number of rotors
Each column is the thrust generated by one rotor | Compute thrust matrix At from geometry dictionnary
At is a 3xN matrix where N is the number of rotors
Each column is the thrust generated by one rotor | [
"Compute",
"thrust",
"matrix",
"At",
"from",
"geometry",
"dictionnary",
"At",
"is",
"a",
"3xN",
"matrix",
"where",
"N",
"is",
"the",
"number",
"of",
"rotors",
"Each",
"column",
"is",
"the",
"thrust",
"generated",
"by",
"one",
"rotor"
] | def geometry_to_thrust_matrix(geometry):
'''
Compute thrust matrix At from geometry dictionnary
At is a 3xN matrix where N is the number of rotors
Each column is the thrust generated by one rotor
'''
At = thrust_matrix(axis=np.array([rotor['axis'] for rotor in geometry['rotors']]),
... | [
"def",
"geometry_to_thrust_matrix",
"(",
"geometry",
")",
":",
"At",
"=",
"thrust_matrix",
"(",
"axis",
"=",
"np",
".",
"array",
"(",
"[",
"rotor",
"[",
"'axis'",
"]",
"for",
"rotor",
"in",
"geometry",
"[",
"'rotors'",
"]",
"]",
")",
",",
"Ct",
"=",
... | https://github.com/PX4/PX4-Autopilot/blob/0b9f60a0370be53d683352c63fd92db3d6586e18/src/lib/mixer/MultirotorMixer/geometries/tools/px_generate_mixers.py#L165-L174 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/ed_style.py | python | StyleItem.GetSize | (self) | return self.size | Returns the value of the size attribute as a string
@return: style items font size attribute | Returns the value of the size attribute as a string
@return: style items font size attribute | [
"Returns",
"the",
"value",
"of",
"the",
"size",
"attribute",
"as",
"a",
"string",
"@return",
":",
"style",
"items",
"font",
"size",
"attribute"
] | def GetSize(self):
"""Returns the value of the size attribute as a string
@return: style items font size attribute
"""
return self.size | [
"def",
"GetSize",
"(",
"self",
")",
":",
"return",
"self",
".",
"size"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/ed_style.py#L171-L176 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/propgrid.py | python | PropertyGrid.IsEditorFocused | (*args, **kwargs) | return _propgrid.PropertyGrid_IsEditorFocused(*args, **kwargs) | IsEditorFocused(self) -> bool | IsEditorFocused(self) -> bool | [
"IsEditorFocused",
"(",
"self",
")",
"-",
">",
"bool"
] | def IsEditorFocused(*args, **kwargs):
"""IsEditorFocused(self) -> bool"""
return _propgrid.PropertyGrid_IsEditorFocused(*args, **kwargs) | [
"def",
"IsEditorFocused",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PropertyGrid_IsEditorFocused",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/propgrid.py#L2154-L2156 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/pyclbr.py | python | _readmodule | (module, path, inpackage=None) | return _create_tree(fullmodule, path, fname, source, tree, inpackage) | Do the hard work for readmodule[_ex].
If inpackage is given, it must be the dotted name of the package in
which we are searching for a submodule, and then PATH must be the
package search path; otherwise, we are searching for a top-level
module, and path is combined with sys.path. | Do the hard work for readmodule[_ex]. | [
"Do",
"the",
"hard",
"work",
"for",
"readmodule",
"[",
"_ex",
"]",
"."
] | def _readmodule(module, path, inpackage=None):
"""Do the hard work for readmodule[_ex].
If inpackage is given, it must be the dotted name of the package in
which we are searching for a submodule, and then PATH must be the
package search path; otherwise, we are searching for a top-level
module, and ... | [
"def",
"_readmodule",
"(",
"module",
",",
"path",
",",
"inpackage",
"=",
"None",
")",
":",
"# Compute the full module name (prepending inpackage if set).",
"if",
"inpackage",
"is",
"not",
"None",
":",
"fullmodule",
"=",
"\"%s.%s\"",
"%",
"(",
"inpackage",
",",
"mo... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/pyclbr.py#L118-L176 | |
polyworld/polyworld | eb7e6bbc82fe77ba79e3bc48c3da2ad8c8238c26 | scripts/agent/reader.py | python | BackwardsReader.__init__ | (self, file, blksize=4096) | initialize the internal structures | initialize the internal structures | [
"initialize",
"the",
"internal",
"structures"
] | def __init__(self, file, blksize=4096):
"""initialize the internal structures"""
# get the file size
self.size = os.stat(file)[6]
# how big of a block to read from the file...
self.blksize = blksize
# how many blocks we've read
self.blkcount = 1
self.f = open(file, 'rb')
# if the fil... | [
"def",
"__init__",
"(",
"self",
",",
"file",
",",
"blksize",
"=",
"4096",
")",
":",
"# get the file size",
"self",
".",
"size",
"=",
"os",
".",
"stat",
"(",
"file",
")",
"[",
"6",
"]",
"# how big of a block to read from the file...",
"self",
".",
"blksize",
... | https://github.com/polyworld/polyworld/blob/eb7e6bbc82fe77ba79e3bc48c3da2ad8c8238c26/scripts/agent/reader.py#L33-L51 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py3/IPython/core/magics/execution.py | python | TimeitTemplateFiller.visit_FunctionDef | (self, node) | return node | Fill in the setup statement | Fill in the setup statement | [
"Fill",
"in",
"the",
"setup",
"statement"
] | def visit_FunctionDef(self, node):
"Fill in the setup statement"
self.generic_visit(node)
if node.name == "inner":
node.body[:1] = self.ast_setup.body
return node | [
"def",
"visit_FunctionDef",
"(",
"self",
",",
"node",
")",
":",
"self",
".",
"generic_visit",
"(",
"node",
")",
"if",
"node",
".",
"name",
"==",
"\"inner\"",
":",
"node",
".",
"body",
"[",
":",
"1",
"]",
"=",
"self",
".",
"ast_setup",
".",
"body",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py3/IPython/core/magics/execution.py#L133-L139 | |
scribusproject/scribus | 41ec7c775a060912cf251682a8b1437f753f80f4 | scribus/plugins/scriptplugin/scripts/Ligatursatz.py | python | GermanLigatureSupport.simple_case_fold_for_lookup | (self, my_unicode_string) | return my_unicode_string.lower().replace("ſ", "s") | Before applying the hyphenation algorithm to a string, some
“folding” has to be done. The german word “auffallend” has the
ligature ["auf", "fallend"]. If it is the first
word of a sentence, than it is written with capital letter
“Auffallend”. The “case” (the
fact that a letter ... | Before applying the hyphenation algorithm to a string, some
“folding” has to be done. The german word “auffallend” has the
ligature ["auf", "fallend"]. If it is the first
word of a sentence, than it is written with capital letter
“Auffallend”. The “case” (the
fact that a letter ... | [
"Before",
"applying",
"the",
"hyphenation",
"algorithm",
"to",
"a",
"string",
"some",
"“folding”",
"has",
"to",
"be",
"done",
".",
"The",
"german",
"word",
"“auffallend”",
"has",
"the",
"ligature",
"[",
"auf",
"fallend",
"]",
".",
"If",
"it",
"is",
"the",
... | def simple_case_fold_for_lookup(self, my_unicode_string):
"""Before applying the hyphenation algorithm to a string, some
“folding” has to be done. The german word “auffallend” has the
ligature ["auf", "fallend"]. If it is the first
word of a sentence, than it is written with capital lett... | [
"def",
"simple_case_fold_for_lookup",
"(",
"self",
",",
"my_unicode_string",
")",
":",
"if",
"type",
"(",
"my_unicode_string",
")",
"is",
"not",
"str",
":",
"raise",
"TypeError",
"(",
"\"The “my_unicode_string” parameter must be of \"",
"\"type “unicode”, but it isn’t.\")",... | https://github.com/scribusproject/scribus/blob/41ec7c775a060912cf251682a8b1437f753f80f4/scribus/plugins/scriptplugin/scripts/Ligatursatz.py#L243-L295 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Start/StartPage/StartPage.py | python | postStart | () | executes needed operations after loading a file | executes needed operations after loading a file | [
"executes",
"needed",
"operations",
"after",
"loading",
"a",
"file"
] | def postStart():
"executes needed operations after loading a file"
param = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Start")
# switch workbench
wb = param.GetString("AutoloadModule","")
if "$LastModule" == wb:
wb = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Genera... | [
"def",
"postStart",
"(",
")",
":",
"param",
"=",
"FreeCAD",
".",
"ParamGet",
"(",
"\"User parameter:BaseApp/Preferences/Mod/Start\"",
")",
"# switch workbench",
"wb",
"=",
"param",
".",
"GetString",
"(",
"\"AutoloadModule\"",
",",
"\"\"",
")",
"if",
"\"$LastModule\"... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Start/StartPage/StartPage.py#L603-L629 | ||
baidu/AnyQ | d94d450d2aaa5f7ed73424b10aa4539835b97527 | tools/simnet/train/paddle/util/data_reader.py | python | get_reader | (conf_dict, is_infer, samples_file) | Get Reader | Get Reader | [
"Get",
"Reader"
] | def get_reader(conf_dict, is_infer, samples_file):
"""
Get Reader
"""
def reader_with_pairwise():
"""
Reader with Pairwise
"""
if is_infer:
with open(conf_dict["test_file_path"]) as file:
for line in file:
if not utils.p... | [
"def",
"get_reader",
"(",
"conf_dict",
",",
"is_infer",
",",
"samples_file",
")",
":",
"def",
"reader_with_pairwise",
"(",
")",
":",
"\"\"\"\n Reader with Pairwise\n \"\"\"",
"if",
"is_infer",
":",
"with",
"open",
"(",
"conf_dict",
"[",
"\"test_file_... | https://github.com/baidu/AnyQ/blob/d94d450d2aaa5f7ed73424b10aa4539835b97527/tools/simnet/train/paddle/util/data_reader.py#L26-L93 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/Jinja2/py2/jinja2/ext.py | python | InternationalizationExtension.parse | (self, parser) | Parse a translatable tag. | Parse a translatable tag. | [
"Parse",
"a",
"translatable",
"tag",
"."
] | def parse(self, parser):
"""Parse a translatable tag."""
lineno = next(parser.stream).lineno
num_called_num = False
# find all the variables referenced. Additionally a variable can be
# defined in the body of the trans block too, but this is checked at
# a later state.
... | [
"def",
"parse",
"(",
"self",
",",
"parser",
")",
":",
"lineno",
"=",
"next",
"(",
"parser",
".",
"stream",
")",
".",
"lineno",
"num_called_num",
"=",
"False",
"# find all the variables referenced. Additionally a variable can be",
"# defined in the body of the trans block... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/Jinja2/py2/jinja2/ext.py#L229-L342 | ||
okex/V3-Open-API-SDK | c5abb0db7e2287718e0055e17e57672ce0ec7fd9 | okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_vendor/urllib3/contrib/pyopenssl.py | python | extract_from_urllib3 | () | Undo monkey-patching by :func:`inject_into_urllib3`. | Undo monkey-patching by :func:`inject_into_urllib3`. | [
"Undo",
"monkey",
"-",
"patching",
"by",
":",
"func",
":",
"inject_into_urllib3",
"."
] | def extract_from_urllib3():
'Undo monkey-patching by :func:`inject_into_urllib3`.'
util.ssl_.SSLContext = orig_util_SSLContext
util.HAS_SNI = orig_util_HAS_SNI
util.ssl_.HAS_SNI = orig_util_HAS_SNI
util.IS_PYOPENSSL = False
util.ssl_.IS_PYOPENSSL = False | [
"def",
"extract_from_urllib3",
"(",
")",
":",
"util",
".",
"ssl_",
".",
"SSLContext",
"=",
"orig_util_SSLContext",
"util",
".",
"HAS_SNI",
"=",
"orig_util_HAS_SNI",
"util",
".",
"ssl_",
".",
"HAS_SNI",
"=",
"orig_util_HAS_SNI",
"util",
".",
"IS_PYOPENSSL",
"=",
... | https://github.com/okex/V3-Open-API-SDK/blob/c5abb0db7e2287718e0055e17e57672ce0ec7fd9/okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_vendor/urllib3/contrib/pyopenssl.py#L127-L134 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/boosted_trees/python/utils/losses.py | python | per_example_exp_loss | (labels, weights, predictions, name=None, eps=0.1) | return unweighted_loss * weights, control_flow_ops.no_op() | Trimmed exponential loss given labels, example weights and predictions.
Note that this is only for binary classification.
If logistic loss tries to make sure that the classifier is certain of its
predictions, exp loss says: "as long as it got it correct, even barely, i
don't care". Can be used on noisy data, o... | Trimmed exponential loss given labels, example weights and predictions. | [
"Trimmed",
"exponential",
"loss",
"given",
"labels",
"example",
"weights",
"and",
"predictions",
"."
] | def per_example_exp_loss(labels, weights, predictions, name=None, eps=0.1):
"""Trimmed exponential loss given labels, example weights and predictions.
Note that this is only for binary classification.
If logistic loss tries to make sure that the classifier is certain of its
predictions, exp loss says: "as long... | [
"def",
"per_example_exp_loss",
"(",
"labels",
",",
"weights",
",",
"predictions",
",",
"name",
"=",
"None",
",",
"eps",
"=",
"0.1",
")",
":",
"def",
"exp_with_logits",
"(",
"name",
",",
"eps",
",",
"labels",
"=",
"None",
",",
"logits",
"=",
"None",
")"... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/boosted_trees/python/utils/losses.py#L175-L260 | |
ultralight-ux/WebCore | 8a83d7f3a7517b75ae7dc18183b4ff9ce898419b | Source/JavaScriptCore/Scripts/jsmin.py | python | jsmin | (js) | return outs.getvalue() | returns a minified version of the javascript string | returns a minified version of the javascript string | [
"returns",
"a",
"minified",
"version",
"of",
"the",
"javascript",
"string"
] | def jsmin(js):
"""
returns a minified version of the javascript string
"""
if not is_3:
if cStringIO and not isinstance(js, unicode):
# strings can use cStringIO for a 3x performance
# improvement, but unicode (in python2) cannot
klass = cStringIO.StringIO
... | [
"def",
"jsmin",
"(",
"js",
")",
":",
"if",
"not",
"is_3",
":",
"if",
"cStringIO",
"and",
"not",
"isinstance",
"(",
"js",
",",
"unicode",
")",
":",
"# strings can use cStringIO for a 3x performance",
"# improvement, but unicode (in python2) cannot",
"klass",
"=",
"cS... | https://github.com/ultralight-ux/WebCore/blob/8a83d7f3a7517b75ae7dc18183b4ff9ce898419b/Source/JavaScriptCore/Scripts/jsmin.py#L43-L59 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_core.py | python | NavigationKeyEvent.SetFlags | (*args, **kwargs) | return _core_.NavigationKeyEvent_SetFlags(*args, **kwargs) | SetFlags(self, long flags)
Set the navigation flags to a combination of the following:
* wx.NavigationKeyEvent.IsBackward
* wx.NavigationKeyEvent.IsForward
* wx.NavigationKeyEvent.WinChange
* wx.NavigationKeyEvent.FromTab | SetFlags(self, long flags) | [
"SetFlags",
"(",
"self",
"long",
"flags",
")"
] | def SetFlags(*args, **kwargs):
"""
SetFlags(self, long flags)
Set the navigation flags to a combination of the following:
* wx.NavigationKeyEvent.IsBackward
* wx.NavigationKeyEvent.IsForward
* wx.NavigationKeyEvent.WinChange
* wx.NavigationKeyEve... | [
"def",
"SetFlags",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"NavigationKeyEvent_SetFlags",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_core.py#L7284-L7296 | |
trilinos/Trilinos | 6168be6dd51e35e1cd681e9c4b24433e709df140 | packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriExtractStructuredMultiBlock.py | python | FigureBlockIndicesFromBlockListOneBlock | (includeIndexList, includeBlockList,
inMetaData, ioFlatIndexCounter, inCsdata, inForceSetting) | determine if this one block should have it's flat index tripped on for
the extract block filter (leaf item of recursion) | determine if this one block should have it's flat index tripped on for
the extract block filter (leaf item of recursion) | [
"determine",
"if",
"this",
"one",
"block",
"should",
"have",
"it",
"s",
"flat",
"index",
"tripped",
"on",
"for",
"the",
"extract",
"block",
"filter",
"(",
"leaf",
"item",
"of",
"recursion",
")"
] | def FigureBlockIndicesFromBlockListOneBlock(includeIndexList, includeBlockList,
inMetaData, ioFlatIndexCounter, inCsdata, inForceSetting):
"""determine if this one block should have it's flat index tripped on for
the extract block filter (leaf item of recursion)"""
if PhactoriDbg(100):
myDebugPrint3("Fig... | [
"def",
"FigureBlockIndicesFromBlockListOneBlock",
"(",
"includeIndexList",
",",
"includeBlockList",
",",
"inMetaData",
",",
"ioFlatIndexCounter",
",",
"inCsdata",
",",
"inForceSetting",
")",
":",
"if",
"PhactoriDbg",
"(",
"100",
")",
":",
"myDebugPrint3",
"(",
"\"Figu... | https://github.com/trilinos/Trilinos/blob/6168be6dd51e35e1cd681e9c4b24433e709df140/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriExtractStructuredMultiBlock.py#L43-L91 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pathlib2/pathlib2/__init__.py | python | PurePath.with_name | (self, name) | return self._from_parsed_parts(self._drv, self._root,
self._parts[:-1] + parts[-1:]) | Return a new path with the file name changed. | Return a new path with the file name changed. | [
"Return",
"a",
"new",
"path",
"with",
"the",
"file",
"name",
"changed",
"."
] | def with_name(self, name):
"""Return a new path with the file name changed."""
if not self.name:
raise ValueError("%r has an empty name" % (self,))
drv, root, parts = self._flavour.parse_parts((name,))
if (not name or name[-1] in [self._flavour.sep, self._flavour.altsep]
... | [
"def",
"with_name",
"(",
"self",
",",
"name",
")",
":",
"if",
"not",
"self",
".",
"name",
":",
"raise",
"ValueError",
"(",
"\"%r has an empty name\"",
"%",
"(",
"self",
",",
")",
")",
"drv",
",",
"root",
",",
"parts",
"=",
"self",
".",
"_flavour",
".... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pathlib2/pathlib2/__init__.py#L1076-L1085 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/py/shell.py | python | Shell.redirectStdout | (self, redirect=True) | If redirect is true then sys.stdout will go to the shell. | If redirect is true then sys.stdout will go to the shell. | [
"If",
"redirect",
"is",
"true",
"then",
"sys",
".",
"stdout",
"will",
"go",
"to",
"the",
"shell",
"."
] | def redirectStdout(self, redirect=True):
"""If redirect is true then sys.stdout will go to the shell."""
if redirect:
sys.stdout = PseudoFileOut(self.writeOut)
else:
sys.stdout = self.stdout | [
"def",
"redirectStdout",
"(",
"self",
",",
"redirect",
"=",
"True",
")",
":",
"if",
"redirect",
":",
"sys",
".",
"stdout",
"=",
"PseudoFileOut",
"(",
"self",
".",
"writeOut",
")",
"else",
":",
"sys",
".",
"stdout",
"=",
"self",
".",
"stdout"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/py/shell.py#L1256-L1261 | ||
tfwu/FaceDetection-ConvNet-3D | f9251c48eb40c5aec8fba7455115c355466555be | python/build/lib.linux-x86_64-2.7/mxnet/kvstore.py | python | KVStore._set_updater | (self, updater) | Set a push updater into the store.
This function only changes the local store. Use set_optimizer for
multi-machines.
Parameters
----------
updater : function
the updater function
Examples
--------
>>> def update(key, input, stored):
... | Set a push updater into the store. | [
"Set",
"a",
"push",
"updater",
"into",
"the",
"store",
"."
] | def _set_updater(self, updater):
"""Set a push updater into the store.
This function only changes the local store. Use set_optimizer for
multi-machines.
Parameters
----------
updater : function
the updater function
Examples
--------
... | [
"def",
"_set_updater",
"(",
"self",
",",
"updater",
")",
":",
"_updater_proto",
"=",
"ctypes",
".",
"CFUNCTYPE",
"(",
"None",
",",
"ctypes",
".",
"c_int",
",",
"NDArrayHandle",
",",
"NDArrayHandle",
",",
"ctypes",
".",
"c_void_p",
")",
"self",
".",
"_updat... | https://github.com/tfwu/FaceDetection-ConvNet-3D/blob/f9251c48eb40c5aec8fba7455115c355466555be/python/build/lib.linux-x86_64-2.7/mxnet/kvstore.py#L297-L328 | ||
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/blackduck_hub.py | python | ReportManager.add_report_metric | (self, comp_name: str, metric: str) | Add a column to be included in the pretty table. | Add a column to be included in the pretty table. | [
"Add",
"a",
"column",
"to",
"be",
"included",
"in",
"the",
"pretty",
"table",
"."
] | def add_report_metric(self, comp_name: str, metric: str):
"""Add a column to be included in the pretty table."""
comp_name = ReportManager._get_norm_comp_name(comp_name)
self._data.add_value(comp_name, metric) | [
"def",
"add_report_metric",
"(",
"self",
",",
"comp_name",
":",
"str",
",",
"metric",
":",
"str",
")",
":",
"comp_name",
"=",
"ReportManager",
".",
"_get_norm_comp_name",
"(",
"comp_name",
")",
"self",
".",
"_data",
".",
"add_value",
"(",
"comp_name",
",",
... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/blackduck_hub.py#L810-L814 | ||
sailing-pmls/bosen | 06cb58902d011fbea5f9428f10ce30e621492204 | style_script/cpplint.py | python | Search | (pattern, s) | return _regexp_compile_cache[pattern].search(s) | Searches the string for the pattern, caching the compiled regexp. | Searches the string for the pattern, caching the compiled regexp. | [
"Searches",
"the",
"string",
"for",
"the",
"pattern",
"caching",
"the",
"compiled",
"regexp",
"."
] | def Search(pattern, s):
"""Searches the string for the pattern, caching the compiled regexp."""
if pattern not in _regexp_compile_cache:
_regexp_compile_cache[pattern] = sre_compile.compile(pattern)
return _regexp_compile_cache[pattern].search(s) | [
"def",
"Search",
"(",
"pattern",
",",
"s",
")",
":",
"if",
"pattern",
"not",
"in",
"_regexp_compile_cache",
":",
"_regexp_compile_cache",
"[",
"pattern",
"]",
"=",
"sre_compile",
".",
"compile",
"(",
"pattern",
")",
"return",
"_regexp_compile_cache",
"[",
"pat... | https://github.com/sailing-pmls/bosen/blob/06cb58902d011fbea5f9428f10ce30e621492204/style_script/cpplint.py#L585-L589 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/gslib/commands/perfdiag.py | python | PerfDiagCommand._RunOperation | (self, func) | return return_val | Runs an operation with retry logic.
Args:
func: The function to run.
Returns:
True if the operation succeeds, False if aborted. | Runs an operation with retry logic. | [
"Runs",
"an",
"operation",
"with",
"retry",
"logic",
"."
] | def _RunOperation(self, func):
"""Runs an operation with retry logic.
Args:
func: The function to run.
Returns:
True if the operation succeeds, False if aborted.
"""
# We retry on httplib exceptions that can happen if the socket was closed
# by the remote party or the connection br... | [
"def",
"_RunOperation",
"(",
"self",
",",
"func",
")",
":",
"# We retry on httplib exceptions that can happen if the socket was closed",
"# by the remote party or the connection broke because of network issues.",
"# Only the BotoServerError is counted as a 5xx error towards the retry",
"# limi... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/gslib/commands/perfdiag.py#L642-L686 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/check_ops.py | python | assert_integer_v2 | (x, message=None, name=None) | Assert that `x` is of integer dtype.
If `x` has a non-integer type, `message`, as well as the dtype of `x` are
printed, and `InvalidArgumentError` is raised.
This can always be checked statically, so this method returns nothing.
Args:
x: A `Tensor`.
message: A string to prefix to the default message.... | Assert that `x` is of integer dtype. | [
"Assert",
"that",
"x",
"is",
"of",
"integer",
"dtype",
"."
] | def assert_integer_v2(x, message=None, name=None):
"""Assert that `x` is of integer dtype.
If `x` has a non-integer type, `message`, as well as the dtype of `x` are
printed, and `InvalidArgumentError` is raised.
This can always be checked statically, so this method returns nothing.
Args:
x: A `Tensor`.... | [
"def",
"assert_integer_v2",
"(",
"x",
",",
"message",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"assert_integer",
"(",
"x",
"=",
"x",
",",
"message",
"=",
"message",
",",
"name",
"=",
"name",
")"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/check_ops.py#L1510-L1526 | ||
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Node/Python.py | python | ValueNodeInfo.__getstate__ | (self) | return state | Return all fields that shall be pickled. Walk the slots in the class
hierarchy and add those to the state dictionary. If a '__dict__' slot is
available, copy all entries to the dictionary. Also include the version
id, which is fixed for all instances of a class. | Return all fields that shall be pickled. Walk the slots in the class
hierarchy and add those to the state dictionary. If a '__dict__' slot is
available, copy all entries to the dictionary. Also include the version
id, which is fixed for all instances of a class. | [
"Return",
"all",
"fields",
"that",
"shall",
"be",
"pickled",
".",
"Walk",
"the",
"slots",
"in",
"the",
"class",
"hierarchy",
"and",
"add",
"those",
"to",
"the",
"state",
"dictionary",
".",
"If",
"a",
"__dict__",
"slot",
"is",
"available",
"copy",
"all",
... | def __getstate__(self):
"""
Return all fields that shall be pickled. Walk the slots in the class
hierarchy and add those to the state dictionary. If a '__dict__' slot is
available, copy all entries to the dictionary. Also include the version
id, which is fixed for all instances o... | [
"def",
"__getstate__",
"(",
"self",
")",
":",
"state",
"=",
"getattr",
"(",
"self",
",",
"'__dict__'",
",",
"{",
"}",
")",
".",
"copy",
"(",
")",
"for",
"obj",
"in",
"type",
"(",
"self",
")",
".",
"mro",
"(",
")",
":",
"for",
"name",
"in",
"get... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Node/Python.py#L43-L62 | |
ideawu/ssdb-rocks | a3cbb322cafb2f493252829c608e2239df98c9ac | deps/cpy/antlr3/tree.py | python | TreeAdaptor.deleteChild | (self, t, i) | Remove ith child and shift children down from right. | Remove ith child and shift children down from right. | [
"Remove",
"ith",
"child",
"and",
"shift",
"children",
"down",
"from",
"right",
"."
] | def deleteChild(self, t, i):
"""Remove ith child and shift children down from right."""
raise NotImplementedError | [
"def",
"deleteChild",
"(",
"self",
",",
"t",
",",
"i",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/ideawu/ssdb-rocks/blob/a3cbb322cafb2f493252829c608e2239df98c9ac/deps/cpy/antlr3/tree.py#L509-L512 | ||
google/or-tools | 2cb85b4eead4c38e1c54b48044f92087cf165bce | ortools/constraint_solver/samples/cvrptw.py | python | create_distance_evaluator | (data) | return distance_evaluator | Creates callback to return distance between points. | Creates callback to return distance between points. | [
"Creates",
"callback",
"to",
"return",
"distance",
"between",
"points",
"."
] | def create_distance_evaluator(data):
"""Creates callback to return distance between points."""
_distances = {}
# precompute distance between location to have distance callback in O(1)
for from_node in range(data['num_locations']):
_distances[from_node] = {}
for to_node in range(data['num... | [
"def",
"create_distance_evaluator",
"(",
"data",
")",
":",
"_distances",
"=",
"{",
"}",
"# precompute distance between location to have distance callback in O(1)",
"for",
"from_node",
"in",
"range",
"(",
"data",
"[",
"'num_locations'",
"]",
")",
":",
"_distances",
"[",
... | https://github.com/google/or-tools/blob/2cb85b4eead4c38e1c54b48044f92087cf165bce/ortools/constraint_solver/samples/cvrptw.py#L93-L111 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/nntplib.py | python | _NNTPBase.getwelcome | (self) | return self.welcome | Get the welcome message from the server
(this is read and squirreled away by __init__()).
If the response code is 200, posting is allowed;
if it 201, posting is not allowed. | Get the welcome message from the server
(this is read and squirreled away by __init__()).
If the response code is 200, posting is allowed;
if it 201, posting is not allowed. | [
"Get",
"the",
"welcome",
"message",
"from",
"the",
"server",
"(",
"this",
"is",
"read",
"and",
"squirreled",
"away",
"by",
"__init__",
"()",
")",
".",
"If",
"the",
"response",
"code",
"is",
"200",
"posting",
"is",
"allowed",
";",
"if",
"it",
"201",
"po... | def getwelcome(self):
"""Get the welcome message from the server
(this is read and squirreled away by __init__()).
If the response code is 200, posting is allowed;
if it 201, posting is not allowed."""
if self.debugging: print('*welcome*', repr(self.welcome))
return self... | [
"def",
"getwelcome",
"(",
"self",
")",
":",
"if",
"self",
".",
"debugging",
":",
"print",
"(",
"'*welcome*'",
",",
"repr",
"(",
"self",
".",
"welcome",
")",
")",
"return",
"self",
".",
"welcome"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/nntplib.py#L373-L380 | |
apache/mesos | 97d9a4063332aae3825d78de71611657e05cf5e2 | support/verify-reviews.py | python | main | () | Main function to verify the submitted reviews. | Main function to verify the submitted reviews. | [
"Main",
"function",
"to",
"verify",
"the",
"submitted",
"reviews",
"."
] | def main():
"""Main function to verify the submitted reviews."""
review_requests_url = \
"%s/api/review-requests/%s" % (REVIEWBOARD_URL, QUERY_PARAMS)
review_requests = api(review_requests_url)
review_ids = []
for review_request in reversed(review_requests["review_requests"]):
if (N... | [
"def",
"main",
"(",
")",
":",
"review_requests_url",
"=",
"\"%s/api/review-requests/%s\"",
"%",
"(",
"REVIEWBOARD_URL",
",",
"QUERY_PARAMS",
")",
"review_requests",
"=",
"api",
"(",
"review_requests_url",
")",
"review_ids",
"=",
"[",
"]",
"for",
"review_request",
... | https://github.com/apache/mesos/blob/97d9a4063332aae3825d78de71611657e05cf5e2/support/verify-reviews.py#L388-L402 | ||
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/ops/nn_ops.py | python | _calc_bias_add_flops | (graph, node) | return ops.OpStats("flops", input_count) | Calculates the computing needed for BiasAdd. | Calculates the computing needed for BiasAdd. | [
"Calculates",
"the",
"computing",
"needed",
"for",
"BiasAdd",
"."
] | def _calc_bias_add_flops(graph, node):
"""Calculates the computing needed for BiasAdd."""
input_shape = graph_util.tensor_shape_from_node_def_name(graph, node.input[0])
input_shape.assert_is_fully_defined()
input_count = np.prod(input_shape.as_list())
return ops.OpStats("flops", input_count) | [
"def",
"_calc_bias_add_flops",
"(",
"graph",
",",
"node",
")",
":",
"input_shape",
"=",
"graph_util",
".",
"tensor_shape_from_node_def_name",
"(",
"graph",
",",
"node",
".",
"input",
"[",
"0",
"]",
")",
"input_shape",
".",
"assert_is_fully_defined",
"(",
")",
... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/ops/nn_ops.py#L1640-L1645 | |
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/mongosymb.py | python | PathDbgFileResolver.__init__ | (self, bin_path_guess) | Initialize PathDbgFileResolver. | Initialize PathDbgFileResolver. | [
"Initialize",
"PathDbgFileResolver",
"."
] | def __init__(self, bin_path_guess):
"""Initialize PathDbgFileResolver."""
self._bin_path_guess = os.path.realpath(bin_path_guess)
self.mci_build_dir = None | [
"def",
"__init__",
"(",
"self",
",",
"bin_path_guess",
")",
":",
"self",
".",
"_bin_path_guess",
"=",
"os",
".",
"path",
".",
"realpath",
"(",
"bin_path_guess",
")",
"self",
".",
"mci_build_dir",
"=",
"None"
] | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/mongosymb.py#L43-L46 | ||
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/python/framework/tensor_shape.py | python | Dimension.__gt__ | (self, other) | Returns True if `self` is known to be greater than `other`.
Dimensions are compared as follows:
Dimension(m) > Dimension(n) == m > n
Dimension(m) > Dimension(None) == None
Dimension(None) > Dimension(n) == None
Dimension(None) > Dimension(None) == None
Args:
other: A... | Returns True if `self` is known to be greater than `other`. | [
"Returns",
"True",
"if",
"self",
"is",
"known",
"to",
"be",
"greater",
"than",
"other",
"."
] | def __gt__(self, other):
"""Returns True if `self` is known to be greater than `other`.
Dimensions are compared as follows:
Dimension(m) > Dimension(n) == m > n
Dimension(m) > Dimension(None) == None
Dimension(None) > Dimension(n) == None
Dimension(None) > Dimension(None) =... | [
"def",
"__gt__",
"(",
"self",
",",
"other",
")",
":",
"other",
"=",
"as_dimension",
"(",
"other",
")",
"if",
"self",
".",
"_value",
"is",
"None",
"or",
"other",
".",
"value",
"is",
"None",
":",
"return",
"None",
"else",
":",
"return",
"self",
".",
... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/framework/tensor_shape.py#L311-L332 | ||
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Editor/Python/windows/Lib/site-packages/pip/download.py | python | unpack_file_url | (link, location, download_dir=None) | Unpack link into location.
If download_dir is provided and link points to a file, make a copy
of the link file inside download_dir. | Unpack link into location.
If download_dir is provided and link points to a file, make a copy
of the link file inside download_dir. | [
"Unpack",
"link",
"into",
"location",
".",
"If",
"download_dir",
"is",
"provided",
"and",
"link",
"points",
"to",
"a",
"file",
"make",
"a",
"copy",
"of",
"the",
"link",
"file",
"inside",
"download_dir",
"."
] | def unpack_file_url(link, location, download_dir=None):
"""Unpack link into location.
If download_dir is provided and link points to a file, make a copy
of the link file inside download_dir."""
link_path = url_to_path(link.url_without_fragment)
# If it's a url to a local directory
if os.path.i... | [
"def",
"unpack_file_url",
"(",
"link",
",",
"location",
",",
"download_dir",
"=",
"None",
")",
":",
"link_path",
"=",
"url_to_path",
"(",
"link",
".",
"url_without_fragment",
")",
"# If it's a url to a local directory",
"if",
"os",
".",
"path",
".",
"isdir",
"("... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Editor/Python/windows/Lib/site-packages/pip/download.py#L688-L727 | ||
TimoSaemann/caffe-segnet-cudnn5 | abcf30dca449245e101bf4ced519f716177f0885 | scripts/cpp_lint.py | python | _ShouldPrintError | (category, confidence, linenum) | return True | If confidence >= verbose, category passes filter and is not suppressed. | If confidence >= verbose, category passes filter and is not suppressed. | [
"If",
"confidence",
">",
"=",
"verbose",
"category",
"passes",
"filter",
"and",
"is",
"not",
"suppressed",
"."
] | def _ShouldPrintError(category, confidence, linenum):
"""If confidence >= verbose, category passes filter and is not suppressed."""
# There are three ways we might decide not to print an error message:
# a "NOLINT(category)" comment appears in the source,
# the verbosity level isn't high enough, or the filters... | [
"def",
"_ShouldPrintError",
"(",
"category",
",",
"confidence",
",",
"linenum",
")",
":",
"# There are three ways we might decide not to print an error message:",
"# a \"NOLINT(category)\" comment appears in the source,",
"# the verbosity level isn't high enough, or the filters filter it out... | https://github.com/TimoSaemann/caffe-segnet-cudnn5/blob/abcf30dca449245e101bf4ced519f716177f0885/scripts/cpp_lint.py#L961-L985 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/idl_parser/idl_parser.py | python | IDLParser.p_TypeSuffix | (self, p) | TypeSuffix : '[' integer ']' TypeSuffix
| '[' ']' TypeSuffix
| '?' TypeSuffixStartingWithArray
| | TypeSuffix : '[' integer ']' TypeSuffix
| '[' ']' TypeSuffix
| '?' TypeSuffixStartingWithArray
| | [
"TypeSuffix",
":",
"[",
"integer",
"]",
"TypeSuffix",
"|",
"[",
"]",
"TypeSuffix",
"|",
"?",
"TypeSuffixStartingWithArray",
"|"
] | def p_TypeSuffix(self, p):
"""TypeSuffix : '[' integer ']' TypeSuffix
| '[' ']' TypeSuffix
| '?' TypeSuffixStartingWithArray
| """
if len(p) == 5:
p[0] = self.BuildNamed('Array', p, 2, p[4])
if len(p) == 4:
p[0] = self.BuildProduction('Array... | [
"def",
"p_TypeSuffix",
"(",
"self",
",",
"p",
")",
":",
"if",
"len",
"(",
"p",
")",
"==",
"5",
":",
"p",
"[",
"0",
"]",
"=",
"self",
".",
"BuildNamed",
"(",
"'Array'",
",",
"p",
",",
"2",
",",
"p",
"[",
"4",
"]",
")",
"if",
"len",
"(",
"p... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/idl_parser/idl_parser.py#L772-L784 | ||
omnisci/omniscidb | b9c95f1bd602b4ffc8b0edf18bfad61031e08d86 | python/omnisci/thrift/OmniSci.py | python | Client.get_license_claims | (self, session, nonce) | return self.recv_get_license_claims() | Parameters:
- session
- nonce | Parameters:
- session
- nonce | [
"Parameters",
":",
"-",
"session",
"-",
"nonce"
] | def get_license_claims(self, session, nonce):
"""
Parameters:
- session
- nonce
"""
self.send_get_license_claims(session, nonce)
return self.recv_get_license_claims() | [
"def",
"get_license_claims",
"(",
"self",
",",
"session",
",",
"nonce",
")",
":",
"self",
".",
"send_get_license_claims",
"(",
"session",
",",
"nonce",
")",
"return",
"self",
".",
"recv_get_license_claims",
"(",
")"
] | https://github.com/omnisci/omniscidb/blob/b9c95f1bd602b4ffc8b0edf18bfad61031e08d86/python/omnisci/thrift/OmniSci.py#L4297-L4305 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/contexts/fitting_contexts/basic_fitting_context.py | python | BasicFittingContext.chi_squared | (self) | return self._chi_squared | Returns all of the chi squared values. | Returns all of the chi squared values. | [
"Returns",
"all",
"of",
"the",
"chi",
"squared",
"values",
"."
] | def chi_squared(self) -> list:
"""Returns all of the chi squared values."""
return self._chi_squared | [
"def",
"chi_squared",
"(",
"self",
")",
"->",
"list",
":",
"return",
"self",
".",
"_chi_squared"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/contexts/fitting_contexts/basic_fitting_context.py#L184-L186 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/tools/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/tools/gyp/pylib/gyp/MSVSUserFile.py#L72-L78 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_core.py | python | Image.InsertHandler | (*args, **kwargs) | return _core_.Image_InsertHandler(*args, **kwargs) | InsertHandler(ImageHandler handler) | InsertHandler(ImageHandler handler) | [
"InsertHandler",
"(",
"ImageHandler",
"handler",
")"
] | def InsertHandler(*args, **kwargs):
"""InsertHandler(ImageHandler handler)"""
return _core_.Image_InsertHandler(*args, **kwargs) | [
"def",
"InsertHandler",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Image_InsertHandler",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L3618-L3620 | |
hpi-xnor/BMXNet | ed0b201da6667887222b8e4b5f997c4f6b61943d | python/mxnet/ndarray/ndarray.py | python | NDArray.__gt__ | (self, other) | return greater(self, other) | x.__gt__(y) <=> x>y <=> mx.nd.greater(x, y) | x.__gt__(y) <=> x>y <=> mx.nd.greater(x, y) | [
"x",
".",
"__gt__",
"(",
"y",
")",
"<",
"=",
">",
"x",
">",
"y",
"<",
"=",
">",
"mx",
".",
"nd",
".",
"greater",
"(",
"x",
"y",
")"
] | def __gt__(self, other):
"""x.__gt__(y) <=> x>y <=> mx.nd.greater(x, y) """
return greater(self, other) | [
"def",
"__gt__",
"(",
"self",
",",
"other",
")",
":",
"return",
"greater",
"(",
"self",
",",
"other",
")"
] | https://github.com/hpi-xnor/BMXNet/blob/ed0b201da6667887222b8e4b5f997c4f6b61943d/python/mxnet/ndarray/ndarray.py#L322-L324 | |
stitchEm/stitchEm | 0f399501d41ab77933677f2907f41f80ceb704d7 | lib/bindings/samples/server/glfw.py | python | _GLFWimage.unwrap | (self) | return self.width, self.height, pixels | Returns a nested python sequence. | Returns a nested python sequence. | [
"Returns",
"a",
"nested",
"python",
"sequence",
"."
] | def unwrap(self):
"""
Returns a nested python sequence.
"""
pixels = [[[int(c) for c in p] for p in l] for l in self.pixels_array]
return self.width, self.height, pixels | [
"def",
"unwrap",
"(",
"self",
")",
":",
"pixels",
"=",
"[",
"[",
"[",
"int",
"(",
"c",
")",
"for",
"c",
"in",
"p",
"]",
"for",
"p",
"in",
"l",
"]",
"for",
"l",
"in",
"self",
".",
"pixels_array",
"]",
"return",
"self",
".",
"width",
",",
"self... | https://github.com/stitchEm/stitchEm/blob/0f399501d41ab77933677f2907f41f80ceb704d7/lib/bindings/samples/server/glfw.py#L323-L328 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/linalg/python/ops/linear_operator_util.py | python | matrix_adjoint | (a, name="matrix_adjoint") | Transposes last two dimensions of tensor `a`, and takes complex conjugate.
If `a` is real valued, the result is equivalent to `matrix_transpose`.
For example:
```python
# Matrix with no batch dimension.
# 'x' is [[1 2 3j]
# [4 5 -6j]]
tf.matrix_adjoint(x) ==> [[1 4]
... | Transposes last two dimensions of tensor `a`, and takes complex conjugate. | [
"Transposes",
"last",
"two",
"dimensions",
"of",
"tensor",
"a",
"and",
"takes",
"complex",
"conjugate",
"."
] | def matrix_adjoint(a, name="matrix_adjoint"):
"""Transposes last two dimensions of tensor `a`, and takes complex conjugate.
If `a` is real valued, the result is equivalent to `matrix_transpose`.
For example:
```python
# Matrix with no batch dimension.
# 'x' is [[1 2 3j]
# [4 5 -6j]]
tf.matrix... | [
"def",
"matrix_adjoint",
"(",
"a",
",",
"name",
"=",
"\"matrix_adjoint\"",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"name",
",",
"values",
"=",
"[",
"a",
"]",
")",
":",
"a",
"=",
"ops",
".",
"convert_to_tensor",
"(",
"a",
",",
"name",
"=",
... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/linalg/python/ops/linear_operator_util.py#L292-L336 | ||
grpc/grpc | 27bc6fe7797e43298dc931b96dc57322d0852a9f | examples/python/cancellation/search.py | python | _bytestrings_of_length | (length) | Generates a stream containing all bytestrings of a given length.
Args:
length: A positive integer length.
Yields:
All bytestrings of length `length`. | Generates a stream containing all bytestrings of a given length. | [
"Generates",
"a",
"stream",
"containing",
"all",
"bytestrings",
"of",
"a",
"given",
"length",
"."
] | def _bytestrings_of_length(length):
"""Generates a stream containing all bytestrings of a given length.
Args:
length: A positive integer length.
Yields:
All bytestrings of length `length`.
"""
for digits in itertools.product(range(_BYTE_MAX), repeat=length):
yield b''.join(stru... | [
"def",
"_bytestrings_of_length",
"(",
"length",
")",
":",
"for",
"digits",
"in",
"itertools",
".",
"product",
"(",
"range",
"(",
"_BYTE_MAX",
")",
",",
"repeat",
"=",
"length",
")",
":",
"yield",
"b''",
".",
"join",
"(",
"struct",
".",
"pack",
"(",
"'B... | https://github.com/grpc/grpc/blob/27bc6fe7797e43298dc931b96dc57322d0852a9f/examples/python/cancellation/search.py#L73-L83 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/learn/python/learn/estimators/run_config.py | python | ClusterConfig.get_task_id | () | return int(task_index) if task_index else 0 | Returns task index from `TF_CONFIG` environmental variable.
If you have a ClusterConfig instance, you can just access its task_id
property instead of calling this function and re-parsing the environmental
variable.
Returns:
`TF_CONFIG['task']['index']`. Defaults to 0. | Returns task index from `TF_CONFIG` environmental variable. | [
"Returns",
"task",
"index",
"from",
"TF_CONFIG",
"environmental",
"variable",
"."
] | def get_task_id():
"""Returns task index from `TF_CONFIG` environmental variable.
If you have a ClusterConfig instance, you can just access its task_id
property instead of calling this function and re-parsing the environmental
variable.
Returns:
`TF_CONFIG['task']['index']`. Defaults to 0.
... | [
"def",
"get_task_id",
"(",
")",
":",
"config",
"=",
"json",
".",
"loads",
"(",
"os",
".",
"environ",
".",
"get",
"(",
"'TF_CONFIG'",
")",
"or",
"'{}'",
")",
"task_env",
"=",
"config",
".",
"get",
"(",
"'task'",
",",
"{",
"}",
")",
"task_index",
"="... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/learn/python/learn/estimators/run_config.py#L195-L208 | |
libornovax/master_thesis_code | 6eca474ed3cae673afde010caef338cf7349f839 | scripts/nets/macc_net_generator.py | python | MACCNetGenerator._add_layer | (self, line, outfile, deploy) | Adds one layer to the PROTOTXT file specified by the line.
Input:
line: string with layer description (one line from the config file)
outfile: File handle into which we will write the layer
deploy: True/False | Adds one layer to the PROTOTXT file specified by the line. | [
"Adds",
"one",
"layer",
"to",
"the",
"PROTOTXT",
"file",
"specified",
"by",
"the",
"line",
"."
] | def _add_layer(self, line, outfile, deploy):
"""
Adds one layer to the PROTOTXT file specified by the line.
Input:
line: string with layer description (one line from the config file)
outfile: File handle into which we will write the layer
deploy: True/False
"""
layer_type = line[:4]
if layer_type... | [
"def",
"_add_layer",
"(",
"self",
",",
"line",
",",
"outfile",
",",
"deploy",
")",
":",
"layer_type",
"=",
"line",
"[",
":",
"4",
"]",
"if",
"layer_type",
"==",
"'conv'",
":",
"# Convolutional layer",
"outfile",
".",
"write",
"(",
"self",
".",
"_layer_co... | https://github.com/libornovax/master_thesis_code/blob/6eca474ed3cae673afde010caef338cf7349f839/scripts/nets/macc_net_generator.py#L163-L184 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/drill/view/DrillTableWidget.py | python | DrillTableWidget.eraseRow | (self, position) | Erase the contents of a whole row (if it exists).
Args:
position (int): row index | Erase the contents of a whole row (if it exists). | [
"Erase",
"the",
"contents",
"of",
"a",
"whole",
"row",
"(",
"if",
"it",
"exists",
")",
"."
] | def eraseRow(self, position):
"""
Erase the contents of a whole row (if it exists).
Args:
position (int): row index
"""
if self._disabled:
return
n_rows = self.rowCount()
if ((position < 0) or (position >= n_rows)):
return
... | [
"def",
"eraseRow",
"(",
"self",
",",
"position",
")",
":",
"if",
"self",
".",
"_disabled",
":",
"return",
"n_rows",
"=",
"self",
".",
"rowCount",
"(",
")",
"if",
"(",
"(",
"position",
"<",
"0",
")",
"or",
"(",
"position",
">=",
"n_rows",
")",
")",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/drill/view/DrillTableWidget.py#L162-L177 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.