nwo stringlengths 5 106 | sha stringlengths 40 40 | path stringlengths 4 174 | language stringclasses 1
value | identifier stringlengths 1 140 | parameters stringlengths 0 87.7k | argument_list stringclasses 1
value | return_statement stringlengths 0 426k | docstring stringlengths 0 64.3k | docstring_summary stringlengths 0 26.3k | docstring_tokens list | function stringlengths 18 4.83M | function_tokens list | url stringlengths 83 304 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
twisted/twisted | dee676b040dd38b847ea6fb112a712cb5e119490 | src/twisted/mail/mail.py | python | MailService.getPOP3Factory | (self) | return protocols.POP3Factory(self) | Create a POP3 protocol factory.
@rtype: L{POP3Factory}
@return: A POP3 protocol factory. | Create a POP3 protocol factory. | [
"Create",
"a",
"POP3",
"protocol",
"factory",
"."
] | def getPOP3Factory(self):
"""
Create a POP3 protocol factory.
@rtype: L{POP3Factory}
@return: A POP3 protocol factory.
"""
return protocols.POP3Factory(self) | [
"def",
"getPOP3Factory",
"(",
"self",
")",
":",
"return",
"protocols",
".",
"POP3Factory",
"(",
"self",
")"
] | https://github.com/twisted/twisted/blob/dee676b040dd38b847ea6fb112a712cb5e119490/src/twisted/mail/mail.py#L499-L506 | |
bslatkin/effectivepython | 4ae6f3141291ea137eb29a245bf889dbc8091713 | example_code/item_46.py | python | Homework.__init__ | (self) | [] | def __init__(self):
self._grade = 0 | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"_grade",
"=",
"0"
] | https://github.com/bslatkin/effectivepython/blob/4ae6f3141291ea137eb29a245bf889dbc8091713/example_code/item_46.py#L51-L52 | ||||
ansible/ansible-modules-core | 00911a75ad6635834b6d28eef41f197b2f73c381 | network/nxos/nxos_vrf_af.py | python | CustomNetworkConfig.add | (self, lines, parents=None) | Adds one or lines of configuration | Adds one or lines of configuration | [
"Adds",
"one",
"or",
"lines",
"of",
"configuration"
] | def add(self, lines, parents=None):
"""Adds one or lines of configuration
"""
ancestors = list()
offset = 0
obj = None
## global config command
if not parents:
for line in to_list(lines):
item = ConfigLine(line)
item.r... | [
"def",
"add",
"(",
"self",
",",
"lines",
",",
"parents",
"=",
"None",
")",
":",
"ancestors",
"=",
"list",
"(",
")",
"offset",
"=",
"0",
"obj",
"=",
"None",
"## global config command",
"if",
"not",
"parents",
":",
"for",
"line",
"in",
"to_list",
"(",
... | https://github.com/ansible/ansible-modules-core/blob/00911a75ad6635834b6d28eef41f197b2f73c381/network/nxos/nxos_vrf_af.py#L167-L213 | ||
QUANTAXIS/QUANTAXIS | d6eccb97c8385854aa596d6ba8d70ec0655519ff | config/data_init.py | python | datamodelx.__init__ | (self, market, frequence) | current support
::::
stock
future
index
::::
::::
1min
1day
market:
合约类型 说明
CS Common Stock, 即股票
ETF Exchange Traded Fund, 即交易所交易基金
LOF Listed Open-Ended Fund,即上市型开放式基金 (以下分级基金已并入)
INDX Index, 即指数
... | current support | [
"current",
"support"
] | def __init__(self, market, frequence):
"""
current support
::::
stock
future
index
::::
::::
1min
1day
market:
合约类型 说明
CS Common Stock, 即股票
ETF Exchange Traded Fund, 即交易所交易基金
LOF Listed Open-... | [
"def",
"__init__",
"(",
"self",
",",
"market",
",",
"frequence",
")",
":",
"self",
".",
"market_dict",
"=",
"{",
"QA",
".",
"MARKET_TYPE",
".",
"STOCK_CN",
":",
"'CS'",
",",
"QA",
".",
"MARKET_TYPE",
".",
"FUTURE_CN",
":",
"'Future'",
",",
"QA",
".",
... | https://github.com/QUANTAXIS/QUANTAXIS/blob/d6eccb97c8385854aa596d6ba8d70ec0655519ff/config/data_init.py#L26-L84 | ||
skorokithakis/goatfish | 6e202ce9bbc81f5915390253c73260b7bd374be5 | goatfish/models.py | python | Model.find | (cls, **parameters) | Query the database for rows. | Query the database for rows. | [
"Query",
"the",
"database",
"for",
"rows",
"."
] | def find(cls, **parameters):
"""
Query the database for rows.
"""
cursor = cls._get_cursor()
statement, parameters = cls._prepare_statement(parameters)
cursor.execute(statement, parameters)
for id, data in cursor:
loaded_dict = json.loads(data)
... | [
"def",
"find",
"(",
"cls",
",",
"*",
"*",
"parameters",
")",
":",
"cursor",
"=",
"cls",
".",
"_get_cursor",
"(",
")",
"statement",
",",
"parameters",
"=",
"cls",
".",
"_prepare_statement",
"(",
"parameters",
")",
"cursor",
".",
"execute",
"(",
"statement... | https://github.com/skorokithakis/goatfish/blob/6e202ce9bbc81f5915390253c73260b7bd374be5/goatfish/models.py#L76-L88 | ||
aiven/pghoard | 1de0d2e33bf087b7ce3b6af556bbf941acfac3a4 | pghoard/common.py | python | extract_pghoard_delta_v1_metadata | (fileobj) | return _extract_metadata(fileobj) | [] | def extract_pghoard_delta_v1_metadata(fileobj):
return _extract_metadata(fileobj) | [
"def",
"extract_pghoard_delta_v1_metadata",
"(",
"fileobj",
")",
":",
"return",
"_extract_metadata",
"(",
"fileobj",
")"
] | https://github.com/aiven/pghoard/blob/1de0d2e33bf087b7ce3b6af556bbf941acfac3a4/pghoard/common.py#L318-L319 | |||
freedombox/FreedomBox | 335a7f92cc08f27981f838a7cddfc67740598e54 | plinth/frontpage.py | python | Shortcut._list_for_user | (cls, username=None) | return shortcuts | Return menu items for a particular user or anonymous user. | Return menu items for a particular user or anonymous user. | [
"Return",
"menu",
"items",
"for",
"a",
"particular",
"user",
"or",
"anonymous",
"user",
"."
] | def _list_for_user(cls, username=None):
"""Return menu items for a particular user or anonymous user."""
if not username:
return cls._all_shortcuts
# XXX: Turn this into an API call in users module and cache
output = actions.superuser_run('users', ['get-user-groups', usernam... | [
"def",
"_list_for_user",
"(",
"cls",
",",
"username",
"=",
"None",
")",
":",
"if",
"not",
"username",
":",
"return",
"cls",
".",
"_all_shortcuts",
"# XXX: Turn this into an API call in users module and cache",
"output",
"=",
"actions",
".",
"superuser_run",
"(",
"'u... | https://github.com/freedombox/FreedomBox/blob/335a7f92cc08f27981f838a7cddfc67740598e54/plinth/frontpage.py#L107-L127 | |
google/timesketch | 1ce6b60e125d104e6644947c6f1dbe1b82ac76b6 | api_client/python/timesketch_api_client/search.py | python | Search.remove_chip | (self, chip_index) | Remove a chip from the saved search. | Remove a chip from the saved search. | [
"Remove",
"a",
"chip",
"from",
"the",
"saved",
"search",
"."
] | def remove_chip(self, chip_index):
"""Remove a chip from the saved search."""
chip_len = len(self._chips)
if chip_index > (chip_len + 1):
raise ValueError(
f'Unable to remove chip, only {chip_len} chips stored '
f'(no index {chip_index})')
try... | [
"def",
"remove_chip",
"(",
"self",
",",
"chip_index",
")",
":",
"chip_len",
"=",
"len",
"(",
"self",
".",
"_chips",
")",
"if",
"chip_index",
">",
"(",
"chip_len",
"+",
"1",
")",
":",
"raise",
"ValueError",
"(",
"f'Unable to remove chip, only {chip_len} chips s... | https://github.com/google/timesketch/blob/1ce6b60e125d104e6644947c6f1dbe1b82ac76b6/api_client/python/timesketch_api_client/search.py#L875-L889 | ||
cloudera/impyla | 0c736af4cad2bade9b8e313badc08ec50e81c948 | impala/_thrift_gen/hive_metastore/ThriftHiveMetastore.py | python | create_database_result.validate | (self) | return | [] | def validate(self):
return | [
"def",
"validate",
"(",
"self",
")",
":",
"return"
] | https://github.com/cloudera/impyla/blob/0c736af4cad2bade9b8e313badc08ec50e81c948/impala/_thrift_gen/hive_metastore/ThriftHiveMetastore.py#L11540-L11541 | |||
vim-scripts/UltiSnips | 5f88199e373a7eea4644b8dc1ff433688e8f2ebd | pythonx/UltiSnips/_vim.py | python | escape | (inp) | return conv(inp) | Creates a vim-friendly string from a group of
dicts, lists and strings. | Creates a vim-friendly string from a group of
dicts, lists and strings. | [
"Creates",
"a",
"vim",
"-",
"friendly",
"string",
"from",
"a",
"group",
"of",
"dicts",
"lists",
"and",
"strings",
"."
] | def escape(inp):
"""Creates a vim-friendly string from a group of
dicts, lists and strings."""
def conv(obj):
"""Convert obj."""
if isinstance(obj, list):
rv = as_unicode('[' + ','.join(conv(o) for o in obj) + ']')
elif isinstance(obj, dict):
rv = as_unicode('... | [
"def",
"escape",
"(",
"inp",
")",
":",
"def",
"conv",
"(",
"obj",
")",
":",
"\"\"\"Convert obj.\"\"\"",
"if",
"isinstance",
"(",
"obj",
",",
"list",
")",
":",
"rv",
"=",
"as_unicode",
"(",
"'['",
"+",
"','",
".",
"join",
"(",
"conv",
"(",
"o",
")",... | https://github.com/vim-scripts/UltiSnips/blob/5f88199e373a7eea4644b8dc1ff433688e8f2ebd/pythonx/UltiSnips/_vim.py#L93-L107 | |
home-assistant-libs/pytradfri | ef2614b0ccdf628abc3b9559dc00b95ec6e4bd72 | pytradfri/api/aiocoap_api.py | python | APIFactory._execute | (self, api_command, timeout) | return api_command.result | Execute the command. | Execute the command. | [
"Execute",
"the",
"command",
"."
] | async def _execute(self, api_command, timeout):
"""Execute the command."""
if api_command.observe:
await self._observe(api_command, timeout)
return None
method = api_command.method
data = api_command.data
parse_json = api_command.parse_json
url = ... | [
"async",
"def",
"_execute",
"(",
"self",
",",
"api_command",
",",
"timeout",
")",
":",
"if",
"api_command",
".",
"observe",
":",
"await",
"self",
".",
"_observe",
"(",
"api_command",
",",
"timeout",
")",
"return",
"None",
"method",
"=",
"api_command",
".",... | https://github.com/home-assistant-libs/pytradfri/blob/ef2614b0ccdf628abc3b9559dc00b95ec6e4bd72/pytradfri/api/aiocoap_api.py#L133-L177 | |
ztosec/hunter | 4ee5cca8dc5fc5d7e631e935517bd0f493c30a37 | SqlmapCelery/sqlmap/thirdparty/bottle/bottle.py | python | FileUpload.filename | (self) | return fname[:255] or 'empty' | Name of the file on the client file system, but normalized to ensure
file system compatibility. An empty filename is returned as 'empty'.
Only ASCII letters, digits, dashes, underscores and dots are
allowed in the final filename. Accents are removed, if possible.
Whitesp... | Name of the file on the client file system, but normalized to ensure
file system compatibility. An empty filename is returned as 'empty'. | [
"Name",
"of",
"the",
"file",
"on",
"the",
"client",
"file",
"system",
"but",
"normalized",
"to",
"ensure",
"file",
"system",
"compatibility",
".",
"An",
"empty",
"filename",
"is",
"returned",
"as",
"empty",
"."
] | def filename(self):
""" Name of the file on the client file system, but normalized to ensure
file system compatibility. An empty filename is returned as 'empty'.
Only ASCII letters, digits, dashes, underscores and dots are
allowed in the final filename. Accents are removed, ... | [
"def",
"filename",
"(",
"self",
")",
":",
"fname",
"=",
"self",
".",
"raw_filename",
"if",
"not",
"isinstance",
"(",
"fname",
",",
"unicode",
")",
":",
"fname",
"=",
"fname",
".",
"decode",
"(",
"'utf8'",
",",
"'ignore'",
")",
"fname",
"=",
"normalize"... | https://github.com/ztosec/hunter/blob/4ee5cca8dc5fc5d7e631e935517bd0f493c30a37/SqlmapCelery/sqlmap/thirdparty/bottle/bottle.py#L2468-L2485 | |
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/whoosh/src/whoosh/searching.py | python | Searcher.avg_field_length | (self, fieldname, default=None) | return self.field_length(fieldname) / (self._doccount or 1) | [] | def avg_field_length(self, fieldname, default=None):
if not self.schema[fieldname].scorable:
return default
return self.field_length(fieldname) / (self._doccount or 1) | [
"def",
"avg_field_length",
"(",
"self",
",",
"fieldname",
",",
"default",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"schema",
"[",
"fieldname",
"]",
".",
"scorable",
":",
"return",
"default",
"return",
"self",
".",
"field_length",
"(",
"fieldname",
... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/whoosh/src/whoosh/searching.py#L260-L263 | |||
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-python/3/idlelib/pyshell.py | python | PyShell.ispythonsource | (self, filename) | return True | Override EditorWindow method: never remove the colorizer | Override EditorWindow method: never remove the colorizer | [
"Override",
"EditorWindow",
"method",
":",
"never",
"remove",
"the",
"colorizer"
] | def ispythonsource(self, filename):
"Override EditorWindow method: never remove the colorizer"
return True | [
"def",
"ispythonsource",
"(",
"self",
",",
"filename",
")",
":",
"return",
"True"
] | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/idlelib/pyshell.py#L1034-L1036 | |
esrlabs/git-repo | 09f5180b06edb337b95c03af6a1f770646703a5d | project.py | python | Project._ExtractArchive | (self, tarpath, path=None) | return False | Extract the given tar on its current location
Args:
- tarpath: The path to the actual tar file | Extract the given tar on its current location | [
"Extract",
"the",
"given",
"tar",
"on",
"its",
"current",
"location"
] | def _ExtractArchive(self, tarpath, path=None):
"""Extract the given tar on its current location
Args:
- tarpath: The path to the actual tar file
"""
try:
with tarfile.open(tarpath, 'r') as tar:
tar.extractall(path=path)
return True
except (IOError, tarfile.TarError) a... | [
"def",
"_ExtractArchive",
"(",
"self",
",",
"tarpath",
",",
"path",
"=",
"None",
")",
":",
"try",
":",
"with",
"tarfile",
".",
"open",
"(",
"tarpath",
",",
"'r'",
")",
"as",
"tar",
":",
"tar",
".",
"extractall",
"(",
"path",
"=",
"path",
")",
"retu... | https://github.com/esrlabs/git-repo/blob/09f5180b06edb337b95c03af6a1f770646703a5d/project.py#L1176-L1189 | |
mcedit/mcedit2 | 4bb98da521447b6cf43d923cea9f00acf2f427e9 | src/mceditlib/worldeditor.py | python | WorldEditor.getWorldVersionInfo | (self) | return self.adapter.getWorldVersionInfo() | Returns a named tuple indicating the latest version of Minecraft that has played this world.
The named tuple will have the following fields:
format: The string "java" for Java Edition worlds.
id: The Minecraft build number. This is the definitive version number for this world file. Example vers... | Returns a named tuple indicating the latest version of Minecraft that has played this world.
The named tuple will have the following fields: | [
"Returns",
"a",
"named",
"tuple",
"indicating",
"the",
"latest",
"version",
"of",
"Minecraft",
"that",
"has",
"played",
"this",
"world",
".",
"The",
"named",
"tuple",
"will",
"have",
"the",
"following",
"fields",
":"
] | def getWorldVersionInfo(self):
""" Returns a named tuple indicating the latest version of Minecraft that has played this world.
The named tuple will have the following fields:
format: The string "java" for Java Edition worlds.
id: The Minecraft build number. This is the definitive versi... | [
"def",
"getWorldVersionInfo",
"(",
"self",
")",
":",
"return",
"self",
".",
"adapter",
".",
"getWorldVersionInfo",
"(",
")"
] | https://github.com/mcedit/mcedit2/blob/4bb98da521447b6cf43d923cea9f00acf2f427e9/src/mceditlib/worldeditor.py#L590-L605 | |
IntelAI/models | 1d7a53ccfad3e6f0e7378c9e3c8840895d63df8c | models/language_translation/tensorflow/transformer_mlperf/training/bfloat16/transformer/model/beam_search.py | python | _gather_beams | (nested, beam_indices, batch_size, new_beam_size) | return nest.map_structure(
lambda state: tf.gather_nd(state, coordinates), nested) | Gather beams from nested structure of tensors.
Each tensor in nested represents a batch of beams, where beam refers to a
single search state (beam search involves searching through multiple states
in parallel).
This function is used to gather the top beams, specified by
beam_indices, from the nested tensors... | Gather beams from nested structure of tensors. | [
"Gather",
"beams",
"from",
"nested",
"structure",
"of",
"tensors",
"."
] | def _gather_beams(nested, beam_indices, batch_size, new_beam_size):
"""Gather beams from nested structure of tensors.
Each tensor in nested represents a batch of beams, where beam refers to a
single search state (beam search involves searching through multiple states
in parallel).
This function is used to g... | [
"def",
"_gather_beams",
"(",
"nested",
",",
"beam_indices",
",",
"batch_size",
",",
"new_beam_size",
")",
":",
"# Computes the i'th coodinate that contains the batch index for gather_nd.",
"# Batch pos is a tensor like [[0,0,0,0,],[1,1,1,1],..].",
"batch_pos",
"=",
"tf",
".",
"ra... | https://github.com/IntelAI/models/blob/1d7a53ccfad3e6f0e7378c9e3c8840895d63df8c/models/language_translation/tensorflow/transformer_mlperf/training/bfloat16/transformer/model/beam_search.py#L502-L536 | |
meraki/dashboard-api-python | aef5e6fe5d23a40d435d5c64ff30580a28af07f1 | meraki/api/batch/wireless.py | python | ActionBatchWireless.createNetworkWirelessSsidIdentityPsk | (self, networkId: str, number: str, name: str, groupPolicyId: str, **kwargs) | return action | **Create an Identity PSK**
https://developer.cisco.com/meraki/api-v1/#!create-network-wireless-ssid-identity-psk
- networkId (string): (required)
- number (string): (required)
- name (string): The name of the Identity PSK
- groupPolicyId (string): The group policy to be applied ... | **Create an Identity PSK**
https://developer.cisco.com/meraki/api-v1/#!create-network-wireless-ssid-identity-psk | [
"**",
"Create",
"an",
"Identity",
"PSK",
"**",
"https",
":",
"//",
"developer",
".",
"cisco",
".",
"com",
"/",
"meraki",
"/",
"api",
"-",
"v1",
"/",
"#!create",
"-",
"network",
"-",
"wireless",
"-",
"ssid",
"-",
"identity",
"-",
"psk"
] | def createNetworkWirelessSsidIdentityPsk(self, networkId: str, number: str, name: str, groupPolicyId: str, **kwargs):
"""
**Create an Identity PSK**
https://developer.cisco.com/meraki/api-v1/#!create-network-wireless-ssid-identity-psk
- networkId (string): (required)
- number (s... | [
"def",
"createNetworkWirelessSsidIdentityPsk",
"(",
"self",
",",
"networkId",
":",
"str",
",",
"number",
":",
"str",
",",
"name",
":",
"str",
",",
"groupPolicyId",
":",
"str",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
".",
"update",
"(",
"locals",
"("... | https://github.com/meraki/dashboard-api-python/blob/aef5e6fe5d23a40d435d5c64ff30580a28af07f1/meraki/api/batch/wireless.py#L580-L607 | |
TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials | 5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e | tensorflow_dl_models/research/inception/inception/slim/variables.py | python | get_variables_to_restore | () | return tf.get_collection(VARIABLES_TO_RESTORE)[:] | Gets the list of variables to restore.
Returns:
a copied list of variables. | Gets the list of variables to restore. | [
"Gets",
"the",
"list",
"of",
"variables",
"to",
"restore",
"."
] | def get_variables_to_restore():
"""Gets the list of variables to restore.
Returns:
a copied list of variables.
"""
return tf.get_collection(VARIABLES_TO_RESTORE)[:] | [
"def",
"get_variables_to_restore",
"(",
")",
":",
"return",
"tf",
".",
"get_collection",
"(",
"VARIABLES_TO_RESTORE",
")",
"[",
":",
"]"
] | https://github.com/TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials/blob/5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e/tensorflow_dl_models/research/inception/inception/slim/variables.py#L130-L136 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/networkx/algorithms/bipartite/projection.py | python | generic_weighted_projected_graph | (B, nodes, weight_function=None) | return G | r"""Weighted projection of B with a user-specified weight function.
The bipartite network B is projected on to the specified nodes
with weights computed by a user-specified function. This function
must accept as a parameter the neighborhood sets of two nodes and
return an integer or a float.
The ... | r"""Weighted projection of B with a user-specified weight function. | [
"r",
"Weighted",
"projection",
"of",
"B",
"with",
"a",
"user",
"-",
"specified",
"weight",
"function",
"."
] | def generic_weighted_projected_graph(B, nodes, weight_function=None):
r"""Weighted projection of B with a user-specified weight function.
The bipartite network B is projected on to the specified nodes
with weights computed by a user-specified function. This function
must accept as a parameter the neig... | [
"def",
"generic_weighted_projected_graph",
"(",
"B",
",",
"nodes",
",",
"weight_function",
"=",
"None",
")",
":",
"if",
"B",
".",
"is_directed",
"(",
")",
":",
"pred",
"=",
"B",
".",
"pred",
"G",
"=",
"nx",
".",
"DiGraph",
"(",
")",
"else",
":",
"pre... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/networkx/algorithms/bipartite/projection.py#L408-L513 | |
cobbler/cobbler | eed8cdca3e970c8aa1d199e80b8c8f19b3f940cc | cobbler/remote.py | python | CobblerXMLRPCInterface.run_install_triggers | (self, mode, objtype, name, ip, token=None, **rest) | return True | This is a feature used to run the pre/post install triggers.
See CobblerTriggers on Wiki for details
:param mode: The mode of the triggers. May be "pre", "post" or "firstboot".
:param objtype: The type of object. This should correspond to the collection type.
:param name: The name of th... | This is a feature used to run the pre/post install triggers.
See CobblerTriggers on Wiki for details | [
"This",
"is",
"a",
"feature",
"used",
"to",
"run",
"the",
"pre",
"/",
"post",
"install",
"triggers",
".",
"See",
"CobblerTriggers",
"on",
"Wiki",
"for",
"details"
] | def run_install_triggers(self, mode, objtype, name, ip, token=None, **rest):
"""
This is a feature used to run the pre/post install triggers.
See CobblerTriggers on Wiki for details
:param mode: The mode of the triggers. May be "pre", "post" or "firstboot".
:param objtype: The t... | [
"def",
"run_install_triggers",
"(",
"self",
",",
"mode",
",",
"objtype",
",",
"name",
",",
"ip",
",",
"token",
"=",
"None",
",",
"*",
"*",
"rest",
")",
":",
"self",
".",
"_log",
"(",
"\"run_install_triggers\"",
",",
"token",
"=",
"token",
")",
"if",
... | https://github.com/cobbler/cobbler/blob/eed8cdca3e970c8aa1d199e80b8c8f19b3f940cc/cobbler/remote.py#L2787-L2812 | |
robotlearn/pyrobolearn | 9cd7c060723fda7d2779fa255ac998c2c82b8436 | pyrobolearn/physics/link_physics_randomizer.py | python | LinkPhysicsRandomizer.local_inertia_diagonals | (self) | return [self.simulator.get_dynamics_info(body_id=self.body.id, link_id=link)[2] for link in self.links] | Return the local inertial diagonal of each specified link. | Return the local inertial diagonal of each specified link. | [
"Return",
"the",
"local",
"inertial",
"diagonal",
"of",
"each",
"specified",
"link",
"."
] | def local_inertia_diagonals(self):
"""Return the local inertial diagonal of each specified link."""
return [self.simulator.get_dynamics_info(body_id=self.body.id, link_id=link)[2] for link in self.links] | [
"def",
"local_inertia_diagonals",
"(",
"self",
")",
":",
"return",
"[",
"self",
".",
"simulator",
".",
"get_dynamics_info",
"(",
"body_id",
"=",
"self",
".",
"body",
".",
"id",
",",
"link_id",
"=",
"link",
")",
"[",
"2",
"]",
"for",
"link",
"in",
"self... | https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/physics/link_physics_randomizer.py#L139-L141 | |
huawei-noah/vega | d9f13deede7f2b584e4b1d32ffdb833856129989 | vega/algorithms/hpo/sha_base/boss.py | python | BOSS.best_config | (self) | Get current best score config.
:return: dict
{'config_id': int,
'score': float,
'configs': dict}
config_id, score, and configs of the current best config. | Get current best score config. | [
"Get",
"current",
"best",
"score",
"config",
"."
] | def best_config(self):
"""Get current best score config.
:return: dict
{'config_id': int,
'score': float,
'configs': dict}
config_id, score, and configs of the current best config.
"""
if self.total_propose == 0:
idx =... | [
"def",
"best_config",
"(",
"self",
")",
":",
"if",
"self",
".",
"total_propose",
"==",
"0",
":",
"idx",
"=",
"random",
".",
"randint",
"(",
"0",
",",
"len",
"(",
"self",
".",
"hyperparameter_list",
")",
")",
"result",
"=",
"{",
"'config_id'",
":",
"i... | https://github.com/huawei-noah/vega/blob/d9f13deede7f2b584e4b1d32ffdb833856129989/vega/algorithms/hpo/sha_base/boss.py#L203-L221 | ||
aspiers/git-deps | 5dd7f4c4b6d4d771c5b6866b8256eb1bad632843 | git_deps/detector.py | python | DependencyDetector.branch_contains | (self, commit, branch) | return result | [] | def branch_contains(self, commit, branch):
sha1 = commit.hex
branch_commit = self.get_commit(branch)
branch_sha1 = branch_commit.hex
self.logger.debug(" Does %s (%s) contain %s?" %
(branch, branch_sha1[:8], sha1[:8]))
if sha1 not in self.branch... | [
"def",
"branch_contains",
"(",
"self",
",",
"commit",
",",
"branch",
")",
":",
"sha1",
"=",
"commit",
".",
"hex",
"branch_commit",
"=",
"self",
".",
"get_commit",
"(",
"branch",
")",
"branch_sha1",
"=",
"branch_commit",
".",
"hex",
"self",
".",
"logger",
... | https://github.com/aspiers/git-deps/blob/5dd7f4c4b6d4d771c5b6866b8256eb1bad632843/git_deps/detector.py#L308-L329 | |||
josiahcarlson/rom | c35aa66a623c356324c3691da8a0bc7687c6f48b | rom/model.py | python | Model.get_by | (cls, **kwargs) | This method offers a simple query method for fetching entities of this
type via attribute numeric ranges (such columns must be ``indexed``),
or via ``unique`` columns.
Some examples::
user = User.get_by(email_address='user@domain.com')
# gets up to 25 users created in t... | This method offers a simple query method for fetching entities of this
type via attribute numeric ranges (such columns must be ``indexed``),
or via ``unique`` columns. | [
"This",
"method",
"offers",
"a",
"simple",
"query",
"method",
"for",
"fetching",
"entities",
"of",
"this",
"type",
"via",
"attribute",
"numeric",
"ranges",
"(",
"such",
"columns",
"must",
"be",
"indexed",
")",
"or",
"via",
"unique",
"columns",
"."
] | def get_by(cls, **kwargs):
'''
This method offers a simple query method for fetching entities of this
type via attribute numeric ranges (such columns must be ``indexed``),
or via ``unique`` columns.
Some examples::
user = User.get_by(email_address='user@domain.com')... | [
"def",
"get_by",
"(",
"cls",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"_connect",
"(",
"cls",
")",
"model",
"=",
"cls",
".",
"_namespace",
"# handle limits and query requirements",
"_limit",
"=",
"kwargs",
".",
"pop",
"(",
"'_limit'",
",",
"(",
")... | https://github.com/josiahcarlson/rom/blob/c35aa66a623c356324c3691da8a0bc7687c6f48b/rom/model.py#L583-L670 | ||
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Lib/site-packages/numpy-1.10.0.dev0_046311a-py3.3-win-amd64.egg/numpy/lib/financial.py | python | mirr | (values, finance_rate, reinvest_rate) | return (numer/denom)**(1.0/(n - 1))*(1 + reinvest_rate) - 1 | Modified internal rate of return.
Parameters
----------
values : array_like
Cash flows (must contain at least one positive and one negative
value) or nan is returned. The first value is considered a sunk
cost at time zero.
finance_rate : scalar
Interest rate paid on the... | Modified internal rate of return. | [
"Modified",
"internal",
"rate",
"of",
"return",
"."
] | def mirr(values, finance_rate, reinvest_rate):
"""
Modified internal rate of return.
Parameters
----------
values : array_like
Cash flows (must contain at least one positive and one negative
value) or nan is returned. The first value is considered a sunk
cost at time zero.
... | [
"def",
"mirr",
"(",
"values",
",",
"finance_rate",
",",
"reinvest_rate",
")",
":",
"values",
"=",
"np",
".",
"asarray",
"(",
"values",
",",
"dtype",
"=",
"np",
".",
"double",
")",
"n",
"=",
"values",
".",
"size",
"pos",
"=",
"values",
">",
"0",
"ne... | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/numpy-1.10.0.dev0_046311a-py3.3-win-amd64.egg/numpy/lib/financial.py#L708-L737 | |
entropy1337/infernal-twin | 10995cd03312e39a48ade0f114ebb0ae3a711bb8 | Modules/build/pillow/PIL/ImageChops.py | python | invert | (image) | return image._new(image.im.chop_invert()) | Invert an image (channel).
.. code-block:: python
out = MAX - image
:rtype: :py:class:`~PIL.Image.Image` | Invert an image (channel). | [
"Invert",
"an",
"image",
"(",
"channel",
")",
"."
] | def invert(image):
"""
Invert an image (channel).
.. code-block:: python
out = MAX - image
:rtype: :py:class:`~PIL.Image.Image`
"""
image.load()
return image._new(image.im.chop_invert()) | [
"def",
"invert",
"(",
"image",
")",
":",
"image",
".",
"load",
"(",
")",
"return",
"image",
".",
"_new",
"(",
"image",
".",
"im",
".",
"chop_invert",
"(",
")",
")"
] | https://github.com/entropy1337/infernal-twin/blob/10995cd03312e39a48ade0f114ebb0ae3a711bb8/Modules/build/pillow/PIL/ImageChops.py#L39-L51 | |
mesalock-linux/mesapy | ed546d59a21b36feb93e2309d5c6b75aa0ad95c9 | pypy/module/cpyext/memoryobject.py | python | memory_realize | (space, obj) | return w_obj | Creates the memory object in the interpreter | Creates the memory object in the interpreter | [
"Creates",
"the",
"memory",
"object",
"in",
"the",
"interpreter"
] | def memory_realize(space, obj):
"""
Creates the memory object in the interpreter
"""
py_mem = rffi.cast(PyMemoryViewObject, obj)
view = py_mem.c_view
ndim = widen(view.c_ndim)
shape = None
if view.c_shape:
shape = [view.c_shape[i] for i in range(ndim)]
strides = None
if v... | [
"def",
"memory_realize",
"(",
"space",
",",
"obj",
")",
":",
"py_mem",
"=",
"rffi",
".",
"cast",
"(",
"PyMemoryViewObject",
",",
"obj",
")",
"view",
"=",
"py_mem",
".",
"c_view",
"ndim",
"=",
"widen",
"(",
"view",
".",
"c_ndim",
")",
"shape",
"=",
"N... | https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/pypy/module/cpyext/memoryobject.py#L53-L80 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/helpers/script.py | python | _ScriptRun._async_delay_step | (self) | Handle delay. | Handle delay. | [
"Handle",
"delay",
"."
] | async def _async_delay_step(self):
"""Handle delay."""
delay = self._get_pos_time_period_template(CONF_DELAY)
self._step_log(f"delay {delay}")
delay = delay.total_seconds()
self._changed()
trace_set_result(delay=delay, done=False)
try:
async with asy... | [
"async",
"def",
"_async_delay_step",
"(",
"self",
")",
":",
"delay",
"=",
"self",
".",
"_get_pos_time_period_template",
"(",
"CONF_DELAY",
")",
"self",
".",
"_step_log",
"(",
"f\"delay {delay}\"",
")",
"delay",
"=",
"delay",
".",
"total_seconds",
"(",
")",
"se... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/helpers/script.py#L441-L454 | ||
nipy/nibabel | 4703f4d8e32be4cec30e829c2d93ebe54759bb62 | nibabel/cifti2/cifti2_axes.py | python | BrainModelAxis.get_element | (self, index) | return element_type, struct[index], self.name[index] | Describes a single element from the axis
Parameters
----------
index : int
Indexes the row/column of interest
Returns
-------
tuple with 3 elements
- str, 'CIFTI_MODEL_TYPE_SURFACE' for vertex or 'CIFTI_MODEL_TYPE_VOXELS' for voxel
- vertex i... | Describes a single element from the axis | [
"Describes",
"a",
"single",
"element",
"from",
"the",
"axis"
] | def get_element(self, index):
"""
Describes a single element from the axis
Parameters
----------
index : int
Indexes the row/column of interest
Returns
-------
tuple with 3 elements
- str, 'CIFTI_MODEL_TYPE_SURFACE' for vertex or 'CIF... | [
"def",
"get_element",
"(",
"self",
",",
"index",
")",
":",
"element_type",
"=",
"'CIFTI_MODEL_TYPE_'",
"+",
"(",
"'SURFACE'",
"if",
"self",
".",
"name",
"[",
"index",
"]",
"in",
"self",
".",
"nvertices",
".",
"keys",
"(",
")",
"else",
"'VOXELS'",
")",
... | https://github.com/nipy/nibabel/blob/4703f4d8e32be4cec30e829c2d93ebe54759bb62/nibabel/cifti2/cifti2_axes.py#L687-L707 | |
pik-copan/pyunicorn | b18316fc08ef34b434a1a4d69dfe3e57e24435ee | pyunicorn/timeseries/inter_system_recurrence_network.py | python | InterSystemRecurrenceNetwork.cross_global_clustering_yx | (self) | return self.cross_global_clustering(np.arange(self.N_x, self.N),
np.arange(self.N_x)) | Return cross global clustering of y with respect to x.
See [Feldhoff2012]_ for definition, further explanation and
applications.
:rtype: number (float)
:return: the cross global clustering of y with respect to x. | Return cross global clustering of y with respect to x. | [
"Return",
"cross",
"global",
"clustering",
"of",
"y",
"with",
"respect",
"to",
"x",
"."
] | def cross_global_clustering_yx(self):
"""
Return cross global clustering of y with respect to x.
See [Feldhoff2012]_ for definition, further explanation and
applications.
:rtype: number (float)
:return: the cross global clustering of y with respect to x.
"""
... | [
"def",
"cross_global_clustering_yx",
"(",
"self",
")",
":",
"return",
"self",
".",
"cross_global_clustering",
"(",
"np",
".",
"arange",
"(",
"self",
".",
"N_x",
",",
"self",
".",
"N",
")",
",",
"np",
".",
"arange",
"(",
"self",
".",
"N_x",
")",
")"
] | https://github.com/pik-copan/pyunicorn/blob/b18316fc08ef34b434a1a4d69dfe3e57e24435ee/pyunicorn/timeseries/inter_system_recurrence_network.py#L360-L371 | |
WeblateOrg/weblate | 8126f3dda9d24f2846b755955132a8b8410866c8 | weblate/auth/utils.py | python | migrate_groups | (model, role_model, update=False) | Create groups as defined in the data. | Create groups as defined in the data. | [
"Create",
"groups",
"as",
"defined",
"in",
"the",
"data",
"."
] | def migrate_groups(model, role_model, update=False):
"""Create groups as defined in the data."""
for group, roles, selection in GROUPS:
defaults = {
"internal": True,
"project_selection": selection,
"language_selection": SELECTION_ALL,
}
instance, crea... | [
"def",
"migrate_groups",
"(",
"model",
",",
"role_model",
",",
"update",
"=",
"False",
")",
":",
"for",
"group",
",",
"roles",
",",
"selection",
"in",
"GROUPS",
":",
"defaults",
"=",
"{",
"\"internal\"",
":",
"True",
",",
"\"project_selection\"",
":",
"sel... | https://github.com/WeblateOrg/weblate/blob/8126f3dda9d24f2846b755955132a8b8410866c8/weblate/auth/utils.py#L83-L97 | ||
PowerScript/KatanaFramework | 0f6ad90a88de865d58ec26941cb4460501e75496 | lib/future/src/future/backports/xmlrpc/server.py | python | DocCGIXMLRPCRequestHandler.handle_get | (self) | Handles the HTTP GET request.
Interpret all HTTP GET requests as requests for server
documentation. | Handles the HTTP GET request. | [
"Handles",
"the",
"HTTP",
"GET",
"request",
"."
] | def handle_get(self):
"""Handles the HTTP GET request.
Interpret all HTTP GET requests as requests for server
documentation.
"""
response = self.generate_html_documentation().encode('utf-8')
print('Content-Type: text/html')
print('Content-Length: %d' % len(resp... | [
"def",
"handle_get",
"(",
"self",
")",
":",
"response",
"=",
"self",
".",
"generate_html_documentation",
"(",
")",
".",
"encode",
"(",
"'utf-8'",
")",
"print",
"(",
"'Content-Type: text/html'",
")",
"print",
"(",
"'Content-Length: %d'",
"%",
"len",
"(",
"respo... | https://github.com/PowerScript/KatanaFramework/blob/0f6ad90a88de865d58ec26941cb4460501e75496/lib/future/src/future/backports/xmlrpc/server.py#L954-L968 | ||
mdiazcl/fuzzbunch-debian | 2b76c2249ade83a389ae3badb12a1bd09901fd2c | windows/Resources/Python/Core/Lib/decimal.py | python | Decimal.adjusted | (self) | Return the adjusted exponent of self | Return the adjusted exponent of self | [
"Return",
"the",
"adjusted",
"exponent",
"of",
"self"
] | def adjusted(self):
"""Return the adjusted exponent of self"""
try:
return self._exp + len(self._int) - 1
except TypeError:
return 0 | [
"def",
"adjusted",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"_exp",
"+",
"len",
"(",
"self",
".",
"_int",
")",
"-",
"1",
"except",
"TypeError",
":",
"return",
"0"
] | https://github.com/mdiazcl/fuzzbunch-debian/blob/2b76c2249ade83a389ae3badb12a1bd09901fd2c/windows/Resources/Python/Core/Lib/decimal.py#L2213-L2218 | ||
gvalkov/python-evdev | 5adc2abf1ec8a02c05c80cb1b3e34ba1d4237803 | evdev/events.py | python | KeyEvent.__init__ | (self, event, allow_unknown=False) | The ``allow_unknown`` argument determines what to do in the event of a event code
for which a key code cannot be found. If ``False`` a ``KeyError`` will be raised.
If ``True`` the keycode will be set to the hex value of the event code. | The ``allow_unknown`` argument determines what to do in the event of a event code
for which a key code cannot be found. If ``False`` a ``KeyError`` will be raised.
If ``True`` the keycode will be set to the hex value of the event code. | [
"The",
"allow_unknown",
"argument",
"determines",
"what",
"to",
"do",
"in",
"the",
"event",
"of",
"a",
"event",
"code",
"for",
"which",
"a",
"key",
"code",
"cannot",
"be",
"found",
".",
"If",
"False",
"a",
"KeyError",
"will",
"be",
"raised",
".",
"If",
... | def __init__(self, event, allow_unknown=False):
'''
The ``allow_unknown`` argument determines what to do in the event of a event code
for which a key code cannot be found. If ``False`` a ``KeyError`` will be raised.
If ``True`` the keycode will be set to the hex value of the event code.
... | [
"def",
"__init__",
"(",
"self",
",",
"event",
",",
"allow_unknown",
"=",
"False",
")",
":",
"self",
".",
"scancode",
"=",
"event",
".",
"code",
"if",
"event",
".",
"value",
"==",
"0",
":",
"self",
".",
"keystate",
"=",
"KeyEvent",
".",
"key_up",
"eli... | https://github.com/gvalkov/python-evdev/blob/5adc2abf1ec8a02c05c80cb1b3e34ba1d4237803/evdev/events.py#L89-L114 | ||
SheffieldML/GPy | bb1bc5088671f9316bc92a46d356734e34c2d5c0 | GPy/models/gp_regression.py | python | GPRegression.__init__ | (self, X, Y, kernel=None, Y_metadata=None, normalizer=None, noise_var=1., mean_function=None) | [] | def __init__(self, X, Y, kernel=None, Y_metadata=None, normalizer=None, noise_var=1., mean_function=None):
if kernel is None:
kernel = kern.RBF(X.shape[1])
likelihood = likelihoods.Gaussian(variance=noise_var)
super(GPRegression, self).__init__(X, Y, kernel, likelihood, name='GP r... | [
"def",
"__init__",
"(",
"self",
",",
"X",
",",
"Y",
",",
"kernel",
"=",
"None",
",",
"Y_metadata",
"=",
"None",
",",
"normalizer",
"=",
"None",
",",
"noise_var",
"=",
"1.",
",",
"mean_function",
"=",
"None",
")",
":",
"if",
"kernel",
"is",
"None",
... | https://github.com/SheffieldML/GPy/blob/bb1bc5088671f9316bc92a46d356734e34c2d5c0/GPy/models/gp_regression.py#L29-L36 | ||||
vlachoudis/bCNC | 67126b4894dabf6579baf47af8d0f9b7de35e6e3 | bCNC/lib/bpath.py | python | Path.fromDxf | (self, dxf, layer, units=0) | [] | def fromDxf(self, dxf, layer, units=0):
for entity in layer:
self.color = entity.color()
A = dxf.convert(entity.start(), units)
B = dxf.convert(entity.end(), units)
if entity.type == "LINE":
if not eq(A,B):
self.append(Segment(Segment.LINE, A, B))
elif entity.type == "CIRCLE":
center = ... | [
"def",
"fromDxf",
"(",
"self",
",",
"dxf",
",",
"layer",
",",
"units",
"=",
"0",
")",
":",
"for",
"entity",
"in",
"layer",
":",
"self",
".",
"color",
"=",
"entity",
".",
"color",
"(",
")",
"A",
"=",
"dxf",
".",
"convert",
"(",
"entity",
".",
"s... | https://github.com/vlachoudis/bCNC/blob/67126b4894dabf6579baf47af8d0f9b7de35e6e3/bCNC/lib/bpath.py#L1811-L1883 | ||||
apache/tvm | 6eb4ed813ebcdcd9558f0906a1870db8302ff1e0 | python/tvm/relay/dataflow_pattern/__init__.py | python | is_tuple | (fields: tvm.ir.container.Array) | return TuplePattern(fields) | Syntatic sugar for creating an ExprPattern.
Parameters
----------
fields : Array[tvm.relay.dataflow_pattern.DFPattern]
The fields in the tuple.
Returns
-------
result: tvm.relay.dataflow_pattern.DFPattern
The resulting pattern. | Syntatic sugar for creating an ExprPattern. | [
"Syntatic",
"sugar",
"for",
"creating",
"an",
"ExprPattern",
"."
] | def is_tuple(fields: tvm.ir.container.Array) -> "DFPattern":
"""
Syntatic sugar for creating an ExprPattern.
Parameters
----------
fields : Array[tvm.relay.dataflow_pattern.DFPattern]
The fields in the tuple.
Returns
-------
result: tvm.relay.dataflow_pattern.DFPattern
... | [
"def",
"is_tuple",
"(",
"fields",
":",
"tvm",
".",
"ir",
".",
"container",
".",
"Array",
")",
"->",
"\"DFPattern\"",
":",
"return",
"TuplePattern",
"(",
"fields",
")"
] | https://github.com/apache/tvm/blob/6eb4ed813ebcdcd9558f0906a1870db8302ff1e0/python/tvm/relay/dataflow_pattern/__init__.py#L283-L297 | |
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/Xenotix Python Scripting Engine/bin/x86/Debug/Lib/distutils/command/config.py | python | config.check_func | (self, func, headers=None, include_dirs=None,
libraries=None, library_dirs=None, decl=0, call=0) | return self.try_link(body, headers, include_dirs,
libraries, library_dirs) | Determine if function 'func' is available by constructing a
source file that refers to 'func', and compiles and links it.
If everything succeeds, returns true; otherwise returns false.
The constructed source file starts out by including the header
files listed in 'headers'. If 'decl' i... | Determine if function 'func' is available by constructing a
source file that refers to 'func', and compiles and links it.
If everything succeeds, returns true; otherwise returns false. | [
"Determine",
"if",
"function",
"func",
"is",
"available",
"by",
"constructing",
"a",
"source",
"file",
"that",
"refers",
"to",
"func",
"and",
"compiles",
"and",
"links",
"it",
".",
"If",
"everything",
"succeeds",
"returns",
"true",
";",
"otherwise",
"returns",... | def check_func(self, func, headers=None, include_dirs=None,
libraries=None, library_dirs=None, decl=0, call=0):
"""Determine if function 'func' is available by constructing a
source file that refers to 'func', and compiles and links it.
If everything succeeds, returns true; o... | [
"def",
"check_func",
"(",
"self",
",",
"func",
",",
"headers",
"=",
"None",
",",
"include_dirs",
"=",
"None",
",",
"libraries",
"=",
"None",
",",
"library_dirs",
"=",
"None",
",",
"decl",
"=",
"0",
",",
"call",
"=",
"0",
")",
":",
"self",
".",
"_ch... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/bin/x86/Debug/Lib/distutils/command/config.py#L285-L315 | |
rockingdingo/deepnlp | dac9793217e513ec19f1bbcc1c119b0b7bbdb883 | deepnlp/ner/models/freeze_graph.py | python | _parse_input_saver_proto | (input_saver, input_binary) | return saver_def | Parser input tensorflow Saver into SaverDef proto. | Parser input tensorflow Saver into SaverDef proto. | [
"Parser",
"input",
"tensorflow",
"Saver",
"into",
"SaverDef",
"proto",
"."
] | def _parse_input_saver_proto(input_saver, input_binary):
"""Parser input tensorflow Saver into SaverDef proto."""
if not gfile.Exists(input_saver):
print("Input saver file '" + input_saver + "' does not exist!")
return -1
mode = "rb" if input_binary else "r"
with gfile.FastGFile(input_saver, mode) as f:... | [
"def",
"_parse_input_saver_proto",
"(",
"input_saver",
",",
"input_binary",
")",
":",
"if",
"not",
"gfile",
".",
"Exists",
"(",
"input_saver",
")",
":",
"print",
"(",
"\"Input saver file '\"",
"+",
"input_saver",
"+",
"\"' does not exist!\"",
")",
"return",
"-",
... | https://github.com/rockingdingo/deepnlp/blob/dac9793217e513ec19f1bbcc1c119b0b7bbdb883/deepnlp/ner/models/freeze_graph.py#L138-L150 | |
yt-project/yt | dc7b24f9b266703db4c843e329c6c8644d47b824 | yt/frontends/chombo/data_structures.py | python | ChomboHierarchy._setup_derived_fields | (self) | [] | def _setup_derived_fields(self):
self.derived_field_list = [] | [
"def",
"_setup_derived_fields",
"(",
"self",
")",
":",
"self",
".",
"derived_field_list",
"=",
"[",
"]"
] | https://github.com/yt-project/yt/blob/dc7b24f9b266703db4c843e329c6c8644d47b824/yt/frontends/chombo/data_structures.py#L216-L217 | ||||
IronLanguages/ironpython3 | 7a7bb2a872eeab0d1009fc8a6e24dca43f65b693 | Src/StdLib/Lib/email/headerregistry.py | python | BaseHeader.name | (self) | return self._name | [] | def name(self):
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/email/headerregistry.py#L209-L210 | |||
nkolot/SPIN | 5c796852ca7ca7373e104e8489aa5864323fbf84 | utils/renderer.py | python | Renderer.__call__ | (self, vertices, camera_translation, image) | return output_img | [] | def __call__(self, vertices, camera_translation, image):
material = pyrender.MetallicRoughnessMaterial(
metallicFactor=0.2,
alphaMode='OPAQUE',
baseColorFactor=(0.8, 0.3, 0.3, 1.0))
camera_translation[0] *= -1.
mesh = trimesh.Trimesh(vertices, self.faces)
... | [
"def",
"__call__",
"(",
"self",
",",
"vertices",
",",
"camera_translation",
",",
"image",
")",
":",
"material",
"=",
"pyrender",
".",
"MetallicRoughnessMaterial",
"(",
"metallicFactor",
"=",
"0.2",
",",
"alphaMode",
"=",
"'OPAQUE'",
",",
"baseColorFactor",
"=",
... | https://github.com/nkolot/SPIN/blob/5c796852ca7ca7373e104e8489aa5864323fbf84/utils/renderer.py#L35-L76 | |||
chenguanyou/weixin_YiQi | ad86ed8061f4f5fa88b6600a9b0809e5bb3bfd08 | backend/Yiqi/Yiqi/utils/weixin_util/weixin/lib/WXBizMsgCrypt.py | python | Prpcrypt.encrypt | (self, text, appid) | 对明文进行加密
@param text: 需要加密的明文
@return: 加密得到的字符串 | 对明文进行加密 | [
"对明文进行加密"
] | def encrypt(self, text, appid):
"""对明文进行加密
@param text: 需要加密的明文
@return: 加密得到的字符串
"""
# 16位随机字符串添加到明文开头
pack_str = struct.pack(b"I", socket.htonl(len(text)))
text = smart_bytes(self.get_random_str()) + pack_str + smart_bytes(text) + smart_bytes(appid)
# 使用... | [
"def",
"encrypt",
"(",
"self",
",",
"text",
",",
"appid",
")",
":",
"# 16位随机字符串添加到明文开头",
"pack_str",
"=",
"struct",
".",
"pack",
"(",
"b\"I\"",
",",
"socket",
".",
"htonl",
"(",
"len",
"(",
"text",
")",
")",
")",
"text",
"=",
"smart_bytes",
"(",
"sel... | https://github.com/chenguanyou/weixin_YiQi/blob/ad86ed8061f4f5fa88b6600a9b0809e5bb3bfd08/backend/Yiqi/Yiqi/utils/weixin_util/weixin/lib/WXBizMsgCrypt.py#L141-L159 | ||
EmuKit/emukit | cdcb0d070d7f1c5585260266160722b636786859 | emukit/examples/multi_fidelity_dgp/multi_fidelity_deep_gp.py | python | MultiFidelityDeepGP._make_inducing_points | (X: List, Y: List) | return Z | Makes inducing points at every other training point location which is deafult behaviour if no inducing point
locations are passed
:param X: training locations
:param Y: training targets
:return: List of numpy arrays containing inducing point locations | Makes inducing points at every other training point location which is deafult behaviour if no inducing point
locations are passed | [
"Makes",
"inducing",
"points",
"at",
"every",
"other",
"training",
"point",
"location",
"which",
"is",
"deafult",
"behaviour",
"if",
"no",
"inducing",
"point",
"locations",
"are",
"passed"
] | def _make_inducing_points(X: List, Y: List) -> List:
"""
Makes inducing points at every other training point location which is deafult behaviour if no inducing point
locations are passed
:param X: training locations
:param Y: training targets
:return: List of numpy array... | [
"def",
"_make_inducing_points",
"(",
"X",
":",
"List",
",",
"Y",
":",
"List",
")",
"->",
"List",
":",
"Z",
"=",
"[",
"X",
"[",
"0",
"]",
".",
"copy",
"(",
")",
"]",
"for",
"x",
",",
"y",
"in",
"zip",
"(",
"X",
"[",
":",
"-",
"1",
"]",
","... | https://github.com/EmuKit/emukit/blob/cdcb0d070d7f1c5585260266160722b636786859/emukit/examples/multi_fidelity_dgp/multi_fidelity_deep_gp.py#L452-L464 | |
geomet/geomet | f7cfaa350cde44a16db21d2678ef5d245e7afda5 | geomet/util.py | python | as_bin_str | (a_list) | [] | def as_bin_str(a_list):
if six.PY2:
return b''.join(a_list)
else:
return bytes(a_list) | [
"def",
"as_bin_str",
"(",
"a_list",
")",
":",
"if",
"six",
".",
"PY2",
":",
"return",
"b''",
".",
"join",
"(",
"a_list",
")",
"else",
":",
"return",
"bytes",
"(",
"a_list",
")"
] | https://github.com/geomet/geomet/blob/f7cfaa350cde44a16db21d2678ef5d245e7afda5/geomet/util.py#L73-L77 | ||||
freelawproject/courtlistener | ab3ae7bb6e5e836b286749113e7dbb403d470912 | cl/simple_pages/views.py | python | about | (request: HttpRequest) | return render(request, "about.html", {"private": False}) | Loads the about page | Loads the about page | [
"Loads",
"the",
"about",
"page"
] | def about(request: HttpRequest) -> HttpResponse:
"""Loads the about page"""
return render(request, "about.html", {"private": False}) | [
"def",
"about",
"(",
"request",
":",
"HttpRequest",
")",
"->",
"HttpResponse",
":",
"return",
"render",
"(",
"request",
",",
"\"about.html\"",
",",
"{",
"\"private\"",
":",
"False",
"}",
")"
] | https://github.com/freelawproject/courtlistener/blob/ab3ae7bb6e5e836b286749113e7dbb403d470912/cl/simple_pages/views.py#L42-L44 | |
ritchie46/anaStruct | cfd9dff89834ea85ed07d2e4877deecbdc4d0403 | anastruct/fem/elements.py | python | Element.hinges | (self) | return out | Node ids of hinges on element | Node ids of hinges on element | [
"Node",
"ids",
"of",
"hinges",
"on",
"element"
] | def hinges(self) -> List[int]:
"""
Node ids of hinges on element
"""
out = []
assert self.springs is not None
for k, v in self.springs.items():
if v == 0:
if k == 1:
out.append(self.node_id1)
if k == 2:
... | [
"def",
"hinges",
"(",
"self",
")",
"->",
"List",
"[",
"int",
"]",
":",
"out",
"=",
"[",
"]",
"assert",
"self",
".",
"springs",
"is",
"not",
"None",
"for",
"k",
",",
"v",
"in",
"self",
".",
"springs",
".",
"items",
"(",
")",
":",
"if",
"v",
"=... | https://github.com/ritchie46/anaStruct/blob/cfd9dff89834ea85ed07d2e4877deecbdc4d0403/anastruct/fem/elements.py#L132-L145 | |
edfungus/Crouton | ada98b3930192938a48909072b45cb84b945f875 | clients/esp8266_clients/venv/lib/python2.7/site-packages/pip/download.py | python | _download_http_url | (link, session, temp_dir) | return file_path, content_type | Download link url into temp_dir using provided session | Download link url into temp_dir using provided session | [
"Download",
"link",
"url",
"into",
"temp_dir",
"using",
"provided",
"session"
] | def _download_http_url(link, session, temp_dir):
"""Download link url into temp_dir using provided session"""
target_url = link.url.split('#', 1)[0]
try:
resp = session.get(
target_url,
# We use Accept-Encoding: identity here because requests
# defaults to accepti... | [
"def",
"_download_http_url",
"(",
"link",
",",
"session",
",",
"temp_dir",
")",
":",
"target_url",
"=",
"link",
".",
"url",
".",
"split",
"(",
"'#'",
",",
"1",
")",
"[",
"0",
"]",
"try",
":",
"resp",
"=",
"session",
".",
"get",
"(",
"target_url",
"... | https://github.com/edfungus/Crouton/blob/ada98b3930192938a48909072b45cb84b945f875/clients/esp8266_clients/venv/lib/python2.7/site-packages/pip/download.py#L831-L887 | |
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/curses/ascii.py | python | isalnum | (c) | return isalpha(c) or isdigit(c) | [] | def isalnum(c): return isalpha(c) or isdigit(c) | [
"def",
"isalnum",
"(",
"c",
")",
":",
"return",
"isalpha",
"(",
"c",
")",
"or",
"isdigit",
"(",
"c",
")"
] | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/curses/ascii.py#L54-L54 | |||
ARISE-Initiative/robosuite | a5dfaf03cd769170881a1931d8f19c8eb72f531a | robosuite/renderers/base_parser.py | python | BaseParser.parse_geometries | (self) | Iterate through each goemetry and load it in the iGibson renderer. | Iterate through each goemetry and load it in the iGibson renderer. | [
"Iterate",
"through",
"each",
"goemetry",
"and",
"load",
"it",
"in",
"the",
"iGibson",
"renderer",
"."
] | def parse_geometries(self):
"""
Iterate through each goemetry and load it in the iGibson renderer.
"""
raise NotImplementedError | [
"def",
"parse_geometries",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/ARISE-Initiative/robosuite/blob/a5dfaf03cd769170881a1931d8f19c8eb72f531a/robosuite/renderers/base_parser.py#L51-L55 | ||
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | docs/source/conf.py | python | linkcode_resolve | (domain, info) | return f"{GITHUB_URL}/blob/{code_branch}/{fn}{linespec}" | Determine the URL corresponding to Python object. | Determine the URL corresponding to Python object. | [
"Determine",
"the",
"URL",
"corresponding",
"to",
"Python",
"object",
"."
] | def linkcode_resolve(domain, info):
"""Determine the URL corresponding to Python object."""
if domain != "py":
return None
modname = info["module"]
fullname = info["fullname"]
submod = sys.modules.get(modname)
if submod is None:
return None
obj = submod
for part in fullna... | [
"def",
"linkcode_resolve",
"(",
"domain",
",",
"info",
")",
":",
"if",
"domain",
"!=",
"\"py\"",
":",
"return",
"None",
"modname",
"=",
"info",
"[",
"\"module\"",
"]",
"fullname",
"=",
"info",
"[",
"\"fullname\"",
"]",
"submod",
"=",
"sys",
".",
"modules... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/docs/source/conf.py#L100-L135 | |
pypa/pipenv | b21baade71a86ab3ee1429f71fbc14d4f95fb75d | pipenv/patched/notpip/_internal/utils/encoding.py | python | auto_decode | (data: bytes) | return data.decode(
locale.getpreferredencoding(False) or sys.getdefaultencoding(),
) | Check a bytes string for a BOM to correctly detect the encoding
Fallback to locale.getpreferredencoding(False) like open() on Python3 | Check a bytes string for a BOM to correctly detect the encoding | [
"Check",
"a",
"bytes",
"string",
"for",
"a",
"BOM",
"to",
"correctly",
"detect",
"the",
"encoding"
] | def auto_decode(data: bytes) -> str:
"""Check a bytes string for a BOM to correctly detect the encoding
Fallback to locale.getpreferredencoding(False) like open() on Python3"""
for bom, encoding in BOMS:
if data.startswith(bom):
return data[len(bom) :].decode(encoding)
# Lets check ... | [
"def",
"auto_decode",
"(",
"data",
":",
"bytes",
")",
"->",
"str",
":",
"for",
"bom",
",",
"encoding",
"in",
"BOMS",
":",
"if",
"data",
".",
"startswith",
"(",
"bom",
")",
":",
"return",
"data",
"[",
"len",
"(",
"bom",
")",
":",
"]",
".",
"decode... | https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/patched/notpip/_internal/utils/encoding.py#L20-L36 | |
brian-team/brian2 | c212a57cb992b766786b5769ebb830ff12d8a8ad | brian2/monitors/spikemonitor.py | python | EventMonitor.it | (self) | return self.i, self.t | Returns the pair (`i`, `t`). | Returns the pair (`i`, `t`). | [
"Returns",
"the",
"pair",
"(",
"i",
"t",
")",
"."
] | def it(self):
"""
Returns the pair (`i`, `t`).
"""
if not self.record:
raise AttributeError("Indices and times have not been recorded."
"Set the record argument to True to record "
"them.")
return self.... | [
"def",
"it",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"record",
":",
"raise",
"AttributeError",
"(",
"\"Indices and times have not been recorded.\"",
"\"Set the record argument to True to record \"",
"\"them.\"",
")",
"return",
"self",
".",
"i",
",",
"self",
... | https://github.com/brian-team/brian2/blob/c212a57cb992b766786b5769ebb830ff12d8a8ad/brian2/monitors/spikemonitor.py#L187-L195 | |
tztztztztz/eql.detectron2 | 29224acf4ea549c53264e6229da69868bd5470f3 | detectron2/checkpoint/c2_model_loading.py | python | convert_c2_detectron_names | (weights) | return new_weights, new_keys_to_original_keys | Map Caffe2 Detectron weight names to Detectron2 names.
Args:
weights (dict): name -> tensor
Returns:
dict: detectron2 names -> tensor
dict: detectron2 names -> C2 names | Map Caffe2 Detectron weight names to Detectron2 names. | [
"Map",
"Caffe2",
"Detectron",
"weight",
"names",
"to",
"Detectron2",
"names",
"."
] | def convert_c2_detectron_names(weights):
"""
Map Caffe2 Detectron weight names to Detectron2 names.
Args:
weights (dict): name -> tensor
Returns:
dict: detectron2 names -> tensor
dict: detectron2 names -> C2 names
"""
logger = logging.getLogger(__name__)
logger.info... | [
"def",
"convert_c2_detectron_names",
"(",
"weights",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"logger",
".",
"info",
"(",
"\"Remapping C2 weights ......\"",
")",
"original_keys",
"=",
"sorted",
"(",
"weights",
".",
"keys",
"(",... | https://github.com/tztztztztz/eql.detectron2/blob/29224acf4ea549c53264e6229da69868bd5470f3/detectron2/checkpoint/c2_model_loading.py#L68-L206 | |
GalSim-developers/GalSim | a05d4ec3b8d8574f99d3b0606ad882cbba53f345 | setup.py | python | try_openmp | (compiler, cc_type) | return success | If cc --version is not helpful, the last resort is to try each compiler type and see
if it works. | If cc --version is not helpful, the last resort is to try each compiler type and see
if it works. | [
"If",
"cc",
"--",
"version",
"is",
"not",
"helpful",
"the",
"last",
"resort",
"is",
"to",
"try",
"each",
"compiler",
"type",
"and",
"see",
"if",
"it",
"works",
"."
] | def try_openmp(compiler, cc_type):
"""
If cc --version is not helpful, the last resort is to try each compiler type and see
if it works.
"""
cpp_code = """
#include <iostream>
#include <vector>
#ifdef _OPENMP
#include "omp.h"
#endif
int get_max_threads() {
#ifdef _OPENMP
return omp_get_max_thre... | [
"def",
"try_openmp",
"(",
"compiler",
",",
"cc_type",
")",
":",
"cpp_code",
"=",
"\"\"\"\n#include <iostream>\n#include <vector>\n#ifdef _OPENMP\n#include \"omp.h\"\n#endif\n\nint get_max_threads() {\n#ifdef _OPENMP\n return omp_get_max_threads();\n#else\n return 1;\n#endif\n}\n\nint main(... | https://github.com/GalSim-developers/GalSim/blob/a05d4ec3b8d8574f99d3b0606ad882cbba53f345/setup.py#L532-L581 | |
tensorflow/model-analysis | e38c23ce76eff039548ce69e3160ed4d7984f2fc | tensorflow_model_analysis/post_export_metrics/metrics.py | python | calibration_plot | (predictions: types.TensorType,
labels: types.TensorType,
left: float,
right: float,
num_buckets: int,
weights: Optional[types.TensorType] = None
) | return value_op, update_op | Calibration plot for predictions in [left, right].
A calibration plot contains multiple buckets, based on the prediction.
Each bucket contains:
(i) the weighted sum of predictions that fall within that bucket
(ii) the weighted sum of labels associated with those predictions
(iii) the sum of weights of the... | Calibration plot for predictions in [left, right]. | [
"Calibration",
"plot",
"for",
"predictions",
"in",
"[",
"left",
"right",
"]",
"."
] | def calibration_plot(predictions: types.TensorType,
labels: types.TensorType,
left: float,
right: float,
num_buckets: int,
weights: Optional[types.TensorType] = None
) -> Tuple[types.TensorType, ... | [
"def",
"calibration_plot",
"(",
"predictions",
":",
"types",
".",
"TensorType",
",",
"labels",
":",
"types",
".",
"TensorType",
",",
"left",
":",
"float",
",",
"right",
":",
"float",
",",
"num_buckets",
":",
"int",
",",
"weights",
":",
"Optional",
"[",
"... | https://github.com/tensorflow/model-analysis/blob/e38c23ce76eff039548ce69e3160ed4d7984f2fc/tensorflow_model_analysis/post_export_metrics/metrics.py#L160-L270 | |
meejah/txtorcon | 7da6ad6f91c395951be1b4e7e1011baa2f7a689f | txtorcon/onion.py | python | IAuthenticatedOnionClients.get_permanent_id | (self) | :return: the service's permanent id, in hex
(For authenticated services, this is not the same as the
.onion URI of any of the clients). The Permanent ID is the
base32 encoding of the first 10 bytes of the SHA1 hash of the
public-key of the service. | :return: the service's permanent id, in hex | [
":",
"return",
":",
"the",
"service",
"s",
"permanent",
"id",
"in",
"hex"
] | def get_permanent_id(self):
"""
:return: the service's permanent id, in hex
(For authenticated services, this is not the same as the
.onion URI of any of the clients). The Permanent ID is the
base32 encoding of the first 10 bytes of the SHA1 hash of the
public-key of the... | [
"def",
"get_permanent_id",
"(",
"self",
")",
":"
] | https://github.com/meejah/txtorcon/blob/7da6ad6f91c395951be1b4e7e1011baa2f7a689f/txtorcon/onion.py#L91-L99 | ||
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/scattermapbox/_stream.py | python | Stream.maxpoints | (self) | return self["maxpoints"] | Sets the maximum number of points to keep on the plots from an
incoming stream. If `maxpoints` is set to 50, only the newest
50 points will be displayed on the plot.
The 'maxpoints' property is a number and may be specified as:
- An int or float in the interval [0, 10000]
... | Sets the maximum number of points to keep on the plots from an
incoming stream. If `maxpoints` is set to 50, only the newest
50 points will be displayed on the plot.
The 'maxpoints' property is a number and may be specified as:
- An int or float in the interval [0, 10000] | [
"Sets",
"the",
"maximum",
"number",
"of",
"points",
"to",
"keep",
"on",
"the",
"plots",
"from",
"an",
"incoming",
"stream",
".",
"If",
"maxpoints",
"is",
"set",
"to",
"50",
"only",
"the",
"newest",
"50",
"points",
"will",
"be",
"displayed",
"on",
"the",
... | def maxpoints(self):
"""
Sets the maximum number of points to keep on the plots from an
incoming stream. If `maxpoints` is set to 50, only the newest
50 points will be displayed on the plot.
The 'maxpoints' property is a number and may be specified as:
- An int or ... | [
"def",
"maxpoints",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"maxpoints\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/scattermapbox/_stream.py#L16-L29 | |
Source-Python-Dev-Team/Source.Python | d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb | addons/source-python/packages/site-packages/sqlalchemy/engine/interfaces.py | python | Dialect.get_isolation_level | (self, dbapi_conn) | Given a DBAPI connection, return its isolation level.
When working with a :class:`.Connection` object, the corresponding
DBAPI connection may be procured using the
:attr:`.Connection.connection` accessor.
Note that this is a dialect-level method which is used as part
of the imp... | Given a DBAPI connection, return its isolation level. | [
"Given",
"a",
"DBAPI",
"connection",
"return",
"its",
"isolation",
"level",
"."
] | def get_isolation_level(self, dbapi_conn):
"""Given a DBAPI connection, return its isolation level.
When working with a :class:`.Connection` object, the corresponding
DBAPI connection may be procured using the
:attr:`.Connection.connection` accessor.
Note that this is a dialect... | [
"def",
"get_isolation_level",
"(",
"self",
",",
"dbapi_conn",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/packages/site-packages/sqlalchemy/engine/interfaces.py#L718-L746 | ||
hyperledger/aries-cloudagent-python | 2f36776e99f6053ae92eed8123b5b1b2e891c02a | aries_cloudagent/vc/ld_proofs/document_loader.py | python | DocumentLoader._load_sync | (self, url: str, options: dict) | return loop.run_until_complete(self._load_async(url, options)) | Run document loader in event loop to make it async.
NOTE: This should be called in a thread where an event loop is not already
running, such as a new thread. | Run document loader in event loop to make it async. | [
"Run",
"document",
"loader",
"in",
"event",
"loop",
"to",
"make",
"it",
"async",
"."
] | def _load_sync(self, url: str, options: dict):
"""Run document loader in event loop to make it async.
NOTE: This should be called in a thread where an event loop is not already
running, such as a new thread.
"""
loop = asyncio.new_event_loop()
return loop.run_until_compl... | [
"def",
"_load_sync",
"(",
"self",
",",
"url",
":",
"str",
",",
"options",
":",
"dict",
")",
":",
"loop",
"=",
"asyncio",
".",
"new_event_loop",
"(",
")",
"return",
"loop",
".",
"run_until_complete",
"(",
"self",
".",
"_load_async",
"(",
"url",
",",
"op... | https://github.com/hyperledger/aries-cloudagent-python/blob/2f36776e99f6053ae92eed8123b5b1b2e891c02a/aries_cloudagent/vc/ld_proofs/document_loader.py#L87-L94 | |
thunlp/OpenQA | e8faddca287c81cb52ac904ba8980734ea40a03c | src/reader/layers.py | python | BilinearSeqAttn2.forward | (self, x, y, x_mask, y_mask) | return xy_column, xy_row | Args:
x: batch * len1 * hdim
y: batch * len2 * hdim
x_mask: batch * len1 (1 for padding, 0 for true) -> batch* len1*len2
y_mask: batch * len2
Output:
xy_column, xy_row = batch * len1 * len2 | Args:
x: batch * len1 * hdim
y: batch * len2 * hdim
x_mask: batch * len1 (1 for padding, 0 for true) -> batch* len1*len2
y_mask: batch * len2
Output:
xy_column, xy_row = batch * len1 * len2 | [
"Args",
":",
"x",
":",
"batch",
"*",
"len1",
"*",
"hdim",
"y",
":",
"batch",
"*",
"len2",
"*",
"hdim",
"x_mask",
":",
"batch",
"*",
"len1",
"(",
"1",
"for",
"padding",
"0",
"for",
"true",
")",
"-",
">",
"batch",
"*",
"len1",
"*",
"len2",
"y_mas... | def forward(self, x, y, x_mask, y_mask):
"""
Args:
x: batch * len1 * hdim
y: batch * len2 * hdim
x_mask: batch * len1 (1 for padding, 0 for true) -> batch* len1*len2
y_mask: batch * len2
Output:
xy_column, xy_row = batch * len1 * len2
... | [
"def",
"forward",
"(",
"self",
",",
"x",
",",
"y",
",",
"x_mask",
",",
"y_mask",
")",
":",
"len1",
"=",
"x_mask",
".",
"size",
"(",
"1",
")",
"len2",
"=",
"y_mask",
".",
"size",
"(",
"1",
")",
"#logger.info(x)",
"#logger.info(y)",
"xy",
"=",
"x",
... | https://github.com/thunlp/OpenQA/blob/e8faddca287c81cb52ac904ba8980734ea40a03c/src/reader/layers.py#L303-L333 | |
edisonlz/fastor | 342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3 | base/site-packages/requests/cookies.py | python | RequestsCookieJar.iteritems | (self) | Dict-like iteritems() that returns an iterator of name-value tuples
from the jar. See iterkeys() and itervalues(). | Dict-like iteritems() that returns an iterator of name-value tuples
from the jar. See iterkeys() and itervalues(). | [
"Dict",
"-",
"like",
"iteritems",
"()",
"that",
"returns",
"an",
"iterator",
"of",
"name",
"-",
"value",
"tuples",
"from",
"the",
"jar",
".",
"See",
"iterkeys",
"()",
"and",
"itervalues",
"()",
"."
] | def iteritems(self):
"""Dict-like iteritems() that returns an iterator of name-value tuples
from the jar. See iterkeys() and itervalues()."""
for cookie in iter(self):
yield cookie.name, cookie.value | [
"def",
"iteritems",
"(",
"self",
")",
":",
"for",
"cookie",
"in",
"iter",
"(",
"self",
")",
":",
"yield",
"cookie",
".",
"name",
",",
"cookie",
".",
"value"
] | https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/requests/cookies.py#L230-L234 | ||
Azure/batch-shipyard | d6da749f9cd678037bd520bc074e40066ea35b56 | convoy/util.py | python | on_windows | () | return _ON_WINDOWS | Execution on Windows
:rtype: bool
:return: if on Windows | Execution on Windows
:rtype: bool
:return: if on Windows | [
"Execution",
"on",
"Windows",
":",
"rtype",
":",
"bool",
":",
"return",
":",
"if",
"on",
"Windows"
] | def on_windows():
# type: (None) -> bool
"""Execution on Windows
:rtype: bool
:return: if on Windows
"""
return _ON_WINDOWS | [
"def",
"on_windows",
"(",
")",
":",
"# type: (None) -> bool",
"return",
"_ON_WINDOWS"
] | https://github.com/Azure/batch-shipyard/blob/d6da749f9cd678037bd520bc074e40066ea35b56/convoy/util.py#L77-L83 | |
livid/v2ex-gae | 32be3a77d535e7c9df85a333e01ab8834d0e8581 | mapreduce/lib/graphy/backends/google_chart_api/encoders.py | python | BaseChartEncoder.Url | (self, width, height, use_html_entities=False) | return util.EncodeUrl(self.url_base, params, self.escape_url,
use_html_entities) | Get the URL for our graph.
Args:
use_html_entities: If True, reserved HTML characters (&, <, >, ") in the
URL are replaced with HTML entities (&, <, etc.). Default is False. | Get the URL for our graph. | [
"Get",
"the",
"URL",
"for",
"our",
"graph",
"."
] | def Url(self, width, height, use_html_entities=False):
"""Get the URL for our graph.
Args:
use_html_entities: If True, reserved HTML characters (&, <, >, ") in the
URL are replaced with HTML entities (&, <, etc.). Default is False.
"""
self._width = width
self._height = height
... | [
"def",
"Url",
"(",
"self",
",",
"width",
",",
"height",
",",
"use_html_entities",
"=",
"False",
")",
":",
"self",
".",
"_width",
"=",
"width",
"self",
".",
"_height",
"=",
"height",
"params",
"=",
"self",
".",
"_Params",
"(",
"self",
".",
"chart",
")... | https://github.com/livid/v2ex-gae/blob/32be3a77d535e7c9df85a333e01ab8834d0e8581/mapreduce/lib/graphy/backends/google_chart_api/encoders.py#L54-L65 | |
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/sympy/sympy/printing/mathml.py | python | MathMLPrinter._print_Function | (self, e) | return x | [] | def _print_Function(self, e):
x = self.dom.createElement("apply")
x.appendChild(self.dom.createElement(self.mathml_tag(e)))
for arg in e.args:
x.appendChild(self._print(arg))
return x | [
"def",
"_print_Function",
"(",
"self",
",",
"e",
")",
":",
"x",
"=",
"self",
".",
"dom",
".",
"createElement",
"(",
"\"apply\"",
")",
"x",
".",
"appendChild",
"(",
"self",
".",
"dom",
".",
"createElement",
"(",
"self",
".",
"mathml_tag",
"(",
"e",
")... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/printing/mathml.py#L349-L354 | |||
celery/kombu | 853b13f1d018ebfe7ad2d064a3111cac9fcf5383 | kombu/transport/SQS.py | python | Channel._create_queue | (self, queue_name, attributes) | return self.sqs(queue=queue_name).create_queue(
QueueName=queue_name,
Attributes=attributes,
) | Create an SQS queue with a given name and nominal attributes. | Create an SQS queue with a given name and nominal attributes. | [
"Create",
"an",
"SQS",
"queue",
"with",
"a",
"given",
"name",
"and",
"nominal",
"attributes",
"."
] | def _create_queue(self, queue_name, attributes):
"""Create an SQS queue with a given name and nominal attributes."""
# Allow specifying additional boto create_queue Attributes
# via transport options
if self.predefined_queues:
return None
attributes.update(
... | [
"def",
"_create_queue",
"(",
"self",
",",
"queue_name",
",",
"attributes",
")",
":",
"# Allow specifying additional boto create_queue Attributes",
"# via transport options",
"if",
"self",
".",
"predefined_queues",
":",
"return",
"None",
"attributes",
".",
"update",
"(",
... | https://github.com/celery/kombu/blob/853b13f1d018ebfe7ad2d064a3111cac9fcf5383/kombu/transport/SQS.py#L372-L386 | |
nltk/nltk | 3f74ac55681667d7ef78b664557487145f51eb02 | nltk/sentiment/util.py | python | demo_sent_subjectivity | (text) | Classify a single sentence as subjective or objective using a stored
SentimentAnalyzer.
:param text: a sentence whose subjectivity has to be classified. | Classify a single sentence as subjective or objective using a stored
SentimentAnalyzer. | [
"Classify",
"a",
"single",
"sentence",
"as",
"subjective",
"or",
"objective",
"using",
"a",
"stored",
"SentimentAnalyzer",
"."
] | def demo_sent_subjectivity(text):
"""
Classify a single sentence as subjective or objective using a stored
SentimentAnalyzer.
:param text: a sentence whose subjectivity has to be classified.
"""
from nltk.classify import NaiveBayesClassifier
from nltk.tokenize import regexp
word_tokeni... | [
"def",
"demo_sent_subjectivity",
"(",
"text",
")",
":",
"from",
"nltk",
".",
"classify",
"import",
"NaiveBayesClassifier",
"from",
"nltk",
".",
"tokenize",
"import",
"regexp",
"word_tokenizer",
"=",
"regexp",
".",
"WhitespaceTokenizer",
"(",
")",
"try",
":",
"se... | https://github.com/nltk/nltk/blob/3f74ac55681667d7ef78b664557487145f51eb02/nltk/sentiment/util.py#L696-L716 | ||
spesmilo/electrum | bdbd59300fbd35b01605e66145458e5f396108e8 | electrum/gui/qt/util.py | python | InfoButton.onclick | (self) | [] | def onclick(self):
custom_message_box(icon=QMessageBox.Information,
parent=self,
title=_('Info'),
text=self.help_text,
rich_text=True) | [
"def",
"onclick",
"(",
"self",
")",
":",
"custom_message_box",
"(",
"icon",
"=",
"QMessageBox",
".",
"Information",
",",
"parent",
"=",
"self",
",",
"title",
"=",
"_",
"(",
"'Info'",
")",
",",
"text",
"=",
"self",
".",
"help_text",
",",
"rich_text",
"=... | https://github.com/spesmilo/electrum/blob/bdbd59300fbd35b01605e66145458e5f396108e8/electrum/gui/qt/util.py#L158-L163 | ||||
huggingface/transformers | 623b4f7c63f60cce917677ee704d6c93ee960b4b | src/transformers/models/longformer/modeling_longformer.py | python | LongformerLMHead.__init__ | (self, config) | [] | def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.layer_norm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
self.decoder = nn.Linear(config.hidden_size, config.vocab_size)
self.bias = nn.Parameter(to... | [
"def",
"__init__",
"(",
"self",
",",
"config",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
")",
"self",
".",
"dense",
"=",
"nn",
".",
"Linear",
"(",
"config",
".",
"hidden_size",
",",
"config",
".",
"hidden_size",
")",
"self",
".",
"layer_norm... | https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/models/longformer/modeling_longformer.py#L1343-L1350 | ||||
axnsan12/drf-yasg | d9700dbf8cc80d725a7db485c2d4446c19c29840 | src/drf_yasg/openapi.py | python | Responses.__init__ | (self, responses, default=None, **extra) | Describes the expected responses of an :class:`.Operation`.
:param responses: mapping of status code to response definition
:type responses: dict[str or int,Response]
:param Response default: description of the response structure to expect if another status code is returned | Describes the expected responses of an :class:`.Operation`. | [
"Describes",
"the",
"expected",
"responses",
"of",
"an",
":",
"class",
":",
".",
"Operation",
"."
] | def __init__(self, responses, default=None, **extra):
"""Describes the expected responses of an :class:`.Operation`.
:param responses: mapping of status code to response definition
:type responses: dict[str or int,Response]
:param Response default: description of the response structure ... | [
"def",
"__init__",
"(",
"self",
",",
"responses",
",",
"default",
"=",
"None",
",",
"*",
"*",
"extra",
")",
":",
"super",
"(",
"Responses",
",",
"self",
")",
".",
"__init__",
"(",
"*",
"*",
"extra",
")",
"for",
"status",
",",
"response",
"in",
"res... | https://github.com/axnsan12/drf-yasg/blob/d9700dbf8cc80d725a7db485c2d4446c19c29840/src/drf_yasg/openapi.py#L576-L588 | ||
securityclippy/elasticintel | aa08d3e9f5ab1c000128e95161139ce97ff0e334 | whois_lambda/ipwhois/asn.py | python | IPASN.parse_fields_verbose_dns | (self, response) | return ret | The function for parsing ASN fields from a verbose dns response.
Args:
response (:obj:`str`): The response from the ASN dns server.
Returns:
dict: The ASN lookup results
::
{
'asn' (str) - The Autonomous System Number
... | The function for parsing ASN fields from a verbose dns response. | [
"The",
"function",
"for",
"parsing",
"ASN",
"fields",
"from",
"a",
"verbose",
"dns",
"response",
"."
] | def parse_fields_verbose_dns(self, response):
"""
The function for parsing ASN fields from a verbose dns response.
Args:
response (:obj:`str`): The response from the ASN dns server.
Returns:
dict: The ASN lookup results
::
{
... | [
"def",
"parse_fields_verbose_dns",
"(",
"self",
",",
"response",
")",
":",
"try",
":",
"temp",
"=",
"response",
".",
"split",
"(",
"'|'",
")",
"# Parse out the ASN information.",
"ret",
"=",
"{",
"'asn_registry'",
":",
"temp",
"[",
"2",
"]",
".",
"strip",
... | https://github.com/securityclippy/elasticintel/blob/aa08d3e9f5ab1c000128e95161139ce97ff0e334/whois_lambda/ipwhois/asn.py#L182-L237 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/combinat/constellation.py | python | Constellation_class.genus | (self) | return 1 - self.euler_characteristic() // 2 | r"""
Return the genus of the surface.
EXAMPLES::
sage: c = Constellation(['(0,1)', '(0,2)', None])
sage: c.genus()
0
sage: c = Constellation(['(0,1)(2,3,4)','(1,3,4)(2,0)', None])
sage: c.genus()
1
TESTS::
s... | r"""
Return the genus of the surface. | [
"r",
"Return",
"the",
"genus",
"of",
"the",
"surface",
"."
] | def genus(self):
r"""
Return the genus of the surface.
EXAMPLES::
sage: c = Constellation(['(0,1)', '(0,2)', None])
sage: c.genus()
0
sage: c = Constellation(['(0,1)(2,3,4)','(1,3,4)(2,0)', None])
sage: c.genus()
1
... | [
"def",
"genus",
"(",
"self",
")",
":",
"return",
"1",
"-",
"self",
".",
"euler_characteristic",
"(",
")",
"//",
"2"
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/constellation.py#L336-L355 | |
JaniceWuo/MovieRecommend | 4c86db64ca45598917d304f535413df3bc9fea65 | movierecommend/venv1/Lib/site-packages/django/db/models/query.py | python | QuerySet.aggregate | (self, *args, **kwargs) | return query.get_aggregation(self.db, kwargs.keys()) | Returns a dictionary containing the calculations (aggregation)
over the current queryset
If args is present the expression is passed as a kwarg using
the Aggregate object's default alias. | Returns a dictionary containing the calculations (aggregation)
over the current queryset | [
"Returns",
"a",
"dictionary",
"containing",
"the",
"calculations",
"(",
"aggregation",
")",
"over",
"the",
"current",
"queryset"
] | def aggregate(self, *args, **kwargs):
"""
Returns a dictionary containing the calculations (aggregation)
over the current queryset
If args is present the expression is passed as a kwarg using
the Aggregate object's default alias.
"""
if self.query.distinct_fields... | [
"def",
"aggregate",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"query",
".",
"distinct_fields",
":",
"raise",
"NotImplementedError",
"(",
"\"aggregate() + distinct(fields) not implemented.\"",
")",
"for",
"arg",
"in",
... | https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/django/db/models/query.py#L325-L351 | |
china-testing/python-api-tesing | edd141d07b6ff53470aa357df9db7e1655d9cb4c | practices/ping3.py | python | Pinger.receive_pong | (self, sock, ID, timeout) | Receive ping from the socket. | Receive ping from the socket. | [
"Receive",
"ping",
"from",
"the",
"socket",
"."
] | def receive_pong(self, sock, ID, timeout):
"""
Receive ping from the socket.
"""
time_remaining = timeout
while True:
start_time = time.time()
readable = select.select([sock], [], [], time_remaining)
time_spent = (time.time() - start_time)
... | [
"def",
"receive_pong",
"(",
"self",
",",
"sock",
",",
"ID",
",",
"timeout",
")",
":",
"time_remaining",
"=",
"timeout",
"while",
"True",
":",
"start_time",
"=",
"time",
".",
"time",
"(",
")",
"readable",
"=",
"select",
".",
"select",
"(",
"[",
"sock",
... | https://github.com/china-testing/python-api-tesing/blob/edd141d07b6ff53470aa357df9db7e1655d9cb4c/practices/ping3.py#L54-L79 | ||
tensorflow/lingvo | ce10019243d954c3c3ebe739f7589b5eebfdf907 | lingvo/tasks/car/evaluation_metadata.py | python | EvaluationMetadata.EvalClassIndices | (self) | return [self.ClassNames().index(name) for name in eval_classes] | List of int32 indices for the classes that should be evaled. | List of int32 indices for the classes that should be evaled. | [
"List",
"of",
"int32",
"indices",
"for",
"the",
"classes",
"that",
"should",
"be",
"evaled",
"."
] | def EvalClassIndices(self):
"""List of int32 indices for the classes that should be evaled."""
eval_classes = sorted(self.IoUThresholds().keys())
return [self.ClassNames().index(name) for name in eval_classes] | [
"def",
"EvalClassIndices",
"(",
"self",
")",
":",
"eval_classes",
"=",
"sorted",
"(",
"self",
".",
"IoUThresholds",
"(",
")",
".",
"keys",
"(",
")",
")",
"return",
"[",
"self",
".",
"ClassNames",
"(",
")",
".",
"index",
"(",
"name",
")",
"for",
"name... | https://github.com/tensorflow/lingvo/blob/ce10019243d954c3c3ebe739f7589b5eebfdf907/lingvo/tasks/car/evaluation_metadata.py#L43-L46 | |
ambakick/Person-Detection-and-Tracking | f925394ac29b5cf321f1ce89a71b193381519a0b | core/preprocessor.py | python | ssd_random_crop_fixed_aspect_ratio | (
image,
boxes,
labels,
label_scores=None,
multiclass_scores=None,
masks=None,
keypoints=None,
min_object_covered=(0.0, 0.1, 0.3, 0.5, 0.7, 0.9, 1.0),
aspect_ratio=1.0,
area_range=((0.1, 1.0),) * 7,
overlap_thresh=(0.0, 0.1, 0.3, 0.5, 0.7, 0.9, 1.0),
random_coef=(0.15,) *... | return result | Random crop preprocessing with default parameters as in SSD paper.
Liu et al., SSD: Single shot multibox detector.
For further information on random crop preprocessing refer to RandomCrop
function above.
The only difference is that the aspect ratio of the crops are fixed.
Args:
image: rank 3 float32 te... | Random crop preprocessing with default parameters as in SSD paper. | [
"Random",
"crop",
"preprocessing",
"with",
"default",
"parameters",
"as",
"in",
"SSD",
"paper",
"."
] | def ssd_random_crop_fixed_aspect_ratio(
image,
boxes,
labels,
label_scores=None,
multiclass_scores=None,
masks=None,
keypoints=None,
min_object_covered=(0.0, 0.1, 0.3, 0.5, 0.7, 0.9, 1.0),
aspect_ratio=1.0,
area_range=((0.1, 1.0),) * 7,
overlap_thresh=(0.0, 0.1, 0.3, 0.5, 0.7... | [
"def",
"ssd_random_crop_fixed_aspect_ratio",
"(",
"image",
",",
"boxes",
",",
"labels",
",",
"label_scores",
"=",
"None",
",",
"multiclass_scores",
"=",
"None",
",",
"masks",
"=",
"None",
",",
"keypoints",
"=",
"None",
",",
"min_object_covered",
"=",
"(",
"0.0... | https://github.com/ambakick/Person-Detection-and-Tracking/blob/f925394ac29b5cf321f1ce89a71b193381519a0b/core/preprocessor.py#L2663-L2785 | |
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/decimal.py | python | Decimal._round_half_down | (self, prec) | Round 5 down | Round 5 down | [
"Round",
"5",
"down"
] | def _round_half_down(self, prec):
"""Round 5 down"""
if _exact_half(self._int, prec):
return -1
else:
return self._round_half_up(prec) | [
"def",
"_round_half_down",
"(",
"self",
",",
"prec",
")",
":",
"if",
"_exact_half",
"(",
"self",
".",
"_int",
",",
"prec",
")",
":",
"return",
"-",
"1",
"else",
":",
"return",
"self",
".",
"_round_half_up",
"(",
"prec",
")"
] | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/decimal.py#L1760-L1765 | ||
virantha/pypdfocr | acc5e13763224267e897865fccafbf51e13725e9 | pypdfocr/pypdfocr_pdf.py | python | PyPdf.add_text_layer | (self,pdf, hocrfile, page_num,height, dpi) | Draw an invisible text layer for OCR data.
This function really needs to get cleaned up | Draw an invisible text layer for OCR data. | [
"Draw",
"an",
"invisible",
"text",
"layer",
"for",
"OCR",
"data",
"."
] | def add_text_layer(self,pdf, hocrfile, page_num,height, dpi):
"""Draw an invisible text layer for OCR data.
This function really needs to get cleaned up
"""
hocr = ElementTree()
try:
# It's possible tesseract has failed and written garbage to this hocr file, so we need... | [
"def",
"add_text_layer",
"(",
"self",
",",
"pdf",
",",
"hocrfile",
",",
"page_num",
",",
"height",
",",
"dpi",
")",
":",
"hocr",
"=",
"ElementTree",
"(",
")",
"try",
":",
"# It's possible tesseract has failed and written garbage to this hocr file, so we need to catch an... | https://github.com/virantha/pypdfocr/blob/acc5e13763224267e897865fccafbf51e13725e9/pypdfocr/pypdfocr_pdf.py#L269-L349 | ||
blawar/nut | 2cf351400418399a70164987e28670309f6c9cb5 | nut.py | python | exportNcaMap | (path) | [] | def exportNcaMap(path):
nut.initTitles()
nut.initFiles()
map = {}
i = 0
for id, title in Titles.items():
print(id)
try:
nsp = title.getLatestFile()
if not nsp:
continue
nsp.open(args.info, 'r+b')
map[id] = {}
map[id]['version'] = int(title.version)
map[id]['files'] = []
for f in ... | [
"def",
"exportNcaMap",
"(",
"path",
")",
":",
"nut",
".",
"initTitles",
"(",
")",
"nut",
".",
"initFiles",
"(",
")",
"map",
"=",
"{",
"}",
"i",
"=",
"0",
"for",
"id",
",",
"title",
"in",
"Titles",
".",
"items",
"(",
")",
":",
"print",
"(",
"id"... | https://github.com/blawar/nut/blob/2cf351400418399a70164987e28670309f6c9cb5/nut.py#L311-L347 | ||||
maas/maas | db2f89970c640758a51247c59bf1ec6f60cf4ab5 | src/provisioningserver/security.py | python | InstallSharedSecretScript.run | (args) | Install a shared-secret to this cluster.
When invoked interactively, you'll be prompted to enter the secret.
Otherwise the secret will be read from the first line of stdin.
In both cases, the secret must be hex/base16 encoded. | Install a shared-secret to this cluster. | [
"Install",
"a",
"shared",
"-",
"secret",
"to",
"this",
"cluster",
"."
] | def run(args):
"""Install a shared-secret to this cluster.
When invoked interactively, you'll be prompted to enter the secret.
Otherwise the secret will be read from the first line of stdin.
In both cases, the secret must be hex/base16 encoded.
"""
# Obtain the secret f... | [
"def",
"run",
"(",
"args",
")",
":",
"# Obtain the secret from the invoker.",
"if",
"stdin",
".",
"isatty",
"(",
")",
":",
"try",
":",
"secret_hex",
"=",
"input",
"(",
"\"Secret (hex/base16 encoded): \"",
")",
"except",
"EOFError",
":",
"print",
"(",
")",
"# S... | https://github.com/maas/maas/blob/db2f89970c640758a51247c59bf1ec6f60cf4ab5/src/provisioningserver/security.py#L221-L251 | ||
AustinMurphy/OBD2-Scantool | 2a1412330b58a6eea010d724b690034dea7175c1 | obd2_reader.py | python | OBD2reader.reset | (self) | Resets device | Resets device | [
"Resets",
"device"
] | def reset(self):
""" Resets device"""
#
if self.debug > 1:
print "Sending reset command..."
#
if self.State != 1:
print "Can't reset reader, reader not connected"
raise self.ErrorNotConnected("Can't reset reader")
else:
if s... | [
"def",
"reset",
"(",
"self",
")",
":",
"#",
"if",
"self",
".",
"debug",
">",
"1",
":",
"print",
"\"Sending reset command...\"",
"#",
"if",
"self",
".",
"State",
"!=",
"1",
":",
"print",
"\"Can't reset reader, reader not connected\"",
"raise",
"self",
".",
"E... | https://github.com/AustinMurphy/OBD2-Scantool/blob/2a1412330b58a6eea010d724b690034dea7175c1/obd2_reader.py#L697-L710 | ||
filerock/FileRock-Client | 37214f701666e76e723595f8f9ed238a42f6eb06 | filerockclient/config.py | python | ConfigManager.get | (self, section, option, raw=False, vars=None) | return ConfigParser.SafeConfigParser.get(
self, section, option, raw=raw, vars=vars) | Overrides the class get method, returns PROXY_PORT if server_port
or linking_port are asked and proxy support is enabled.
Note: all getX() methods are affected by this override. | Overrides the class get method, returns PROXY_PORT if server_port
or linking_port are asked and proxy support is enabled. | [
"Overrides",
"the",
"class",
"get",
"method",
"returns",
"PROXY_PORT",
"if",
"server_port",
"or",
"linking_port",
"are",
"asked",
"and",
"proxy",
"support",
"is",
"enabled",
"."
] | def get(self, section, option, raw=False, vars=None):
"""
Overrides the class get method, returns PROXY_PORT if server_port
or linking_port are asked and proxy support is enabled.
Note: all getX() methods are affected by this override.
"""
if self._port_for_proxy(section... | [
"def",
"get",
"(",
"self",
",",
"section",
",",
"option",
",",
"raw",
"=",
"False",
",",
"vars",
"=",
"None",
")",
":",
"if",
"self",
".",
"_port_for_proxy",
"(",
"section",
",",
"option",
")",
":",
"return",
"PROXY_PORT",
"return",
"ConfigParser",
"."... | https://github.com/filerock/FileRock-Client/blob/37214f701666e76e723595f8f9ed238a42f6eb06/filerockclient/config.py#L312-L322 | |
facebookresearch/BLINK | 5fe254dd64d37332347edc73738edcb56096183f | elq/biencoder/biencoder.py | python | BiEncoderModule.get_raw_ctxt_encoding | (
self,
token_idx_ctxt,
segment_idx_ctxt,
mask_ctxt,
) | return raw_ctxt_encoding | Gets raw, shared context embeddings from BERT,
to be used by both mention detector and entity linker
Returns:
torch.FloatTensor (bsz, seqlen, embed_dim) | Gets raw, shared context embeddings from BERT,
to be used by both mention detector and entity linker | [
"Gets",
"raw",
"shared",
"context",
"embeddings",
"from",
"BERT",
"to",
"be",
"used",
"by",
"both",
"mention",
"detector",
"and",
"entity",
"linker"
] | def get_raw_ctxt_encoding(
self,
token_idx_ctxt,
segment_idx_ctxt,
mask_ctxt,
):
"""
Gets raw, shared context embeddings from BERT,
to be used by both mention detector and entity linker
Returns:
torch.FloatTensor (bsz, seqlen, embe... | [
"def",
"get_raw_ctxt_encoding",
"(",
"self",
",",
"token_idx_ctxt",
",",
"segment_idx_ctxt",
",",
"mask_ctxt",
",",
")",
":",
"raw_ctxt_encoding",
",",
"_",
",",
"_",
"=",
"self",
".",
"context_encoder",
".",
"bert_model",
"(",
"token_idx_ctxt",
",",
"segment_id... | https://github.com/facebookresearch/BLINK/blob/5fe254dd64d37332347edc73738edcb56096183f/elq/biencoder/biencoder.py#L273-L289 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/numpy-1.16.0-py3.7-macosx-10.9-x86_64.egg/numpy/polynomial/chebyshev.py | python | _zseries_to_cseries | (zs) | return c | Covert z-series to a Chebyshev series.
Covert a z series to the equivalent Chebyshev series. The result is
never an empty array. The dtype of the return is the same as that of
the input. No checks are run on the arguments as this routine is for
internal use.
Parameters
----------
zs : 1-D ... | Covert z-series to a Chebyshev series. | [
"Covert",
"z",
"-",
"series",
"to",
"a",
"Chebyshev",
"series",
"."
] | def _zseries_to_cseries(zs):
"""Covert z-series to a Chebyshev series.
Covert a z series to the equivalent Chebyshev series. The result is
never an empty array. The dtype of the return is the same as that of
the input. No checks are run on the arguments as this routine is for
internal use.
Par... | [
"def",
"_zseries_to_cseries",
"(",
"zs",
")",
":",
"n",
"=",
"(",
"zs",
".",
"size",
"+",
"1",
")",
"//",
"2",
"c",
"=",
"zs",
"[",
"n",
"-",
"1",
":",
"]",
".",
"copy",
"(",
")",
"c",
"[",
"1",
":",
"n",
"]",
"*=",
"2",
"return",
"c"
] | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/numpy-1.16.0-py3.7-macosx-10.9-x86_64.egg/numpy/polynomial/chebyshev.py#L141-L163 | |
FederatedAI/FATE | 32540492623568ecd1afcb367360133616e02fa3 | python/federatedml/ensemble/boosting/hetero/hetero_secureboost_guest.py | python | HeteroSecureBoostingTreeGuest.predict | (self, data_inst, ret_format='std') | [] | def predict(self, data_inst, ret_format='std'):
# standard format, leaf indices, raw score
assert ret_format in ['std', 'leaf', 'raw'], 'illegal ret format'
LOGGER.info('running prediction')
cache_dataset_key = self.predict_data_cache.get_data_key(data_inst)
processed_data = s... | [
"def",
"predict",
"(",
"self",
",",
"data_inst",
",",
"ret_format",
"=",
"'std'",
")",
":",
"# standard format, leaf indices, raw score",
"assert",
"ret_format",
"in",
"[",
"'std'",
",",
"'leaf'",
",",
"'raw'",
"]",
",",
"'illegal ret format'",
"LOGGER",
".",
"i... | https://github.com/FederatedAI/FATE/blob/32540492623568ecd1afcb367360133616e02fa3/python/federatedml/ensemble/boosting/hetero/hetero_secureboost_guest.py#L344-L393 | ||||
missionpinball/mpf | 8e6b74cff4ba06d2fec9445742559c1068b88582 | mpf/modes/credits/code/credits.py | python | Credits._control_coin_inhibit | (self) | Physically prevent or allow a player to insert coins depending on our state. | Physically prevent or allow a player to insert coins depending on our state. | [
"Physically",
"prevent",
"or",
"allow",
"a",
"player",
"to",
"insert",
"coins",
"depending",
"on",
"our",
"state",
"."
] | def _control_coin_inhibit(self):
"""Physically prevent or allow a player to insert coins depending on our state."""
if self.credits_config['coin_inhibit_disable_output']:
if not self.machine.settings.get_setting_value('free_play') and \
self._get_credit_units() < self.cre... | [
"def",
"_control_coin_inhibit",
"(",
"self",
")",
":",
"if",
"self",
".",
"credits_config",
"[",
"'coin_inhibit_disable_output'",
"]",
":",
"if",
"not",
"self",
".",
"machine",
".",
"settings",
".",
"get_setting_value",
"(",
"'free_play'",
")",
"and",
"self",
... | https://github.com/missionpinball/mpf/blob/8e6b74cff4ba06d2fec9445742559c1068b88582/mpf/modes/credits/code/credits.py#L149-L156 | ||
joschabach/micropsi2 | 74a2642d20da9da1d64acc5e4c11aeabee192a27 | micropsi_core/runtime.py | python | get_nodenet | (nodenet_uid) | return nodenets[nodenet_uid] | Returns the nodenet with the given uid, and loads into memory if necessary.
Returns None if nodenet does not exist | Returns the nodenet with the given uid, and loads into memory if necessary.
Returns None if nodenet does not exist | [
"Returns",
"the",
"nodenet",
"with",
"the",
"given",
"uid",
"and",
"loads",
"into",
"memory",
"if",
"necessary",
".",
"Returns",
"None",
"if",
"nodenet",
"does",
"not",
"exist"
] | def get_nodenet(nodenet_uid):
"""Returns the nodenet with the given uid, and loads into memory if necessary.
Returns None if nodenet does not exist"""
if nodenet_uid not in nodenets:
if nodenet_uid in get_available_nodenets():
load_nodenet(nodenet_uid)
else:
raise Ke... | [
"def",
"get_nodenet",
"(",
"nodenet_uid",
")",
":",
"if",
"nodenet_uid",
"not",
"in",
"nodenets",
":",
"if",
"nodenet_uid",
"in",
"get_available_nodenets",
"(",
")",
":",
"load_nodenet",
"(",
"nodenet_uid",
")",
"else",
":",
"raise",
"KeyError",
"(",
"\"Unknow... | https://github.com/joschabach/micropsi2/blob/74a2642d20da9da1d64acc5e4c11aeabee192a27/micropsi_core/runtime.py#L294-L303 | |
Nihilate/Roboragi | be8d2164383953f1466b22b64eda4ad2db7189e4 | roboragi/DatabaseHandler.py | python | addComment | (commentid, requester, subreddit, hadRequest) | Adds a comment to the "already seen" database. Also handles submissions,
which have a similar ID structure. | Adds a comment to the "already seen" database. Also handles submissions,
which have a similar ID structure. | [
"Adds",
"a",
"comment",
"to",
"the",
"already",
"seen",
"database",
".",
"Also",
"handles",
"submissions",
"which",
"have",
"a",
"similar",
"ID",
"structure",
"."
] | def addComment(commentid, requester, subreddit, hadRequest):
"""
Adds a comment to the "already seen" database. Also handles submissions,
which have a similar ID structure.
"""
query = """
INSERT INTO comments (commentid, requester, subreddit, hadRequest)
VALUES (%s, %s, %s, %s);
"""
... | [
"def",
"addComment",
"(",
"commentid",
",",
"requester",
",",
"subreddit",
",",
"hadRequest",
")",
":",
"query",
"=",
"\"\"\"\n INSERT INTO comments (commentid, requester, subreddit, hadRequest)\n VALUES (%s, %s, %s, %s);\n \"\"\"",
"values",
"=",
"(",
"commentid",
","... | https://github.com/Nihilate/Roboragi/blob/be8d2164383953f1466b22b64eda4ad2db7189e4/roboragi/DatabaseHandler.py#L117-L137 | ||
IBM/lale | b4d6829c143a4735b06083a0e6c70d2cca244162 | lale/lib/autoai_libs/numpy_replace_missing_values.py | python | _NumpyReplaceMissingValuesImpl.fit | (self, X, y=None) | return self | [] | def fit(self, X, y=None):
self._wrapped_model.fit(X, y)
return self | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
")",
":",
"self",
".",
"_wrapped_model",
".",
"fit",
"(",
"X",
",",
"y",
")",
"return",
"self"
] | https://github.com/IBM/lale/blob/b4d6829c143a4735b06083a0e6c70d2cca244162/lale/lib/autoai_libs/numpy_replace_missing_values.py#L34-L36 | |||
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-linux/x64/tornado/template.py | python | _TemplateReader.consume | (self, count: int = None) | return s | [] | def consume(self, count: int = None) -> str:
if count is None:
count = len(self.text) - self.pos
newpos = self.pos + count
self.line += self.text.count("\n", self.pos, newpos)
s = self.text[self.pos : newpos]
self.pos = newpos
return s | [
"def",
"consume",
"(",
"self",
",",
"count",
":",
"int",
"=",
"None",
")",
"->",
"str",
":",
"if",
"count",
"is",
"None",
":",
"count",
"=",
"len",
"(",
"self",
".",
"text",
")",
"-",
"self",
".",
"pos",
"newpos",
"=",
"self",
".",
"pos",
"+",
... | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-linux/x64/tornado/template.py#L799-L806 | |||
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/telnetlib.py | python | Telnet.read_sb_data | (self) | return buf | Return any data available in the SB ... SE queue.
Return '' if no SB ... SE available. Should only be called
after seeing a SB or SE command. When a new SB command is
found, old unread SB data will be discarded. Don't block. | Return any data available in the SB ... SE queue. | [
"Return",
"any",
"data",
"available",
"in",
"the",
"SB",
"...",
"SE",
"queue",
"."
] | def read_sb_data(self):
"""Return any data available in the SB ... SE queue.
Return '' if no SB ... SE available. Should only be called
after seeing a SB or SE command. When a new SB command is
found, old unread SB data will be discarded. Don't block.
"""
buf = self.sbd... | [
"def",
"read_sb_data",
"(",
"self",
")",
":",
"buf",
"=",
"self",
".",
"sbdataq",
"self",
".",
"sbdataq",
"=",
"''",
"return",
"buf"
] | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/telnetlib.py#L398-L408 | |
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/apps/export/views/utils.py | python | ODataFeedMixin.page_context | (self) | return context | [] | def page_context(self):
context = super(ODataFeedMixin, self).page_context
context['format_options'] = ["odata"]
return context | [
"def",
"page_context",
"(",
"self",
")",
":",
"context",
"=",
"super",
"(",
"ODataFeedMixin",
",",
"self",
")",
".",
"page_context",
"context",
"[",
"'format_options'",
"]",
"=",
"[",
"\"odata\"",
"]",
"return",
"context"
] | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/export/views/utils.py#L233-L236 | |||
tribe29/checkmk | 6260f2512e159e311f426e16b84b19d0b8e9ad0c | cmk/base/plugins/agent_based/cisco_mem_asa.py | python | _idem_check_cisco_mem | (
value_store: MutableMapping[str, Any],
item: str,
params: Mapping[str, Any],
section: Section,
) | >>> vs = {}
>>> for result in _idem_check_cisco_mem(
... vs,
... "MEMPOOL_DMA",
... {
... 'trend_perfdata': True,
... 'trend_range': 24,
... 'trend_showtimeleft': True,
... 'trend_timeleft': (12, 6)},
... ... | >>> vs = {}
>>> for result in _idem_check_cisco_mem(
... vs,
... "MEMPOOL_DMA",
... {
... 'trend_perfdata': True,
... 'trend_range': 24,
... 'trend_showtimeleft': True,
... 'trend_timeleft': (12, 6)},
... ... | [
">>>",
"vs",
"=",
"{}",
">>>",
"for",
"result",
"in",
"_idem_check_cisco_mem",
"(",
"...",
"vs",
"...",
"MEMPOOL_DMA",
"...",
"{",
"...",
"trend_perfdata",
":",
"True",
"...",
"trend_range",
":",
"24",
"...",
"trend_showtimeleft",
":",
"True",
"...",
"trend_... | def _idem_check_cisco_mem(
value_store: MutableMapping[str, Any],
item: str,
params: Mapping[str, Any],
section: Section,
) -> CheckResult:
"""
>>> vs = {}
>>> for result in _idem_check_cisco_mem(
... vs,
... "MEMPOOL_DMA",
... {
... 'trend... | [
"def",
"_idem_check_cisco_mem",
"(",
"value_store",
":",
"MutableMapping",
"[",
"str",
",",
"Any",
"]",
",",
"item",
":",
"str",
",",
"params",
":",
"Mapping",
"[",
"str",
",",
"Any",
"]",
",",
"section",
":",
"Section",
",",
")",
"->",
"CheckResult",
... | https://github.com/tribe29/checkmk/blob/6260f2512e159e311f426e16b84b19d0b8e9ad0c/cmk/base/plugins/agent_based/cisco_mem_asa.py#L144-L187 | ||
gpodder/mygpo | 7a028ad621d05d4ca0d58fd22fb92656c8835e43 | mygpo/web/templatetags/flickr.py | python | is_flickr_photo | (url) | return flickr.is_flickr_image(url) | [] | def is_flickr_photo(url):
return flickr.is_flickr_image(url) | [
"def",
"is_flickr_photo",
"(",
"url",
")",
":",
"return",
"flickr",
".",
"is_flickr_image",
"(",
"url",
")"
] | https://github.com/gpodder/mygpo/blob/7a028ad621d05d4ca0d58fd22fb92656c8835e43/mygpo/web/templatetags/flickr.py#L11-L12 | |||
out0fmemory/GoAgent-Always-Available | c4254984fea633ce3d1893fe5901debd9f22c2a9 | server/lib/google/appengine/api/appinfo.py | python | URLMap.AssertUniqueContentType | (self) | Makes sure that self.http_headers is consistent with self.mime_type.
Assumes self is a static handler i.e. either self.static_dir or
self.static_files is set (to not None).
Raises:
appinfo_errors.ContentTypeSpecifiedMultipleTimes: Raised when
self.http_headers contains a Content-Type header,... | Makes sure that self.http_headers is consistent with self.mime_type. | [
"Makes",
"sure",
"that",
"self",
".",
"http_headers",
"is",
"consistent",
"with",
"self",
".",
"mime_type",
"."
] | def AssertUniqueContentType(self):
"""Makes sure that self.http_headers is consistent with self.mime_type.
Assumes self is a static handler i.e. either self.static_dir or
self.static_files is set (to not None).
Raises:
appinfo_errors.ContentTypeSpecifiedMultipleTimes: Raised when
self.ht... | [
"def",
"AssertUniqueContentType",
"(",
"self",
")",
":",
"used_both_fields",
"=",
"self",
".",
"mime_type",
"and",
"self",
".",
"http_headers",
"if",
"not",
"used_both_fields",
":",
"return",
"content_type",
"=",
"self",
".",
"http_headers",
".",
"Get",
"(",
"... | https://github.com/out0fmemory/GoAgent-Always-Available/blob/c4254984fea633ce3d1893fe5901debd9f22c2a9/server/lib/google/appengine/api/appinfo.py#L1062-L1092 | ||
learningequality/ka-lite | 571918ea668013dcf022286ea85eff1c5333fb8b | kalite/topic_tools/content_models.py | python | create | (item, **kwargs) | Wrapper around create that allows us to specify a database
and also parse the model data to compress extra fields.
:param item: A dictionary containing content metadata for one node.
:return Item | Wrapper around create that allows us to specify a database
and also parse the model data to compress extra fields.
:param item: A dictionary containing content metadata for one node.
:return Item | [
"Wrapper",
"around",
"create",
"that",
"allows",
"us",
"to",
"specify",
"a",
"database",
"and",
"also",
"parse",
"the",
"model",
"data",
"to",
"compress",
"extra",
"fields",
".",
":",
"param",
"item",
":",
"A",
"dictionary",
"containing",
"content",
"metadat... | def create(item, **kwargs):
"""
Wrapper around create that allows us to specify a database
and also parse the model data to compress extra fields.
:param item: A dictionary containing content metadata for one node.
:return Item
"""
if item:
return Item.create(**parse_model_data(item)... | [
"def",
"create",
"(",
"item",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"item",
":",
"return",
"Item",
".",
"create",
"(",
"*",
"*",
"parse_model_data",
"(",
"item",
")",
")"
] | https://github.com/learningequality/ka-lite/blob/571918ea668013dcf022286ea85eff1c5333fb8b/kalite/topic_tools/content_models.py#L527-L535 | ||
ucsb-seclab/leakless | 94c01b4b67b870b7fbe45a257f28498f5f4762d6 | rangeset.py | python | RangeSet.max | (self) | return self.ends[-1][0] | [] | def max(self):
return self.ends[-1][0] | [
"def",
"max",
"(",
"self",
")",
":",
"return",
"self",
".",
"ends",
"[",
"-",
"1",
"]",
"[",
"0",
"]"
] | https://github.com/ucsb-seclab/leakless/blob/94c01b4b67b870b7fbe45a257f28498f5f4762d6/rangeset.py#L288-L289 | |||
missionpinball/mpf | 8e6b74cff4ba06d2fec9445742559c1068b88582 | mpf/core/segment_mappings.py | python | FourteenSegments.get_apc_encoding | (self) | return bytes([
(self.dp << 7) | (self.g1 << 6) | (self.f << 5) | (self.e << 4) | (self.a << 3) | (self.b << 2) |
(self.c << 1) | self.d,
(self.l << 7) | (self.dp << 6) | (self.n << 5) | (self.m << 4) | (self.k << 3) | (self.g2 << 2) |
(self.h << 1) | self.j]) | Return segment in d, c, b, a, e, f, g, comma + j, h, m, k, p, r, dp, n order. | Return segment in d, c, b, a, e, f, g, comma + j, h, m, k, p, r, dp, n order. | [
"Return",
"segment",
"in",
"d",
"c",
"b",
"a",
"e",
"f",
"g",
"comma",
"+",
"j",
"h",
"m",
"k",
"p",
"r",
"dp",
"n",
"order",
"."
] | def get_apc_encoding(self) -> bytes:
"""Return segment in d, c, b, a, e, f, g, comma + j, h, m, k, p, r, dp, n order."""
return bytes([
(self.dp << 7) | (self.g1 << 6) | (self.f << 5) | (self.e << 4) | (self.a << 3) | (self.b << 2) |
(self.c << 1) | self.d,
(self.l <<... | [
"def",
"get_apc_encoding",
"(",
"self",
")",
"->",
"bytes",
":",
"return",
"bytes",
"(",
"[",
"(",
"self",
".",
"dp",
"<<",
"7",
")",
"|",
"(",
"self",
".",
"g1",
"<<",
"6",
")",
"|",
"(",
"self",
".",
"f",
"<<",
"5",
")",
"|",
"(",
"self",
... | https://github.com/missionpinball/mpf/blob/8e6b74cff4ba06d2fec9445742559c1068b88582/mpf/core/segment_mappings.py#L491-L497 | |
LumaPictures/pymel | fa88a3f4fa18e09bb8aa9bdf4dab53d984bada72 | pymel/util/mathutils.py | python | linstep | (min, max, x) | return linmap(min, max, x) | Returns the value of a linear step function.
Returns 0 if x < min, 1 if x > max, and performs a linear
interpolation between 0 and 1 in the interval min to max.
:rtype: float | Returns the value of a linear step function. | [
"Returns",
"the",
"value",
"of",
"a",
"linear",
"step",
"function",
"."
] | def linstep(min, max, x):
# type: (Any, Any, Any) -> float
"""Returns the value of a linear step function.
Returns 0 if x < min, 1 if x > max, and performs a linear
interpolation between 0 and 1 in the interval min to max.
:rtype: float
"""
if x < min:
return 0.0
if x > max:
... | [
"def",
"linstep",
"(",
"min",
",",
"max",
",",
"x",
")",
":",
"# type: (Any, Any, Any) -> float",
"if",
"x",
"<",
"min",
":",
"return",
"0.0",
"if",
"x",
">",
"max",
":",
"return",
"1.0",
"return",
"linmap",
"(",
"min",
",",
"max",
",",
"x",
")"
] | https://github.com/LumaPictures/pymel/blob/fa88a3f4fa18e09bb8aa9bdf4dab53d984bada72/pymel/util/mathutils.py#L125-L138 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.