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
numba/numba
bf480b9e0da858a65508c2b17759a72ee6a44c51
numba/cpython/mathimpl.py
python
isinf_float_impl
(context, builder, sig, args)
return impl_ret_untracked(context, builder, sig.return_type, res)
[]
def isinf_float_impl(context, builder, sig, args): [val] = args res = is_inf(builder, val) return impl_ret_untracked(context, builder, sig.return_type, res)
[ "def", "isinf_float_impl", "(", "context", ",", "builder", ",", "sig", ",", "args", ")", ":", "[", "val", "]", "=", "args", "res", "=", "is_inf", "(", "builder", ",", "val", ")", "return", "impl_ret_untracked", "(", "context", ",", "builder", ",", "sig...
https://github.com/numba/numba/blob/bf480b9e0da858a65508c2b17759a72ee6a44c51/numba/cpython/mathimpl.py#L226-L229
DataDog/integrations-core
934674b29d94b70ccc008f76ea172d0cdae05e1e
datadog_cluster_agent/datadog_checks/datadog_cluster_agent/config_models/defaults.py
python
instance_send_distribution_buckets
(field, value)
return False
[]
def instance_send_distribution_buckets(field, value): return False
[ "def", "instance_send_distribution_buckets", "(", "field", ",", "value", ")", ":", "return", "False" ]
https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/datadog_cluster_agent/datadog_checks/datadog_cluster_agent/config_models/defaults.py#L189-L190
researchmm/tasn
5dba8ccc096cedc63913730eeea14a9647911129
tasn-mxnet/3rdparty/tvm/python/tvm/rpc/proxy.py
python
ForwardHandler.on_start
(self)
Event when the initialization is completed
Event when the initialization is completed
[ "Event", "when", "the", "initialization", "is", "completed" ]
def on_start(self): """Event when the initialization is completed""" self._proxy.handler_ready(self)
[ "def", "on_start", "(", "self", ")", ":", "self", ".", "_proxy", ".", "handler_ready", "(", "self", ")" ]
https://github.com/researchmm/tasn/blob/5dba8ccc096cedc63913730eeea14a9647911129/tasn-mxnet/3rdparty/tvm/python/tvm/rpc/proxy.py#L80-L82
lightforever/mlcomp
c78fdb77ec9c4ec8ff11beea50b90cab20903ad9
mlcomp/server/back/create_dags/standard.py
python
DagStandardBuilder.create_providers
(self)
[]
def create_providers(self): self.log_info('create_providers') self.provider = TaskProvider(self.session) self.report_provider = ReportProvider(self.session) self.report_tasks_provider = ReportTasksProvider(self.session) self.report_layout_provider = ReportLayoutProvider(self.ses...
[ "def", "create_providers", "(", "self", ")", ":", "self", ".", "log_info", "(", "'create_providers'", ")", "self", ".", "provider", "=", "TaskProvider", "(", "self", ".", "session", ")", "self", ".", "report_provider", "=", "ReportProvider", "(", "self", "."...
https://github.com/lightforever/mlcomp/blob/c78fdb77ec9c4ec8ff11beea50b90cab20903ad9/mlcomp/server/back/create_dags/standard.py#L69-L80
brython-dev/brython
9cba5fb7f43a9b52fff13e89b403e02a1dfaa5f3
www/src/Lib/email/_header_value_parser.py
python
get_address_list
(value)
return address_list, value
address_list = (address *("," address)) / obs-addr-list obs-addr-list = *([CFWS] ",") address *("," [address / CFWS]) We depart from the formal grammar here by continuing to parse until the end of the input, assuming the input to be entirely composed of an address-list. This is always true in emai...
address_list = (address *("," address)) / obs-addr-list obs-addr-list = *([CFWS] ",") address *("," [address / CFWS])
[ "address_list", "=", "(", "address", "*", "(", "address", "))", "/", "obs", "-", "addr", "-", "list", "obs", "-", "addr", "-", "list", "=", "*", "(", "[", "CFWS", "]", ")", "address", "*", "(", "[", "address", "/", "CFWS", "]", ")" ]
def get_address_list(value): """ address_list = (address *("," address)) / obs-addr-list obs-addr-list = *([CFWS] ",") address *("," [address / CFWS]) We depart from the formal grammar here by continuing to parse until the end of the input, assuming the input to be entirely composed of an addre...
[ "def", "get_address_list", "(", "value", ")", ":", "address_list", "=", "AddressList", "(", ")", "while", "value", ":", "try", ":", "token", ",", "value", "=", "get_address", "(", "value", ")", "address_list", ".", "append", "(", "token", ")", "except", ...
https://github.com/brython-dev/brython/blob/9cba5fb7f43a9b52fff13e89b403e02a1dfaa5f3/www/src/Lib/email/_header_value_parser.py#L1975-L2027
blawar/nut
2cf351400418399a70164987e28670309f6c9cb5
Server/Controller/Api.py
python
getInfo
(request, response)
[]
def getInfo(request, response): try: response.headers['Content-Type'] = 'application/json' nsp = Nsps.getByTitleId(request.bits[2]) t = Titles.get(request.bits[2]).__dict__ t['size'] = nsp.getFileSize() t['mtime'] = nsp.getFileModified() response.write(json.dumps(t)) except BaseException as e: response....
[ "def", "getInfo", "(", "request", ",", "response", ")", ":", "try", ":", "response", ".", "headers", "[", "'Content-Type'", "]", "=", "'application/json'", "nsp", "=", "Nsps", ".", "getByTitleId", "(", "request", ".", "bits", "[", "2", "]", ")", "t", "...
https://github.com/blawar/nut/blob/2cf351400418399a70164987e28670309f6c9cb5/Server/Controller/Api.py#L255-L264
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/twisted/twisted/application/app.py
python
HotshotRunner.run
(self, reactor)
Run reactor under the hotshot profiler.
Run reactor under the hotshot profiler.
[ "Run", "reactor", "under", "the", "hotshot", "profiler", "." ]
def run(self, reactor): """ Run reactor under the hotshot profiler. """ try: import hotshot.stats except (ImportError, SystemExit), e: # Certain versions of Debian (and Debian derivatives) raise # SystemExit when importing hotshot if the "non-f...
[ "def", "run", "(", "self", ",", "reactor", ")", ":", "try", ":", "import", "hotshot", ".", "stats", "except", "(", "ImportError", ",", "SystemExit", ")", ",", "e", ":", "# Certain versions of Debian (and Debian derivatives) raise", "# SystemExit when importing hotshot...
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/twisted/twisted/application/app.py#L88-L130
tobegit3hub/deep_image_model
8a53edecd9e00678b278bb10f6fb4bdb1e4ee25e
java_predict_client/src/main/proto/tensorflow/python/framework/ops.py
python
Graph._as_graph_element_locked
(self, obj, allow_tensor, allow_operation)
See `Graph.as_graph_element()` for details.
See `Graph.as_graph_element()` for details.
[ "See", "Graph", ".", "as_graph_element", "()", "for", "details", "." ]
def _as_graph_element_locked(self, obj, allow_tensor, allow_operation): """See `Graph.as_graph_element()` for details.""" # The vast majority of this function is figuring # out what an API user might be doing wrong, so # that we can give helpful error messages. # # Ideally, it would be nice to s...
[ "def", "_as_graph_element_locked", "(", "self", ",", "obj", ",", "allow_tensor", ",", "allow_operation", ")", ":", "# The vast majority of this function is figuring", "# out what an API user might be doing wrong, so", "# that we can give helpful error messages.", "#", "# Ideally, it ...
https://github.com/tobegit3hub/deep_image_model/blob/8a53edecd9e00678b278bb10f6fb4bdb1e4ee25e/java_predict_client/src/main/proto/tensorflow/python/framework/ops.py#L2318-L2405
smart-mobile-software/gitstack
d9fee8f414f202143eb6e620529e8e5539a2af56
python/Lib/distutils/dist.py
python
Distribution._set_command_options
(self, command_obj, option_dict=None)
Set the options for 'command_obj' from 'option_dict'. Basically this means copying elements of a dictionary ('option_dict') to attributes of an instance ('command'). 'command_obj' must be a Command instance. If 'option_dict' is not supplied, uses the standard option dictionary for thi...
Set the options for 'command_obj' from 'option_dict'. Basically this means copying elements of a dictionary ('option_dict') to attributes of an instance ('command').
[ "Set", "the", "options", "for", "command_obj", "from", "option_dict", ".", "Basically", "this", "means", "copying", "elements", "of", "a", "dictionary", "(", "option_dict", ")", "to", "attributes", "of", "an", "instance", "(", "command", ")", "." ]
def _set_command_options(self, command_obj, option_dict=None): """Set the options for 'command_obj' from 'option_dict'. Basically this means copying elements of a dictionary ('option_dict') to attributes of an instance ('command'). 'command_obj' must be a Command instance. If 'option_...
[ "def", "_set_command_options", "(", "self", ",", "command_obj", ",", "option_dict", "=", "None", ")", ":", "command_name", "=", "command_obj", ".", "get_command_name", "(", ")", "if", "option_dict", "is", "None", ":", "option_dict", "=", "self", ".", "get_opti...
https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/distutils/dist.py#L860-L901
kuri65536/python-for-android
26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891
python-modules/twisted/twisted/internet/interfaces.py
python
IResolver.lookupAuthority
(name, timeout = 10)
Lookup the SOA records associated with C{name}.
Lookup the SOA records associated with C{name}.
[ "Lookup", "the", "SOA", "records", "associated", "with", "C", "{", "name", "}", "." ]
def lookupAuthority(name, timeout = 10): """ Lookup the SOA records associated with C{name}. """
[ "def", "lookupAuthority", "(", "name", ",", "timeout", "=", "10", ")", ":" ]
https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python-modules/twisted/twisted/internet/interfaces.py#L141-L144
allenai/allennlp
a3d71254fcc0f3615910e9c3d48874515edf53e0
allennlp/models/model.py
python
remove_pretrained_embedding_params
(params: Params)
This function only exists for backwards compatibility. Please use `remove_weights_related_keys_from_params()` instead.
This function only exists for backwards compatibility. Please use `remove_weights_related_keys_from_params()` instead.
[ "This", "function", "only", "exists", "for", "backwards", "compatibility", ".", "Please", "use", "remove_weights_related_keys_from_params", "()", "instead", "." ]
def remove_pretrained_embedding_params(params: Params): """This function only exists for backwards compatibility. Please use `remove_weights_related_keys_from_params()` instead.""" remove_keys_from_params(params, ["pretrained_file"])
[ "def", "remove_pretrained_embedding_params", "(", "params", ":", "Params", ")", ":", "remove_keys_from_params", "(", "params", ",", "[", "\"pretrained_file\"", "]", ")" ]
https://github.com/allenai/allennlp/blob/a3d71254fcc0f3615910e9c3d48874515edf53e0/allennlp/models/model.py#L500-L503
joxeankoret/nightmare
11b22bb7c346611de90f479ee781c9228af453ea
runtime/diff_match_patch.py
python
diff_match_patch.diff_toDelta
(self, diffs)
return "\t".join(text)
Crush the diff into an encoded string which describes the operations required to transform text1 into text2. E.g. =3\t-2\t+ing -> Keep 3 chars, delete 2 chars, insert 'ing'. Operations are tab-separated. Inserted text is escaped using %xx notation. Args: diffs: Array of diff tuples. Return...
Crush the diff into an encoded string which describes the operations required to transform text1 into text2. E.g. =3\t-2\t+ing -> Keep 3 chars, delete 2 chars, insert 'ing'. Operations are tab-separated. Inserted text is escaped using %xx notation.
[ "Crush", "the", "diff", "into", "an", "encoded", "string", "which", "describes", "the", "operations", "required", "to", "transform", "text1", "into", "text2", ".", "E", ".", "g", ".", "=", "3", "\\", "t", "-", "2", "\\", "t", "+", "ing", "-", ">", ...
def diff_toDelta(self, diffs): """Crush the diff into an encoded string which describes the operations required to transform text1 into text2. E.g. =3\t-2\t+ing -> Keep 3 chars, delete 2 chars, insert 'ing'. Operations are tab-separated. Inserted text is escaped using %xx notation. Args: di...
[ "def", "diff_toDelta", "(", "self", ",", "diffs", ")", ":", "text", "=", "[", "]", "for", "(", "op", ",", "data", ")", "in", "diffs", ":", "if", "op", "==", "self", ".", "DIFF_INSERT", ":", "# High ascii will raise UnicodeDecodeError. Use Unicode instead.", ...
https://github.com/joxeankoret/nightmare/blob/11b22bb7c346611de90f479ee781c9228af453ea/runtime/diff_match_patch.py#L1138-L1160
bnpy/bnpy
d5b311e8f58ccd98477f4a0c8a4d4982e3fca424
bnpy/allocmodel/topics/OptimizerRhoOmega.py
python
kvec
(K)
Obtain descending vector of [K, K-1, ... 1] Returns -------- kvec : 1D array, size K
Obtain descending vector of [K, K-1, ... 1]
[ "Obtain", "descending", "vector", "of", "[", "K", "K", "-", "1", "...", "1", "]" ]
def kvec(K): ''' Obtain descending vector of [K, K-1, ... 1] Returns -------- kvec : 1D array, size K ''' try: return kvecCache[K] except KeyError as e: kvec = K + 1 - np.arange(1, K + 1) kvecCache[K] = kvec return kvec
[ "def", "kvec", "(", "K", ")", ":", "try", ":", "return", "kvecCache", "[", "K", "]", "except", "KeyError", "as", "e", ":", "kvec", "=", "K", "+", "1", "-", "np", ".", "arange", "(", "1", ",", "K", "+", "1", ")", "kvecCache", "[", "K", "]", ...
https://github.com/bnpy/bnpy/blob/d5b311e8f58ccd98477f4a0c8a4d4982e3fca424/bnpy/allocmodel/topics/OptimizerRhoOmega.py#L349-L361
Bogdanp/molten
a49fd32a470f8d3c0d7f94a62bd86597d86d7c2f
molten/http/headers.py
python
Headers.get_all
(self, header: str)
return self._headers[header.lower()]
Get all the values for a given header.
Get all the values for a given header.
[ "Get", "all", "the", "values", "for", "a", "given", "header", "." ]
def get_all(self, header: str) -> List[str]: """Get all the values for a given header. """ return self._headers[header.lower()]
[ "def", "get_all", "(", "self", ",", "header", ":", "str", ")", "->", "List", "[", "str", "]", ":", "return", "self", ".", "_headers", "[", "header", ".", "lower", "(", ")", "]" ]
https://github.com/Bogdanp/molten/blob/a49fd32a470f8d3c0d7f94a62bd86597d86d7c2f/molten/http/headers.py#L77-L80
EnableSecurity/wafw00f
3257c48d45ffb2f6504629aa3c5d529f1b886c1b
wafw00f/plugins/shieldon.py
python
is_waf
(self)
return False
[]
def is_waf(self): captcha = [ self.matchContent('Please solve CAPTCHA'), self.matchContent('shieldon_captcha'), self.matchContent('Unusual behavior detected'), self.matchContent('status-user-info'), ] if all(i for i in captcha): return True ip_banned = [ ...
[ "def", "is_waf", "(", "self", ")", ":", "captcha", "=", "[", "self", ".", "matchContent", "(", "'Please solve CAPTCHA'", ")", ",", "self", ".", "matchContent", "(", "'shieldon_captcha'", ")", ",", "self", ".", "matchContent", "(", "'Unusual behavior detected'", ...
https://github.com/EnableSecurity/wafw00f/blob/3257c48d45ffb2f6504629aa3c5d529f1b886c1b/wafw00f/plugins/shieldon.py#L10-L45
learningequality/ka-lite
571918ea668013dcf022286ea85eff1c5333fb8b
kalite/packages/bundled/django/contrib/messages/storage/base.py
python
BaseStorage.add
(self, level, message, extra_tags='')
Queues a message to be stored. The message is only queued if it contained something and its level is not less than the recording level (``self.level``).
Queues a message to be stored.
[ "Queues", "a", "message", "to", "be", "stored", "." ]
def add(self, level, message, extra_tags=''): """ Queues a message to be stored. The message is only queued if it contained something and its level is not less than the recording level (``self.level``). """ if not message: return # Check that the mess...
[ "def", "add", "(", "self", ",", "level", ",", "message", ",", "extra_tags", "=", "''", ")", ":", "if", "not", "message", ":", "return", "# Check that the message level is not less than the recording level.", "level", "=", "int", "(", "level", ")", "if", "level",...
https://github.com/learningequality/ka-lite/blob/571918ea668013dcf022286ea85eff1c5333fb8b/kalite/packages/bundled/django/contrib/messages/storage/base.py#L143-L159
pymedusa/Medusa
1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38
ext/github/Repository.py
python
Repository.get_key
(self, id)
return github.RepositoryKey.RepositoryKey( self._requester, headers, data, completed=True )
:calls: `GET /repos/:owner/:repo/keys/:id <http://developer.github.com/v3/repos/keys>`_ :param id: integer :rtype: :class:`github.RepositoryKey.RepositoryKey`
:calls: `GET /repos/:owner/:repo/keys/:id <http://developer.github.com/v3/repos/keys>`_ :param id: integer :rtype: :class:`github.RepositoryKey.RepositoryKey`
[ ":", "calls", ":", "GET", "/", "repos", "/", ":", "owner", "/", ":", "repo", "/", "keys", "/", ":", "id", "<http", ":", "//", "developer", ".", "github", ".", "com", "/", "v3", "/", "repos", "/", "keys", ">", "_", ":", "param", "id", ":", "in...
def get_key(self, id): """ :calls: `GET /repos/:owner/:repo/keys/:id <http://developer.github.com/v3/repos/keys>`_ :param id: integer :rtype: :class:`github.RepositoryKey.RepositoryKey` """ assert isinstance(id, six.integer_types), id headers, data = self._request...
[ "def", "get_key", "(", "self", ",", "id", ")", ":", "assert", "isinstance", "(", "id", ",", "six", ".", "integer_types", ")", ",", "id", "headers", ",", "data", "=", "self", ".", "_requester", ".", "requestJsonAndCheck", "(", "\"GET\"", ",", "self", "....
https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/github/Repository.py#L2363-L2375
VirtueSecurity/aws-extender
d123b7e1a845847709ba3a481f11996bddc68a1c
BappModules/docutils/nodes.py
python
document.set_name_id_map
(self, node, id, msgnode=None, explicit=None)
`self.nameids` maps names to IDs, while `self.nametypes` maps names to booleans representing hyperlink type (True==explicit, False==implicit). This method updates the mappings. The following state transition table shows how `self.nameids` ("ids") and `self.nametypes` ("types") change w...
`self.nameids` maps names to IDs, while `self.nametypes` maps names to booleans representing hyperlink type (True==explicit, False==implicit). This method updates the mappings.
[ "self", ".", "nameids", "maps", "names", "to", "IDs", "while", "self", ".", "nametypes", "maps", "names", "to", "booleans", "representing", "hyperlink", "type", "(", "True", "==", "explicit", "False", "==", "implicit", ")", ".", "This", "method", "updates", ...
def set_name_id_map(self, node, id, msgnode=None, explicit=None): """ `self.nameids` maps names to IDs, while `self.nametypes` maps names to booleans representing hyperlink type (True==explicit, False==implicit). This method updates the mappings. The following state transition ...
[ "def", "set_name_id_map", "(", "self", ",", "node", ",", "id", ",", "msgnode", "=", "None", ",", "explicit", "=", "None", ")", ":", "for", "name", "in", "node", "[", "'names'", "]", ":", "if", "name", "in", "self", ".", "nameids", ":", "self", ".",...
https://github.com/VirtueSecurity/aws-extender/blob/d123b7e1a845847709ba3a481f11996bddc68a1c/BappModules/docutils/nodes.py#L1296-L1333
StackStorm/st2
85ae05b73af422efd3097c9c05351f7f1cc8369e
tools/migrate_triggers_to_include_ref_count.py
python
TriggerMigrator.migrate
(self)
Will migrate all Triggers that should have ref_count to have the right ref_count.
Will migrate all Triggers that should have ref_count to have the right ref_count.
[ "Will", "migrate", "all", "Triggers", "that", "should", "have", "ref_count", "to", "have", "the", "right", "ref_count", "." ]
def migrate(self): """ Will migrate all Triggers that should have ref_count to have the right ref_count. """ trigger_dbs = self._get_trigger_with_parameters() for trigger_db in trigger_dbs: trigger_ref = trigger_db.get_reference().ref rules = self._get_rul...
[ "def", "migrate", "(", "self", ")", ":", "trigger_dbs", "=", "self", ".", "_get_trigger_with_parameters", "(", ")", "for", "trigger_db", "in", "trigger_dbs", ":", "trigger_ref", "=", "trigger_db", ".", "get_reference", "(", ")", ".", "ref", "rules", "=", "se...
https://github.com/StackStorm/st2/blob/85ae05b73af422efd3097c9c05351f7f1cc8369e/tools/migrate_triggers_to_include_ref_count.py#L49-L59
CouchPotato/CouchPotatoV1
135b3331d1b88ef645e29b76f2d4cc4a732c9232
library/imdb/utils.py
python
escape4xml
(value)
return value
Escape some chars that can't be present in a XML value.
Escape some chars that can't be present in a XML value.
[ "Escape", "some", "chars", "that", "can", "t", "be", "present", "in", "a", "XML", "value", "." ]
def escape4xml(value): """Escape some chars that can't be present in a XML value.""" if isinstance(value, int): value = str(value) value = _re_amp.sub('&amp;', value) value = value.replace('"', '&quot;').replace("'", '&apos;') value = value.replace('<', '&lt;').replace('>', '&gt;') if is...
[ "def", "escape4xml", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "int", ")", ":", "value", "=", "str", "(", "value", ")", "value", "=", "_re_amp", ".", "sub", "(", "'&amp;'", ",", "value", ")", "value", "=", "value", ".", "replac...
https://github.com/CouchPotato/CouchPotatoV1/blob/135b3331d1b88ef645e29b76f2d4cc4a732c9232/library/imdb/utils.py#L805-L814
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/pip/_vendor/webencodings/__init__.py
python
ascii_lower
(string)
return string.encode('utf8').lower().decode('utf8')
r"""Transform (only) ASCII letters to lower case: A-Z is mapped to a-z. :param string: An Unicode string. :returns: A new Unicode string. This is used for `ASCII case-insensitive <http://encoding.spec.whatwg.org/#ascii-case-insensitive>`_ matching of encoding labels. The same matching is also ...
r"""Transform (only) ASCII letters to lower case: A-Z is mapped to a-z.
[ "r", "Transform", "(", "only", ")", "ASCII", "letters", "to", "lower", "case", ":", "A", "-", "Z", "is", "mapped", "to", "a", "-", "z", "." ]
def ascii_lower(string): r"""Transform (only) ASCII letters to lower case: A-Z is mapped to a-z. :param string: An Unicode string. :returns: A new Unicode string. This is used for `ASCII case-insensitive <http://encoding.spec.whatwg.org/#ascii-case-insensitive>`_ matching of encoding labels. ...
[ "def", "ascii_lower", "(", "string", ")", ":", "# This turns out to be faster than unicode.translate()", "return", "string", ".", "encode", "(", "'utf8'", ")", ".", "lower", "(", ")", ".", "decode", "(", "'utf8'", ")" ]
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/pip/_vendor/webencodings/__init__.py#L35-L58
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/sympy/polys/rootisolation.py
python
ComplexInterval.center
(self)
return ((self.ax + self.bx)/2, (self.ay + self.by)/2)
Return the center of the complex isolating interval.
Return the center of the complex isolating interval.
[ "Return", "the", "center", "of", "the", "complex", "isolating", "interval", "." ]
def center(self): """Return the center of the complex isolating interval. """ return ((self.ax + self.bx)/2, (self.ay + self.by)/2)
[ "def", "center", "(", "self", ")", ":", "return", "(", "(", "self", ".", "ax", "+", "self", ".", "bx", ")", "/", "2", ",", "(", "self", ".", "ay", "+", "self", ".", "by", ")", "/", "2", ")" ]
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/sympy/polys/rootisolation.py#L1990-L1992
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/sympy/physics/continuum_mechanics/beam.py
python
Beam.apply_support
(self, loc, type="fixed")
This method applies support to a particular beam object. Parameters ========== loc : Sympifyable Location of point at which support is applied. type : String Determines type of Beam support applied. To apply support structure with - zero d...
This method applies support to a particular beam object.
[ "This", "method", "applies", "support", "to", "a", "particular", "beam", "object", "." ]
def apply_support(self, loc, type="fixed"): """ This method applies support to a particular beam object. Parameters ========== loc : Sympifyable Location of point at which support is applied. type : String Determines type of Beam support applied. ...
[ "def", "apply_support", "(", "self", ",", "loc", ",", "type", "=", "\"fixed\"", ")", ":", "loc", "=", "sympify", "(", "loc", ")", "self", ".", "_applied_supports", ".", "append", "(", "(", "loc", ",", "type", ")", ")", "if", "type", "==", "\"pin\"", ...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/sympy/physics/continuum_mechanics/beam.py#L323-L382
ladybug-tools/honeybee-legacy
bd62af4862fe022801fb87dbc8794fdf1dff73a9
src/Honeybee_Outdoor Comfort Analysis Recipe.py
python
checkTheInputs
()
[]
def checkTheInputs(): w = gh.GH_RuntimeMessageLevel.Warning #Unpack the viewFactorInfo. checkData25 = True try: viewFacInfoFromHive = hb_hive.visualizeFromHoneybeeHive(_viewFactorInfo)[0] testPtViewFactor, zoneSrfNames, testPtSkyView, testPtBlockedVec, testPtZoneWeights, \ t...
[ "def", "checkTheInputs", "(", ")", ":", "w", "=", "gh", ".", "GH_RuntimeMessageLevel", ".", "Warning", "#Unpack the viewFactorInfo.", "checkData25", "=", "True", "try", ":", "viewFacInfoFromHive", "=", "hb_hive", ".", "visualizeFromHoneybeeHive", "(", "_viewFactorInfo...
https://github.com/ladybug-tools/honeybee-legacy/blob/bd62af4862fe022801fb87dbc8794fdf1dff73a9/src/Honeybee_Outdoor Comfort Analysis Recipe.py#L93-L659
automl/Auto-PyTorch
06e67de5017b4cccad9398e24a3d9f0bd8176da3
autoPyTorch/pipeline/components/preprocessing/base_preprocessing.py
python
autoPyTorchPreprocessingComponent.transform
(self, X: Dict[str, Any])
Adds the fitted early_preprocessor into the 'X' dictionary and returns it. Args: X (Dict[str, Any]): 'X' dictionary Returns: (Dict[str, Any]): the updated 'X' dictionary
Adds the fitted early_preprocessor into the 'X' dictionary and returns it. Args: X (Dict[str, Any]): 'X' dictionary
[ "Adds", "the", "fitted", "early_preprocessor", "into", "the", "X", "dictionary", "and", "returns", "it", ".", "Args", ":", "X", "(", "Dict", "[", "str", "Any", "]", ")", ":", "X", "dictionary" ]
def transform(self, X: Dict[str, Any]) -> Dict[str, Any]: """ Adds the fitted early_preprocessor into the 'X' dictionary and returns it. Args: X (Dict[str, Any]): 'X' dictionary Returns: (Dict[str, Any]): the updated 'X' dictionary """ raise NotIm...
[ "def", "transform", "(", "self", ",", "X", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "raise", "NotImplementedError", "(", ")" ]
https://github.com/automl/Auto-PyTorch/blob/06e67de5017b4cccad9398e24a3d9f0bd8176da3/autoPyTorch/pipeline/components/preprocessing/base_preprocessing.py#L33-L42
JiYou/openstack
8607dd488bde0905044b303eb6e52bdea6806923
chap19/monitor/monitor/monitor/api/xmlutil.py
python
TemplateBuilder.construct
(self)
Construct a template. Called to construct a template instance, which it must return. Only called once.
Construct a template.
[ "Construct", "a", "template", "." ]
def construct(self): """Construct a template. Called to construct a template instance, which it must return. Only called once. """ raise NotImplementedError(_("subclasses must implement construct()!"))
[ "def", "construct", "(", "self", ")", ":", "raise", "NotImplementedError", "(", "_", "(", "\"subclasses must implement construct()!\"", ")", ")" ]
https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/chap19/monitor/monitor/monitor/api/xmlutil.py#L854-L861
SheffieldML/GPy
bb1bc5088671f9316bc92a46d356734e34c2d5c0
GPy/mappings/mlpext.py
python
MLPext.__init__
(self, input_dim=1, output_dim=1, hidden_dims=[3], prior=None, activation='tanh', name='mlpmap')
:param input_dim: number of input dimensions :param output_dim: number of output dimensions :param hidden_dims: list of hidden sizes of hidden layers :param prior: variance of Gaussian prior on all variables. If None, no prior is used (default: None) :param activation: choose activation ...
:param input_dim: number of input dimensions :param output_dim: number of output dimensions :param hidden_dims: list of hidden sizes of hidden layers :param prior: variance of Gaussian prior on all variables. If None, no prior is used (default: None) :param activation: choose activation ...
[ ":", "param", "input_dim", ":", "number", "of", "input", "dimensions", ":", "param", "output_dim", ":", "number", "of", "output", "dimensions", ":", "param", "hidden_dims", ":", "list", "of", "hidden", "sizes", "of", "hidden", "layers", ":", "param", "prior"...
def __init__(self, input_dim=1, output_dim=1, hidden_dims=[3], prior=None, activation='tanh', name='mlpmap'): """ :param input_dim: number of input dimensions :param output_dim: number of output dimensions :param hidden_dims: list of hidden sizes of hidden layers :param prior: v...
[ "def", "__init__", "(", "self", ",", "input_dim", "=", "1", ",", "output_dim", "=", "1", ",", "hidden_dims", "=", "[", "3", "]", ",", "prior", "=", "None", ",", "activation", "=", "'tanh'", ",", "name", "=", "'mlpmap'", ")", ":", "super", "(", "MLP...
https://github.com/SheffieldML/GPy/blob/bb1bc5088671f9316bc92a46d356734e34c2d5c0/GPy/mappings/mlpext.py#L15-L57
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/mailcap.py
python
show
(caps)
[]
def show(caps): print("Mailcap files:") for fn in listmailcapfiles(): print("\t" + fn) print() if not caps: caps = getcaps() print("Mailcap entries:") print() ckeys = sorted(caps) for type in ckeys: print(type) entries = caps[type] for e in entries: ke...
[ "def", "show", "(", "caps", ")", ":", "print", "(", "\"Mailcap files:\"", ")", "for", "fn", "in", "listmailcapfiles", "(", ")", ":", "print", "(", "\"\\t\"", "+", "fn", ")", "print", "(", ")", "if", "not", "caps", ":", "caps", "=", "getcaps", "(", ...
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/mailcap.py#L257-L272
joschu/cgt
90b15ab041fc2137e62b96e8612ccee605f71ceb
cgt/api.py
python
ones_like
(x)
return ones(shape(x), x.dtype)
Like numpy.ones_like
Like numpy.ones_like
[ "Like", "numpy", ".", "ones_like" ]
def ones_like(x): """ Like numpy.ones_like """ return ones(shape(x), x.dtype)
[ "def", "ones_like", "(", "x", ")", ":", "return", "ones", "(", "shape", "(", "x", ")", ",", "x", ".", "dtype", ")" ]
https://github.com/joschu/cgt/blob/90b15ab041fc2137e62b96e8612ccee605f71ceb/cgt/api.py#L501-L505
fedora-infra/anitya
cc01878ac023790646a76eb4cbef45d639e2372c
anitya/lib/backends/gnome.py
python
GnomeBackend.get_versions
(cls, project)
return output
Method called to retrieve all the versions (that can be found) of the projects provided, project that relies on the backend of this plugin. :arg Project project: a :class:`anitya.db.models.Project` object whose backend corresponds to the current plugin. :return: a list of al...
Method called to retrieve all the versions (that can be found) of the projects provided, project that relies on the backend of this plugin.
[ "Method", "called", "to", "retrieve", "all", "the", "versions", "(", "that", "can", "be", "found", ")", "of", "the", "projects", "provided", "project", "that", "relies", "on", "the", "backend", "of", "this", "plugin", "." ]
def get_versions(cls, project): """Method called to retrieve all the versions (that can be found) of the projects provided, project that relies on the backend of this plugin. :arg Project project: a :class:`anitya.db.models.Project` object whose backend corresponds to the cu...
[ "def", "get_versions", "(", "cls", ",", "project", ")", ":", "output", "=", "[", "]", "try", ":", "# First try to get the version by using the cache.json file", "output", "=", "use_gnome_cache_json", "(", "project", ")", "except", "Exception", "as", "err", ":", "_...
https://github.com/fedora-infra/anitya/blob/cc01878ac023790646a76eb4cbef45d639e2372c/anitya/lib/backends/gnome.py#L98-L121
WolframResearch/WolframClientForPython
27cffef560eea8d16c02fe4086f42363604284b6
wolframclient/utils/dispatch.py
python
Dispatch.clear
(self)
Reset the dispatcher to its initial state.
Reset the dispatcher to its initial state.
[ "Reset", "the", "dispatcher", "to", "its", "initial", "state", "." ]
def clear(self): """ Reset the dispatcher to its initial state. """ self.dispatch_dict = dict() self.dispatch_dict_cache = dict()
[ "def", "clear", "(", "self", ")", ":", "self", ".", "dispatch_dict", "=", "dict", "(", ")", "self", ".", "dispatch_dict_cache", "=", "dict", "(", ")" ]
https://github.com/WolframResearch/WolframClientForPython/blob/27cffef560eea8d16c02fe4086f42363604284b6/wolframclient/utils/dispatch.py#L114-L117
hacktoolkit/django-htk
902f3780630f1308aa97a70b9b62a5682239ff2d
lib/shopify_lib/archivers.py
python
HtkShopifyArchiver.archive_all
(self, include_products=True, include_customers=True, include_orders=True)
Archives everything
Archives everything
[ "Archives", "everything" ]
def archive_all(self, include_products=True, include_customers=True, include_orders=True): """Archives everything """ self._reset_cache() if include_products: self._safe_archive(self.archive_products) if include_customers: self._safe_archive(self.archive_...
[ "def", "archive_all", "(", "self", ",", "include_products", "=", "True", ",", "include_customers", "=", "True", ",", "include_orders", "=", "True", ")", ":", "self", ".", "_reset_cache", "(", ")", "if", "include_products", ":", "self", ".", "_safe_archive", ...
https://github.com/hacktoolkit/django-htk/blob/902f3780630f1308aa97a70b9b62a5682239ff2d/lib/shopify_lib/archivers.py#L70-L80
rndusr/stig
334f03e2e3eda7c1856dd5489f0265a47b9861b6
stig/client/utils.py
python
SleepUneasy.interrupt
(self)
Stop sleeping
Stop sleeping
[ "Stop", "sleeping" ]
def interrupt(self): """Stop sleeping""" self._interrupt.set()
[ "def", "interrupt", "(", "self", ")", ":", "self", ".", "_interrupt", ".", "set", "(", ")" ]
https://github.com/rndusr/stig/blob/334f03e2e3eda7c1856dd5489f0265a47b9861b6/stig/client/utils.py#L591-L593
ales-tsurko/cells
4cf7e395cd433762bea70cdc863a346f3a6fe1d0
packaging/macos/python/lib/python3.7/uuid.py
python
_netbios_getnode
()
return first_local_mac or None
Get the hardware address on Windows using NetBIOS calls. See http://support.microsoft.com/kb/118623 for details.
Get the hardware address on Windows using NetBIOS calls. See http://support.microsoft.com/kb/118623 for details.
[ "Get", "the", "hardware", "address", "on", "Windows", "using", "NetBIOS", "calls", ".", "See", "http", ":", "//", "support", ".", "microsoft", ".", "com", "/", "kb", "/", "118623", "for", "details", "." ]
def _netbios_getnode(): """Get the hardware address on Windows using NetBIOS calls. See http://support.microsoft.com/kb/118623 for details.""" import win32wnet, netbios first_local_mac = None ncb = netbios.NCB() ncb.Command = netbios.NCBENUM ncb.Buffer = adapters = netbios.LANA_ENUM() ad...
[ "def", "_netbios_getnode", "(", ")", ":", "import", "win32wnet", ",", "netbios", "first_local_mac", "=", "None", "ncb", "=", "netbios", ".", "NCB", "(", ")", "ncb", ".", "Command", "=", "netbios", ".", "NCBENUM", "ncb", ".", "Buffer", "=", "adapters", "=...
https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/uuid.py#L517-L550
robclewley/pydstool
939e3abc9dd1f180d35152bacbde57e24c85ff26
PyDSTool/ModelTools.py
python
GenTransform.makeStaticVar
(self, obj_name)
Force RHSfuncSpec variable to have RHS=0.
Force RHSfuncSpec variable to have RHS=0.
[ "Force", "RHSfuncSpec", "variable", "to", "have", "RHS", "=", "0", "." ]
def makeStaticVar(self, obj_name): """Force RHSfuncSpec variable to have RHS=0. """ try: obj = self.trans_gen.modelspec[obj_name] except KeyError: raise PyDSTool_ValueError("Unknown object") if parseUtils.isHierarchicalName(obj_name): parent_na...
[ "def", "makeStaticVar", "(", "self", ",", "obj_name", ")", ":", "try", ":", "obj", "=", "self", ".", "trans_gen", ".", "modelspec", "[", "obj_name", "]", "except", "KeyError", ":", "raise", "PyDSTool_ValueError", "(", "\"Unknown object\"", ")", "if", "parseU...
https://github.com/robclewley/pydstool/blob/939e3abc9dd1f180d35152bacbde57e24c85ff26/PyDSTool/ModelTools.py#L2337-L2355
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/networkx/readwrite/nx_shp.py
python
edges_from_line
(geom, attrs, simplify=True, geom_attrs=True)
Generate edges for each line in geom Written as a helper for read_shp Parameters ---------- geom: ogr line geometry To be converted into an edge or edges attrs: dict Attributes to be associated with all geoms simplify: bool If True, simplify the line as in read_shp...
Generate edges for each line in geom Written as a helper for read_shp
[ "Generate", "edges", "for", "each", "line", "in", "geom", "Written", "as", "a", "helper", "for", "read_shp" ]
def edges_from_line(geom, attrs, simplify=True, geom_attrs=True): """ Generate edges for each line in geom Written as a helper for read_shp Parameters ---------- geom: ogr line geometry To be converted into an edge or edges attrs: dict Attributes to be associated with al...
[ "def", "edges_from_line", "(", "geom", ",", "attrs", ",", "simplify", "=", "True", ",", "geom_attrs", "=", "True", ")", ":", "try", ":", "from", "osgeo", "import", "ogr", "except", "ImportError", ":", "raise", "ImportError", "(", "\"edges_from_line requires OG...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/networkx/readwrite/nx_shp.py#L127-L188
tortoise/tortoise-orm
5bf910a3dcd1e729106b7f0dee16aae362d35f46
tortoise/backends/base/client.py
python
BaseDBAsyncClient.db_delete
(self)
Delete the database from the Server. Typically only called by the test runner. Need to have called ``create_connection()``` with parameter ``with_db=False`` set to use the default connection instead of the configured one, else you would get errors indicating the database is in use.
Delete the database from the Server. Typically only called by the test runner.
[ "Delete", "the", "database", "from", "the", "Server", ".", "Typically", "only", "called", "by", "the", "test", "runner", "." ]
async def db_delete(self) -> None: """ Delete the database from the Server. Typically only called by the test runner. Need to have called ``create_connection()``` with parameter ``with_db=False`` set to use the default connection instead of the configured one, else you would get errors ...
[ "async", "def", "db_delete", "(", "self", ")", "->", "None", ":", "raise", "NotImplementedError", "(", ")" ]
https://github.com/tortoise/tortoise-orm/blob/5bf910a3dcd1e729106b7f0dee16aae362d35f46/tortoise/backends/base/client.py#L134-L142
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/wagtail/contrib/postgres_search/backend.py
python
PostgresSearchBackend.add_bulk
(self, model, obj_list)
[]
def add_bulk(self, model, obj_list): if obj_list: self.get_index_for_object(obj_list[0]).add_items(model, obj_list)
[ "def", "add_bulk", "(", "self", ",", "model", ",", "obj_list", ")", ":", "if", "obj_list", ":", "self", ".", "get_index_for_object", "(", "obj_list", "[", "0", "]", ")", ".", "add_items", "(", "model", ",", "obj_list", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/wagtail/contrib/postgres_search/backend.py#L366-L368
cleverhans-lab/cleverhans
e5d00e537ce7ad6119ed5a8db1f0e9736d1f6e1d
cleverhans_v3.1.0/examples/nips17_adversarial_competition/eval_infra/code/eval_lib/image_batches.py
python
ImageBatchesBase.init_from_datastore
(self)
Initializes batches by reading from the datastore.
Initializes batches by reading from the datastore.
[ "Initializes", "batches", "by", "reading", "from", "the", "datastore", "." ]
def init_from_datastore(self): """Initializes batches by reading from the datastore.""" self._data = {} for entity in self._datastore_client.query_fetch( kind=self._entity_kind_batches ): batch_id = entity.key.flat_path[-1] self._data[batch_id] = dict(...
[ "def", "init_from_datastore", "(", "self", ")", ":", "self", ".", "_data", "=", "{", "}", "for", "entity", "in", "self", ".", "_datastore_client", ".", "query_fetch", "(", "kind", "=", "self", ".", "_entity_kind_batches", ")", ":", "batch_id", "=", "entity...
https://github.com/cleverhans-lab/cleverhans/blob/e5d00e537ce7ad6119ed5a8db1f0e9736d1f6e1d/cleverhans_v3.1.0/examples/nips17_adversarial_competition/eval_infra/code/eval_lib/image_batches.py#L103-L115
LabPy/lantz
3e878e3f765a4295b0089d04e241d4beb7b8a65b
lantz/drivers/legacy/labjack/_internal/u12.py
python
getErrorString
(errorcode)
return errorString.value
Name: U12.getErrorString(errorcode) Args: See section 4.19 of the User's Guide Desc: Converts a LabJack errorcode, returned by another function, into a string describing the error. No hardware communication is involved. >>> dev = U12() >>> dev.getErrorString(1) >>> Unkown error
Name: U12.getErrorString(errorcode) Args: See section 4.19 of the User's Guide Desc: Converts a LabJack errorcode, returned by another function, into a string describing the error. No hardware communication is involved.
[ "Name", ":", "U12", ".", "getErrorString", "(", "errorcode", ")", "Args", ":", "See", "section", "4", ".", "19", "of", "the", "User", "s", "Guide", "Desc", ":", "Converts", "a", "LabJack", "errorcode", "returned", "by", "another", "function", "into", "a"...
def getErrorString(errorcode): """ Name: U12.getErrorString(errorcode) Args: See section 4.19 of the User's Guide Desc: Converts a LabJack errorcode, returned by another function, into a string describing the error. No hardware communication is involved. >>> dev = U12() >>> dev.getErrorString(1...
[ "def", "getErrorString", "(", "errorcode", ")", ":", "errorString", "=", "ctypes", ".", "c_char_p", "(", "\" \"", "*", "50", ")", "staticLib", ".", "GetErrorString", "(", "errorcode", ",", "errorString", ")", "return", "errorString", ".", "value" ]
https://github.com/LabPy/lantz/blob/3e878e3f765a4295b0089d04e241d4beb7b8a65b/lantz/drivers/legacy/labjack/_internal/u12.py#L2961-L2973
TengXiaoDai/DistributedCrawling
f5c2439e6ce68dd9b49bde084d76473ff9ed4963
Lib/site-packages/pip/_vendor/requests/cookies.py
python
RequestsCookieJar.items
(self)
return list(self.iteritems())
Dict-like items() that returns a list of name-value tuples from the jar. Allows client-code to call ``dict(RequestsCookieJar)`` and get a vanilla python dict of key value pairs. .. seealso:: keys() and values().
Dict-like items() that returns a list of name-value tuples from the jar. Allows client-code to call ``dict(RequestsCookieJar)`` and get a vanilla python dict of key value pairs.
[ "Dict", "-", "like", "items", "()", "that", "returns", "a", "list", "of", "name", "-", "value", "tuples", "from", "the", "jar", ".", "Allows", "client", "-", "code", "to", "call", "dict", "(", "RequestsCookieJar", ")", "and", "get", "a", "vanilla", "py...
def items(self): """Dict-like items() that returns a list of name-value tuples from the jar. Allows client-code to call ``dict(RequestsCookieJar)`` and get a vanilla python dict of key value pairs. .. seealso:: keys() and values(). """ return list(self.iteritems())
[ "def", "items", "(", "self", ")", ":", "return", "list", "(", "self", ".", "iteritems", "(", ")", ")" ]
https://github.com/TengXiaoDai/DistributedCrawling/blob/f5c2439e6ce68dd9b49bde084d76473ff9ed4963/Lib/site-packages/pip/_vendor/requests/cookies.py#L262-L269
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/docutils/docutils/utils/math/math2html.py
python
MacroFunction.parsenumbers
(self, pos, remaining)
return None
Parse the remaining parameters as a running number.
Parse the remaining parameters as a running number.
[ "Parse", "the", "remaining", "parameters", "as", "a", "running", "number", "." ]
def parsenumbers(self, pos, remaining): "Parse the remaining parameters as a running number." "For example, 12 would be {1}{2}." number = self.factory.parsetype(FormulaNumber, pos) if not len(number.original) == remaining: return number for digit in number.original: value = self.factory....
[ "def", "parsenumbers", "(", "self", ",", "pos", ",", "remaining", ")", ":", "\"For example, 12 would be {1}{2}.\"", "number", "=", "self", ".", "factory", ".", "parsetype", "(", "FormulaNumber", ",", "pos", ")", "if", "not", "len", "(", "number", ".", "origi...
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/docutils/docutils/utils/math/math2html.py#L5176-L5187
huggingface/transformers
623b4f7c63f60cce917677ee704d6c93ee960b4b
examples/legacy/seq2seq/save_len_file.py
python
save_len_file
( tokenizer_name, data_dir, max_source_length=1024, max_target_length=1024, consider_target=False, **kwargs )
Save max(src_len, tgt_len) for each example to allow dynamic batching.
Save max(src_len, tgt_len) for each example to allow dynamic batching.
[ "Save", "max", "(", "src_len", "tgt_len", ")", "for", "each", "example", "to", "allow", "dynamic", "batching", "." ]
def save_len_file( tokenizer_name, data_dir, max_source_length=1024, max_target_length=1024, consider_target=False, **kwargs ): """Save max(src_len, tgt_len) for each example to allow dynamic batching.""" tok = AutoTokenizer.from_pretrained(tokenizer_name) train_ds = Seq2SeqDataset(tok, data_dir, max_so...
[ "def", "save_len_file", "(", "tokenizer_name", ",", "data_dir", ",", "max_source_length", "=", "1024", ",", "max_target_length", "=", "1024", ",", "consider_target", "=", "False", ",", "*", "*", "kwargs", ")", ":", "tok", "=", "AutoTokenizer", ".", "from_pretr...
https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/examples/legacy/seq2seq/save_len_file.py#L24-L52
ChineseGLUE/ChineseGLUE
1591b85cf5427c2ff60f718d359ecb71d2b44879
baselines/models_pytorch/classifier_pytorch/transformers/tokenization_bert.py
python
BertTokenizer._convert_id_to_token
(self, index)
return self.ids_to_tokens.get(index, self.unk_token)
Converts an index (integer) in a token (string/unicode) using the vocab.
Converts an index (integer) in a token (string/unicode) using the vocab.
[ "Converts", "an", "index", "(", "integer", ")", "in", "a", "token", "(", "string", "/", "unicode", ")", "using", "the", "vocab", "." ]
def _convert_id_to_token(self, index): """Converts an index (integer) in a token (string/unicode) using the vocab.""" return self.ids_to_tokens.get(index, self.unk_token)
[ "def", "_convert_id_to_token", "(", "self", ",", "index", ")", ":", "return", "self", ".", "ids_to_tokens", ".", "get", "(", "index", ",", "self", ".", "unk_token", ")" ]
https://github.com/ChineseGLUE/ChineseGLUE/blob/1591b85cf5427c2ff60f718d359ecb71d2b44879/baselines/models_pytorch/classifier_pytorch/transformers/tokenization_bert.py#L187-L189
TabbycatDebate/tabbycat
7cc3b2fa1cc34569501a4be10fe9234b98c65df3
tabbycat/api/views.py
python
BreakingTeamsView.list
(self, request, *args, **kwargs)
return Response(serializer.data)
Pagination might be dangerous here, so disabled.
Pagination might be dangerous here, so disabled.
[ "Pagination", "might", "be", "dangerous", "here", "so", "disabled", "." ]
def list(self, request, *args, **kwargs): """Pagination might be dangerous here, so disabled.""" queryset = self.filter_queryset(self.get_queryset()) serializer = self.get_serializer(queryset, many=True) return Response(serializer.data)
[ "def", "list", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "queryset", "=", "self", ".", "filter_queryset", "(", "self", ".", "get_queryset", "(", ")", ")", "serializer", "=", "self", ".", "get_serializer", "(", ...
https://github.com/TabbycatDebate/tabbycat/blob/7cc3b2fa1cc34569501a4be10fe9234b98c65df3/tabbycat/api/views.py#L157-L161
AutodeskRoboticsLab/Mimic
85447f0d346be66988303a6a054473d92f1ed6f4
mimic/scripts/extern/pyqtgraph_0_11_0/pyqtgraph/parametertree/ParameterItem.py
python
ParameterItem.columnChangedEvent
(self, col)
Called when the text in a column has been edited (or otherwise changed). By default, we only use changes to column 0 to rename the parameter.
Called when the text in a column has been edited (or otherwise changed). By default, we only use changes to column 0 to rename the parameter.
[ "Called", "when", "the", "text", "in", "a", "column", "has", "been", "edited", "(", "or", "otherwise", "changed", ")", ".", "By", "default", "we", "only", "use", "changes", "to", "column", "0", "to", "rename", "the", "parameter", "." ]
def columnChangedEvent(self, col): """Called when the text in a column has been edited (or otherwise changed). By default, we only use changes to column 0 to rename the parameter. """ if col == 0 and (self.param.opts.get('title', None) is None): if self.ignoreNameColumnChang...
[ "def", "columnChangedEvent", "(", "self", ",", "col", ")", ":", "if", "col", "==", "0", "and", "(", "self", ".", "param", ".", "opts", ".", "get", "(", "'title'", ",", "None", ")", "is", "None", ")", ":", "if", "self", ".", "ignoreNameColumnChange", ...
https://github.com/AutodeskRoboticsLab/Mimic/blob/85447f0d346be66988303a6a054473d92f1ed6f4/mimic/scripts/extern/pyqtgraph_0_11_0/pyqtgraph/parametertree/ParameterItem.py#L134-L151
mozilla/TTS
e9e07844b77a43fb0864354791fb4cf72ffded11
TTS/tts/utils/text/cleaners.py
python
basic_turkish_cleaners
(text)
return text
Pipeline for Turkish text
Pipeline for Turkish text
[ "Pipeline", "for", "Turkish", "text" ]
def basic_turkish_cleaners(text): '''Pipeline for Turkish text''' text = text.replace("I", "ı") text = lowercase(text) text = collapse_whitespace(text) return text
[ "def", "basic_turkish_cleaners", "(", "text", ")", ":", "text", "=", "text", ".", "replace", "(", "\"I\"", ",", "\"ı\")", "", "text", "=", "lowercase", "(", "text", ")", "text", "=", "collapse_whitespace", "(", "text", ")", "return", "text" ]
https://github.com/mozilla/TTS/blob/e9e07844b77a43fb0864354791fb4cf72ffded11/TTS/tts/utils/text/cleaners.py#L88-L93
pinterest/mysql_utils
7ab237699b85de8b503b09f36e0309ac807689fe
lib/host_utils.py
python
get_user
()
return username
Return the username of the caller, or unknown if we can't figure it out (should never happen)
Return the username of the caller, or unknown if we can't figure it out (should never happen)
[ "Return", "the", "username", "of", "the", "caller", "or", "unknown", "if", "we", "can", "t", "figure", "it", "out", "(", "should", "never", "happen", ")" ]
def get_user(): """ Return the username of the caller, or unknown if we can't figure it out (should never happen) """ try: username = getpass.getuser() except: log.warning("Can't determine caller's username. Setting to unknown.") username = 'unknown' return username
[ "def", "get_user", "(", ")", ":", "try", ":", "username", "=", "getpass", ".", "getuser", "(", ")", "except", ":", "log", ".", "warning", "(", "\"Can't determine caller's username. Setting to unknown.\"", ")", "username", "=", "'unknown'", "return", "username" ]
https://github.com/pinterest/mysql_utils/blob/7ab237699b85de8b503b09f36e0309ac807689fe/lib/host_utils.py#L119-L129
TengXiaoDai/DistributedCrawling
f5c2439e6ce68dd9b49bde084d76473ff9ed4963
Lib/site-packages/wheel/bdist_wheel.py
python
bdist_wheel.license_file
(self)
return metadata['license_file'][1]
Return license filename from a license-file key in setup.cfg, or None.
Return license filename from a license-file key in setup.cfg, or None.
[ "Return", "license", "filename", "from", "a", "license", "-", "file", "key", "in", "setup", ".", "cfg", "or", "None", "." ]
def license_file(self): """Return license filename from a license-file key in setup.cfg, or None.""" metadata = self.distribution.get_option_dict('metadata') if not 'license_file' in metadata: return None return metadata['license_file'][1]
[ "def", "license_file", "(", "self", ")", ":", "metadata", "=", "self", ".", "distribution", ".", "get_option_dict", "(", "'metadata'", ")", "if", "not", "'license_file'", "in", "metadata", ":", "return", "None", "return", "metadata", "[", "'license_file'", "]"...
https://github.com/TengXiaoDai/DistributedCrawling/blob/f5c2439e6ce68dd9b49bde084d76473ff9ed4963/Lib/site-packages/wheel/bdist_wheel.py#L286-L291
emesene/emesene
4548a4098310e21b16437bb36223a7f632a4f7bc
emesene/e3/webqq/Worker.py
python
Worker.run
(self)
main method, block waiting for data, process it, and send data back
main method, block waiting for data, process it, and send data back
[ "main", "method", "block", "waiting", "for", "data", "process", "it", "and", "send", "data", "back" ]
def run(self): '''main method, block waiting for data, process it, and send data back ''' call_back_dict = { 512 : self._on_message, 513 : self._on_group_message, 515 : self._on_photo_update , 516 : self._on_status_change, 517 : self._on_nic...
[ "def", "run", "(", "self", ")", ":", "call_back_dict", "=", "{", "512", ":", "self", ".", "_on_message", ",", "513", ":", "self", ".", "_on_group_message", ",", "515", ":", "self", ".", "_on_photo_update", ",", "516", ":", "self", ".", "_on_status_change...
https://github.com/emesene/emesene/blob/4548a4098310e21b16437bb36223a7f632a4f7bc/emesene/e3/webqq/Worker.py#L74-L100
aliyun/aliyun-oss-python-sdk
5f2afa0928a58c7c1cc6317ac147f3637481f6fd
oss2/http.py
python
_convert_request_body
(data)
return data
[]
def _convert_request_body(data): data = to_bytes(data) if hasattr(data, '__len__'): return data if hasattr(data, 'seek') and hasattr(data, 'tell'): return SizedFileAdapter(data, file_object_remaining_bytes(data)) return data
[ "def", "_convert_request_body", "(", "data", ")", ":", "data", "=", "to_bytes", "(", "data", ")", "if", "hasattr", "(", "data", ",", "'__len__'", ")", ":", "return", "data", "if", "hasattr", "(", "data", ",", "'seek'", ")", "and", "hasattr", "(", "data...
https://github.com/aliyun/aliyun-oss-python-sdk/blob/5f2afa0928a58c7c1cc6317ac147f3637481f6fd/oss2/http.py#L138-L147
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/structure/set_factories.py
python
FacadeParentPolicy.__init__
(self, factory, parent)
r""" TESTS:: sage: from sage.structure.set_factories import FacadeParentPolicy sage: from sage.structure.set_factories_example import XYPairs, XYPair sage: F = FacadeParentPolicy(XYPairs, XYPairs()); F Set factory policy for facade parent AllPairs sag...
r""" TESTS::
[ "r", "TESTS", "::" ]
def __init__(self, factory, parent): r""" TESTS:: sage: from sage.structure.set_factories import FacadeParentPolicy sage: from sage.structure.set_factories_example import XYPairs, XYPair sage: F = FacadeParentPolicy(XYPairs, XYPairs()); F Set factory poli...
[ "def", "__init__", "(", "self", ",", "factory", ",", "parent", ")", ":", "self", ".", "_parent_for", "=", "parent", "SetFactoryPolicy", ".", "__init__", "(", "self", ",", "factory", ")" ]
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/structure/set_factories.py#L743-L754
KalleHallden/AutoTimer
2d954216700c4930baa154e28dbddc34609af7ce
env/lib/python2.7/site-packages/pip/_vendor/distlib/database.py
python
Distribution.test_requires
(self)
return self._get_requirements('test_requires')
[]
def test_requires(self): return self._get_requirements('test_requires')
[ "def", "test_requires", "(", "self", ")", ":", "return", "self", ".", "_get_requirements", "(", "'test_requires'", ")" ]
https://github.com/KalleHallden/AutoTimer/blob/2d954216700c4930baa154e28dbddc34609af7ce/env/lib/python2.7/site-packages/pip/_vendor/distlib/database.py#L400-L401
AstroPrint/AstroBox
e7e3b8a7d33ea85fcb6b2696869c0d719ceb8b75
src/astroprint/plugin/__init__.py
python
Plugin.version
(self)
return self._definition['version']
[]
def version(self): return self._definition['version']
[ "def", "version", "(", "self", ")", ":", "return", "self", ".", "_definition", "[", "'version'", "]" ]
https://github.com/AstroPrint/AstroBox/blob/e7e3b8a7d33ea85fcb6b2696869c0d719ceb8b75/src/astroprint/plugin/__init__.py#L81-L82
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/djangorestframework-3.9.4/rest_framework/views.py
python
APIView.determine_version
(self, request, *args, **kwargs)
return (scheme.determine_version(request, *args, **kwargs), scheme)
If versioning is being used, then determine any API version for the incoming request. Returns a two-tuple of (version, versioning_scheme)
If versioning is being used, then determine any API version for the incoming request. Returns a two-tuple of (version, versioning_scheme)
[ "If", "versioning", "is", "being", "used", "then", "determine", "any", "API", "version", "for", "the", "incoming", "request", ".", "Returns", "a", "two", "-", "tuple", "of", "(", "version", "versioning_scheme", ")" ]
def determine_version(self, request, *args, **kwargs): """ If versioning is being used, then determine any API version for the incoming request. Returns a two-tuple of (version, versioning_scheme) """ if self.versioning_class is None: return (None, None) schem...
[ "def", "determine_version", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "versioning_class", "is", "None", ":", "return", "(", "None", ",", "None", ")", "scheme", "=", "self", ".", "versioning_cla...
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/djangorestframework-3.9.4/rest_framework/views.py#L359-L367
craffel/mir_eval
576aad4e0b5931e7c697c078a1153c99b885c64f
mir_eval/io.py
python
load_labeled_events
(filename, delimiter=r'\s+', comment='#')
return events, labels
r"""Import labeled time-stamp events from an annotation file. The file should consist of two columns; the first having numeric values corresponding to the event times and the second having string labels for each event. This is primarily useful for processing labeled events which lack duration, such as...
r"""Import labeled time-stamp events from an annotation file. The file should consist of two columns; the first having numeric values corresponding to the event times and the second having string labels for each event. This is primarily useful for processing labeled events which lack duration, such as...
[ "r", "Import", "labeled", "time", "-", "stamp", "events", "from", "an", "annotation", "file", ".", "The", "file", "should", "consist", "of", "two", "columns", ";", "the", "first", "having", "numeric", "values", "corresponding", "to", "the", "event", "times",...
def load_labeled_events(filename, delimiter=r'\s+', comment='#'): r"""Import labeled time-stamp events from an annotation file. The file should consist of two columns; the first having numeric values corresponding to the event times and the second having string labels for each event. This is primarily...
[ "def", "load_labeled_events", "(", "filename", ",", "delimiter", "=", "r'\\s+'", ",", "comment", "=", "'#'", ")", ":", "# Use our universal function to load in the events", "events", ",", "labels", "=", "load_delimited", "(", "filename", ",", "[", "float", ",", "s...
https://github.com/craffel/mir_eval/blob/576aad4e0b5931e7c697c078a1153c99b885c64f/mir_eval/io.py#L161-L200
pymeasure/pymeasure
b4d888e9ead85ef7f7af0031f2dbb44c9ce1825e
pymeasure/instruments/keithley/keithley2700.py
python
Keithley2700.reset
(self)
Resets the instrument and clears the queue.
Resets the instrument and clears the queue.
[ "Resets", "the", "instrument", "and", "clears", "the", "queue", "." ]
def reset(self): """ Resets the instrument and clears the queue. """ self.write("status:queue:clear;*RST;:stat:pres;:*CLS;")
[ "def", "reset", "(", "self", ")", ":", "self", ".", "write", "(", "\"status:queue:clear;*RST;:stat:pres;:*CLS;\"", ")" ]
https://github.com/pymeasure/pymeasure/blob/b4d888e9ead85ef7f7af0031f2dbb44c9ce1825e/pymeasure/instruments/keithley/keithley2700.py#L303-L305
localstack/localstack
ec8b72d5c926ae8495ca50ce168494247aef54be
localstack/services/logs/logs_listener.py
python
get_pattern_matcher
(pattern: str)
return lambda _pattern, _log_event: True
Returns a pattern matcher. Can be patched by plugins to return a more sophisticated pattern matcher.
Returns a pattern matcher. Can be patched by plugins to return a more sophisticated pattern matcher.
[ "Returns", "a", "pattern", "matcher", ".", "Can", "be", "patched", "by", "plugins", "to", "return", "a", "more", "sophisticated", "pattern", "matcher", "." ]
def get_pattern_matcher(pattern: str) -> Callable[[str, Dict], bool]: """Returns a pattern matcher. Can be patched by plugins to return a more sophisticated pattern matcher.""" return lambda _pattern, _log_event: True
[ "def", "get_pattern_matcher", "(", "pattern", ":", "str", ")", "->", "Callable", "[", "[", "str", ",", "Dict", "]", ",", "bool", "]", ":", "return", "lambda", "_pattern", ",", "_log_event", ":", "True" ]
https://github.com/localstack/localstack/blob/ec8b72d5c926ae8495ca50ce168494247aef54be/localstack/services/logs/logs_listener.py#L96-L98
sahana/eden
1696fa50e90ce967df69f66b571af45356cc18da
controllers/supply.py
python
catalog
()
return s3_rest_controller(rheader = supply_catalog_rheader)
RESTful CRUD controller
RESTful CRUD controller
[ "RESTful", "CRUD", "controller" ]
def catalog(): """ RESTful CRUD controller """ from s3db.supply import supply_catalog_rheader return s3_rest_controller(rheader = supply_catalog_rheader)
[ "def", "catalog", "(", ")", ":", "from", "s3db", ".", "supply", "import", "supply_catalog_rheader", "return", "s3_rest_controller", "(", "rheader", "=", "supply_catalog_rheader", ")" ]
https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/controllers/supply.py#L24-L28
0vercl0k/stuffz
2ff82f4739d7e215c6140d4987efa8310db39d55
transmissionrpc.py
python
Session.from_request
(self, data)
Update the session information.
Update the session information.
[ "Update", "the", "session", "information", "." ]
def from_request(self, data): """Update the session information.""" self._update_fields(data)
[ "def", "from_request", "(", "self", ",", "data", ")", ":", "self", ".", "_update_fields", "(", "data", ")" ]
https://github.com/0vercl0k/stuffz/blob/2ff82f4739d7e215c6140d4987efa8310db39d55/transmissionrpc.py#L1172-L1174
implus/PytorchInsight
2864528f8b83f52c3df76f7c3804aa468b91e5cf
detection/mmdet/ops/nms/setup.py
python
custom_build_ext.build_extensions
(self)
[]
def build_extensions(self): customize_compiler_for_nvcc(self.compiler) build_ext.build_extensions(self)
[ "def", "build_extensions", "(", "self", ")", ":", "customize_compiler_for_nvcc", "(", "self", ".", "compiler", ")", "build_ext", ".", "build_extensions", "(", "self", ")" ]
https://github.com/implus/PytorchInsight/blob/2864528f8b83f52c3df76f7c3804aa468b91e5cf/detection/mmdet/ops/nms/setup.py#L65-L67
plkmo/BERT-Relation-Extraction
06075620fccb044785f5fd319e8d06df9af15b50
src/model/BERT/tokenization_bert.py
python
BasicTokenizer._tokenize_chinese_chars
(self, text)
return "".join(output)
Adds whitespace around any CJK character.
Adds whitespace around any CJK character.
[ "Adds", "whitespace", "around", "any", "CJK", "character", "." ]
def _tokenize_chinese_chars(self, text): """Adds whitespace around any CJK character.""" output = [] for char in text: cp = ord(char) if self._is_chinese_char(cp): output.append(" ") output.append(char) output.append(" ") ...
[ "def", "_tokenize_chinese_chars", "(", "self", ",", "text", ")", ":", "output", "=", "[", "]", "for", "char", "in", "text", ":", "cp", "=", "ord", "(", "char", ")", "if", "self", ".", "_is_chinese_char", "(", "cp", ")", ":", "output", ".", "append", ...
https://github.com/plkmo/BERT-Relation-Extraction/blob/06075620fccb044785f5fd319e8d06df9af15b50/src/model/BERT/tokenization_bert.py#L356-L367
IBM/lale
b4d6829c143a4735b06083a0e6c70d2cca244162
lale/operators.py
python
BasePipeline._indices_to_preds
( cls, _steps: List[OpType], _pred_indices: Dict[int, List[int]] )
return { _steps[k]: ([_steps[v] for v in vs]) for (k, vs) in _pred_indices.items() }
[]
def _indices_to_preds( cls, _steps: List[OpType], _pred_indices: Dict[int, List[int]] ) -> Dict[OpType, List[OpType]]: return { _steps[k]: ([_steps[v] for v in vs]) for (k, vs) in _pred_indices.items() }
[ "def", "_indices_to_preds", "(", "cls", ",", "_steps", ":", "List", "[", "OpType", "]", ",", "_pred_indices", ":", "Dict", "[", "int", ",", "List", "[", "int", "]", "]", ")", "->", "Dict", "[", "OpType", ",", "List", "[", "OpType", "]", "]", ":", ...
https://github.com/IBM/lale/blob/b4d6829c143a4735b06083a0e6c70d2cca244162/lale/operators.py#L3461-L3466
enthought/mayavi
2103a273568b8f0bd62328801aafbd6252543ae8
tvtk/pyface/scene_model.py
python
SceneModel._get_light_manager
(self)
return None
Getter for the light manager.
Getter for the light manager.
[ "Getter", "for", "the", "light", "manager", "." ]
def _get_light_manager(self): """Getter for the light manager.""" se = self.scene_editor if se is not None: return se.light_manager return None
[ "def", "_get_light_manager", "(", "self", ")", ":", "se", "=", "self", ".", "scene_editor", "if", "se", "is", "not", "None", ":", "return", "se", ".", "light_manager", "return", "None" ]
https://github.com/enthought/mayavi/blob/2103a273568b8f0bd62328801aafbd6252543ae8/tvtk/pyface/scene_model.py#L327-L332
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-windows/x86/idna/uts46data.py
python
_seg_71
()
return [ (0x1EE84, 'M', u'ه'), (0x1EE85, 'M', u'و'), (0x1EE86, 'M', u'ز'), (0x1EE87, 'M', u'ح'), (0x1EE88, 'M', u'ط'), (0x1EE89, 'M', u'ي'), (0x1EE8A, 'X'), (0x1EE8B, 'M', u'ل'), (0x1EE8C, 'M', u'م'), (0x1EE8D, 'M', u'ن'), (0x1EE8E, 'M', u'س'), (0x1EE8F, 'M', u'ع'), (...
[]
def _seg_71(): return [ (0x1EE84, 'M', u'ه'), (0x1EE85, 'M', u'و'), (0x1EE86, 'M', u'ز'), (0x1EE87, 'M', u'ح'), (0x1EE88, 'M', u'ط'), (0x1EE89, 'M', u'ي'), (0x1EE8A, 'X'), (0x1EE8B, 'M', u'ل'), (0x1EE8C, 'M', u'م'), (0x1EE8D, 'M', u'ن'), (0x1EE8E, 'M', u'س'), (0x1EE8F...
[ "def", "_seg_71", "(", ")", ":", "return", "[", "(", "0x1EE84", ",", "'M'", ",", "u'ه')", ",", "", "(", "0x1EE85", ",", "'M'", ",", "u'و')", ",", "", "(", "0x1EE86", ",", "'M'", ",", "u'ز')", ",", "", "(", "0x1EE87", ",", "'M'", ",", "u'ح')", ...
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-windows/x86/idna/uts46data.py#L7392-L7494
ricequant/rqalpha-mod-ctp
bfd40801f9a182226a911cac74660f62993eb6db
rqalpha_mod_ctp/ctp/pyctp/linux64_35/__init__.py
python
MdApi.OnRspUserLogout
(self, pUserLogout, pRspInfo, nRequestID, bIsLast)
登出请求响应
登出请求响应
[ "登出请求响应" ]
def OnRspUserLogout(self, pUserLogout, pRspInfo, nRequestID, bIsLast): """登出请求响应"""
[ "def", "OnRspUserLogout", "(", "self", ",", "pUserLogout", ",", "pRspInfo", ",", "nRequestID", ",", "bIsLast", ")", ":" ]
https://github.com/ricequant/rqalpha-mod-ctp/blob/bfd40801f9a182226a911cac74660f62993eb6db/rqalpha_mod_ctp/ctp/pyctp/linux64_35/__init__.py#L130-L131
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
Python-2.7.13/Lib/trace.py
python
Trace.globaltrace_countfuncs
(self, frame, why, arg)
Handler for call events. Adds (filename, modulename, funcname) to the self._calledfuncs dict.
Handler for call events.
[ "Handler", "for", "call", "events", "." ]
def globaltrace_countfuncs(self, frame, why, arg): """Handler for call events. Adds (filename, modulename, funcname) to the self._calledfuncs dict. """ if why == 'call': this_func = self.file_module_function_of(frame) self._calledfuncs[this_func] = 1
[ "def", "globaltrace_countfuncs", "(", "self", ",", "frame", ",", "why", ",", "arg", ")", ":", "if", "why", "==", "'call'", ":", "this_func", "=", "self", ".", "file_module_function_of", "(", "frame", ")", "self", ".", "_calledfuncs", "[", "this_func", "]",...
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/trace.py#L581-L588
Altinity/clickhouse-mysql-data-reader
3b1b7088751b05e5bbf45890c5949b58208c2343
clickhouse_mysql/tableprocessor.py
python
TableProcessor.tables_list
(self, db)
return self.client.tables_list(db)
List tables in specified DB :param db: database to list tables in :return: ['table1', 'table2', ...]
List tables in specified DB
[ "List", "tables", "in", "specified", "DB" ]
def tables_list(self, db): """ List tables in specified DB :param db: database to list tables in :return: ['table1', 'table2', ...] """ return self.client.tables_list(db)
[ "def", "tables_list", "(", "self", ",", "db", ")", ":", "return", "self", ".", "client", ".", "tables_list", "(", "db", ")" ]
https://github.com/Altinity/clickhouse-mysql-data-reader/blob/3b1b7088751b05e5bbf45890c5949b58208c2343/clickhouse_mysql/tableprocessor.py#L117-L124
tomerfiliba/plumbum
20cdda5e8bbd9f83d64b154f6b4fcd28216c63e1
plumbum/fs/atomic.py
python
AtomicCounterFile.next
(self)
Read and increment the counter, returning its previous value
Read and increment the counter, returning its previous value
[ "Read", "and", "increment", "the", "counter", "returning", "its", "previous", "value" ]
def next(self): """ Read and increment the counter, returning its previous value """ with self.atomicfile.locked(): curr = self.atomicfile.read_atomic().decode("utf8") if not curr: curr = self.initial else: curr = int(cu...
[ "def", "next", "(", "self", ")", ":", "with", "self", ".", "atomicfile", ".", "locked", "(", ")", ":", "curr", "=", "self", ".", "atomicfile", ".", "read_atomic", "(", ")", ".", "decode", "(", "\"utf8\"", ")", "if", "not", "curr", ":", "curr", "=",...
https://github.com/tomerfiliba/plumbum/blob/20cdda5e8bbd9f83d64b154f6b4fcd28216c63e1/plumbum/fs/atomic.py#L231-L242
titusjan/argos
5a9c31a8a9a2ca825bbf821aa1e685740e3682d7
argos/application.py
python
ArgosApplication.inspectorRegistry
(self)
return self._inspectorRegistry
Returns the repository tree item (rti) registry
Returns the repository tree item (rti) registry
[ "Returns", "the", "repository", "tree", "item", "(", "rti", ")", "registry" ]
def inspectorRegistry(self): """ Returns the repository tree item (rti) registry """ return self._inspectorRegistry
[ "def", "inspectorRegistry", "(", "self", ")", ":", "return", "self", ".", "_inspectorRegistry" ]
https://github.com/titusjan/argos/blob/5a9c31a8a9a2ca825bbf821aa1e685740e3682d7/argos/application.py#L202-L205
galaxyproject/galaxy
4c03520f05062e0f4a1b3655dc0b7452fda69943
tools/filters/sff_extract.py
python
extract_read_info
(data, fname)
return seqstring, qualstring, xmlstring
Given the data for one read it returns 3 strs with the fasta seq, fasta qual and xml ancillary data.
Given the data for one read it returns 3 strs with the fasta seq, fasta qual and xml ancillary data.
[ "Given", "the", "data", "for", "one", "read", "it", "returns", "3", "strs", "with", "the", "fasta", "seq", "fasta", "qual", "and", "xml", "ancillary", "data", "." ]
def extract_read_info(data, fname): '''Given the data for one read it returns 3 strs with the fasta seq, fasta qual and xml ancillary data.''' seq, qual = get_read_data(data) seqstring, qualstring = format_as_fasta(data['name'], seq, qual) xmlstring = create_xml_for_unpaired_read(data, fname) re...
[ "def", "extract_read_info", "(", "data", ",", "fname", ")", ":", "seq", ",", "qual", "=", "get_read_data", "(", "data", ")", "seqstring", ",", "qualstring", "=", "format_as_fasta", "(", "data", "[", "'name'", "]", ",", "seq", ",", "qual", ")", "xmlstring...
https://github.com/galaxyproject/galaxy/blob/4c03520f05062e0f4a1b3655dc0b7452fda69943/tools/filters/sff_extract.py#L418-L424
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-windows/x86/PIL/GifImagePlugin.py
python
_get_color_table_size
(palette_bytes)
[]
def _get_color_table_size(palette_bytes): # calculate the palette size for the header if not palette_bytes: return 0 elif len(palette_bytes) < 9: return 1 else: return math.ceil(math.log(len(palette_bytes) // 3, 2)) - 1
[ "def", "_get_color_table_size", "(", "palette_bytes", ")", ":", "# calculate the palette size for the header", "if", "not", "palette_bytes", ":", "return", "0", "elif", "len", "(", "palette_bytes", ")", "<", "9", ":", "return", "1", "else", ":", "return", "math", ...
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-windows/x86/PIL/GifImagePlugin.py#L703-L710
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/setuptools/_vendor/packaging/version.py
python
Version.__str__
(self)
return "".join(parts)
[]
def __str__(self): parts = [] # Epoch if self._version.epoch != 0: parts.append("{0}!".format(self._version.epoch)) # Release segment parts.append(".".join(str(x) for x in self._version.release)) # Pre-release if self._version.pre is not None: ...
[ "def", "__str__", "(", "self", ")", ":", "parts", "=", "[", "]", "# Epoch", "if", "self", ".", "_version", ".", "epoch", "!=", "0", ":", "parts", ".", "append", "(", "\"{0}!\"", ".", "format", "(", "self", ".", "_version", ".", "epoch", ")", ")", ...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/setuptools/_vendor/packaging/version.py#L236-L264
WooYun/TangScan
f4fd60228ec09ad10bd3dd3ef3b67e58bcdd4aa5
tangscan/thirdparty/requests/packages/urllib3/util/timeout.py
python
Timeout.start_connect
(self)
return self._start_connect
Start the timeout clock, used during a connect() attempt :raises urllib3.exceptions.TimeoutStateError: if you attempt to start a timer that has been started already.
Start the timeout clock, used during a connect() attempt
[ "Start", "the", "timeout", "clock", "used", "during", "a", "connect", "()", "attempt" ]
def start_connect(self): """ Start the timeout clock, used during a connect() attempt :raises urllib3.exceptions.TimeoutStateError: if you attempt to start a timer that has been started already. """ if self._start_connect is not None: raise TimeoutStateError("Tim...
[ "def", "start_connect", "(", "self", ")", ":", "if", "self", ".", "_start_connect", "is", "not", "None", ":", "raise", "TimeoutStateError", "(", "\"Timeout timer has already been started.\"", ")", "self", ".", "_start_connect", "=", "current_time", "(", ")", "retu...
https://github.com/WooYun/TangScan/blob/f4fd60228ec09ad10bd3dd3ef3b67e58bcdd4aa5/tangscan/thirdparty/requests/packages/urllib3/util/timeout.py#L169-L178
rotki/rotki
aafa446815cdd5e9477436d1b02bee7d01b398c8
rotkehlchen/exchanges/binance.py
python
Binance.query_online_trade_history
( self, start_ts: Timestamp, end_ts: Timestamp, )
return trades, (start_ts, end_ts)
May raise due to api query and unexpected id: - RemoteError - BinancePermissionError
[]
def query_online_trade_history( self, start_ts: Timestamp, end_ts: Timestamp, ) -> Tuple[List[Trade], Tuple[Timestamp, Timestamp]]: """ May raise due to api query and unexpected id: - RemoteError - BinancePermissionError """ self.f...
[ "def", "query_online_trade_history", "(", "self", ",", "start_ts", ":", "Timestamp", ",", "end_ts", ":", "Timestamp", ",", ")", "->", "Tuple", "[", "List", "[", "Trade", "]", ",", "Tuple", "[", "Timestamp", ",", "Timestamp", "]", "]", ":", "self", ".", ...
https://github.com/rotki/rotki/blob/aafa446815cdd5e9477436d1b02bee7d01b398c8/rotkehlchen/exchanges/binance.py#L823-L925
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/distlib/util.py
python
get_export_entry
(specification)
return result
[]
def get_export_entry(specification): m = ENTRY_RE.search(specification) if not m: result = None if '[' in specification or ']' in specification: raise DistlibException("Invalid specification " "'%s'" % specification) else: d = m.groupdic...
[ "def", "get_export_entry", "(", "specification", ")", ":", "m", "=", "ENTRY_RE", ".", "search", "(", "specification", ")", "if", "not", "m", ":", "result", "=", "None", "if", "'['", "in", "specification", "or", "']'", "in", "specification", ":", "raise", ...
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/distlib/util.py#L567-L595
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/builds/views.py
python
get_all
(request)
return render(request, 'builds/all.html', {'builds': builds})
[]
def get_all(request): builds = sorted(CommCareBuild.all_builds(), key=lambda build: build.time) return render(request, 'builds/all.html', {'builds': builds})
[ "def", "get_all", "(", "request", ")", ":", "builds", "=", "sorted", "(", "CommCareBuild", ".", "all_builds", "(", ")", ",", "key", "=", "lambda", "build", ":", "build", ".", "time", ")", "return", "render", "(", "request", ",", "'builds/all.html'", ",",...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/builds/views.py#L63-L65
famavott/osint-scraper
825991d83ad0934c1e4509481c6ec1d0248bf37b
osint_scraper/scripts/recon.py
python
pwned_recon
(email)
return {'site': 'Have I been pwned.', 'url': url, 'results': results }
Check HIBP if email has been compromised.
Check HIBP if email has been compromised.
[ "Check", "HIBP", "if", "email", "has", "been", "compromised", "." ]
def pwned_recon(email): """Check HIBP if email has been compromised.""" if not email: return None results = pypwned.getAllBreachesForAccount(email=email) url = 'https://haveibeenpwned.com/' if '404' in results: return None if 'A server error' in results: # pragma: no cover ...
[ "def", "pwned_recon", "(", "email", ")", ":", "if", "not", "email", ":", "return", "None", "results", "=", "pypwned", ".", "getAllBreachesForAccount", "(", "email", "=", "email", ")", "url", "=", "'https://haveibeenpwned.com/'", "if", "'404'", "in", "results",...
https://github.com/famavott/osint-scraper/blob/825991d83ad0934c1e4509481c6ec1d0248bf37b/osint_scraper/scripts/recon.py#L49-L62
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/combinat/words/words.py
python
Words_n.__init__
(self, words, n)
r""" INPUT: - ``words`` -- a set of finite words - ``n`` -- a non-negative integer TESTS:: sage: Words([0,1], length=-42) Traceback (most recent call last): ... ValueError: n = -42 must be non-negative
r""" INPUT:
[ "r", "INPUT", ":" ]
def __init__(self, words, n): r""" INPUT: - ``words`` -- a set of finite words - ``n`` -- a non-negative integer TESTS:: sage: Words([0,1], length=-42) Traceback (most recent call last): ... ValueError: n = -42 must be non-negat...
[ "def", "__init__", "(", "self", ",", "words", ",", "n", ")", ":", "n", "=", "ZZ", "(", "n", ")", "if", "n", "<", "0", ":", "raise", "ValueError", "(", "\"n = {} must be non-negative\"", ".", "format", "(", "n", ")", ")", "self", ".", "_words", "=",...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/words/words.py#L2077-L2098
tensorflow/estimator
edb6e18703a0fa00182bcc72a056da6f5ce45e70
tensorflow_estimator/python/estimator/tpu/tpu_estimator.py
python
_InputsWithStoppingSignals.signals
(self)
return signals
Returns the `Signals` from `_Inputs`.
Returns the `Signals` from `_Inputs`.
[ "Returns", "the", "Signals", "from", "_Inputs", "." ]
def signals(self): """Returns the `Signals` from `_Inputs`.""" if self._current_inputs is None: raise RuntimeError( 'Internal Error: The current inputs have not been properly ' 'generated. First call features_and_labels, then call signals.') signals = self._current_inputs['signals'...
[ "def", "signals", "(", "self", ")", ":", "if", "self", ".", "_current_inputs", "is", "None", ":", "raise", "RuntimeError", "(", "'Internal Error: The current inputs have not been properly '", "'generated. First call features_and_labels, then call signals.'", ")", "signals", "...
https://github.com/tensorflow/estimator/blob/edb6e18703a0fa00182bcc72a056da6f5ce45e70/tensorflow_estimator/python/estimator/tpu/tpu_estimator.py#L4014-L4022
airlab-unibas/airlab
1a715766e17c812803624d95196092291fa2241d
airlab/utils/imageFilters.py
python
remove_bed_filter
(image, cropping=True)
return (Image(outImage).to(device=image.device), Image(bodyMask).to(device=image.device))
Removes fine structures from the image using morphological operators. It can be used to remove the bed structure usually present in CT images. The resulting image and the respective body mask can be cropped with the cropping option. Note: the morphological operations are performed on a downsampled version ...
Removes fine structures from the image using morphological operators. It can be used to remove the bed structure usually present in CT images. The resulting image and the respective body mask can be cropped with the cropping option.
[ "Removes", "fine", "structures", "from", "the", "image", "using", "morphological", "operators", ".", "It", "can", "be", "used", "to", "remove", "the", "bed", "structure", "usually", "present", "in", "CT", "images", ".", "The", "resulting", "image", "and", "t...
def remove_bed_filter(image, cropping=True): """ Removes fine structures from the image using morphological operators. It can be used to remove the bed structure usually present in CT images. The resulting image and the respective body mask can be cropped with the cropping option. Note: the morphol...
[ "def", "remove_bed_filter", "(", "image", ",", "cropping", "=", "True", ")", ":", "# define parameters", "houndsfield_min", "=", "-", "300", "houndsfield_max", "=", "3071", "houndsfield_default", "=", "-", "1024", "radius_opening", "=", "3", "radius_closing", "=",...
https://github.com/airlab-unibas/airlab/blob/1a715766e17c812803624d95196092291fa2241d/airlab/utils/imageFilters.py#L89-L191
Qiskit/qiskit-terra
b66030e3b9192efdd3eb95cf25c6545fe0a13da4
qiskit/providers/models/backendproperties.py
python
BackendProperties.t2
(self, qubit: int)
return self.qubit_property(qubit, "T2")[0]
Return the T2 time of the given qubit. Args: qubit: Qubit for which to return the T2 time of. Returns: T2 time of the given qubit.
Return the T2 time of the given qubit.
[ "Return", "the", "T2", "time", "of", "the", "given", "qubit", "." ]
def t2(self, qubit: int) -> float: # pylint: disable=invalid-name """ Return the T2 time of the given qubit. Args: qubit: Qubit for which to return the T2 time of. Returns: T2 time of the given qubit. """ return self.qubit_property(qubit, "T2")[...
[ "def", "t2", "(", "self", ",", "qubit", ":", "int", ")", "->", "float", ":", "# pylint: disable=invalid-name", "return", "self", ".", "qubit_property", "(", "qubit", ",", "\"T2\"", ")", "[", "0", "]" ]
https://github.com/Qiskit/qiskit-terra/blob/b66030e3b9192efdd3eb95cf25c6545fe0a13da4/qiskit/providers/models/backendproperties.py#L406-L416
ReactionMechanismGenerator/RMG-Py
2b7baf51febf27157def58fb3f6cee03fb6a684c
arkane/encorr/reference.py
python
ReferenceSpecies.update_from_arkane_spcs
(self, arkane_species)
Add in calculated data from an existing ArkaneSpecies object. Notes: If the model chemistry already exists then this calculated data will be overwritten by the data contained in arkane_species Args: arkane_species (ArkaneSpecies): Matching Arkane species that was r...
Add in calculated data from an existing ArkaneSpecies object.
[ "Add", "in", "calculated", "data", "from", "an", "existing", "ArkaneSpecies", "object", "." ]
def update_from_arkane_spcs(self, arkane_species): """ Add in calculated data from an existing ArkaneSpecies object. Notes: If the model chemistry already exists then this calculated data will be overwritten by the data contained in arkane_species Args: ...
[ "def", "update_from_arkane_spcs", "(", "self", ",", "arkane_species", ")", ":", "# First, check that the species matches", "if", "not", "self", ".", "species", ".", "is_isomorphic", "(", "arkane_species", ".", "species", ")", ":", "raise", "ValueError", "(", "f'Cann...
https://github.com/ReactionMechanismGenerator/RMG-Py/blob/2b7baf51febf27157def58fb3f6cee03fb6a684c/arkane/encorr/reference.py#L199-L230
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-linux/x64/PIL/TiffImagePlugin.py
python
IFDRational.__hash__
(self)
return self._val.__hash__()
[]
def __hash__(self): return self._val.__hash__()
[ "def", "__hash__", "(", "self", ")", ":", "return", "self", ".", "_val", ".", "__hash__", "(", ")" ]
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-linux/x64/PIL/TiffImagePlugin.py#L351-L352
praw-dev/praw
d1280b132f509ad115f3941fb55f13f979068377
praw/models/reddit/subreddit.py
python
SubredditLinkFlairTemplates.__iter__
( self, )
Iterate through the link flair templates as a moderator. For example: .. code-block:: python for template in reddit.subreddit("test").flair.link_templates: print(template)
Iterate through the link flair templates as a moderator.
[ "Iterate", "through", "the", "link", "flair", "templates", "as", "a", "moderator", "." ]
def __iter__( self, ) -> Generator[Dict[str, Union[str, int, bool, List[Dict[str, str]]]], None, None]: """Iterate through the link flair templates as a moderator. For example: .. code-block:: python for template in reddit.subreddit("test").flair.link_templates: ...
[ "def", "__iter__", "(", "self", ",", ")", "->", "Generator", "[", "Dict", "[", "str", ",", "Union", "[", "str", ",", "int", ",", "bool", ",", "List", "[", "Dict", "[", "str", ",", "str", "]", "]", "]", "]", ",", "None", ",", "None", "]", ":",...
https://github.com/praw-dev/praw/blob/d1280b132f509ad115f3941fb55f13f979068377/praw/models/reddit/subreddit.py#L2033-L2048
replit-archive/empythoned
977ec10ced29a3541a4973dc2b59910805695752
cpython/Lib/plat-mac/EasyDialogs.py
python
ProgressBar.inc
(self, n=1)
inc(amt) - Increment progress bar position
inc(amt) - Increment progress bar position
[ "inc", "(", "amt", ")", "-", "Increment", "progress", "bar", "position" ]
def inc(self, n=1): """inc(amt) - Increment progress bar position""" self.set(self.curval + n)
[ "def", "inc", "(", "self", ",", "n", "=", "1", ")", ":", "self", ".", "set", "(", "self", ".", "curval", "+", "n", ")" ]
https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/cpython/Lib/plat-mac/EasyDialogs.py#L337-L339
jliljebl/flowblade
995313a509b80e99eb1ad550d945bdda5995093b
flowblade-trunk/Flowblade/guicomponents.py
python
MediaPanel.empty_pressed
(self, widget, event)
[]
def empty_pressed(self, widget, event): self.clear_selection() if event.button == 3: self.panel_menu_cb(event)
[ "def", "empty_pressed", "(", "self", ",", "widget", ",", "event", ")", ":", "self", ".", "clear_selection", "(", ")", "if", "event", ".", "button", "==", "3", ":", "self", ".", "panel_menu_cb", "(", "event", ")" ]
https://github.com/jliljebl/flowblade/blob/995313a509b80e99eb1ad550d945bdda5995093b/flowblade-trunk/Flowblade/guicomponents.py#L1280-L1283
tenzir/threatbus
a26096e7b61b3eddf25c445d40a6cd2ea4420558
apps/zmq-app-template/zmq_app_template/template.py
python
receive
(pub_endpoint: str, topic: str, indicator_queue: asyncio.Queue)
Starts a zmq subscriber on the given endpoint and listens for new messages that are published on the given topic (zmq prefix matching). Depending on the topic suffix, Indicators are enqueued to the indicator_queue. @param pub_endpoint A host:port string to connect to via zmq @param topic The topic prefi...
Starts a zmq subscriber on the given endpoint and listens for new messages that are published on the given topic (zmq prefix matching). Depending on the topic suffix, Indicators are enqueued to the indicator_queue.
[ "Starts", "a", "zmq", "subscriber", "on", "the", "given", "endpoint", "and", "listens", "for", "new", "messages", "that", "are", "published", "on", "the", "given", "topic", "(", "zmq", "prefix", "matching", ")", ".", "Depending", "on", "the", "topic", "suf...
async def receive(pub_endpoint: str, topic: str, indicator_queue: asyncio.Queue): """ Starts a zmq subscriber on the given endpoint and listens for new messages that are published on the given topic (zmq prefix matching). Depending on the topic suffix, Indicators are enqueued to the indicator_queue. ...
[ "async", "def", "receive", "(", "pub_endpoint", ":", "str", ",", "topic", ":", "str", ",", "indicator_queue", ":", "asyncio", ".", "Queue", ")", ":", "global", "logger", "socket", "=", "zmq", ".", "Context", "(", ")", ".", "socket", "(", "zmq", ".", ...
https://github.com/tenzir/threatbus/blob/a26096e7b61b3eddf25c445d40a6cd2ea4420558/apps/zmq-app-template/zmq_app_template/template.py#L237-L269
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/site-packages/pip/_vendor/pkg_resources/__init__.py
python
find_nothing
(importer, path_item, only=False)
return ()
[]
def find_nothing(importer, path_item, only=False): return ()
[ "def", "find_nothing", "(", "importer", ",", "path_item", ",", "only", "=", "False", ")", ":", "return", "(", ")" ]
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/site-packages/pip/_vendor/pkg_resources/__init__.py#L1964-L1965
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-darwin/x64/wheezy/captcha/image.py
python
background
(color='#EEEECC')
return drawer
[]
def background(color='#EEEECC'): color = getrgb(color) def drawer(image, text): Draw(image).rectangle([(0, 0), image.size], fill=color) return image return drawer
[ "def", "background", "(", "color", "=", "'#EEEECC'", ")", ":", "color", "=", "getrgb", "(", "color", ")", "def", "drawer", "(", "image", ",", "text", ")", ":", "Draw", "(", "image", ")", ".", "rectangle", "(", "[", "(", "0", ",", "0", ")", ",", ...
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-darwin/x64/wheezy/captcha/image.py#L26-L32
isnowfy/pydown
71ecc891868cd2a34b7e5fe662c99474f2d0fd7f
pygments/lexer.py
python
_PseudoMatch.groups
(self)
return (self._text,)
[]
def groups(self): return (self._text,)
[ "def", "groups", "(", "self", ")", ":", "return", "(", "self", ".", "_text", ",", ")" ]
https://github.com/isnowfy/pydown/blob/71ecc891868cd2a34b7e5fe662c99474f2d0fd7f/pygments/lexer.py#L274-L275
simonw/djangopeople.net
ed04d3c79d03b9c74f3e7f82b2af944e021f8e15
lib/openid/consumer/consumer.py
python
Consumer.begin
(self, user_url)
Start the OpenID authentication process. See steps 1-2 in the overview at the top of this file. @param user_url: Identity URL given by the user. This method performs a textual transformation of the URL to try and make sure it is normalized. For example, a user_url of ...
Start the OpenID authentication process. See steps 1-2 in the overview at the top of this file.
[ "Start", "the", "OpenID", "authentication", "process", ".", "See", "steps", "1", "-", "2", "in", "the", "overview", "at", "the", "top", "of", "this", "file", "." ]
def begin(self, user_url): """Start the OpenID authentication process. See steps 1-2 in the overview at the top of this file. @param user_url: Identity URL given by the user. This method performs a textual transformation of the URL to try and make sure it is normalized. ...
[ "def", "begin", "(", "self", ",", "user_url", ")", ":", "if", "yadis_available", "and", "xri", ".", "identifierScheme", "(", "user_url", ")", "==", "\"XRI\"", ":", "discoverMethod", "=", "discoverXRI", "openid_url", "=", "user_url", "else", ":", "discoverMetho...
https://github.com/simonw/djangopeople.net/blob/ed04d3c79d03b9c74f3e7f82b2af944e021f8e15/lib/openid/consumer/consumer.py#L253-L308
sametmax/Django--an-app-at-a-time
99eddf12ead76e6dfbeb09ce0bae61e282e22f8a
ignore_this_directory/django/db/backends/oracle/introspection.py
python
DatabaseIntrospection.identifier_converter
(self, name)
return name.lower()
Identifier comparison is case insensitive under Oracle.
Identifier comparison is case insensitive under Oracle.
[ "Identifier", "comparison", "is", "case", "insensitive", "under", "Oracle", "." ]
def identifier_converter(self, name): """Identifier comparison is case insensitive under Oracle.""" return name.lower()
[ "def", "identifier_converter", "(", "self", ",", "name", ")", ":", "return", "name", ".", "lower", "(", ")" ]
https://github.com/sametmax/Django--an-app-at-a-time/blob/99eddf12ead76e6dfbeb09ce0bae61e282e22f8a/ignore_this_directory/django/db/backends/oracle/introspection.py#L106-L108
sightmachine/SimpleCV
6c4d61b6d1d9d856b471910107cad0838954d2b2
SimpleCV/examples/web-based/cloudanimator/images2gif.py
python
getGraphicsControlExt
(duration=0.1)
return bb
Graphics Control Extension. A sort of header at the start of each image. Specifies transparancy and duration.
Graphics Control Extension. A sort of header at the start of each image. Specifies transparancy and duration.
[ "Graphics", "Control", "Extension", ".", "A", "sort", "of", "header", "at", "the", "start", "of", "each", "image", ".", "Specifies", "transparancy", "and", "duration", "." ]
def getGraphicsControlExt(duration=0.1): """ Graphics Control Extension. A sort of header at the start of each image. Specifies transparancy and duration. """ bb = '\x21\xF9\x04' bb += '\x08' # no transparancy bb += intToBin( int(duration*100) ) # in 100th of seconds bb += '\x00' # no transpar...
[ "def", "getGraphicsControlExt", "(", "duration", "=", "0.1", ")", ":", "bb", "=", "'\\x21\\xF9\\x04'", "bb", "+=", "'\\x08'", "# no transparancy", "bb", "+=", "intToBin", "(", "int", "(", "duration", "*", "100", ")", ")", "# in 100th of seconds", "bb", "+=", ...
https://github.com/sightmachine/SimpleCV/blob/6c4d61b6d1d9d856b471910107cad0838954d2b2/SimpleCV/examples/web-based/cloudanimator/images2gif.py#L66-L74
azavea/raster-vision
fc181a6f31f085affa1ee12f0204bdbc5a6bf85a
rastervision_core/rastervision/core/data/label/semantic_segmentation_labels.py
python
SemanticSegmentationLabels.__setitem__
(self, window: Box, values: np.ndarray)
Set labels for the given window, overriding current values, if any.
Set labels for the given window, overriding current values, if any.
[ "Set", "labels", "for", "the", "given", "window", "overriding", "current", "values", "if", "any", "." ]
def __setitem__(self, window: Box, values: np.ndarray) -> None: """Set labels for the given window, overriding current values, if any. """ pass
[ "def", "__setitem__", "(", "self", ",", "window", ":", "Box", ",", "values", ":", "np", ".", "ndarray", ")", "->", "None", ":", "pass" ]
https://github.com/azavea/raster-vision/blob/fc181a6f31f085affa1ee12f0204bdbc5a6bf85a/rastervision_core/rastervision/core/data/label/semantic_segmentation_labels.py#L26-L29
pyannote/pyannote-audio
a448164b4abe56a2c0da11e143648d4fed5967f8
pyannote/audio/applications/config.py
python
load_config
( config_yml: Path, training: bool = False, config_default_module: Text = None, pretrained_config_yml: Path = None, )
return cfg
Returns ------- config : Dict ['preprocessors'] ['learning_rate'] ['scheduler'] ['get_optimizer'] ['callbacks'] ['feature_extraction'] ['task'] ['get_model_from_specs'] ['model_resolution'] ['model_alignment']
[]
def load_config( config_yml: Path, training: bool = False, config_default_module: Text = None, pretrained_config_yml: Path = None, ) -> Dict: """ Returns ------- config : Dict ['preprocessors'] ['learning_rate'] ['scheduler'] ['get_optimizer'] ['c...
[ "def", "load_config", "(", "config_yml", ":", "Path", ",", "training", ":", "bool", "=", "False", ",", "config_default_module", ":", "Text", "=", "None", ",", "pretrained_config_yml", ":", "Path", "=", "None", ",", ")", "->", "Dict", ":", "# load pretrained ...
https://github.com/pyannote/pyannote-audio/blob/a448164b4abe56a2c0da11e143648d4fed5967f8/pyannote/audio/applications/config.py#L64-L235
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/modular/local_comp/smoothchar.py
python
SmoothCharacterGroupQp.quadratic_chars
(self)
return sorted([nr] + [f for f in ram] + [f*nr for f in ram])
r""" Return a list of the (non-trivial) quadratic characters in this group. This will be a list of 3 characters, unless `p = 2` when there are 7. EXAMPLES:: sage: from sage.modular.local_comp.smoothchar import SmoothCharacterGroupQp sage: SmoothCharacterGroupQp(7, QQ).q...
r""" Return a list of the (non-trivial) quadratic characters in this group. This will be a list of 3 characters, unless `p = 2` when there are 7.
[ "r", "Return", "a", "list", "of", "the", "(", "non", "-", "trivial", ")", "quadratic", "characters", "in", "this", "group", ".", "This", "will", "be", "a", "list", "of", "3", "characters", "unless", "p", "=", "2", "when", "there", "are", "7", "." ]
def quadratic_chars(self): r""" Return a list of the (non-trivial) quadratic characters in this group. This will be a list of 3 characters, unless `p = 2` when there are 7. EXAMPLES:: sage: from sage.modular.local_comp.smoothchar import SmoothCharacterGroupQp sa...
[ "def", "quadratic_chars", "(", "self", ")", ":", "if", "self", ".", "prime", "(", ")", "==", "2", ":", "q", "=", "3", "else", ":", "q", "=", "1", "ram", "=", "[", "self", ".", "from_dirichlet", "(", "chi", ")", "for", "chi", "in", "DirichletGroup...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/modular/local_comp/smoothchar.py#L1069-L1096
freewym/espresso
6671c507350295269e38add57dbe601dcb8e6ecf
fairseq/data/audio/data_cfg.py
python
S2SDataConfig.output_sample_rate
(self)
return self.config.get("output_sample_rate", 22050)
The audio sample rate of output target speech
The audio sample rate of output target speech
[ "The", "audio", "sample", "rate", "of", "output", "target", "speech" ]
def output_sample_rate(self): """The audio sample rate of output target speech""" return self.config.get("output_sample_rate", 22050)
[ "def", "output_sample_rate", "(", "self", ")", ":", "return", "self", ".", "config", ".", "get", "(", "\"output_sample_rate\"", ",", "22050", ")" ]
https://github.com/freewym/espresso/blob/6671c507350295269e38add57dbe601dcb8e6ecf/fairseq/data/audio/data_cfg.py#L182-L184
tgalal/yowsup
dd47d57a950964bab0c4715e9d56fd8450bc94e2
yowsup/config/base/transform.py
python
ConfigTransform.transform
(self, config)
:param config: :type config: yowsup.config.base.config.Config :return: dict :rtype:
:param config: :type config: yowsup.config.base.config.Config :return: dict :rtype:
[ ":", "param", "config", ":", ":", "type", "config", ":", "yowsup", ".", "config", ".", "base", ".", "config", ".", "Config", ":", "return", ":", "dict", ":", "rtype", ":" ]
def transform(self, config): """ :param config: :type config: yowsup.config.base.config.Config :return: dict :rtype: """
[ "def", "transform", "(", "self", ",", "config", ")", ":" ]
https://github.com/tgalal/yowsup/blob/dd47d57a950964bab0c4715e9d56fd8450bc94e2/yowsup/config/base/transform.py#L2-L8
Tautulli/Tautulli
2410eb33805aaac4bd1c5dad0f71e4f15afaf742
lib/paho/mqtt/matcher.py
python
MQTTMatcher.__init__
(self)
[]
def __init__(self): self._root = self.Node()
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "_root", "=", "self", ".", "Node", "(", ")" ]
https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/paho/mqtt/matcher.py#L16-L17