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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
panda3d/panda3d | 833ad89ebad58395d0af0b7ec08538e5e4308265 | direct/src/gui/DirectGuiBase.py | python | DirectGuiBase.cget | (self, option) | Get current configuration setting for this option | Get current configuration setting for this option | [
"Get",
"current",
"configuration",
"setting",
"for",
"this",
"option"
] | def cget(self, option):
"""
Get current configuration setting for this option
"""
# Return the value of an option, for example myWidget['font'].
if option in self._optionInfo:
return self._optionInfo[option][DGG._OPT_VALUE]
else:
index = option.fin... | [
"def",
"cget",
"(",
"self",
",",
"option",
")",
":",
"# Return the value of an option, for example myWidget['font'].",
"if",
"option",
"in",
"self",
".",
"_optionInfo",
":",
"return",
"self",
".",
"_optionInfo",
"[",
"option",
"]",
"[",
"DGG",
".",
"_OPT_VALUE",
... | https://github.com/panda3d/panda3d/blob/833ad89ebad58395d0af0b7ec08538e5e4308265/direct/src/gui/DirectGuiBase.py#L446-L483 | ||
kungfu-origin/kungfu | 90c84b2b590855654cb9a6395ed050e0f7763512 | core/extensions/sim/mdmaker/src/stock.py | python | OrderBook.match | (self, aggressor_side) | return trades | Match orders and return a list of trades | Match orders and return a list of trades | [
"Match",
"orders",
"and",
"return",
"a",
"list",
"of",
"trades"
] | def match(self, aggressor_side):
"""
Match orders and return a list of trades
"""
# print("Matching on the following book:")
# self.print()
trades = []
for bid_i in range(len(self.bid) - 1, -1, -1):
bid = self.bid[bid_i]
size_offer = l... | [
"def",
"match",
"(",
"self",
",",
"aggressor_side",
")",
":",
"# print(\"Matching on the following book:\")",
"# self.print()",
"trades",
"=",
"[",
"]",
"for",
"bid_i",
"in",
"range",
"(",
"len",
"(",
"self",
".",
"bid",
")",
"-",
"1",
",",
"-",
"1",
",",
... | https://github.com/kungfu-origin/kungfu/blob/90c84b2b590855654cb9a6395ed050e0f7763512/core/extensions/sim/mdmaker/src/stock.py#L268-L303 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py | python | TarFile.getmember | (self, name) | return tarinfo | Return a TarInfo object for member `name'. If `name' can not be
found in the archive, KeyError is raised. If a member occurs more
than once in the archive, its last occurrence is assumed to be the
most up-to-date version. | Return a TarInfo object for member `name'. If `name' can not be | [
"Return",
"a",
"TarInfo",
"object",
"for",
"member",
"name",
".",
"If",
"name",
"can",
"not",
"be"
] | def getmember(self, name):
"""Return a TarInfo object for member `name'. If `name' can not be
found in the archive, KeyError is raised. If a member occurs more
than once in the archive, its last occurrence is assumed to be the
most up-to-date version.
"""
t... | [
"def",
"getmember",
"(",
"self",
",",
"name",
")",
":",
"tarinfo",
"=",
"self",
".",
"_getmember",
"(",
"name",
")",
"if",
"tarinfo",
"is",
"None",
":",
"raise",
"KeyError",
"(",
"\"filename %r not found\"",
"%",
"name",
")",
"return",
"tarinfo"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py#L3767-L3785 | |
deepmind/open_spiel | 4ca53bea32bb2875c7385d215424048ae92f78c8 | open_spiel/python/algorithms/adidas_utils/helpers/symmetric/game_runner.py | python | construct_game_queries_for_exp | (base_profile, num_checkpts) | return new_queries | Constructs a list of checkpoint selection tuples to query value function.
Each query tuple (p1's selected checkpt, ..., p7's selected checkpt)
fixes the players in the game of diplomacy to be played. It may be necessary
to play several games with the same players to form an accurate estimate of
the value or pa... | Constructs a list of checkpoint selection tuples to query value function. | [
"Constructs",
"a",
"list",
"of",
"checkpoint",
"selection",
"tuples",
"to",
"query",
"value",
"function",
"."
] | def construct_game_queries_for_exp(base_profile, num_checkpts):
"""Constructs a list of checkpoint selection tuples to query value function.
Each query tuple (p1's selected checkpt, ..., p7's selected checkpt)
fixes the players in the game of diplomacy to be played. It may be necessary
to play several games wi... | [
"def",
"construct_game_queries_for_exp",
"(",
"base_profile",
",",
"num_checkpts",
")",
":",
"new_queries",
"=",
"set",
"(",
"[",
"]",
")",
"pi",
"=",
"0",
"new_profile",
"=",
"list",
"(",
"base_profile",
")",
"for",
"ai",
"in",
"range",
"(",
"num_checkpts",... | https://github.com/deepmind/open_spiel/blob/4ca53bea32bb2875c7385d215424048ae92f78c8/open_spiel/python/algorithms/adidas_utils/helpers/symmetric/game_runner.py#L52-L76 | |
freeorion/freeorion | c266a40eccd3a99a17de8fe57c36ef6ba3771665 | default/python/AI/FleetUtilsAI.py | python | extract_fleet_ids_without_mission_types | (fleets_ids) | return [fleet_id for fleet_id in fleets_ids if not aistate.get_fleet_mission(fleet_id).type] | Extracts a list with fleetIDs that have no mission. | Extracts a list with fleetIDs that have no mission. | [
"Extracts",
"a",
"list",
"with",
"fleetIDs",
"that",
"have",
"no",
"mission",
"."
] | def extract_fleet_ids_without_mission_types(fleets_ids):
"""Extracts a list with fleetIDs that have no mission."""
aistate = get_aistate()
return [fleet_id for fleet_id in fleets_ids if not aistate.get_fleet_mission(fleet_id).type] | [
"def",
"extract_fleet_ids_without_mission_types",
"(",
"fleets_ids",
")",
":",
"aistate",
"=",
"get_aistate",
"(",
")",
"return",
"[",
"fleet_id",
"for",
"fleet_id",
"in",
"fleets_ids",
"if",
"not",
"aistate",
".",
"get_fleet_mission",
"(",
"fleet_id",
")",
".",
... | https://github.com/freeorion/freeorion/blob/c266a40eccd3a99a17de8fe57c36ef6ba3771665/default/python/AI/FleetUtilsAI.py#L369-L372 | |
BitMEX/api-connectors | 37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812 | auto-generated/python/swagger_client/models/instrument.py | python | Instrument.taxed | (self) | return self._taxed | Gets the taxed of this Instrument. # noqa: E501
:return: The taxed of this Instrument. # noqa: E501
:rtype: bool | Gets the taxed of this Instrument. # noqa: E501 | [
"Gets",
"the",
"taxed",
"of",
"this",
"Instrument",
".",
"#",
"noqa",
":",
"E501"
] | def taxed(self):
"""Gets the taxed of this Instrument. # noqa: E501
:return: The taxed of this Instrument. # noqa: E501
:rtype: bool
"""
return self._taxed | [
"def",
"taxed",
"(",
"self",
")",
":",
"return",
"self",
".",
"_taxed"
] | https://github.com/BitMEX/api-connectors/blob/37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812/auto-generated/python/swagger_client/models/instrument.py#L1444-L1451 | |
arangodb/arangodb | 0d658689c7d1b721b314fa3ca27d38303e1570c8 | 3rdParty/V8/gyp/msvs_emulation.py | python | MsvsSettings._GetLdManifestFlags | (self, config, name, gyp_to_build_path, allow_isolation, build_dir) | return flags, output_name, manifest_files | Returns a 3-tuple:
- the set of flags that need to be added to the link to generate
a default manifest
- the intermediate manifest that the linker will generate that should be
used to assert it doesn't add anything to the merged one.
- the list of all the manifest files to be merged by the manif... | Returns a 3-tuple:
- the set of flags that need to be added to the link to generate
a default manifest
- the intermediate manifest that the linker will generate that should be
used to assert it doesn't add anything to the merged one.
- the list of all the manifest files to be merged by the manif... | [
"Returns",
"a",
"3",
"-",
"tuple",
":",
"-",
"the",
"set",
"of",
"flags",
"that",
"need",
"to",
"be",
"added",
"to",
"the",
"link",
"to",
"generate",
"a",
"default",
"manifest",
"-",
"the",
"intermediate",
"manifest",
"that",
"the",
"linker",
"will",
"... | def _GetLdManifestFlags(self, config, name, gyp_to_build_path, allow_isolation, build_dir):
"""Returns a 3-tuple:
- the set of flags that need to be added to the link to generate
a default manifest
- the intermediate manifest that the linker will generate that should be
used to assert it doesn't... | [
"def",
"_GetLdManifestFlags",
"(",
"self",
",",
"config",
",",
"name",
",",
"gyp_to_build_path",
",",
"allow_isolation",
",",
"build_dir",
")",
":",
"generate_manifest",
"=",
"self",
".",
"_Setting",
"(",
"(",
"'VCLinkerTool'",
",",
"'GenerateManifest'",
")",
",... | https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/V8/gyp/msvs_emulation.py#L602-L674 | |
wangkuiyi/mapreduce-lite | 1bb92fe094dc47480ef9163c34070a3199feead6 | src/mapreduce_lite/scheduler/util.py | python | SocketWrapper.send | (self, mesg) | Send out message | Send out message | [
"Send",
"out",
"message"
] | def send(self, mesg):
""" Send out message
"""
mesg = urllib.quote(mesg)
mesg = '%s\n' %mesg
self.sockobj.sendall(mesg) | [
"def",
"send",
"(",
"self",
",",
"mesg",
")",
":",
"mesg",
"=",
"urllib",
".",
"quote",
"(",
"mesg",
")",
"mesg",
"=",
"'%s\\n'",
"%",
"mesg",
"self",
".",
"sockobj",
".",
"sendall",
"(",
"mesg",
")"
] | https://github.com/wangkuiyi/mapreduce-lite/blob/1bb92fe094dc47480ef9163c34070a3199feead6/src/mapreduce_lite/scheduler/util.py#L50-L55 | ||
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py | python | GenerateOutput | (target_list, target_dicts, data, params) | Called by gyp as the final stage. Outputs results. | Called by gyp as the final stage. Outputs results. | [
"Called",
"by",
"gyp",
"as",
"the",
"final",
"stage",
".",
"Outputs",
"results",
"."
] | def GenerateOutput(target_list, target_dicts, data, params):
"""Called by gyp as the final stage. Outputs results."""
config = Config()
try:
config.Init(params)
if not config.files:
raise Exception('Must specify files to analyze via config_path generator '
'flag')
topleve... | [
"def",
"GenerateOutput",
"(",
"target_list",
",",
"target_dicts",
",",
"data",
",",
"params",
")",
":",
"config",
"=",
"Config",
"(",
")",
"try",
":",
"config",
".",
"Init",
"(",
"params",
")",
"if",
"not",
"config",
".",
"files",
":",
"raise",
"Except... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py#L692-L743 | ||
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | xpcom/idl-parser/header.py | python | methodReturnType | (m, macro) | macro should be NS_IMETHOD or NS_IMETHODIMP | macro should be NS_IMETHOD or NS_IMETHODIMP | [
"macro",
"should",
"be",
"NS_IMETHOD",
"or",
"NS_IMETHODIMP"
] | def methodReturnType(m, macro):
"""macro should be NS_IMETHOD or NS_IMETHODIMP"""
if m.nostdcall and m.notxpcom:
return "%s%s" % (macro == "NS_IMETHOD" and "virtual " or "",
m.realtype.nativeType('in').strip())
elif m.nostdcall:
return "%snsresult" % (macro == "NS_IM... | [
"def",
"methodReturnType",
"(",
"m",
",",
"macro",
")",
":",
"if",
"m",
".",
"nostdcall",
"and",
"m",
".",
"notxpcom",
":",
"return",
"\"%s%s\"",
"%",
"(",
"macro",
"==",
"\"NS_IMETHOD\"",
"and",
"\"virtual \"",
"or",
"\"\"",
",",
"m",
".",
"realtype",
... | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/xpcom/idl-parser/header.py#L64-L74 | ||
funnyzhou/Adaptive_Feeding | 9c78182331d8c0ea28de47226e805776c638d46f | python/caffe/detector.py | python | Detector.crop | (self, im, window) | return crop | Crop a window from the image for detection. Include surrounding context
according to the `context_pad` configuration.
Parameters
----------
im: H x W x K image ndarray to crop.
window: bounding box coordinates as ymin, xmin, ymax, xmax.
Returns
-------
c... | Crop a window from the image for detection. Include surrounding context
according to the `context_pad` configuration. | [
"Crop",
"a",
"window",
"from",
"the",
"image",
"for",
"detection",
".",
"Include",
"surrounding",
"context",
"according",
"to",
"the",
"context_pad",
"configuration",
"."
] | def crop(self, im, window):
"""
Crop a window from the image for detection. Include surrounding context
according to the `context_pad` configuration.
Parameters
----------
im: H x W x K image ndarray to crop.
window: bounding box coordinates as ymin, xmin, ymax, ... | [
"def",
"crop",
"(",
"self",
",",
"im",
",",
"window",
")",
":",
"# Crop window from the image.",
"crop",
"=",
"im",
"[",
"window",
"[",
"0",
"]",
":",
"window",
"[",
"2",
"]",
",",
"window",
"[",
"1",
"]",
":",
"window",
"[",
"3",
"]",
"]",
"if",... | https://github.com/funnyzhou/Adaptive_Feeding/blob/9c78182331d8c0ea28de47226e805776c638d46f/python/caffe/detector.py#L125-L179 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/contrib/metrics/python/ops/metric_ops.py | python | streaming_concat | (values,
axis=0,
max_size=None,
metrics_collections=None,
updates_collections=None,
name=None) | Concatenate values along an axis across batches.
The function `streaming_concat` creates two local variables, `array` and
`size`, that are used to store concatenated values. Internally, `array` is
used as storage for a dynamic array (if `maxsize` is `None`), which ensures
that updates can be run in amortized c... | Concatenate values along an axis across batches. | [
"Concatenate",
"values",
"along",
"an",
"axis",
"across",
"batches",
"."
] | def streaming_concat(values,
axis=0,
max_size=None,
metrics_collections=None,
updates_collections=None,
name=None):
"""Concatenate values along an axis across batches.
The function `streaming_concat` creates tw... | [
"def",
"streaming_concat",
"(",
"values",
",",
"axis",
"=",
"0",
",",
"max_size",
"=",
"None",
",",
"metrics_collections",
"=",
"None",
",",
"updates_collections",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"with",
"variable_scope",
".",
"variable_scop... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/metrics/python/ops/metric_ops.py#L2766-L2874 | ||
apache/singa | 93fd9da72694e68bfe3fb29d0183a65263d238a1 | python/singa/autograd.py | python | CrossEntropy.forward | (self, x) | return loss | Args:
x (CTensor): 1d or 2d tensor, the prediction data(output)
of current network.
t (CTensor): 1d or 2d tensor, the target data for training.
Returns:
loss (CTensor): scalar. | Args:
x (CTensor): 1d or 2d tensor, the prediction data(output)
of current network.
t (CTensor): 1d or 2d tensor, the target data for training.
Returns:
loss (CTensor): scalar. | [
"Args",
":",
"x",
"(",
"CTensor",
")",
":",
"1d",
"or",
"2d",
"tensor",
"the",
"prediction",
"data",
"(",
"output",
")",
"of",
"current",
"network",
".",
"t",
"(",
"CTensor",
")",
":",
"1d",
"or",
"2d",
"tensor",
"the",
"target",
"data",
"for",
"tr... | def forward(self, x):
"""
Args:
x (CTensor): 1d or 2d tensor, the prediction data(output)
of current network.
t (CTensor): 1d or 2d tensor, the target data for training.
Returns:
loss (CTensor): scalar.
"""
loss = singa... | [
"def",
"forward",
"(",
"self",
",",
"x",
")",
":",
"loss",
"=",
"singa",
".",
"SumAll",
"(",
"singa",
".",
"__mul__",
"(",
"self",
".",
"t",
",",
"singa",
".",
"Log",
"(",
"x",
")",
")",
")",
"loss",
"/=",
"-",
"x",
".",
"shape",
"(",
")",
... | https://github.com/apache/singa/blob/93fd9da72694e68bfe3fb29d0183a65263d238a1/python/singa/autograd.py#L1222-L1234 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib-tk/Tkinter.py | python | Menu.__init__ | (self, master=None, cnf={}, **kw) | Construct menu widget with the parent MASTER.
Valid resource names: activebackground, activeborderwidth,
activeforeground, background, bd, bg, borderwidth, cursor,
disabledforeground, fg, font, foreground, postcommand, relief,
selectcolor, takefocus, tearoff, tearoffcommand, title, type... | Construct menu widget with the parent MASTER. | [
"Construct",
"menu",
"widget",
"with",
"the",
"parent",
"MASTER",
"."
] | def __init__(self, master=None, cnf={}, **kw):
"""Construct menu widget with the parent MASTER.
Valid resource names: activebackground, activeborderwidth,
activeforeground, background, bd, bg, borderwidth, cursor,
disabledforeground, fg, font, foreground, postcommand, relief,
se... | [
"def",
"__init__",
"(",
"self",
",",
"master",
"=",
"None",
",",
"cnf",
"=",
"{",
"}",
",",
"*",
"*",
"kw",
")",
":",
"Widget",
".",
"__init__",
"(",
"self",
",",
"master",
",",
"'menu'",
",",
"cnf",
",",
"kw",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib-tk/Tkinter.py#L2635-L2642 | ||
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | tools/codestyle/docstring_checker.py | python | DocstringChecker.has_period | (self, node) | return True | has_period checks if one line doc end-with '.' .
Args:
node (astroid.node): the node is visiting.
Returns:
True if successful otherwise False. | has_period checks if one line doc end-with '.' .
Args:
node (astroid.node): the node is visiting.
Returns:
True if successful otherwise False. | [
"has_period",
"checks",
"if",
"one",
"line",
"doc",
"end",
"-",
"with",
".",
".",
"Args",
":",
"node",
"(",
"astroid",
".",
"node",
")",
":",
"the",
"node",
"is",
"visiting",
".",
"Returns",
":",
"True",
"if",
"successful",
"otherwise",
"False",
"."
] | def has_period(self, node):
"""has_period checks if one line doc end-with '.' .
Args:
node (astroid.node): the node is visiting.
Returns:
True if successful otherwise False.
"""
if node.doc is None:
return True
if len(node.doc.splitlin... | [
"def",
"has_period",
"(",
"self",
",",
"node",
")",
":",
"if",
"node",
".",
"doc",
"is",
"None",
":",
"return",
"True",
"if",
"len",
"(",
"node",
".",
"doc",
".",
"splitlines",
"(",
")",
")",
">",
"1",
":",
"return",
"True",
"if",
"not",
"node",
... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/tools/codestyle/docstring_checker.py#L240-L257 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/htmllib.py | python | HTMLParser.handle_image | (self, src, alt, *args) | This method is called to handle images.
The default implementation simply passes the alt value to the
handle_data() method. | This method is called to handle images. | [
"This",
"method",
"is",
"called",
"to",
"handle",
"images",
"."
] | def handle_image(self, src, alt, *args):
"""This method is called to handle images.
The default implementation simply passes the alt value to the
handle_data() method.
"""
self.handle_data(alt) | [
"def",
"handle_image",
"(",
"self",
",",
"src",
",",
"alt",
",",
"*",
"args",
")",
":",
"self",
".",
"handle_data",
"(",
"alt",
")"
] | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/htmllib.py#L128-L135 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/script_ops.py | python | FuncRegistry._next_unique_token | (self) | return "pyfunc_%d" % uid | Returns a unique token. | Returns a unique token. | [
"Returns",
"a",
"unique",
"token",
"."
] | def _next_unique_token(self):
"""Returns a unique token."""
with self._lock:
uid = self._unique_id
self._unique_id += 1
return "pyfunc_%d" % uid | [
"def",
"_next_unique_token",
"(",
"self",
")",
":",
"with",
"self",
".",
"_lock",
":",
"uid",
"=",
"self",
".",
"_unique_id",
"self",
".",
"_unique_id",
"+=",
"1",
"return",
"\"pyfunc_%d\"",
"%",
"uid"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/script_ops.py#L251-L256 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/scipy/signal/signaltools.py | python | correlate | (in1, in2, mode='full', method='auto') | return z | Cross-correlate two N-dimensional arrays.
Cross-correlate `in1` and `in2`, with the output size determined by the
`mode` argument.
Parameters
----------
in1 : array_like
First input.
in2 : array_like
Second input. Should have the same number of dimensions as `in1`.
mode : s... | Cross-correlate two N-dimensional arrays. | [
"Cross",
"-",
"correlate",
"two",
"N",
"-",
"dimensional",
"arrays",
"."
] | def correlate(in1, in2, mode='full', method='auto'):
"""
Cross-correlate two N-dimensional arrays.
Cross-correlate `in1` and `in2`, with the output size determined by the
`mode` argument.
Parameters
----------
in1 : array_like
First input.
in2 : array_like
Second input.... | [
"def",
"correlate",
"(",
"in1",
",",
"in2",
",",
"mode",
"=",
"'full'",
",",
"method",
"=",
"'auto'",
")",
":",
"in1",
"=",
"asarray",
"(",
"in1",
")",
"in2",
"=",
"asarray",
"(",
"in2",
")",
"if",
"in1",
".",
"ndim",
"==",
"in2",
".",
"ndim",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/signal/signaltools.py#L111-L258 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/compiler/transformer.py | python | Transformer.parsefile | (self, file) | return self.parsesuite(file.read()) | Return a modified parse tree for the contents of the given file. | Return a modified parse tree for the contents of the given file. | [
"Return",
"a",
"modified",
"parse",
"tree",
"for",
"the",
"contents",
"of",
"the",
"given",
"file",
"."
] | def parsefile(self, file):
"""Return a modified parse tree for the contents of the given file."""
if type(file) == type(''):
file = open(file)
return self.parsesuite(file.read()) | [
"def",
"parsefile",
"(",
"self",
",",
"file",
")",
":",
"if",
"type",
"(",
"file",
")",
"==",
"type",
"(",
"''",
")",
":",
"file",
"=",
"open",
"(",
"file",
")",
"return",
"self",
".",
"parsesuite",
"(",
"file",
".",
"read",
"(",
")",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/compiler/transformer.py#L134-L138 | |
glotzerlab/hoomd-blue | f7f97abfa3fcc2522fa8d458d65d0aeca7ba781a | hoomd/hpmc/external/wall.py | python | wall.set_sphere_wall | (self, index, radius, origin, inside=True) | R"""Change the parameters associated with a particular sphere wall. # noqa
Args:
index (int): index of the sphere wall to be modified. indices begin at 0 in the order the sphere walls were added to the system.
radius (float): New radius of spherical wall
origin (tuple): New... | R"""Change the parameters associated with a particular sphere wall. # noqa | [
"R",
"Change",
"the",
"parameters",
"associated",
"with",
"a",
"particular",
"sphere",
"wall",
".",
"#",
"noqa"
] | def set_sphere_wall(self, index, radius, origin, inside=True):
R"""Change the parameters associated with a particular sphere wall. # noqa
Args:
index (int): index of the sphere wall to be modified. indices begin at 0 in the order the sphere walls were added to the system.
radiu... | [
"def",
"set_sphere_wall",
"(",
"self",
",",
"index",
",",
"radius",
",",
"origin",
",",
"inside",
"=",
"True",
")",
":",
"self",
".",
"cpp_compute",
".",
"SetSphereWallParameter",
"(",
"index",
",",
"_hpmc",
".",
"make_sphere_wall",
"(",
"radius",
",",
"or... | https://github.com/glotzerlab/hoomd-blue/blob/f7f97abfa3fcc2522fa8d458d65d0aeca7ba781a/hoomd/hpmc/external/wall.py#L118-L137 | ||
pyne/pyne | 0c2714d7c0d1b5e20be6ae6527da2c660dd6b1b3 | pyne/xs/channels.py | python | sigma_t | (nuc, temp=300.0, group_struct=None, phi_g=None, xs_cache=None) | return sig_t_g | Calculates the total neutron cross section for a nuclide.
.. math::
\\sigma_{t, g} = \\sigma_{a, g} + \\sigma_{s, g}
Parameters
----------
nuc : int, str, Material, or dict-like
A nuclide or nuclide-atom fraction mapping.
temp : float, optional
Temperature [K] of material... | Calculates the total neutron cross section for a nuclide. | [
"Calculates",
"the",
"total",
"neutron",
"cross",
"section",
"for",
"a",
"nuclide",
"."
] | def sigma_t(nuc, temp=300.0, group_struct=None, phi_g=None, xs_cache=None):
"""Calculates the total neutron cross section for a nuclide.
.. math::
\\sigma_{t, g} = \\sigma_{a, g} + \\sigma_{s, g}
Parameters
----------
nuc : int, str, Material, or dict-like
A nuclide or nuclide-at... | [
"def",
"sigma_t",
"(",
"nuc",
",",
"temp",
"=",
"300.0",
",",
"group_struct",
"=",
"None",
",",
"phi_g",
"=",
"None",
",",
"xs_cache",
"=",
"None",
")",
":",
"xs_cache",
"=",
"cache",
".",
"xs_cache",
"if",
"xs_cache",
"is",
"None",
"else",
"xs_cache",... | https://github.com/pyne/pyne/blob/0c2714d7c0d1b5e20be6ae6527da2c660dd6b1b3/pyne/xs/channels.py#L461-L508 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/flatmenu.py | python | FlatToolbarItem.IsCheckItem | (self) | return self._kind == wx.ITEM_CHECK | Returns ``True`` if the item is a radio item. | Returns ``True`` if the item is a radio item. | [
"Returns",
"True",
"if",
"the",
"item",
"is",
"a",
"radio",
"item",
"."
] | def IsCheckItem(self):
""" Returns ``True`` if the item is a radio item. """
return self._kind == wx.ITEM_CHECK | [
"def",
"IsCheckItem",
"(",
"self",
")",
":",
"return",
"self",
".",
"_kind",
"==",
"wx",
".",
"ITEM_CHECK"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/flatmenu.py#L4666-L4669 | |
emscripten-core/emscripten | 0d413d3c5af8b28349682496edc14656f5700c2f | third_party/WebIDL.py | python | Parser.p_NonAnyTypeScopedName | (self, p) | NonAnyType : ScopedName TypeSuffix | NonAnyType : ScopedName TypeSuffix | [
"NonAnyType",
":",
"ScopedName",
"TypeSuffix"
] | def p_NonAnyTypeScopedName(self, p):
"""
NonAnyType : ScopedName TypeSuffix
"""
assert isinstance(p[1], IDLUnresolvedIdentifier)
type = None
try:
if self.globalScope()._lookupIdentifier(p[1]):
obj = self.globalScope()._lookupIdentifier(p[... | [
"def",
"p_NonAnyTypeScopedName",
"(",
"self",
",",
"p",
")",
":",
"assert",
"isinstance",
"(",
"p",
"[",
"1",
"]",
",",
"IDLUnresolvedIdentifier",
")",
"type",
"=",
"None",
"try",
":",
"if",
"self",
".",
"globalScope",
"(",
")",
".",
"_lookupIdentifier",
... | https://github.com/emscripten-core/emscripten/blob/0d413d3c5af8b28349682496edc14656f5700c2f/third_party/WebIDL.py#L4639-L4660 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/vis/visualization.py | python | addText | (name : str, text : str, position=None, **kwargs) | Adds text to the visualizer. You must give an identifier to all pieces
of text, which will be used to access the text as any other vis object.
Args:
name (str): the text's unique identifier.
text (str): the string to be drawn
pos (list, optional): the position of the string. If pos=N... | Adds text to the visualizer. You must give an identifier to all pieces
of text, which will be used to access the text as any other vis object. | [
"Adds",
"text",
"to",
"the",
"visualizer",
".",
"You",
"must",
"give",
"an",
"identifier",
"to",
"all",
"pieces",
"of",
"text",
"which",
"will",
"be",
"used",
"to",
"access",
"the",
"text",
"as",
"any",
"other",
"vis",
"object",
"."
] | def addText(name : str, text : str, position=None, **kwargs) -> None:
"""Adds text to the visualizer. You must give an identifier to all pieces
of text, which will be used to access the text as any other vis object.
Args:
name (str): the text's unique identifier.
text (str): the string t... | [
"def",
"addText",
"(",
"name",
":",
"str",
",",
"text",
":",
"str",
",",
"position",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
"->",
"None",
":",
"_init",
"(",
")",
"if",
"position",
"is",
"None",
":",
"scene",
"(",
")",
".",
"addText",
"(",
"... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/vis/visualization.py#L1565-L1589 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/OpenSSL/SSL.py | python | Connection.send | (self, buf, flags=0) | Send data on the connection. NOTE: If you get one of the WantRead,
WantWrite or WantX509Lookup exceptions on this, you have to call the
method again with the SAME buffer.
:param buf: The string, buffer or memoryview to send
:param flags: (optional) Included for compatibility with the so... | Send data on the connection. NOTE: If you get one of the WantRead,
WantWrite or WantX509Lookup exceptions on this, you have to call the
method again with the SAME buffer. | [
"Send",
"data",
"on",
"the",
"connection",
".",
"NOTE",
":",
"If",
"you",
"get",
"one",
"of",
"the",
"WantRead",
"WantWrite",
"or",
"WantX509Lookup",
"exceptions",
"on",
"this",
"you",
"have",
"to",
"call",
"the",
"method",
"again",
"with",
"the",
"SAME",
... | def send(self, buf, flags=0):
"""
Send data on the connection. NOTE: If you get one of the WantRead,
WantWrite or WantX509Lookup exceptions on this, you have to call the
method again with the SAME buffer.
:param buf: The string, buffer or memoryview to send
:param flags:... | [
"def",
"send",
"(",
"self",
",",
"buf",
",",
"flags",
"=",
"0",
")",
":",
"# Backward compatibility",
"buf",
"=",
"_text_to_bytes_and_warn",
"(",
"\"buf\"",
",",
"buf",
")",
"with",
"_from_buffer",
"(",
"buf",
")",
"as",
"data",
":",
"# check len(buf) instea... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/OpenSSL/SSL.py#L1735-L1759 | ||
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/task_generation/suite_split.py | python | SuiteSplitService.split_suite | (self, params: SuiteSplitParameters) | Split the given resmoke suite into multiple sub-suites.
:param params: Description of suite to split.
:return: List of sub-suites from the given suite. | Split the given resmoke suite into multiple sub-suites. | [
"Split",
"the",
"given",
"resmoke",
"suite",
"into",
"multiple",
"sub",
"-",
"suites",
"."
] | def split_suite(self, params: SuiteSplitParameters) -> GeneratedSuite:
"""
Split the given resmoke suite into multiple sub-suites.
:param params: Description of suite to split.
:return: List of sub-suites from the given suite.
"""
if self.config.default_to_fallback:
... | [
"def",
"split_suite",
"(",
"self",
",",
"params",
":",
"SuiteSplitParameters",
")",
"->",
"GeneratedSuite",
":",
"if",
"self",
".",
"config",
".",
"default_to_fallback",
":",
"return",
"self",
".",
"calculate_fallback_suites",
"(",
"params",
")",
"try",
":",
"... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/task_generation/suite_split.py#L194-L222 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/bisect.py | python | insort_right | (a, x, lo=0, hi=None) | Insert item x in list a, and keep it sorted assuming a is sorted.
If x is already in a, insert it to the right of the rightmost x.
Optional args lo (default 0) and hi (default len(a)) bound the
slice of a to be searched. | Insert item x in list a, and keep it sorted assuming a is sorted. | [
"Insert",
"item",
"x",
"in",
"list",
"a",
"and",
"keep",
"it",
"sorted",
"assuming",
"a",
"is",
"sorted",
"."
] | def insort_right(a, x, lo=0, hi=None):
"""Insert item x in list a, and keep it sorted assuming a is sorted.
If x is already in a, insert it to the right of the rightmost x.
Optional args lo (default 0) and hi (default len(a)) bound the
slice of a to be searched.
"""
if lo < 0:
raise V... | [
"def",
"insort_right",
"(",
"a",
",",
"x",
",",
"lo",
"=",
"0",
",",
"hi",
"=",
"None",
")",
":",
"if",
"lo",
"<",
"0",
":",
"raise",
"ValueError",
"(",
"'lo must be non-negative'",
")",
"if",
"hi",
"is",
"None",
":",
"hi",
"=",
"len",
"(",
"a",
... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/bisect.py#L3-L20 | ||
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/rospkg/distro.py | python | distro_to_rosinstall | (distro, branch, variant_name=None, implicit=True, released_only=True, anonymous=True) | return rosinstall_data | :param branch: branch to convert for
:param variant_name: if not None, only include stacks in the specified variant.
:param implicit: if variant_name is provided, include full (recursive) dependencies of variant, default True
:param released_only: only included released stacks, default True.
:param anon... | :param branch: branch to convert for
:param variant_name: if not None, only include stacks in the specified variant.
:param implicit: if variant_name is provided, include full (recursive) dependencies of variant, default True
:param released_only: only included released stacks, default True.
:param anon... | [
":",
"param",
"branch",
":",
"branch",
"to",
"convert",
"for",
":",
"param",
"variant_name",
":",
"if",
"not",
"None",
"only",
"include",
"stacks",
"in",
"the",
"specified",
"variant",
".",
":",
"param",
"implicit",
":",
"if",
"variant_name",
"is",
"provid... | def distro_to_rosinstall(distro, branch, variant_name=None, implicit=True, released_only=True, anonymous=True):
"""
:param branch: branch to convert for
:param variant_name: if not None, only include stacks in the specified variant.
:param implicit: if variant_name is provided, include full (recursive) ... | [
"def",
"distro_to_rosinstall",
"(",
"distro",
",",
"branch",
",",
"variant_name",
"=",
"None",
",",
"implicit",
"=",
"True",
",",
"released_only",
"=",
"True",
",",
"anonymous",
"=",
"True",
")",
":",
"variant",
"=",
"distro",
".",
"variants",
".",
"get",
... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/rospkg/distro.py#L285-L306 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/stc.py | python | StyledTextCtrl.SetTechnology | (*args, **kwargs) | return _stc.StyledTextCtrl_SetTechnology(*args, **kwargs) | SetTechnology(self, int technology) | SetTechnology(self, int technology) | [
"SetTechnology",
"(",
"self",
"int",
"technology",
")"
] | def SetTechnology(*args, **kwargs):
"""SetTechnology(self, int technology)"""
return _stc.StyledTextCtrl_SetTechnology(*args, **kwargs) | [
"def",
"SetTechnology",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_SetTechnology",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/stc.py#L6385-L6387 | |
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py | python | SBThread.SafeToCallFunctions | (self) | return _lldb.SBThread_SafeToCallFunctions(self) | Takes no arguments, returns a bool.
lldb may be able to detect that function calls should not be executed
on a given thread at a particular point in time. It is recommended that
this is checked before performing an inferior function call on a given
thread. | Takes no arguments, returns a bool.
lldb may be able to detect that function calls should not be executed
on a given thread at a particular point in time. It is recommended that
this is checked before performing an inferior function call on a given
thread. | [
"Takes",
"no",
"arguments",
"returns",
"a",
"bool",
".",
"lldb",
"may",
"be",
"able",
"to",
"detect",
"that",
"function",
"calls",
"should",
"not",
"be",
"executed",
"on",
"a",
"given",
"thread",
"at",
"a",
"particular",
"point",
"in",
"time",
".",
"It",... | def SafeToCallFunctions(self):
"""
Takes no arguments, returns a bool.
lldb may be able to detect that function calls should not be executed
on a given thread at a particular point in time. It is recommended that
this is checked before performing an inferior function call on a g... | [
"def",
"SafeToCallFunctions",
"(",
"self",
")",
":",
"return",
"_lldb",
".",
"SBThread_SafeToCallFunctions",
"(",
"self",
")"
] | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py#L9887-L9895 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/pstats.py | python | Stats.dump_stats | (self, filename) | Write the profile data to a file we know how to load back. | Write the profile data to a file we know how to load back. | [
"Write",
"the",
"profile",
"data",
"to",
"a",
"file",
"we",
"know",
"how",
"to",
"load",
"back",
"."
] | def dump_stats(self, filename):
"""Write the profile data to a file we know how to load back."""
f = file(filename, 'wb')
try:
marshal.dump(self.stats, f)
finally:
f.close() | [
"def",
"dump_stats",
"(",
"self",
",",
"filename",
")",
":",
"f",
"=",
"file",
"(",
"filename",
",",
"'wb'",
")",
"try",
":",
"marshal",
".",
"dump",
"(",
"self",
".",
"stats",
",",
"f",
")",
"finally",
":",
"f",
".",
"close",
"(",
")"
] | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/pstats.py#L174-L180 | ||
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/contrib/learn/python/learn/estimators/base.py | python | TensorFlowEstimator.predict_proba | (self, x, batch_size=None) | return self._predict(x, batch_size=batch_size) | Predict class probability of the input samples `x`.
Args:
x: array-like matrix, [n_samples, n_features...] or iterator.
batch_size: If test set is too big, use batch size to split
it into mini batches. By default the batch_size member variable is used.
Returns:
y: array of shape [n_s... | Predict class probability of the input samples `x`. | [
"Predict",
"class",
"probability",
"of",
"the",
"input",
"samples",
"x",
"."
] | def predict_proba(self, x, batch_size=None):
"""Predict class probability of the input samples `x`.
Args:
x: array-like matrix, [n_samples, n_features...] or iterator.
batch_size: If test set is too big, use batch size to split
it into mini batches. By default the batch_size member variable... | [
"def",
"predict_proba",
"(",
"self",
",",
"x",
",",
"batch_size",
"=",
"None",
")",
":",
"return",
"self",
".",
"_predict",
"(",
"x",
",",
"batch_size",
"=",
"batch_size",
")"
] | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/contrib/learn/python/learn/estimators/base.py#L245-L257 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/tools/configure.d/nodedownload.py | python | checkHash | (targetfile, hashAlgo) | return digest.hexdigest() | Check a file using hashAlgo. Return the hex digest. | Check a file using hashAlgo. Return the hex digest. | [
"Check",
"a",
"file",
"using",
"hashAlgo",
".",
"Return",
"the",
"hex",
"digest",
"."
] | def checkHash(targetfile, hashAlgo):
"""Check a file using hashAlgo. Return the hex digest."""
digest = hashlib.new(hashAlgo)
with open(targetfile, 'rb') as f:
chunk = f.read(1024)
while chunk != "":
digest.update(chunk)
chunk = f.read(1024)
return digest.hexdigest() | [
"def",
"checkHash",
"(",
"targetfile",
",",
"hashAlgo",
")",
":",
"digest",
"=",
"hashlib",
".",
"new",
"(",
"hashAlgo",
")",
"with",
"open",
"(",
"targetfile",
",",
"'rb'",
")",
"as",
"f",
":",
"chunk",
"=",
"f",
".",
"read",
"(",
"1024",
")",
"wh... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/tools/configure.d/nodedownload.py#L61-L69 | |
ispc/ispc | 0a7ee59b6ec50e54d545eb2a31056e54c4891d51 | utils/lit/lit/util.py | python | to_bytes | (s) | return s.encode('utf-8') | Return the parameter as type 'bytes', possibly encoding it.
In Python2, the 'bytes' type is the same as 'str'. In Python3, they
are distinct. | Return the parameter as type 'bytes', possibly encoding it. | [
"Return",
"the",
"parameter",
"as",
"type",
"bytes",
"possibly",
"encoding",
"it",
"."
] | def to_bytes(s):
"""Return the parameter as type 'bytes', possibly encoding it.
In Python2, the 'bytes' type is the same as 'str'. In Python3, they
are distinct.
"""
if isinstance(s, bytes):
# In Python2, this branch is taken for both 'str' and 'bytes'.
# In Python3, this branch is... | [
"def",
"to_bytes",
"(",
"s",
")",
":",
"if",
"isinstance",
"(",
"s",
",",
"bytes",
")",
":",
"# In Python2, this branch is taken for both 'str' and 'bytes'.",
"# In Python3, this branch is taken only for 'bytes'.",
"return",
"s",
"# In Python2, 's' is a 'unicode' object.",
"# I... | https://github.com/ispc/ispc/blob/0a7ee59b6ec50e54d545eb2a31056e54c4891d51/utils/lit/lit/util.py#L47-L61 | |
nmslib/nmslib | 5acedb651c277af8d99fa75def9f8b2590bd9512 | benchmark/eval.py | python | benchamrk_binary | (work_dir, binary_dir,
dist_type, data_type,
method_name, index_time_params, query_time_param_arr,
data_file, query_qty,
K, repeat_qty,
num_threads, max_data_qty=None) | return res | Carry out a benchmark of the binary executable (experiment) in two phases.
In phase 1 we create the index from scratch. In phase 2 we reload it from disk.
In each phase, for each set of query parameters we repeat the search procedure repeat_qty: times.
:param work_dir working directory ... | Carry out a benchmark of the binary executable (experiment) in two phases.
In phase 1 we create the index from scratch. In phase 2 we reload it from disk.
In each phase, for each set of query parameters we repeat the search procedure repeat_qty: times. | [
"Carry",
"out",
"a",
"benchmark",
"of",
"the",
"binary",
"executable",
"(",
"experiment",
")",
"in",
"two",
"phases",
".",
"In",
"phase",
"1",
"we",
"create",
"the",
"index",
"from",
"scratch",
".",
"In",
"phase",
"2",
"we",
"reload",
"it",
"from",
"di... | def benchamrk_binary(work_dir, binary_dir,
dist_type, data_type,
method_name, index_time_params, query_time_param_arr,
data_file, query_qty,
K, repeat_qty,
num_threads, max_data_qty=None):
"""Carry out... | [
"def",
"benchamrk_binary",
"(",
"work_dir",
",",
"binary_dir",
",",
"dist_type",
",",
"data_type",
",",
"method_name",
",",
"index_time_params",
",",
"query_time_param_arr",
",",
"data_file",
",",
"query_qty",
",",
"K",
",",
"repeat_qty",
",",
"num_threads",
",",
... | https://github.com/nmslib/nmslib/blob/5acedb651c277af8d99fa75def9f8b2590bd9512/benchmark/eval.py#L302-L382 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/examples/learn/iris.py | python | input_fn | (file_name, num_data, batch_size, is_training) | return _input_fn | Creates an input_fn required by Estimator train/evaluate. | Creates an input_fn required by Estimator train/evaluate. | [
"Creates",
"an",
"input_fn",
"required",
"by",
"Estimator",
"train",
"/",
"evaluate",
"."
] | def input_fn(file_name, num_data, batch_size, is_training):
"""Creates an input_fn required by Estimator train/evaluate."""
# If the data sets aren't stored locally, download them.
def _parse_csv(rows_string_tensor):
"""Takes the string input tensor and returns tuple of (features, labels)."""
# Last dim ... | [
"def",
"input_fn",
"(",
"file_name",
",",
"num_data",
",",
"batch_size",
",",
"is_training",
")",
":",
"# If the data sets aren't stored locally, download them.",
"def",
"_parse_csv",
"(",
"rows_string_tensor",
")",
":",
"\"\"\"Takes the string input tensor and returns tuple of... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/examples/learn/iris.py#L50-L84 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py3/numpy/polynomial/chebyshev.py | python | chebval3d | (x, y, z, c) | return pu._valnd(chebval, c, x, y, z) | Evaluate a 3-D Chebyshev series at points (x, y, z).
This function returns the values:
.. math:: p(x,y,z) = \\sum_{i,j,k} c_{i,j,k} * T_i(x) * T_j(y) * T_k(z)
The parameters `x`, `y`, and `z` are converted to arrays only if
they are tuples or a lists, otherwise they are treated as a scalars and
t... | Evaluate a 3-D Chebyshev series at points (x, y, z). | [
"Evaluate",
"a",
"3",
"-",
"D",
"Chebyshev",
"series",
"at",
"points",
"(",
"x",
"y",
"z",
")",
"."
] | def chebval3d(x, y, z, c):
"""
Evaluate a 3-D Chebyshev series at points (x, y, z).
This function returns the values:
.. math:: p(x,y,z) = \\sum_{i,j,k} c_{i,j,k} * T_i(x) * T_j(y) * T_k(z)
The parameters `x`, `y`, and `z` are converted to arrays only if
they are tuples or a lists, otherwise ... | [
"def",
"chebval3d",
"(",
"x",
",",
"y",
",",
"z",
",",
"c",
")",
":",
"return",
"pu",
".",
"_valnd",
"(",
"chebval",
",",
"c",
",",
"x",
",",
"y",
",",
"z",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py3/numpy/polynomial/chebyshev.py#L1280-L1328 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/cuda/cudadrv/autotune.py | python | AutoTuner.table | (self) | return self._table | A dict with thread-per-block as keys and tuple-2 of
(occupency, limiting factor) as values. | A dict with thread-per-block as keys and tuple-2 of
(occupency, limiting factor) as values. | [
"A",
"dict",
"with",
"thread",
"-",
"per",
"-",
"block",
"as",
"keys",
"and",
"tuple",
"-",
"2",
"of",
"(",
"occupency",
"limiting",
"factor",
")",
"as",
"values",
"."
] | def table(self):
"""A dict with thread-per-block as keys and tuple-2 of
(occupency, limiting factor) as values.
"""
return self._table | [
"def",
"table",
"(",
"self",
")",
":",
"return",
"self",
".",
"_table"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/cuda/cudadrv/autotune.py#L59-L63 | |
SFTtech/openage | d6a08c53c48dc1e157807471df92197f6ca9e04d | openage/convert/processor/conversion/swgbcc/upgrade_resource_subprocessor.py | python | SWGBCCUpgradeResourceSubprocessor.assault_mech_anti_air_upgrade | (converter_group, value, operator, team=False) | return patches | Creates a patch for the assault mech anti air effect (ID: 31).
:param converter_group: Tech/Civ that gets the patch.
:type converter_group: ...dataformat.converter_object.ConverterObjectGroup
:param value: Value used for patching the member.
:type value: MemberOperator
:param op... | Creates a patch for the assault mech anti air effect (ID: 31). | [
"Creates",
"a",
"patch",
"for",
"the",
"assault",
"mech",
"anti",
"air",
"effect",
"(",
"ID",
":",
"31",
")",
"."
] | def assault_mech_anti_air_upgrade(converter_group, value, operator, team=False):
"""
Creates a patch for the assault mech anti air effect (ID: 31).
:param converter_group: Tech/Civ that gets the patch.
:type converter_group: ...dataformat.converter_object.ConverterObjectGroup
:p... | [
"def",
"assault_mech_anti_air_upgrade",
"(",
"converter_group",
",",
"value",
",",
"operator",
",",
"team",
"=",
"False",
")",
":",
"patches",
"=",
"[",
"]",
"# TODO: Implement",
"return",
"patches"
] | https://github.com/SFTtech/openage/blob/d6a08c53c48dc1e157807471df92197f6ca9e04d/openage/convert/processor/conversion/swgbcc/upgrade_resource_subprocessor.py#L24-L41 | |
gnina/gnina | b9ae032f52fc7a8153987bde09c0efa3620d8bb6 | caffe/scripts/cpp_lint.py | python | CheckInvalidIncrement | (filename, clean_lines, linenum, error) | Checks for invalid increment *count++.
For example following function:
void increment_counter(int* count) {
*count++;
}
is invalid, because it effectively does count++, moving pointer, and should
be replaced with ++*count, (*count)++ or *count += 1.
Args:
filename: The name of the current file.
... | Checks for invalid increment *count++. | [
"Checks",
"for",
"invalid",
"increment",
"*",
"count",
"++",
"."
] | def CheckInvalidIncrement(filename, clean_lines, linenum, error):
"""Checks for invalid increment *count++.
For example following function:
void increment_counter(int* count) {
*count++;
}
is invalid, because it effectively does count++, moving pointer, and should
be replaced with ++*count, (*count)++ ... | [
"def",
"CheckInvalidIncrement",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"if",
"_RE_PATTERN_INVALID_INCREMENT",
".",
"match",
"(",
"line",
")",
":",
"error",
... | https://github.com/gnina/gnina/blob/b9ae032f52fc7a8153987bde09c0efa3620d8bb6/caffe/scripts/cpp_lint.py#L1737-L1756 | ||
cms-sw/cmssw | fd9de012d503d3405420bcbeec0ec879baa57cf2 | Alignment/CommonAlignment/scripts/tkal_create_file_lists.py | python | FileListCreator._prepare_iov_datastructures | (self) | Create the needed objects for IOV handling. | Create the needed objects for IOV handling. | [
"Create",
"the",
"needed",
"objects",
"for",
"IOV",
"handling",
"."
] | def _prepare_iov_datastructures(self):
"""Create the needed objects for IOV handling."""
self._iovs = sorted(set(self._args.iovs))
if len(self._iovs) == 0: self._iovs.append(1)
self._iov_info_alignment = {iov: {"events": 0, "files": []}
for iov in... | [
"def",
"_prepare_iov_datastructures",
"(",
"self",
")",
":",
"self",
".",
"_iovs",
"=",
"sorted",
"(",
"set",
"(",
"self",
".",
"_args",
".",
"iovs",
")",
")",
"if",
"len",
"(",
"self",
".",
"_iovs",
")",
"==",
"0",
":",
"self",
".",
"_iovs",
".",
... | https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/Alignment/CommonAlignment/scripts/tkal_create_file_lists.py#L265-L275 | ||
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/ndarray/ndarray.py | python | NDArray.round | (self, *args, **kwargs) | return op.round(self, *args, **kwargs) | Convenience fluent method for :py:func:`round`.
The arguments are the same as for :py:func:`round`, with
this array as data. | Convenience fluent method for :py:func:`round`. | [
"Convenience",
"fluent",
"method",
"for",
":",
"py",
":",
"func",
":",
"round",
"."
] | def round(self, *args, **kwargs):
"""Convenience fluent method for :py:func:`round`.
The arguments are the same as for :py:func:`round`, with
this array as data.
"""
return op.round(self, *args, **kwargs) | [
"def",
"round",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"op",
".",
"round",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/ndarray/ndarray.py#L1966-L1972 | |
CaoWGG/TensorRT-CenterNet | f949252e37b51e60f873808f46d3683f15735e79 | onnx-tensorrt/third_party/onnx/third_party/benchmark/tools/gbench/util.py | python | run_or_load_benchmark | (filename, benchmark_flags) | Get the results for a specified benchmark. If 'filename' specifies
an executable benchmark then the results are generated by running the
benchmark. Otherwise 'filename' must name a valid JSON output file,
which is loaded and the result returned. | Get the results for a specified benchmark. If 'filename' specifies
an executable benchmark then the results are generated by running the
benchmark. Otherwise 'filename' must name a valid JSON output file,
which is loaded and the result returned. | [
"Get",
"the",
"results",
"for",
"a",
"specified",
"benchmark",
".",
"If",
"filename",
"specifies",
"an",
"executable",
"benchmark",
"then",
"the",
"results",
"are",
"generated",
"by",
"running",
"the",
"benchmark",
".",
"Otherwise",
"filename",
"must",
"name",
... | def run_or_load_benchmark(filename, benchmark_flags):
"""
Get the results for a specified benchmark. If 'filename' specifies
an executable benchmark then the results are generated by running the
benchmark. Otherwise 'filename' must name a valid JSON output file,
which is loaded and the result return... | [
"def",
"run_or_load_benchmark",
"(",
"filename",
",",
"benchmark_flags",
")",
":",
"ftype",
"=",
"check_input_file",
"(",
"filename",
")",
"if",
"ftype",
"==",
"IT_JSON",
":",
"return",
"load_benchmark_results",
"(",
"filename",
")",
"elif",
"ftype",
"==",
"IT_E... | https://github.com/CaoWGG/TensorRT-CenterNet/blob/f949252e37b51e60f873808f46d3683f15735e79/onnx-tensorrt/third_party/onnx/third_party/benchmark/tools/gbench/util.py#L146-L159 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/DiamondAttenuationCorrection/FitTransReadUB.py | python | SimTrans3 | (x) | return chi2 | %SimTrans calculates transmission spectrum from two crystals
% lam - array containing wavelengths to calc over
% hkl - contains all Nref hkl's that calculation is performed for
% bgd - array containing coefficients of polynomial for background
% sf - overall scale factor
% pktype - 1 = gau... | %SimTrans calculates transmission spectrum from two crystals
% lam - array containing wavelengths to calc over
% hkl - contains all Nref hkl's that calculation is performed for
% bgd - array containing coefficients of polynomial for background
% sf - overall scale factor
% pktype - 1 = gau... | [
"%SimTrans",
"calculates",
"transmission",
"spectrum",
"from",
"two",
"crystals",
"%",
"lam",
"-",
"array",
"containing",
"wavelengths",
"to",
"calc",
"over",
"%",
"hkl",
"-",
"contains",
"all",
"Nref",
"hkl",
"s",
"that",
"calculation",
"is",
"performed",
"fo... | def SimTrans3(x):
'''
%SimTrans calculates transmission spectrum from two crystals
% lam - array containing wavelengths to calc over
% hkl - contains all Nref hkl's that calculation is performed for
% bgd - array containing coefficients of polynomial for background
% sf - overall scale f... | [
"def",
"SimTrans3",
"(",
"x",
")",
":",
"global",
"hkl1",
",",
"hkl2",
"global",
"UB1",
",",
"pkcalcint1",
"global",
"UB2",
",",
"pkcalcint2",
"global",
"pktype",
"global",
"lam",
",",
"y",
",",
"e",
",",
"TOF",
"global",
"L1",
"global",
"ttot",
"globa... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/DiamondAttenuationCorrection/FitTransReadUB.py#L754-L889 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/importlib-metadata/py3/importlib_metadata/__init__.py | python | Distribution._discover_resolvers | () | return filter(None, declared) | Search the meta_path for resolvers. | Search the meta_path for resolvers. | [
"Search",
"the",
"meta_path",
"for",
"resolvers",
"."
] | def _discover_resolvers():
"""Search the meta_path for resolvers."""
declared = (
getattr(finder, 'find_distributions', None) for finder in sys.meta_path
)
return filter(None, declared) | [
"def",
"_discover_resolvers",
"(",
")",
":",
"declared",
"=",
"(",
"getattr",
"(",
"finder",
",",
"'find_distributions'",
",",
"None",
")",
"for",
"finder",
"in",
"sys",
".",
"meta_path",
")",
"return",
"filter",
"(",
"None",
",",
"declared",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/importlib-metadata/py3/importlib_metadata/__init__.py#L577-L582 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/_collections_abc.py | python | Coroutine.send | (self, value) | Send a value into the coroutine.
Return next yielded value or raise StopIteration. | Send a value into the coroutine.
Return next yielded value or raise StopIteration. | [
"Send",
"a",
"value",
"into",
"the",
"coroutine",
".",
"Return",
"next",
"yielded",
"value",
"or",
"raise",
"StopIteration",
"."
] | def send(self, value):
"""Send a value into the coroutine.
Return next yielded value or raise StopIteration.
"""
raise StopIteration | [
"def",
"send",
"(",
"self",
",",
"value",
")",
":",
"raise",
"StopIteration"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/_collections_abc.py#L119-L123 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/decimal.py | python | Context.logical_and | (self, a, b) | return a.logical_and(b, context=self) | Applies the logical operation 'and' between each operand's digits.
The operands must be both logical numbers.
>>> ExtendedContext.logical_and(Decimal('0'), Decimal('0'))
Decimal('0')
>>> ExtendedContext.logical_and(Decimal('0'), Decimal('1'))
Decimal('0')
>>> ExtendedCo... | Applies the logical operation 'and' between each operand's digits. | [
"Applies",
"the",
"logical",
"operation",
"and",
"between",
"each",
"operand",
"s",
"digits",
"."
] | def logical_and(self, a, b):
"""Applies the logical operation 'and' between each operand's digits.
The operands must be both logical numbers.
>>> ExtendedContext.logical_and(Decimal('0'), Decimal('0'))
Decimal('0')
>>> ExtendedContext.logical_and(Decimal('0'), Decimal('1'))
... | [
"def",
"logical_and",
"(",
"self",
",",
"a",
",",
"b",
")",
":",
"a",
"=",
"_convert_other",
"(",
"a",
",",
"raiseit",
"=",
"True",
")",
"return",
"a",
".",
"logical_and",
"(",
"b",
",",
"context",
"=",
"self",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/decimal.py#L4562-L4587 | |
PrincetonUniversity/athena-public-version | 9c266692b9423743d8e23509b3ab266a232a92d2 | tst/style/cpplint.py | python | _IncludeState.ResetSection | (self, directive) | Reset section checking for preprocessor directive.
Args:
directive: preprocessor directive (e.g. "if", "else"). | Reset section checking for preprocessor directive. | [
"Reset",
"section",
"checking",
"for",
"preprocessor",
"directive",
"."
] | def ResetSection(self, directive):
"""Reset section checking for preprocessor directive.
Args:
directive: preprocessor directive (e.g. "if", "else").
"""
# The name of the current section.
self._section = self._INITIAL_SECTION
# The path of last found header.
... | [
"def",
"ResetSection",
"(",
"self",
",",
"directive",
")",
":",
"# The name of the current section.",
"self",
".",
"_section",
"=",
"self",
".",
"_INITIAL_SECTION",
"# The path of last found header.",
"self",
".",
"_last_header",
"=",
"''",
"# Update list of includes. No... | https://github.com/PrincetonUniversity/athena-public-version/blob/9c266692b9423743d8e23509b3ab266a232a92d2/tst/style/cpplint.py#L891-L907 | ||
microsoft/Azure-Kinect-Sensor-SDK | d87ef578676c05b9a5d23c097502942753bf3777 | src/python/k4a/src/k4a/_bindings/transformation.py | python | Transformation.create | (calibration:Calibration) | return Transformation(calibration) | ! Create a transformation object.
@param calibration (Calibration): A calibration object obtained by
Device.get_calibration().
@returns Transformation: A Transformation instance. If an error occurs,
then None is returned.
@remarks
- The transformation is used t... | ! Create a transformation object. | [
"!",
"Create",
"a",
"transformation",
"object",
"."
] | def create(calibration:Calibration):
'''! Create a transformation object.
@param calibration (Calibration): A calibration object obtained by
Device.get_calibration().
@returns Transformation: A Transformation instance. If an error occurs,
then None is returned.
... | [
"def",
"create",
"(",
"calibration",
":",
"Calibration",
")",
":",
"return",
"Transformation",
"(",
"calibration",
")"
] | https://github.com/microsoft/Azure-Kinect-Sensor-SDK/blob/d87ef578676c05b9a5d23c097502942753bf3777/src/python/k4a/src/k4a/_bindings/transformation.py#L80-L104 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/bisect-builds.py | python | PathContext.GetDownloadURL | (self, revision) | return '%s/%s%s/%s' % (self.base_url, self._listing_platform_dir,
revision, self.archive_name) | Gets the download URL for a build archive of a specific revision. | Gets the download URL for a build archive of a specific revision. | [
"Gets",
"the",
"download",
"URL",
"for",
"a",
"build",
"archive",
"of",
"a",
"specific",
"revision",
"."
] | def GetDownloadURL(self, revision):
"""Gets the download URL for a build archive of a specific revision."""
if self.is_asan:
return '%s/%s-%s/%s-%d.zip' % (
ASAN_BASE_URL, self.GetASANPlatformDir(), self.build_type,
self.GetASANBaseName(), revision)
if str(revision) in self.githash... | [
"def",
"GetDownloadURL",
"(",
"self",
",",
"revision",
")",
":",
"if",
"self",
".",
"is_asan",
":",
"return",
"'%s/%s-%s/%s-%d.zip'",
"%",
"(",
"ASAN_BASE_URL",
",",
"self",
".",
"GetASANPlatformDir",
"(",
")",
",",
"self",
".",
"build_type",
",",
"self",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/bisect-builds.py#L182-L191 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/stats/_multivariate.py | python | random_correlation_gen.rvs | (self, eigs, random_state=None, tol=1e-13, diag_tol=1e-7) | return m | Draw random correlation matrices
Parameters
----------
eigs : 1d ndarray
Eigenvalues of correlation matrix
tol : float, optional
Tolerance for input parameter checks
diag_tol : float, optional
Tolerance for deviation of the diagonal of the res... | Draw random correlation matrices | [
"Draw",
"random",
"correlation",
"matrices"
] | def rvs(self, eigs, random_state=None, tol=1e-13, diag_tol=1e-7):
"""
Draw random correlation matrices
Parameters
----------
eigs : 1d ndarray
Eigenvalues of correlation matrix
tol : float, optional
Tolerance for input parameter checks
dia... | [
"def",
"rvs",
"(",
"self",
",",
"eigs",
",",
"random_state",
"=",
"None",
",",
"tol",
"=",
"1e-13",
",",
"diag_tol",
"=",
"1e-7",
")",
":",
"dim",
",",
"eigs",
"=",
"self",
".",
"_process_parameters",
"(",
"eigs",
",",
"tol",
"=",
"tol",
")",
"rand... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/stats/_multivariate.py#L3691-L3730 | |
quantOS-org/DataCore | e2ef9bd2c22ee9e2845675b6435a14fa607f3551 | mdlink/deps/windows/protobuf-2.5.0/python/mox.py | python | MockMethod.__call__ | (self, *params, **named_params) | return expected_method._return_value | Log parameters and return the specified return value.
If the Mock(Anything/Object) associated with this call is in record mode,
this MockMethod will be pushed onto the expected call queue. If the mock
is in replay mode, this will pop a MockMethod off the top of the queue and
verify this call is equal ... | Log parameters and return the specified return value. | [
"Log",
"parameters",
"and",
"return",
"the",
"specified",
"return",
"value",
"."
] | def __call__(self, *params, **named_params):
"""Log parameters and return the specified return value.
If the Mock(Anything/Object) associated with this call is in record mode,
this MockMethod will be pushed onto the expected call queue. If the mock
is in replay mode, this will pop a MockMethod off the... | [
"def",
"__call__",
"(",
"self",
",",
"*",
"params",
",",
"*",
"*",
"named_params",
")",
":",
"self",
".",
"_params",
"=",
"params",
"self",
".",
"_named_params",
"=",
"named_params",
"if",
"not",
"self",
".",
"_replay_mode",
":",
"self",
".",
"_call_queu... | https://github.com/quantOS-org/DataCore/blob/e2ef9bd2c22ee9e2845675b6435a14fa607f3551/mdlink/deps/windows/protobuf-2.5.0/python/mox.py#L545-L573 | |
epam/Indigo | 30e40b4b1eb9bae0207435a26cfcb81ddcc42be1 | api/python/indigo/__init__.py | python | IndigoObject.stereocenterType | (self) | return self.dispatcher._checkResult(
Indigo._lib.indigoStereocenterType(self.id)
) | Atom method returns stereo center type
Returns:
int: type of stereocenter
* ABS = 1
* OR = 2
* AND = 3
* EITHER = 4 | Atom method returns stereo center type | [
"Atom",
"method",
"returns",
"stereo",
"center",
"type"
] | def stereocenterType(self):
"""Atom method returns stereo center type
Returns:
int: type of stereocenter
* ABS = 1
* OR = 2
* AND = 3
* EITHER = 4
"""
self.dispatcher._setSessionId()
return self.dispatch... | [
"def",
"stereocenterType",
"(",
"self",
")",
":",
"self",
".",
"dispatcher",
".",
"_setSessionId",
"(",
")",
"return",
"self",
".",
"dispatcher",
".",
"_checkResult",
"(",
"Indigo",
".",
"_lib",
".",
"indigoStereocenterType",
"(",
"self",
".",
"id",
")",
"... | https://github.com/epam/Indigo/blob/30e40b4b1eb9bae0207435a26cfcb81ddcc42be1/api/python/indigo/__init__.py#L929-L942 | |
nasa/fprime | 595cf3682d8365943d86c1a6fe7c78f0a116acf0 | Autocoders/Python/src/fprime_ac/generators/writers/ComponentWriterBase.py | python | ComponentWriterBase.doxygenPreComment | (self, comment) | Emit a doxygen pre comment | Emit a doxygen pre comment | [
"Emit",
"a",
"doxygen",
"pre",
"comment"
] | def doxygenPreComment(self, comment):
"""
Emit a doxygen pre comment
"""
if comment is None or comment == "":
return ""
else:
return "/*! " + comment + "*/" | [
"def",
"doxygenPreComment",
"(",
"self",
",",
"comment",
")",
":",
"if",
"comment",
"is",
"None",
"or",
"comment",
"==",
"\"\"",
":",
"return",
"\"\"",
"else",
":",
"return",
"\"/*! \"",
"+",
"comment",
"+",
"\"*/\""
] | https://github.com/nasa/fprime/blob/595cf3682d8365943d86c1a6fe7c78f0a116acf0/Autocoders/Python/src/fprime_ac/generators/writers/ComponentWriterBase.py#L141-L148 | ||
microsoft/EdgeML | ef9f8a77f096acbdeb941014791f8eda1c1bc35b | tools/SeeDot/seedot/util.py | python | computeScalingFactor | (val) | The scale computation algorithm is different while generating function calls and while generating inline code.
The inline code generation uses an extra padding bit for each parameter and is less precise.
The scales computed while generating function calls uses all bits. | The scale computation algorithm is different while generating function calls and while generating inline code.
The inline code generation uses an extra padding bit for each parameter and is less precise.
The scales computed while generating function calls uses all bits. | [
"The",
"scale",
"computation",
"algorithm",
"is",
"different",
"while",
"generating",
"function",
"calls",
"and",
"while",
"generating",
"inline",
"code",
".",
"The",
"inline",
"code",
"generation",
"uses",
"an",
"extra",
"padding",
"bit",
"for",
"each",
"parame... | def computeScalingFactor(val):
'''
The scale computation algorithm is different while generating function calls and while generating inline code.
The inline code generation uses an extra padding bit for each parameter and is less precise.
The scales computed while generating function calls uses all bits... | [
"def",
"computeScalingFactor",
"(",
"val",
")",
":",
"if",
"genFuncCalls",
"(",
")",
":",
"return",
"computeScalingFactorForFuncCalls",
"(",
"val",
")",
"else",
":",
"return",
"computeScalingFactorForInlineCodegen",
"(",
"val",
")"
] | https://github.com/microsoft/EdgeML/blob/ef9f8a77f096acbdeb941014791f8eda1c1bc35b/tools/SeeDot/seedot/util.py#L154-L163 | ||
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/compiler-rt/lib/sanitizer_common/scripts/cpplint.py | python | FileInfo.IsSource | (self) | return self.Extension()[1:] in ('c', 'cc', 'cpp', 'cxx') | File has a source file extension. | File has a source file extension. | [
"File",
"has",
"a",
"source",
"file",
"extension",
"."
] | def IsSource(self):
"""File has a source file extension."""
return self.Extension()[1:] in ('c', 'cc', 'cpp', 'cxx') | [
"def",
"IsSource",
"(",
"self",
")",
":",
"return",
"self",
".",
"Extension",
"(",
")",
"[",
"1",
":",
"]",
"in",
"(",
"'c'",
",",
"'cc'",
",",
"'cpp'",
",",
"'cxx'",
")"
] | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/compiler-rt/lib/sanitizer_common/scripts/cpplint.py#L820-L822 | |
microsoft/Multiverso | e45369e1d07277f656b0900beb2709d86679fa53 | binding/python/multiverso/theano_ext/sharedvar.py | python | sync_all_mv_shared_vars | () | Sync shared value created by `mv_shared` with multiverso
It is often used when you are training model, and it will add the gradients
(delta value) to the server and update the latest value from the server.
Notice: It will **only** sync shared value created by `mv_shared` | Sync shared value created by `mv_shared` with multiverso | [
"Sync",
"shared",
"value",
"created",
"by",
"mv_shared",
"with",
"multiverso"
] | def sync_all_mv_shared_vars():
'''Sync shared value created by `mv_shared` with multiverso
It is often used when you are training model, and it will add the gradients
(delta value) to the server and update the latest value from the server.
Notice: It will **only** sync shared value created by `mv_share... | [
"def",
"sync_all_mv_shared_vars",
"(",
")",
":",
"for",
"sv",
"in",
"mv_shared",
".",
"shared_vars",
":",
"sv",
".",
"mv_sync",
"(",
")"
] | https://github.com/microsoft/Multiverso/blob/e45369e1d07277f656b0900beb2709d86679fa53/binding/python/multiverso/theano_ext/sharedvar.py#L91-L99 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py3/numpy/ma/mrecords.py | python | MaskedRecords.harden_mask | (self) | Forces the mask to hard. | Forces the mask to hard. | [
"Forces",
"the",
"mask",
"to",
"hard",
"."
] | def harden_mask(self):
"""
Forces the mask to hard.
"""
self._hardmask = True | [
"def",
"harden_mask",
"(",
"self",
")",
":",
"self",
".",
"_hardmask",
"=",
"True"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py3/numpy/ma/mrecords.py#L404-L409 | ||
ValveSoftware/source-sdk-2013 | 0d8dceea4310fde5706b3ce1c70609d72a38efdf | mp/src/thirdparty/protobuf-2.3.0/python/google/protobuf/internal/encoder.py | python | GroupSizer | (field_number, is_repeated, is_packed) | Returns a sizer for a group field. | Returns a sizer for a group field. | [
"Returns",
"a",
"sizer",
"for",
"a",
"group",
"field",
"."
] | def GroupSizer(field_number, is_repeated, is_packed):
"""Returns a sizer for a group field."""
tag_size = _TagSize(field_number) * 2
assert not is_packed
if is_repeated:
def RepeatedFieldSize(value):
result = tag_size * len(value)
for element in value:
result += element.ByteSize()
... | [
"def",
"GroupSizer",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"tag_size",
"=",
"_TagSize",
"(",
"field_number",
")",
"*",
"2",
"assert",
"not",
"is_packed",
"if",
"is_repeated",
":",
"def",
"RepeatedFieldSize",
"(",
"value",
")",
... | https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/mp/src/thirdparty/protobuf-2.3.0/python/google/protobuf/internal/encoder.py#L265-L280 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | chrome/browser/resources/web_dev_style/js_checker.py | python | JSChecker.ChromeSendCheck | (self, i, line) | return self.RegexCheck(i, line, r"chrome\.send\('[^']+'\s*(, \[\])\)",
'Passing an empty array to chrome.send is unnecessary') | Checks for a particular misuse of 'chrome.send'. | Checks for a particular misuse of 'chrome.send'. | [
"Checks",
"for",
"a",
"particular",
"misuse",
"of",
"chrome",
".",
"send",
"."
] | def ChromeSendCheck(self, i, line):
"""Checks for a particular misuse of 'chrome.send'."""
return self.RegexCheck(i, line, r"chrome\.send\('[^']+'\s*(, \[\])\)",
'Passing an empty array to chrome.send is unnecessary') | [
"def",
"ChromeSendCheck",
"(",
"self",
",",
"i",
",",
"line",
")",
":",
"return",
"self",
".",
"RegexCheck",
"(",
"i",
",",
"line",
",",
"r\"chrome\\.send\\('[^']+'\\s*(, \\[\\])\\)\"",
",",
"'Passing an empty array to chrome.send is unnecessary'",
")"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/chrome/browser/resources/web_dev_style/js_checker.py#L39-L42 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/data/experimental/ops/batching.py | python | dense_to_sparse_batch | (batch_size, row_shape) | return _apply_fn | A transformation that batches ragged elements into `tf.SparseTensor`s.
Like `Dataset.padded_batch()`, this transformation combines multiple
consecutive elements of the dataset, which might have different
shapes, into a single element. The resulting element has three
components (`indices`, `values`, and `dense_... | A transformation that batches ragged elements into `tf.SparseTensor`s. | [
"A",
"transformation",
"that",
"batches",
"ragged",
"elements",
"into",
"tf",
".",
"SparseTensor",
"s",
"."
] | def dense_to_sparse_batch(batch_size, row_shape):
"""A transformation that batches ragged elements into `tf.SparseTensor`s.
Like `Dataset.padded_batch()`, this transformation combines multiple
consecutive elements of the dataset, which might have different
shapes, into a single element. The resulting element h... | [
"def",
"dense_to_sparse_batch",
"(",
"batch_size",
",",
"row_shape",
")",
":",
"def",
"_apply_fn",
"(",
"dataset",
")",
":",
"return",
"_DenseToSparseBatchDataset",
"(",
"dataset",
",",
"batch_size",
",",
"row_shape",
")",
"return",
"_apply_fn"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/data/experimental/ops/batching.py#L34-L80 | |
turtlecoin/turtlecoin | 02ee0f0551f4552e7d2fd48df23f4b4ff84f4dd8 | external/rocksdb/tools/advisor/advisor/db_bench_runner.py | python | DBBenchRunner._get_options_command_line_args_str | (self, curr_options) | return optional_args_str | This method uses the provided Rocksdb OPTIONS to create a string of
command-line arguments for db_bench.
The --options_file argument is always given and the options that are
not supported by the OPTIONS file are given as separate arguments. | This method uses the provided Rocksdb OPTIONS to create a string of
command-line arguments for db_bench.
The --options_file argument is always given and the options that are
not supported by the OPTIONS file are given as separate arguments. | [
"This",
"method",
"uses",
"the",
"provided",
"Rocksdb",
"OPTIONS",
"to",
"create",
"a",
"string",
"of",
"command",
"-",
"line",
"arguments",
"for",
"db_bench",
".",
"The",
"--",
"options_file",
"argument",
"is",
"always",
"given",
"and",
"the",
"options",
"t... | def _get_options_command_line_args_str(self, curr_options):
'''
This method uses the provided Rocksdb OPTIONS to create a string of
command-line arguments for db_bench.
The --options_file argument is always given and the options that are
not supported by the OPTIONS file are give... | [
"def",
"_get_options_command_line_args_str",
"(",
"self",
",",
"curr_options",
")",
":",
"optional_args_str",
"=",
"DBBenchRunner",
".",
"get_opt_args_str",
"(",
"curr_options",
".",
"get_misc_options",
"(",
")",
")",
"# generate an options configuration file",
"options_fil... | https://github.com/turtlecoin/turtlecoin/blob/02ee0f0551f4552e7d2fd48df23f4b4ff84f4dd8/external/rocksdb/tools/advisor/advisor/db_bench_runner.py#L149-L162 | |
KratosMultiphysics/Kratos | 0000833054ed0503424eb28205d6508d9ca6cbbc | applications/MultilevelMonteCarloApplication/external_libraries/XMC/xmc/methodDefs_randomGeneratorWrapper/generator.py | python | returnIntegerUniform | (*args) | return [int(np.random.uniform(args[0],args[1]))] | Return one integer uniformly distributed random variable | Return one integer uniformly distributed random variable | [
"Return",
"one",
"integer",
"uniformly",
"distributed",
"random",
"variable"
] | def returnIntegerUniform(*args):
"""
Return one integer uniformly distributed random variable
"""
return [int(np.random.uniform(args[0],args[1]))] | [
"def",
"returnIntegerUniform",
"(",
"*",
"args",
")",
":",
"return",
"[",
"int",
"(",
"np",
".",
"random",
".",
"uniform",
"(",
"args",
"[",
"0",
"]",
",",
"args",
"[",
"1",
"]",
")",
")",
"]"
] | https://github.com/KratosMultiphysics/Kratos/blob/0000833054ed0503424eb28205d6508d9ca6cbbc/applications/MultilevelMonteCarloApplication/external_libraries/XMC/xmc/methodDefs_randomGeneratorWrapper/generator.py#L88-L92 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/tkinter/messagebox.py | python | showerror | (title=None, message=None, **options) | return _show(title, message, ERROR, OK, **options) | Show an error message | Show an error message | [
"Show",
"an",
"error",
"message"
] | def showerror(title=None, message=None, **options):
"Show an error message"
return _show(title, message, ERROR, OK, **options) | [
"def",
"showerror",
"(",
"title",
"=",
"None",
",",
"message",
"=",
"None",
",",
"*",
"*",
"options",
")",
":",
"return",
"_show",
"(",
"title",
",",
"message",
",",
"ERROR",
",",
"OK",
",",
"*",
"*",
"options",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/tkinter/messagebox.py#L89-L91 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/stc.py | python | StyledTextCtrl.AutoCompSetMaxWidth | (*args, **kwargs) | return _stc.StyledTextCtrl_AutoCompSetMaxWidth(*args, **kwargs) | AutoCompSetMaxWidth(self, int characterCount)
Set the maximum width, in characters, of auto-completion and user lists.
Set to 0 to autosize to fit longest item, which is the default. | AutoCompSetMaxWidth(self, int characterCount) | [
"AutoCompSetMaxWidth",
"(",
"self",
"int",
"characterCount",
")"
] | def AutoCompSetMaxWidth(*args, **kwargs):
"""
AutoCompSetMaxWidth(self, int characterCount)
Set the maximum width, in characters, of auto-completion and user lists.
Set to 0 to autosize to fit longest item, which is the default.
"""
return _stc.StyledTextCtrl_AutoCompSet... | [
"def",
"AutoCompSetMaxWidth",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_AutoCompSetMaxWidth",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/stc.py#L3236-L3243 | |
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/framework/ops.py | python | Graph._apply_device_functions | (self, op) | Applies the current device function stack to the given operation. | Applies the current device function stack to the given operation. | [
"Applies",
"the",
"current",
"device",
"function",
"stack",
"to",
"the",
"given",
"operation",
"."
] | def _apply_device_functions(self, op):
"""Applies the current device function stack to the given operation."""
# Apply any device functions in reverse order, so that the most recently
# pushed function has the first chance to apply a device to the op.
# We apply here because the result can depend on the... | [
"def",
"_apply_device_functions",
"(",
"self",
",",
"op",
")",
":",
"# Apply any device functions in reverse order, so that the most recently",
"# pushed function has the first chance to apply a device to the op.",
"# We apply here because the result can depend on the Operation's",
"# signatur... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/framework/ops.py#L3008-L3017 | ||
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/numpy/multiarray.py | python | arctan2 | (x1, x2, out=None, **kwargs) | return _mx_nd_np.arctan2(x1, x2, out=out) | r"""
Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly.
The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is
the signed angle in radians between the ray ending at the origin and
passing through the point (1,0), and the ray ending at the origin and
passing through... | r"""
Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. | [
"r",
"Element",
"-",
"wise",
"arc",
"tangent",
"of",
"x1",
"/",
"x2",
"choosing",
"the",
"quadrant",
"correctly",
"."
] | def arctan2(x1, x2, out=None, **kwargs):
r"""
Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly.
The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is
the signed angle in radians between the ray ending at the origin and
passing through the point (1,0), and the ray... | [
"def",
"arctan2",
"(",
"x1",
",",
"x2",
",",
"out",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_mx_nd_np",
".",
"arctan2",
"(",
"x1",
",",
"x2",
",",
"out",
"=",
"out",
")"
] | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/numpy/multiarray.py#L9441-L9525 | |
panda3d/panda3d | 833ad89ebad58395d0af0b7ec08538e5e4308265 | direct/src/tkwidgets/Tree.py | python | TreeItem.SetText | (self, text) | Change the item's text (if it is editable). | Change the item's text (if it is editable). | [
"Change",
"the",
"item",
"s",
"text",
"(",
"if",
"it",
"is",
"editable",
")",
"."
] | def SetText(self, text):
"""Change the item's text (if it is editable).""" | [
"def",
"SetText",
"(",
"self",
",",
"text",
")",
":"
] | https://github.com/panda3d/panda3d/blob/833ad89ebad58395d0af0b7ec08538e5e4308265/direct/src/tkwidgets/Tree.py#L502-L503 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib2to3/pytree.py | python | Node.__repr__ | (self) | return "%s(%s, %r)" % (self.__class__.__name__,
type_repr(self.type),
self.children) | Return a canonical string representation. | Return a canonical string representation. | [
"Return",
"a",
"canonical",
"string",
"representation",
"."
] | def __repr__(self):
"""Return a canonical string representation."""
return "%s(%s, %r)" % (self.__class__.__name__,
type_repr(self.type),
self.children) | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"\"%s(%s, %r)\"",
"%",
"(",
"self",
".",
"__class__",
".",
"__name__",
",",
"type_repr",
"(",
"self",
".",
"type",
")",
",",
"self",
".",
"children",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib2to3/pytree.py#L268-L272 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | current/tools/gyp/pylib/gyp/generator/cmake.py | python | WriteCopies | (target_name, copies, extra_deps, path_to_gyp, output) | Write CMake for the 'copies' in the target.
Args:
target_name: the name of the CMake target being generated.
actions: the Gyp 'actions' dict for this target.
extra_deps: [<cmake_taget>] to append with generated targets.
path_to_gyp: relative path from CMakeLists.txt being generated to
the Gyp... | Write CMake for the 'copies' in the target. | [
"Write",
"CMake",
"for",
"the",
"copies",
"in",
"the",
"target",
"."
] | def WriteCopies(target_name, copies, extra_deps, path_to_gyp, output):
"""Write CMake for the 'copies' in the target.
Args:
target_name: the name of the CMake target being generated.
actions: the Gyp 'actions' dict for this target.
extra_deps: [<cmake_taget>] to append with generated targets.
path_... | [
"def",
"WriteCopies",
"(",
"target_name",
",",
"copies",
",",
"extra_deps",
",",
"path_to_gyp",
",",
"output",
")",
":",
"copy_name",
"=",
"target_name",
"+",
"'__copies'",
"# CMake gets upset with custom targets with OUTPUT which specify no output.",
"have_copies",
"=",
... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/current/tools/gyp/pylib/gyp/generator/cmake.py#L449-L554 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/feature_column/feature_column_v2.py | python | VocabularyListCategoricalColumn._from_config | (cls, config, custom_objects=None, columns_by_name=None) | return cls(**kwargs) | See 'FeatureColumn` base class. | See 'FeatureColumn` base class. | [
"See",
"FeatureColumn",
"base",
"class",
"."
] | def _from_config(cls, config, custom_objects=None, columns_by_name=None):
"""See 'FeatureColumn` base class."""
_check_config_keys(config, cls._fields)
kwargs = _standardize_and_copy_config(config)
kwargs['dtype'] = dtypes.as_dtype(config['dtype'])
return cls(**kwargs) | [
"def",
"_from_config",
"(",
"cls",
",",
"config",
",",
"custom_objects",
"=",
"None",
",",
"columns_by_name",
"=",
"None",
")",
":",
"_check_config_keys",
"(",
"config",
",",
"cls",
".",
"_fields",
")",
"kwargs",
"=",
"_standardize_and_copy_config",
"(",
"conf... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/feature_column/feature_column_v2.py#L3783-L3788 | |
CMU-Perceptual-Computing-Lab/caffe_rtpose | a4778bb1c3eb74d7250402016047216f77b4dba6 | python/caffe/io.py | python | Transformer.set_mean | (self, in_, mean) | Set the mean to subtract for centering the data.
Parameters
----------
in_ : which input to assign this mean.
mean : mean ndarray (input dimensional or broadcastable) | Set the mean to subtract for centering the data. | [
"Set",
"the",
"mean",
"to",
"subtract",
"for",
"centering",
"the",
"data",
"."
] | def set_mean(self, in_, mean):
"""
Set the mean to subtract for centering the data.
Parameters
----------
in_ : which input to assign this mean.
mean : mean ndarray (input dimensional or broadcastable)
"""
self.__check_input(in_)
ms = mean.shape
... | [
"def",
"set_mean",
"(",
"self",
",",
"in_",
",",
"mean",
")",
":",
"self",
".",
"__check_input",
"(",
"in_",
")",
"ms",
"=",
"mean",
".",
"shape",
"if",
"mean",
".",
"ndim",
"==",
"1",
":",
"# broadcast channels",
"if",
"ms",
"[",
"0",
"]",
"!=",
... | https://github.com/CMU-Perceptual-Computing-Lab/caffe_rtpose/blob/a4778bb1c3eb74d7250402016047216f77b4dba6/python/caffe/io.py#L236-L260 | ||
tinyobjloader/tinyobjloader | 8322e00ae685ea623ab6ac5a6cebcfa2d22fbf93 | deps/cpplint.py | python | IsRValueType | (typenames, clean_lines, nesting_state, linenum, column) | return False | Check if the token ending on (linenum, column) is a type.
Assumes that text to the right of the column is "&&" or a function
name.
Args:
typenames: set of type names from template-argument-list.
clean_lines: A CleansedLines instance containing the file.
nesting_state: A NestingState instance which m... | Check if the token ending on (linenum, column) is a type. | [
"Check",
"if",
"the",
"token",
"ending",
"on",
"(",
"linenum",
"column",
")",
"is",
"a",
"type",
"."
] | def IsRValueType(typenames, clean_lines, nesting_state, linenum, column):
"""Check if the token ending on (linenum, column) is a type.
Assumes that text to the right of the column is "&&" or a function
name.
Args:
typenames: set of type names from template-argument-list.
clean_lines: A CleansedLines i... | [
"def",
"IsRValueType",
"(",
"typenames",
",",
"clean_lines",
",",
"nesting_state",
",",
"linenum",
",",
"column",
")",
":",
"prefix",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"[",
"0",
":",
"column",
"]",
"# Get one word to the left. If we failed... | https://github.com/tinyobjloader/tinyobjloader/blob/8322e00ae685ea623ab6ac5a6cebcfa2d22fbf93/deps/cpplint.py#L3431-L3632 | |
gamedev-net/nehe-opengl | 9f073e5b092ad8dbcb21393871a2855fe86a65c6 | python/lesson44/ztv121/lesson44.py | python | LoadTexture | (path) | return True, texid | // Load Image And Convert To A Texture
path can be a relative path, or a fully qualified path.
returns tuple of status and ID:
returns False if the requested image couldn't loaded as a texture
returns True and the texture ID if image was loaded | // Load Image And Convert To A Texture
path can be a relative path, or a fully qualified path.
returns tuple of status and ID:
returns False if the requested image couldn't loaded as a texture
returns True and the texture ID if image was loaded | [
"//",
"Load",
"Image",
"And",
"Convert",
"To",
"A",
"Texture",
"path",
"can",
"be",
"a",
"relative",
"path",
"or",
"a",
"fully",
"qualified",
"path",
".",
"returns",
"tuple",
"of",
"status",
"and",
"ID",
":",
"returns",
"False",
"if",
"the",
"requested",... | def LoadTexture (path):
""" // Load Image And Convert To A Texture
path can be a relative path, or a fully qualified path.
returns tuple of status and ID:
returns False if the requested image couldn't loaded as a texture
returns True and the texture ID if image was loaded
"""
# Catch exception here if image file... | [
"def",
"LoadTexture",
"(",
"path",
")",
":",
"# Catch exception here if image file couldn't be loaded",
"try",
":",
"# Note, NYI, path specified as URL's could be access using python url lib",
"# OleLoadPicturePath () supports url paths, but that capability isn't critcial to this tutorial.",
"... | https://github.com/gamedev-net/nehe-opengl/blob/9f073e5b092ad8dbcb21393871a2855fe86a65c6/python/lesson44/ztv121/lesson44.py#L83-L126 | |
deepmind/streetlearn | ccf1d60b9c45154894d45a897748aee85d7eb69b | streetlearn/python/environment/incremental_instruction_game.py | python | IncrementalInstructionGame.__init__ | (self, config) | Creates an instance of the StreetLearn level.
Args:
config: config dict of various settings. | Creates an instance of the StreetLearn level. | [
"Creates",
"an",
"instance",
"of",
"the",
"StreetLearn",
"level",
"."
] | def __init__(self, config):
"""Creates an instance of the StreetLearn level.
Args:
config: config dict of various settings.
"""
super(IncrementalInstructionGame, self).__init__(config)
# Verify that waypoints receive reward.
assert self._reward_at_waypoint > 0, "Waypoint reward should be... | [
"def",
"__init__",
"(",
"self",
",",
"config",
")",
":",
"super",
"(",
"IncrementalInstructionGame",
",",
"self",
")",
".",
"__init__",
"(",
"config",
")",
"# Verify that waypoints receive reward.",
"assert",
"self",
".",
"_reward_at_waypoint",
">",
"0",
",",
"\... | https://github.com/deepmind/streetlearn/blob/ccf1d60b9c45154894d45a897748aee85d7eb69b/streetlearn/python/environment/incremental_instruction_game.py#L33-L42 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/SANS/ISISCommandInterface.py | python | set_q_resolution_collimation_length | (collimation_length) | Sets the collimation length
@param collimation_length: the collimation length | Sets the collimation length | [
"Sets",
"the",
"collimation",
"length"
] | def set_q_resolution_collimation_length(collimation_length):
'''
Sets the collimation length
@param collimation_length: the collimation length
'''
if collimation_length is None:
return
msg = "Collimation Length"
if su.is_convertible_to_float(collimation_length):
c_l = float(c... | [
"def",
"set_q_resolution_collimation_length",
"(",
"collimation_length",
")",
":",
"if",
"collimation_length",
"is",
"None",
":",
"return",
"msg",
"=",
"\"Collimation Length\"",
"if",
"su",
".",
"is_convertible_to_float",
"(",
"collimation_length",
")",
":",
"c_l",
"=... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/SANS/ISISCommandInterface.py#L1571-L1583 | ||
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | scripts/Python/static-binding/lldb.py | python | SBListener.IsValid | (self) | return _lldb.SBListener_IsValid(self) | IsValid(SBListener self) -> bool | IsValid(SBListener self) -> bool | [
"IsValid",
"(",
"SBListener",
"self",
")",
"-",
">",
"bool"
] | def IsValid(self):
"""IsValid(SBListener self) -> bool"""
return _lldb.SBListener_IsValid(self) | [
"def",
"IsValid",
"(",
"self",
")",
":",
"return",
"_lldb",
".",
"SBListener_IsValid",
"(",
"self",
")"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L6824-L6826 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/joblib/joblib/externals/loky/backend/resource_tracker.py | python | ResourceTracker.unregister | (self, name, rtype) | Unregister a named resource with resource tracker. | Unregister a named resource with resource tracker. | [
"Unregister",
"a",
"named",
"resource",
"with",
"resource",
"tracker",
"."
] | def unregister(self, name, rtype):
'''Unregister a named resource with resource tracker.'''
self.ensure_running()
self._send('UNREGISTER', name, rtype) | [
"def",
"unregister",
"(",
"self",
",",
"name",
",",
"rtype",
")",
":",
"self",
".",
"ensure_running",
"(",
")",
"self",
".",
"_send",
"(",
"'UNREGISTER'",
",",
"name",
",",
"rtype",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/joblib/joblib/externals/loky/backend/resource_tracker.py#L193-L196 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/richtext.py | python | RichTextCtrl.BeginStandardBullet | (*args, **kwargs) | return _richtext.RichTextCtrl_BeginStandardBullet(*args, **kwargs) | BeginStandardBullet(self, String bulletName, int leftIndent, int leftSubIndent,
int bulletStyle=TEXT_ATTR_BULLET_STYLE_STANDARD) -> bool
Begin standard bullet | BeginStandardBullet(self, String bulletName, int leftIndent, int leftSubIndent,
int bulletStyle=TEXT_ATTR_BULLET_STYLE_STANDARD) -> bool | [
"BeginStandardBullet",
"(",
"self",
"String",
"bulletName",
"int",
"leftIndent",
"int",
"leftSubIndent",
"int",
"bulletStyle",
"=",
"TEXT_ATTR_BULLET_STYLE_STANDARD",
")",
"-",
">",
"bool"
] | def BeginStandardBullet(*args, **kwargs):
"""
BeginStandardBullet(self, String bulletName, int leftIndent, int leftSubIndent,
int bulletStyle=TEXT_ATTR_BULLET_STYLE_STANDARD) -> bool
Begin standard bullet
"""
return _richtext.RichTextCtrl_BeginStandardBullet(*args, ... | [
"def",
"BeginStandardBullet",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextCtrl_BeginStandardBullet",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/richtext.py#L3548-L3555 | |
cvxpy/cvxpy | 5165b4fb750dfd237de8659383ef24b4b2e33aaf | cvxpy/atoms/affine/kron.py | python | kron.is_incr | (self, idx) | return self.args[0].is_nonneg() | Is the composition non-decreasing in argument idx? | Is the composition non-decreasing in argument idx? | [
"Is",
"the",
"composition",
"non",
"-",
"decreasing",
"in",
"argument",
"idx?"
] | def is_incr(self, idx) -> bool:
"""Is the composition non-decreasing in argument idx?
"""
return self.args[0].is_nonneg() | [
"def",
"is_incr",
"(",
"self",
",",
"idx",
")",
"->",
"bool",
":",
"return",
"self",
".",
"args",
"[",
"0",
"]",
".",
"is_nonneg",
"(",
")"
] | https://github.com/cvxpy/cvxpy/blob/5165b4fb750dfd237de8659383ef24b4b2e33aaf/cvxpy/atoms/affine/kron.py#L62-L65 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/botocore/vendored/requests/packages/urllib3/response.py | python | HTTPResponse.from_httplib | (ResponseCls, r, **response_kw) | return resp | Given an :class:`httplib.HTTPResponse` instance ``r``, return a
corresponding :class:`urllib3.response.HTTPResponse` object.
Remaining parameters are passed to the HTTPResponse constructor, along
with ``original_response=r``. | Given an :class:`httplib.HTTPResponse` instance ``r``, return a
corresponding :class:`urllib3.response.HTTPResponse` object. | [
"Given",
"an",
":",
"class",
":",
"httplib",
".",
"HTTPResponse",
"instance",
"r",
"return",
"a",
"corresponding",
":",
"class",
":",
"urllib3",
".",
"response",
".",
"HTTPResponse",
"object",
"."
] | def from_httplib(ResponseCls, r, **response_kw):
"""
Given an :class:`httplib.HTTPResponse` instance ``r``, return a
corresponding :class:`urllib3.response.HTTPResponse` object.
Remaining parameters are passed to the HTTPResponse constructor, along
with ``original_response=r``.
... | [
"def",
"from_httplib",
"(",
"ResponseCls",
",",
"r",
",",
"*",
"*",
"response_kw",
")",
":",
"headers",
"=",
"r",
".",
"msg",
"if",
"not",
"isinstance",
"(",
"headers",
",",
"HTTPHeaderDict",
")",
":",
"if",
"PY3",
":",
"# Python 3",
"headers",
"=",
"H... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/botocore/vendored/requests/packages/urllib3/response.py#L313-L338 | |
luliyucoordinate/Leetcode | 96afcdc54807d1d184e881a075d1dbf3371e31fb | src/0129-Sum-Root-to-Leaf-Numbers/0129.py | python | Solution.sumNumbers | (self, root) | return result | :type root: TreeNode
:rtype: int | :type root: TreeNode
:rtype: int | [
":",
"type",
"root",
":",
"TreeNode",
":",
"rtype",
":",
"int"
] | def sumNumbers(self, root):
"""
:type root: TreeNode
:rtype: int
"""
result = 0
if not root:
return result
path = [(0, root)]
while path:
pre, node = path.pop()
if node:
if not node.left and not node.rig... | [
"def",
"sumNumbers",
"(",
"self",
",",
"root",
")",
":",
"result",
"=",
"0",
"if",
"not",
"root",
":",
"return",
"result",
"path",
"=",
"[",
"(",
"0",
",",
"root",
")",
"]",
"while",
"path",
":",
"pre",
",",
"node",
"=",
"path",
".",
"pop",
"("... | https://github.com/luliyucoordinate/Leetcode/blob/96afcdc54807d1d184e881a075d1dbf3371e31fb/src/0129-Sum-Root-to-Leaf-Numbers/0129.py#L2-L20 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/aui/aui_utilities.py | python | ChopText | (dc, text, max_size) | return ret | Chops the input `text` if its size does not fit in `max_size`, by cutting the
text and adding ellipsis at the end.
:param `dc`: a :class:`DC` device context;
:param string `text`: the text to chop;
:param integer `max_size`: the maximum size in which the text should fit. | Chops the input `text` if its size does not fit in `max_size`, by cutting the
text and adding ellipsis at the end. | [
"Chops",
"the",
"input",
"text",
"if",
"its",
"size",
"does",
"not",
"fit",
"in",
"max_size",
"by",
"cutting",
"the",
"text",
"and",
"adding",
"ellipsis",
"at",
"the",
"end",
"."
] | def ChopText(dc, text, max_size):
"""
Chops the input `text` if its size does not fit in `max_size`, by cutting the
text and adding ellipsis at the end.
:param `dc`: a :class:`DC` device context;
:param string `text`: the text to chop;
:param integer `max_size`: the maximum size in which the te... | [
"def",
"ChopText",
"(",
"dc",
",",
"text",
",",
"max_size",
")",
":",
"# first check if the text fits with no problems",
"x",
",",
"y",
",",
"dummy",
"=",
"dc",
".",
"GetMultiLineTextExtent",
"(",
"text",
")",
"if",
"x",
"<=",
"max_size",
":",
"return",
"tex... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/aui/aui_utilities.py#L96-L126 | |
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Editor/Python/windows/Lib/site-packages/setuptools/command/egg_info.py | python | get_pkg_info_revision | () | return 0 | Get a -r### off of PKG-INFO Version in case this is an sdist of
a subversion revision. | Get a -r### off of PKG-INFO Version in case this is an sdist of
a subversion revision. | [
"Get",
"a",
"-",
"r###",
"off",
"of",
"PKG",
"-",
"INFO",
"Version",
"in",
"case",
"this",
"is",
"an",
"sdist",
"of",
"a",
"subversion",
"revision",
"."
] | def get_pkg_info_revision():
"""
Get a -r### off of PKG-INFO Version in case this is an sdist of
a subversion revision.
"""
warnings.warn("get_pkg_info_revision is deprecated.", EggInfoDeprecationWarning)
if os.path.exists('PKG-INFO'):
with io.open('PKG-INFO') as f:
for line ... | [
"def",
"get_pkg_info_revision",
"(",
")",
":",
"warnings",
".",
"warn",
"(",
"\"get_pkg_info_revision is deprecated.\"",
",",
"EggInfoDeprecationWarning",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"'PKG-INFO'",
")",
":",
"with",
"io",
".",
"open",
"(",
... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Editor/Python/windows/Lib/site-packages/setuptools/command/egg_info.py#L701-L713 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/tornado/tornado-6/tornado/httputil.py | python | qs_to_qsl | (qs: Dict[str, List[AnyStr]]) | Generator converting a result of ``parse_qs`` back to name-value pairs.
.. versionadded:: 5.0 | Generator converting a result of ``parse_qs`` back to name-value pairs. | [
"Generator",
"converting",
"a",
"result",
"of",
"parse_qs",
"back",
"to",
"name",
"-",
"value",
"pairs",
"."
] | def qs_to_qsl(qs: Dict[str, List[AnyStr]]) -> Iterable[Tuple[str, AnyStr]]:
"""Generator converting a result of ``parse_qs`` back to name-value pairs.
.. versionadded:: 5.0
"""
for k, vs in qs.items():
for v in vs:
yield (k, v) | [
"def",
"qs_to_qsl",
"(",
"qs",
":",
"Dict",
"[",
"str",
",",
"List",
"[",
"AnyStr",
"]",
"]",
")",
"->",
"Iterable",
"[",
"Tuple",
"[",
"str",
",",
"AnyStr",
"]",
"]",
":",
"for",
"k",
",",
"vs",
"in",
"qs",
".",
"items",
"(",
")",
":",
"for"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/tornado/tornado-6/tornado/httputil.py#L1045-L1052 | ||
borglab/gtsam | a5bee157efce6a0563704bce6a5d188c29817f39 | wrap/gtwrap/matlab_wrapper/wrapper.py | python | MatlabWrapper.wrap_class_serialize_method | (self, namespace_name, inst_class) | return WrapperTemplate.class_serialize_method.format(
wrapper=self._wrapper_name(),
wrapper_id=wrapper_id,
class_name=namespace_name + '.' + class_name) | Wrap the serizalize method of the class. | Wrap the serizalize method of the class. | [
"Wrap",
"the",
"serizalize",
"method",
"of",
"the",
"class",
"."
] | def wrap_class_serialize_method(self, namespace_name, inst_class):
"""
Wrap the serizalize method of the class.
"""
class_name = inst_class.name
wrapper_id = self._update_wrapper_id(
(namespace_name, inst_class, 'string_serialize', 'serialize'))
return Wrappe... | [
"def",
"wrap_class_serialize_method",
"(",
"self",
",",
"namespace_name",
",",
"inst_class",
")",
":",
"class_name",
"=",
"inst_class",
".",
"name",
"wrapper_id",
"=",
"self",
".",
"_update_wrapper_id",
"(",
"(",
"namespace_name",
",",
"inst_class",
",",
"'string_... | https://github.com/borglab/gtsam/blob/a5bee157efce6a0563704bce6a5d188c29817f39/wrap/gtwrap/matlab_wrapper/wrapper.py#L1534-L1545 | |
fabianschenk/REVO | eb949c0fdbcdf0be09a38464eb0592a90803947f | thirdparty/Sophus/py/sophus/so2.py | python | So2.log | (self) | return sympy.atan2(self.z.imag, self.z.real) | logarithmic map | logarithmic map | [
"logarithmic",
"map"
] | def log(self):
""" logarithmic map"""
return sympy.atan2(self.z.imag, self.z.real) | [
"def",
"log",
"(",
"self",
")",
":",
"return",
"sympy",
".",
"atan2",
"(",
"self",
".",
"z",
".",
"imag",
",",
"self",
".",
"z",
".",
"real",
")"
] | https://github.com/fabianschenk/REVO/blob/eb949c0fdbcdf0be09a38464eb0592a90803947f/thirdparty/Sophus/py/sophus/so2.py#L23-L25 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/contrib/graph_editor/select.py | python | make_regex | (obj) | Return a compiled regular expression.
Args:
obj: a string or a regular expression.
Returns:
A compiled regular expression.
Raises:
ValueError: if obj could not be converted to a regular expression. | Return a compiled regular expression. | [
"Return",
"a",
"compiled",
"regular",
"expression",
"."
] | def make_regex(obj):
"""Return a compiled regular expression.
Args:
obj: a string or a regular expression.
Returns:
A compiled regular expression.
Raises:
ValueError: if obj could not be converted to a regular expression.
"""
if not can_be_regex(obj):
raise ValueError("Expected a string or ... | [
"def",
"make_regex",
"(",
"obj",
")",
":",
"if",
"not",
"can_be_regex",
"(",
"obj",
")",
":",
"raise",
"ValueError",
"(",
"\"Expected a string or a regex, got: {}\"",
".",
"format",
"(",
"type",
"(",
"obj",
")",
")",
")",
"if",
"isinstance",
"(",
"obj",
",... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/contrib/graph_editor/select.py#L40-L56 | ||
microsoft/checkedc-clang | a173fefde5d7877b7750e7ce96dd08cf18baebf2 | lldb/examples/python/bsd.py | python | Archive.get_object_dicts | (self) | return object_dicts | Returns an array of object dictionaries that contain they following
keys:
'object': the actual bsd.Object instance
'symdefs': an array of symbol names that the object contains
as found in the "__.SYMDEF" item in the archive | Returns an array of object dictionaries that contain they following
keys:
'object': the actual bsd.Object instance
'symdefs': an array of symbol names that the object contains
as found in the "__.SYMDEF" item in the archive | [
"Returns",
"an",
"array",
"of",
"object",
"dictionaries",
"that",
"contain",
"they",
"following",
"keys",
":",
"object",
":",
"the",
"actual",
"bsd",
".",
"Object",
"instance",
"symdefs",
":",
"an",
"array",
"of",
"symbol",
"names",
"that",
"the",
"object",
... | def get_object_dicts(self):
'''
Returns an array of object dictionaries that contain they following
keys:
'object': the actual bsd.Object instance
'symdefs': an array of symbol names that the object contains
as found in the "__.S... | [
"def",
"get_object_dicts",
"(",
"self",
")",
":",
"symdefs",
"=",
"self",
".",
"get_symdef",
"(",
")",
"symdef_dict",
"=",
"{",
"}",
"if",
"symdefs",
":",
"for",
"(",
"name",
",",
"offset",
")",
"in",
"symdefs",
":",
"if",
"offset",
"in",
"symdef_dict"... | https://github.com/microsoft/checkedc-clang/blob/a173fefde5d7877b7750e7ce96dd08cf18baebf2/lldb/examples/python/bsd.py#L174-L198 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/setuptools/_vendor/pyparsing.py | python | ParseResults.insert | ( self, index, insStr ) | Inserts new element at location index in the list of parsed tokens.
Similar to C{list.insert()}.
Example::
print(OneOrMore(Word(nums)).parseString("0 123 321")) # -> ['0', '123', '321']
# use a parse action to insert the parse location in the front of the parsed result... | Inserts new element at location index in the list of parsed tokens.
Similar to C{list.insert()}. | [
"Inserts",
"new",
"element",
"at",
"location",
"index",
"in",
"the",
"list",
"of",
"parsed",
"tokens",
".",
"Similar",
"to",
"C",
"{",
"list",
".",
"insert",
"()",
"}",
"."
] | def insert( self, index, insStr ):
"""
Inserts new element at location index in the list of parsed tokens.
Similar to C{list.insert()}.
Example::
print(OneOrMore(Word(nums)).parseString("0 123 321")) # -> ['0', '123', '321']
# use a parse action to inse... | [
"def",
"insert",
"(",
"self",
",",
"index",
",",
"insStr",
")",
":",
"self",
".",
"__toklist",
".",
"insert",
"(",
"index",
",",
"insStr",
")",
"# fixup indices in token dictionary",
"for",
"name",
",",
"occurrences",
"in",
"self",
".",
"__tokdict",
".",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/setuptools/_vendor/pyparsing.py#L585-L603 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/balloontip.py | python | BalloonTip.SetMessageFont | (self, font=None) | Sets the font for the tip message.
:param `font`: a valid :class:`Font` instance. | Sets the font for the tip message. | [
"Sets",
"the",
"font",
"for",
"the",
"tip",
"message",
"."
] | def SetMessageFont(self, font=None):
"""
Sets the font for the tip message.
:param `font`: a valid :class:`Font` instance.
"""
if font is None:
font = wx.Font(8, wx.SWISS, wx.NORMAL, wx.NORMAL, False)
self._balloonmsgfont = font | [
"def",
"SetMessageFont",
"(",
"self",
",",
"font",
"=",
"None",
")",
":",
"if",
"font",
"is",
"None",
":",
"font",
"=",
"wx",
".",
"Font",
"(",
"8",
",",
"wx",
".",
"SWISS",
",",
"wx",
".",
"NORMAL",
",",
"wx",
".",
"NORMAL",
",",
"False",
")",... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/balloontip.py#L987-L997 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/framework/device.py | python | MergeDevice.is_null_merge | (self) | return not bool(self._spec.to_string()) | Indicate whether the wrapped spec is empty.
In the degenerate case where self._spec is an empty specification, a caller
may wish to skip a merge step entirely. (However this class does not have
enough information to make that determination.)
Returns:
A boolean indicating whether a device merge w... | Indicate whether the wrapped spec is empty. | [
"Indicate",
"whether",
"the",
"wrapped",
"spec",
"is",
"empty",
"."
] | def is_null_merge(self):
"""Indicate whether the wrapped spec is empty.
In the degenerate case where self._spec is an empty specification, a caller
may wish to skip a merge step entirely. (However this class does not have
enough information to make that determination.)
Returns:
A boolean ind... | [
"def",
"is_null_merge",
"(",
"self",
")",
":",
"return",
"not",
"bool",
"(",
"self",
".",
"_spec",
".",
"to_string",
"(",
")",
")"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/framework/device.py#L168-L178 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/bisect.py | python | insort_left | (a, x, lo=0, hi=None) | Insert item x in list a, and keep it sorted assuming a is sorted.
If x is already in a, insert it to the left of the leftmost x.
Optional args lo (default 0) and hi (default len(a)) bound the
slice of a to be searched. | Insert item x in list a, and keep it sorted assuming a is sorted. | [
"Insert",
"item",
"x",
"in",
"list",
"a",
"and",
"keep",
"it",
"sorted",
"assuming",
"a",
"is",
"sorted",
"."
] | def insort_left(a, x, lo=0, hi=None):
"""Insert item x in list a, and keep it sorted assuming a is sorted.
If x is already in a, insert it to the left of the leftmost x.
Optional args lo (default 0) and hi (default len(a)) bound the
slice of a to be searched.
"""
if lo < 0:
raise Valu... | [
"def",
"insort_left",
"(",
"a",
",",
"x",
",",
"lo",
"=",
"0",
",",
"hi",
"=",
"None",
")",
":",
"if",
"lo",
"<",
"0",
":",
"raise",
"ValueError",
"(",
"'lo must be non-negative'",
")",
"if",
"hi",
"is",
"None",
":",
"hi",
"=",
"len",
"(",
"a",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/bisect.py#L47-L64 | ||
lmb-freiburg/ogn | 974f72ef4bf840d6f6693d22d1843a79223e77ce | examples/pycaffe/tools.py | python | CaffeSolver.write | (self, filepath) | Export solver parameters to INPUT "filepath". Sorted alphabetically. | Export solver parameters to INPUT "filepath". Sorted alphabetically. | [
"Export",
"solver",
"parameters",
"to",
"INPUT",
"filepath",
".",
"Sorted",
"alphabetically",
"."
] | def write(self, filepath):
"""
Export solver parameters to INPUT "filepath". Sorted alphabetically.
"""
f = open(filepath, 'w')
for key, value in sorted(self.sp.items()):
if not(type(value) is str):
raise TypeError('All solver parameters must be string... | [
"def",
"write",
"(",
"self",
",",
"filepath",
")",
":",
"f",
"=",
"open",
"(",
"filepath",
",",
"'w'",
")",
"for",
"key",
",",
"value",
"in",
"sorted",
"(",
"self",
".",
"sp",
".",
"items",
"(",
")",
")",
":",
"if",
"not",
"(",
"type",
"(",
"... | https://github.com/lmb-freiburg/ogn/blob/974f72ef4bf840d6f6693d22d1843a79223e77ce/examples/pycaffe/tools.py#L113-L121 | ||
weolar/miniblink49 | 1c4678db0594a4abde23d3ebbcc7cd13c3170777 | v8_5_7/src/inspector/build/rjsmin.py | python | jsmin_for_posers | (script) | return _re.sub(
r'([^\047"/\000-\040]+)|((?:(?:\047[^\047\\\r\n]*(?:\\(?:[^\r\n]|\r?'
r'\n|\r)[^\047\\\r\n]*)*\047)|(?:"[^"\\\r\n]*(?:\\(?:[^\r\n]|\r?\n|'
r'\r)[^"\\\r\n]*)*"))[^\047"/\000-\040]*)|(?<=[(,=:\[!&|?{};\r\n])(?'
r':[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)... | r"""
Minify javascript based on `jsmin.c by Douglas Crockford`_\.
Instead of parsing the stream char by char, it uses a regular
expression approach which minifies the whole script with one big
substitution regex.
.. _jsmin.c by Douglas Crockford:
http://www.crockford.com/javascript/jsmin.c
... | r"""
Minify javascript based on `jsmin.c by Douglas Crockford`_\. | [
"r",
"Minify",
"javascript",
"based",
"on",
"jsmin",
".",
"c",
"by",
"Douglas",
"Crockford",
"_",
"\\",
"."
] | def jsmin_for_posers(script):
r"""
Minify javascript based on `jsmin.c by Douglas Crockford`_\.
Instead of parsing the stream char by char, it uses a regular
expression approach which minifies the whole script with one big
substitution regex.
.. _jsmin.c by Douglas Crockford:
http://www... | [
"def",
"jsmin_for_posers",
"(",
"script",
")",
":",
"def",
"subber",
"(",
"match",
")",
":",
"\"\"\" Substitution callback \"\"\"",
"groups",
"=",
"match",
".",
"groups",
"(",
")",
"return",
"(",
"groups",
"[",
"0",
"]",
"or",
"groups",
"[",
"1",
"]",
"o... | https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/v8_5_7/src/inspector/build/rjsmin.py#L230-L290 | |
nileshkulkarni/csm | 0e6e0e7d4f725fd36f2414c0be4b9d83197aa1fc | csm/utils/mesh.py | python | compute_uvsampler | (verts, faces, tex_size=2) | return uv | For this mesh, pre-computes the UV coordinates for
F x T x T points.
Returns F x T x T x 2 | For this mesh, pre-computes the UV coordinates for
F x T x T points.
Returns F x T x T x 2 | [
"For",
"this",
"mesh",
"pre",
"-",
"computes",
"the",
"UV",
"coordinates",
"for",
"F",
"x",
"T",
"x",
"T",
"points",
".",
"Returns",
"F",
"x",
"T",
"x",
"T",
"x",
"2"
] | def compute_uvsampler(verts, faces, tex_size=2):
"""
For this mesh, pre-computes the UV coordinates for
F x T x T points.
Returns F x T x T x 2
"""
alpha = np.arange(tex_size, dtype=np.float) / (tex_size-1)
beta = np.arange(tex_size, dtype=np.float) / (tex_size-1)
import itertools
# ... | [
"def",
"compute_uvsampler",
"(",
"verts",
",",
"faces",
",",
"tex_size",
"=",
"2",
")",
":",
"alpha",
"=",
"np",
".",
"arange",
"(",
"tex_size",
",",
"dtype",
"=",
"np",
".",
"float",
")",
"/",
"(",
"tex_size",
"-",
"1",
")",
"beta",
"=",
"np",
"... | https://github.com/nileshkulkarni/csm/blob/0e6e0e7d4f725fd36f2414c0be4b9d83197aa1fc/csm/utils/mesh.py#L45-L73 | |
swift/swift | 12d031cf8177fdec0137f9aa7e2912fa23c4416b | 3rdParty/SCons/scons-3.0.1/engine/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/swift/swift/blob/12d031cf8177fdec0137f9aa7e2912fa23c4416b/3rdParty/SCons/scons-3.0.1/engine/SCons/Node/Python.py#L43-L62 | |
bh107/bohrium | 5b83e7117285fefc7779ed0e9acb0f8e74c7e068 | bridge/npbackend/bohrium/linalg.py | python | gauss | (a) | return a | Performe Gausian elimination on matrix a without pivoting | Performe Gausian elimination on matrix a without pivoting | [
"Performe",
"Gausian",
"elimination",
"on",
"matrix",
"a",
"without",
"pivoting"
] | def gauss(a):
"""
Performe Gausian elimination on matrix a without pivoting
"""
for c in range(1, a.shape[0]):
a[c:, c - 1:] = a[c:, c - 1:] - (a[c:, c - 1] / a[c - 1, c - 1:c])[:, None] * a[c - 1, c - 1:]
np.flush()
a /= np.diagonal(a)[:, None]
return a | [
"def",
"gauss",
"(",
"a",
")",
":",
"for",
"c",
"in",
"range",
"(",
"1",
",",
"a",
".",
"shape",
"[",
"0",
"]",
")",
":",
"a",
"[",
"c",
":",
",",
"c",
"-",
"1",
":",
"]",
"=",
"a",
"[",
"c",
":",
",",
"c",
"-",
"1",
":",
"]",
"-",
... | https://github.com/bh107/bohrium/blob/5b83e7117285fefc7779ed0e9acb0f8e74c7e068/bridge/npbackend/bohrium/linalg.py#L25-L33 | |
Genius-x/genius-x | 9fc9f194e6d1fb92dd0e33d43db19ddb67cda7b0 | cocos2d/tools/bindings-generator/clang/cindex.py | python | Cursor.canonical | (self) | return self._canonical | Return the canonical Cursor corresponding to this Cursor.
The canonical cursor is the cursor which is representative for the
underlying entity. For example, if you have multiple forward
declarations for the same class, the canonical cursor for the forward
declarations will be identical. | Return the canonical Cursor corresponding to this Cursor. | [
"Return",
"the",
"canonical",
"Cursor",
"corresponding",
"to",
"this",
"Cursor",
"."
] | def canonical(self):
"""Return the canonical Cursor corresponding to this Cursor.
The canonical cursor is the cursor which is representative for the
underlying entity. For example, if you have multiple forward
declarations for the same class, the canonical cursor for the forward
... | [
"def",
"canonical",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_canonical'",
")",
":",
"self",
".",
"_canonical",
"=",
"conf",
".",
"lib",
".",
"clang_getCanonicalCursor",
"(",
"self",
")",
"return",
"self",
".",
"_canonical"
] | https://github.com/Genius-x/genius-x/blob/9fc9f194e6d1fb92dd0e33d43db19ddb67cda7b0/cocos2d/tools/bindings-generator/clang/cindex.py#L1309-L1320 | |
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py | python | SBData.CreateDataFromSInt64Array | (*args) | return _lldb.SBData_CreateDataFromSInt64Array(*args) | CreateDataFromSInt64Array(ByteOrder endian, uint32_t addr_byte_size, int64_t array) -> SBData | CreateDataFromSInt64Array(ByteOrder endian, uint32_t addr_byte_size, int64_t array) -> SBData | [
"CreateDataFromSInt64Array",
"(",
"ByteOrder",
"endian",
"uint32_t",
"addr_byte_size",
"int64_t",
"array",
")",
"-",
">",
"SBData"
] | def CreateDataFromSInt64Array(*args):
"""CreateDataFromSInt64Array(ByteOrder endian, uint32_t addr_byte_size, int64_t array) -> SBData"""
return _lldb.SBData_CreateDataFromSInt64Array(*args) | [
"def",
"CreateDataFromSInt64Array",
"(",
"*",
"args",
")",
":",
"return",
"_lldb",
".",
"SBData_CreateDataFromSInt64Array",
"(",
"*",
"args",
")"
] | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py#L2778-L2780 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.