repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
3 values
summary
stringlengths
4
350
SandstoneHPC/sandstone-ide
sandstone/lib/filesystem/filewatcher.py
FilesystemEventHandler.on_deleted
def on_deleted(self, event): """ Event Handler when a file is deleted """ key = 'filesystem:file_deleted' data = { 'filepath': event.src_path, 'is_directory': event.is_directory, 'dirpath': os.path.dirname(event.src_path) } bms...
python
def on_deleted(self, event): """ Event Handler when a file is deleted """ key = 'filesystem:file_deleted' data = { 'filepath': event.src_path, 'is_directory': event.is_directory, 'dirpath': os.path.dirname(event.src_path) } bms...
[ "def", "on_deleted", "(", "self", ",", "event", ")", ":", "key", "=", "'filesystem:file_deleted'", "data", "=", "{", "'filepath'", ":", "event", ".", "src_path", ",", "'is_directory'", ":", "event", ".", "is_directory", ",", "'dirpath'", ":", "os", ".", "p...
Event Handler when a file is deleted
[ "Event", "Handler", "when", "a", "file", "is", "deleted" ]
7a47947fb07281c3e3018042863dc67e7e56dc04
https://github.com/SandstoneHPC/sandstone-ide/blob/7a47947fb07281c3e3018042863dc67e7e56dc04/sandstone/lib/filesystem/filewatcher.py#L27-L39
train
Event Handler when a file is deleted
stestagg/dateformat
dateformat.py
DateFormat.format
def format(self, date): """ Given a datetime.datetime object, return a string representing this date/time, formatted according to this dateformat. """ context = {'date': date} for handler in self.format_chain: handler(self, date, context) return eval(s...
python
def format(self, date): """ Given a datetime.datetime object, return a string representing this date/time, formatted according to this dateformat. """ context = {'date': date} for handler in self.format_chain: handler(self, date, context) return eval(s...
[ "def", "format", "(", "self", ",", "date", ")", ":", "context", "=", "{", "'date'", ":", "date", "}", "for", "handler", "in", "self", ".", "format_chain", ":", "handler", "(", "self", ",", "date", ",", "context", ")", "return", "eval", "(", "self", ...
Given a datetime.datetime object, return a string representing this date/time, formatted according to this dateformat.
[ "Given", "a", "datetime", ".", "datetime", "object", "return", "a", "string", "representing", "this", "date", "/", "time", "formatted", "according", "to", "this", "dateformat", "." ]
4743f5dabf1eaf66524247328c76cfd3a05d0daf
https://github.com/stestagg/dateformat/blob/4743f5dabf1eaf66524247328c76cfd3a05d0daf/dateformat.py#L506-L514
train
Given a datetime. datetime object return a string representing this date / time formatted according to this dateformat.
go-macaroon-bakery/py-macaroon-bakery
macaroonbakery/httpbakery/agent/_agent.py
read_auth_info
def read_auth_info(agent_file_content): '''Loads agent authentication information from the specified content string, as read from an agents file. The returned information is suitable for passing as an argument to the AgentInteractor constructor. @param agent_file_content The agent file content (str)...
python
def read_auth_info(agent_file_content): '''Loads agent authentication information from the specified content string, as read from an agents file. The returned information is suitable for passing as an argument to the AgentInteractor constructor. @param agent_file_content The agent file content (str)...
[ "def", "read_auth_info", "(", "agent_file_content", ")", ":", "try", ":", "data", "=", "json", ".", "loads", "(", "agent_file_content", ")", "return", "AuthInfo", "(", "key", "=", "bakery", ".", "PrivateKey", ".", "deserialize", "(", "data", "[", "'key'", ...
Loads agent authentication information from the specified content string, as read from an agents file. The returned information is suitable for passing as an argument to the AgentInteractor constructor. @param agent_file_content The agent file content (str) @return AuthInfo The authentication inform...
[ "Loads", "agent", "authentication", "information", "from", "the", "specified", "content", "string", "as", "read", "from", "an", "agents", "file", ".", "The", "returned", "information", "is", "suitable", "for", "passing", "as", "an", "argument", "to", "the", "A...
63ce1ef1dabe816eb8aaec48fbb46761c34ddf77
https://github.com/go-macaroon-bakery/py-macaroon-bakery/blob/63ce1ef1dabe816eb8aaec48fbb46761c34ddf77/macaroonbakery/httpbakery/agent/_agent.py#L37-L60
train
Loads agent authentication information from the specified content string as read from an agents file.
go-macaroon-bakery/py-macaroon-bakery
macaroonbakery/httpbakery/agent/_agent.py
AgentInteractor.interact
def interact(self, client, location, interaction_required_err): '''Implement Interactor.interact by obtaining obtaining a macaroon from the discharger, discharging it with the local private key using the discharged macaroon as a discharge token''' p = interaction_required_err.int...
python
def interact(self, client, location, interaction_required_err): '''Implement Interactor.interact by obtaining obtaining a macaroon from the discharger, discharging it with the local private key using the discharged macaroon as a discharge token''' p = interaction_required_err.int...
[ "def", "interact", "(", "self", ",", "client", ",", "location", ",", "interaction_required_err", ")", ":", "p", "=", "interaction_required_err", ".", "interaction_method", "(", "'agent'", ",", "InteractionInfo", ")", "if", "p", ".", "login_url", "is", "None", ...
Implement Interactor.interact by obtaining obtaining a macaroon from the discharger, discharging it with the local private key using the discharged macaroon as a discharge token
[ "Implement", "Interactor", ".", "interact", "by", "obtaining", "obtaining", "a", "macaroon", "from", "the", "discharger", "discharging", "it", "with", "the", "local", "private", "key", "using", "the", "discharged", "macaroon", "as", "a", "discharge", "token" ]
63ce1ef1dabe816eb8aaec48fbb46761c34ddf77
https://github.com/go-macaroon-bakery/py-macaroon-bakery/blob/63ce1ef1dabe816eb8aaec48fbb46761c34ddf77/macaroonbakery/httpbakery/agent/_agent.py#L98-L130
train
Implement Interactor. interact by obtaining the acquired macaroon from the discharger using the discharged macaroon as a discharge token using the discharged macaroon as a discharge token
go-macaroon-bakery/py-macaroon-bakery
macaroonbakery/httpbakery/agent/_agent.py
AgentInteractor._find_agent
def _find_agent(self, location): ''' Finds an appropriate agent entry for the given location. :return Agent ''' for a in self._auth_info.agents: # Don't worry about trailing slashes if a.url.rstrip('/') == location.rstrip('/'): return a rai...
python
def _find_agent(self, location): ''' Finds an appropriate agent entry for the given location. :return Agent ''' for a in self._auth_info.agents: # Don't worry about trailing slashes if a.url.rstrip('/') == location.rstrip('/'): return a rai...
[ "def", "_find_agent", "(", "self", ",", "location", ")", ":", "for", "a", "in", "self", ".", "_auth_info", ".", "agents", ":", "# Don't worry about trailing slashes", "if", "a", ".", "url", ".", "rstrip", "(", "'/'", ")", "==", "location", ".", "rstrip", ...
Finds an appropriate agent entry for the given location. :return Agent
[ "Finds", "an", "appropriate", "agent", "entry", "for", "the", "given", "location", ".", ":", "return", "Agent" ]
63ce1ef1dabe816eb8aaec48fbb46761c34ddf77
https://github.com/go-macaroon-bakery/py-macaroon-bakery/blob/63ce1ef1dabe816eb8aaec48fbb46761c34ddf77/macaroonbakery/httpbakery/agent/_agent.py#L132-L141
train
Find an appropriate agent entry for the given location.
go-macaroon-bakery/py-macaroon-bakery
macaroonbakery/httpbakery/agent/_agent.py
AgentInteractor.legacy_interact
def legacy_interact(self, client, location, visit_url): '''Implement LegacyInteractor.legacy_interact by obtaining the discharge macaroon using the client's private key ''' agent = self._find_agent(location) # Shallow-copy the client so that we don't unexpectedly side-effect ...
python
def legacy_interact(self, client, location, visit_url): '''Implement LegacyInteractor.legacy_interact by obtaining the discharge macaroon using the client's private key ''' agent = self._find_agent(location) # Shallow-copy the client so that we don't unexpectedly side-effect ...
[ "def", "legacy_interact", "(", "self", ",", "client", ",", "location", ",", "visit_url", ")", ":", "agent", "=", "self", ".", "_find_agent", "(", "location", ")", "# Shallow-copy the client so that we don't unexpectedly side-effect", "# it by changing the key. Another possi...
Implement LegacyInteractor.legacy_interact by obtaining the discharge macaroon using the client's private key
[ "Implement", "LegacyInteractor", ".", "legacy_interact", "by", "obtaining", "the", "discharge", "macaroon", "using", "the", "client", "s", "private", "key" ]
63ce1ef1dabe816eb8aaec48fbb46761c34ddf77
https://github.com/go-macaroon-bakery/py-macaroon-bakery/blob/63ce1ef1dabe816eb8aaec48fbb46761c34ddf77/macaroonbakery/httpbakery/agent/_agent.py#L143-L166
train
Implement LegacyInteractor. legacy_interact by obtaining the discharge macaroon using the client s private key and the agent s public key.
go-macaroon-bakery/py-macaroon-bakery
macaroonbakery/checkers/_time.py
macaroons_expiry_time
def macaroons_expiry_time(ns, ms): ''' Returns the minimum time of any time-before caveats found in the given macaroons or None if no such caveats were found. :param ns: a Namespace, used to resolve caveats. :param ms: a list of pymacaroons.Macaroon :return: datetime.DateTime or None. ''' t ...
python
def macaroons_expiry_time(ns, ms): ''' Returns the minimum time of any time-before caveats found in the given macaroons or None if no such caveats were found. :param ns: a Namespace, used to resolve caveats. :param ms: a list of pymacaroons.Macaroon :return: datetime.DateTime or None. ''' t ...
[ "def", "macaroons_expiry_time", "(", "ns", ",", "ms", ")", ":", "t", "=", "None", "for", "m", "in", "ms", ":", "et", "=", "expiry_time", "(", "ns", ",", "m", ".", "caveats", ")", "if", "et", "is", "not", "None", "and", "(", "t", "is", "None", "...
Returns the minimum time of any time-before caveats found in the given macaroons or None if no such caveats were found. :param ns: a Namespace, used to resolve caveats. :param ms: a list of pymacaroons.Macaroon :return: datetime.DateTime or None.
[ "Returns", "the", "minimum", "time", "of", "any", "time", "-", "before", "caveats", "found", "in", "the", "given", "macaroons", "or", "None", "if", "no", "such", "caveats", "were", "found", ".", ":", "param", "ns", ":", "a", "Namespace", "used", "to", ...
63ce1ef1dabe816eb8aaec48fbb46761c34ddf77
https://github.com/go-macaroon-bakery/py-macaroon-bakery/blob/63ce1ef1dabe816eb8aaec48fbb46761c34ddf77/macaroonbakery/checkers/_time.py#L25-L37
train
Returns the minimum time of any time - before caveats found in the given macaroons.
go-macaroon-bakery/py-macaroon-bakery
macaroonbakery/checkers/_time.py
expiry_time
def expiry_time(ns, cavs): ''' Returns the minimum time of any time-before caveats found in the given list or None if no such caveats were found. The ns parameter is :param ns: used to determine the standard namespace prefix - if the standard namespace is not found, the empty prefix is assumed. ...
python
def expiry_time(ns, cavs): ''' Returns the minimum time of any time-before caveats found in the given list or None if no such caveats were found. The ns parameter is :param ns: used to determine the standard namespace prefix - if the standard namespace is not found, the empty prefix is assumed. ...
[ "def", "expiry_time", "(", "ns", ",", "cavs", ")", ":", "prefix", "=", "ns", ".", "resolve", "(", "STD_NAMESPACE", ")", "time_before_cond", "=", "condition_with_prefix", "(", "prefix", ",", "COND_TIME_BEFORE", ")", "t", "=", "None", "for", "cav", "in", "ca...
Returns the minimum time of any time-before caveats found in the given list or None if no such caveats were found. The ns parameter is :param ns: used to determine the standard namespace prefix - if the standard namespace is not found, the empty prefix is assumed. :param cavs: a list of pymacaroons...
[ "Returns", "the", "minimum", "time", "of", "any", "time", "-", "before", "caveats", "found", "in", "the", "given", "list", "or", "None", "if", "no", "such", "caveats", "were", "found", "." ]
63ce1ef1dabe816eb8aaec48fbb46761c34ddf77
https://github.com/go-macaroon-bakery/py-macaroon-bakery/blob/63ce1ef1dabe816eb8aaec48fbb46761c34ddf77/macaroonbakery/checkers/_time.py#L40-L67
train
Returns the minimum time of any time - before caveats found in the given list or None if no such caveats were found.
SandstoneHPC/sandstone-ide
sandstone/lib/websocket_client.py
WebSocketClient.connect
def connect(self, url): """Connect to the server. :param str url: server URL. """ headers = httputil.HTTPHeaders({'Content-Type': APPLICATION_JSON}) request = httpclient.HTTPRequest(url=url, connect_timeout=self.connect_timeout, ...
python
def connect(self, url): """Connect to the server. :param str url: server URL. """ headers = httputil.HTTPHeaders({'Content-Type': APPLICATION_JSON}) request = httpclient.HTTPRequest(url=url, connect_timeout=self.connect_timeout, ...
[ "def", "connect", "(", "self", ",", "url", ")", ":", "headers", "=", "httputil", ".", "HTTPHeaders", "(", "{", "'Content-Type'", ":", "APPLICATION_JSON", "}", ")", "request", "=", "httpclient", ".", "HTTPRequest", "(", "url", "=", "url", ",", "connect_time...
Connect to the server. :param str url: server URL.
[ "Connect", "to", "the", "server", ".", ":", "param", "str", "url", ":", "server", "URL", "." ]
7a47947fb07281c3e3018042863dc67e7e56dc04
https://github.com/SandstoneHPC/sandstone-ide/blob/7a47947fb07281c3e3018042863dc67e7e56dc04/sandstone/lib/websocket_client.py#L30-L41
train
Connect to the server.
SandstoneHPC/sandstone-ide
sandstone/lib/websocket_client.py
WebSocketClient.send
def send(self, data): """Send message to the server :param str data: message. """ if not self._ws_connection: raise RuntimeError('Web socket connection is closed.') self._ws_connection.write_message(json.dumps(data))
python
def send(self, data): """Send message to the server :param str data: message. """ if not self._ws_connection: raise RuntimeError('Web socket connection is closed.') self._ws_connection.write_message(json.dumps(data))
[ "def", "send", "(", "self", ",", "data", ")", ":", "if", "not", "self", ".", "_ws_connection", ":", "raise", "RuntimeError", "(", "'Web socket connection is closed.'", ")", "self", ".", "_ws_connection", ".", "write_message", "(", "json", ".", "dumps", "(", ...
Send message to the server :param str data: message.
[ "Send", "message", "to", "the", "server", ":", "param", "str", "data", ":", "message", "." ]
7a47947fb07281c3e3018042863dc67e7e56dc04
https://github.com/SandstoneHPC/sandstone-ide/blob/7a47947fb07281c3e3018042863dc67e7e56dc04/sandstone/lib/websocket_client.py#L43-L50
train
Send a message to the server.
Phyks/libbmc
libbmc/tools.py
replace_all
def replace_all(text, replace_dict): """ Replace multiple strings in a text. .. note:: Replacements are made successively, without any warranty on the order \ in which they are made. :param text: Text to replace in. :param replace_dict: Dictionary mapping strings to replace with ...
python
def replace_all(text, replace_dict): """ Replace multiple strings in a text. .. note:: Replacements are made successively, without any warranty on the order \ in which they are made. :param text: Text to replace in. :param replace_dict: Dictionary mapping strings to replace with ...
[ "def", "replace_all", "(", "text", ",", "replace_dict", ")", ":", "for", "i", ",", "j", "in", "replace_dict", ".", "items", "(", ")", ":", "text", "=", "text", ".", "replace", "(", "i", ",", "j", ")", "return", "text" ]
Replace multiple strings in a text. .. note:: Replacements are made successively, without any warranty on the order \ in which they are made. :param text: Text to replace in. :param replace_dict: Dictionary mapping strings to replace with their \ substitution. :returns: T...
[ "Replace", "multiple", "strings", "in", "a", "text", "." ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/tools.py#L16-L36
train
Replace multiple strings in a text.
Phyks/libbmc
libbmc/tools.py
map_or_apply
def map_or_apply(function, param): """ Map the function on ``param``, or apply it, depending whether ``param`` \ is a list or an item. :param function: The function to apply. :param param: The parameter to feed the function with (list or item). :returns: The computed value or ``None``. ...
python
def map_or_apply(function, param): """ Map the function on ``param``, or apply it, depending whether ``param`` \ is a list or an item. :param function: The function to apply. :param param: The parameter to feed the function with (list or item). :returns: The computed value or ``None``. ...
[ "def", "map_or_apply", "(", "function", ",", "param", ")", ":", "try", ":", "if", "isinstance", "(", "param", ",", "list", ")", ":", "return", "[", "next", "(", "iter", "(", "function", "(", "i", ")", ")", ")", "for", "i", "in", "param", "]", "el...
Map the function on ``param``, or apply it, depending whether ``param`` \ is a list or an item. :param function: The function to apply. :param param: The parameter to feed the function with (list or item). :returns: The computed value or ``None``.
[ "Map", "the", "function", "on", "param", "or", "apply", "it", "depending", "whether", "param", "\\", "is", "a", "list", "or", "an", "item", "." ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/tools.py#L39-L54
train
Maps the function on param or applies it depending on param \ is a list or an item.
Phyks/libbmc
libbmc/tools.py
batch
def batch(iterable, size): """ Get items from a sequence a batch at a time. .. note: Adapted from https://code.activestate.com/recipes/303279-getting-items-in-batches/. .. note: All batches must be exhausted immediately. :params iterable: An iterable to get batches from...
python
def batch(iterable, size): """ Get items from a sequence a batch at a time. .. note: Adapted from https://code.activestate.com/recipes/303279-getting-items-in-batches/. .. note: All batches must be exhausted immediately. :params iterable: An iterable to get batches from...
[ "def", "batch", "(", "iterable", ",", "size", ")", ":", "item", "=", "iter", "(", "iterable", ")", "while", "True", ":", "batch_iterator", "=", "islice", "(", "item", ",", "size", ")", "try", ":", "yield", "chain", "(", "[", "next", "(", "batch_itera...
Get items from a sequence a batch at a time. .. note: Adapted from https://code.activestate.com/recipes/303279-getting-items-in-batches/. .. note: All batches must be exhausted immediately. :params iterable: An iterable to get batches from. :params size: Size of the batches...
[ "Get", "items", "from", "a", "sequence", "a", "batch", "at", "a", "time", "." ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/tools.py#L87-L114
train
Returns a list of items from an iterable in batches of the given size at a time.
Phyks/libbmc
libbmc/tools.py
slugify
def slugify(value): """ Normalizes string, converts to lowercase, removes non-alpha characters, and converts spaces to hyphens to have nice filenames. From Django's "django/template/defaultfilters.py". >>> slugify("El pingüino Wenceslao hizo kilómetros bajo exhaustiva lluvia y frío, añoraba a su q...
python
def slugify(value): """ Normalizes string, converts to lowercase, removes non-alpha characters, and converts spaces to hyphens to have nice filenames. From Django's "django/template/defaultfilters.py". >>> slugify("El pingüino Wenceslao hizo kilómetros bajo exhaustiva lluvia y frío, añoraba a su q...
[ "def", "slugify", "(", "value", ")", ":", "try", ":", "unicode_type", "=", "unicode", "except", "NameError", ":", "unicode_type", "=", "str", "if", "not", "isinstance", "(", "value", ",", "unicode_type", ")", ":", "value", "=", "unicode_type", "(", "value"...
Normalizes string, converts to lowercase, removes non-alpha characters, and converts spaces to hyphens to have nice filenames. From Django's "django/template/defaultfilters.py". >>> slugify("El pingüino Wenceslao hizo kilómetros bajo exhaustiva lluvia y frío, añoraba a su querido cachorro. ortez ce vieux ...
[ "Normalizes", "string", "converts", "to", "lowercase", "removes", "non", "-", "alpha", "characters", "and", "converts", "spaces", "to", "hyphens", "to", "have", "nice", "filenames", "." ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/tools.py#L131-L150
train
Generates a slug for the given string.
Phyks/libbmc
libbmc/citations/repositories/arxiv.py
get_plaintext_citations
def get_plaintext_citations(arxiv_id): """ Get the citations of a given preprint, in plain text. .. note:: Bulk download of sources from arXiv is not permitted by their API. \ You should have a look at http://arxiv.org/help/bulk_data_s3. :param arxiv_id: The arXiv id (e.g. ``1...
python
def get_plaintext_citations(arxiv_id): """ Get the citations of a given preprint, in plain text. .. note:: Bulk download of sources from arXiv is not permitted by their API. \ You should have a look at http://arxiv.org/help/bulk_data_s3. :param arxiv_id: The arXiv id (e.g. ``1...
[ "def", "get_plaintext_citations", "(", "arxiv_id", ")", ":", "plaintext_citations", "=", "[", "]", "# Get the list of bbl files for this preprint", "bbl_files", "=", "arxiv", ".", "get_bbl", "(", "arxiv_id", ")", "for", "bbl_file", "in", "bbl_files", ":", "# Fetch the...
Get the citations of a given preprint, in plain text. .. note:: Bulk download of sources from arXiv is not permitted by their API. \ You should have a look at http://arxiv.org/help/bulk_data_s3. :param arxiv_id: The arXiv id (e.g. ``1401.2910`` or ``1401.2910v1``) in \ a c...
[ "Get", "the", "citations", "of", "a", "given", "preprint", "in", "plain", "text", "." ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/citations/repositories/arxiv.py#L9-L28
train
Get the citations of a given preprint in plain text.
Phyks/libbmc
libbmc/citations/repositories/arxiv.py
get_cited_dois
def get_cited_dois(arxiv_id): """ Get the DOIs of the papers cited in a .bbl file. .. note:: Bulk download of sources from arXiv is not permitted by their API. \ You should have a look at http://arxiv.org/help/bulk_data_s3. :param arxiv_id: The arXiv id (e.g. ``1401.2910`` or ...
python
def get_cited_dois(arxiv_id): """ Get the DOIs of the papers cited in a .bbl file. .. note:: Bulk download of sources from arXiv is not permitted by their API. \ You should have a look at http://arxiv.org/help/bulk_data_s3. :param arxiv_id: The arXiv id (e.g. ``1401.2910`` or ...
[ "def", "get_cited_dois", "(", "arxiv_id", ")", ":", "dois", "=", "{", "}", "# Get the list of bbl files for this preprint", "bbl_files", "=", "arxiv", ".", "get_bbl", "(", "arxiv_id", ")", "for", "bbl_file", "in", "bbl_files", ":", "# Fetch the cited DOIs for each of ...
Get the DOIs of the papers cited in a .bbl file. .. note:: Bulk download of sources from arXiv is not permitted by their API. \ You should have a look at http://arxiv.org/help/bulk_data_s3. :param arxiv_id: The arXiv id (e.g. ``1401.2910`` or ``1401.2910v1``) in \ a canoni...
[ "Get", "the", "DOIs", "of", "the", "papers", "cited", "in", "a", ".", "bbl", "file", "." ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/citations/repositories/arxiv.py#L31-L50
train
Get the cited DOIs of the papers cited in a. bbl file.
eonpatapon/contrail-api-cli
contrail_api_cli/main.py
get_subcommand_kwargs
def get_subcommand_kwargs(mgr, name, namespace): """Get subcommand options from global parsed arguments. """ subcmd = mgr.get(name) subcmd_kwargs = {} for opt in list(subcmd.args.values()) + list(subcmd.options.values()): if hasattr(namespace, opt.dest): subcmd_kwargs[opt.des...
python
def get_subcommand_kwargs(mgr, name, namespace): """Get subcommand options from global parsed arguments. """ subcmd = mgr.get(name) subcmd_kwargs = {} for opt in list(subcmd.args.values()) + list(subcmd.options.values()): if hasattr(namespace, opt.dest): subcmd_kwargs[opt.des...
[ "def", "get_subcommand_kwargs", "(", "mgr", ",", "name", ",", "namespace", ")", ":", "subcmd", "=", "mgr", ".", "get", "(", "name", ")", "subcmd_kwargs", "=", "{", "}", "for", "opt", "in", "list", "(", "subcmd", ".", "args", ".", "values", "(", ")", ...
Get subcommand options from global parsed arguments.
[ "Get", "subcommand", "options", "from", "global", "parsed", "arguments", "." ]
1571bf523fa054f3d6bf83dba43a224fea173a73
https://github.com/eonpatapon/contrail-api-cli/blob/1571bf523fa054f3d6bf83dba43a224fea173a73/contrail_api_cli/main.py#L23-L32
train
Get the kwargs for a given subcommand from global parsed arguments.
Phyks/libbmc
libbmc/citations/plaintext.py
get_plaintext_citations
def get_plaintext_citations(file): """ Parse a plaintext file to get a clean list of plaintext citations. The \ file should have one citation per line. :param file: Either the path to the plaintext file or the content of a \ plaintext file. :returns: A list of cleaned plaintext...
python
def get_plaintext_citations(file): """ Parse a plaintext file to get a clean list of plaintext citations. The \ file should have one citation per line. :param file: Either the path to the plaintext file or the content of a \ plaintext file. :returns: A list of cleaned plaintext...
[ "def", "get_plaintext_citations", "(", "file", ")", ":", "# Handle path or content", "if", "os", ".", "path", ".", "isfile", "(", "file", ")", ":", "with", "open", "(", "file", ",", "'r'", ")", "as", "fh", ":", "content", "=", "fh", ".", "readlines", "...
Parse a plaintext file to get a clean list of plaintext citations. The \ file should have one citation per line. :param file: Either the path to the plaintext file or the content of a \ plaintext file. :returns: A list of cleaned plaintext citations.
[ "Parse", "a", "plaintext", "file", "to", "get", "a", "clean", "list", "of", "plaintext", "citations", ".", "The", "\\", "file", "should", "have", "one", "citation", "per", "line", "." ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/citations/plaintext.py#L20-L37
train
Parse a plaintext file to get a list of cleaned plaintext citations.
Phyks/libbmc
libbmc/citations/plaintext.py
get_cited_dois
def get_cited_dois(file): """ Get the DOIs of the papers cited in a plaintext file. The file should \ have one citation per line. .. note:: This function is also used as a backend tool by most of the others \ citations processors, to factorize the code. :param file: Either...
python
def get_cited_dois(file): """ Get the DOIs of the papers cited in a plaintext file. The file should \ have one citation per line. .. note:: This function is also used as a backend tool by most of the others \ citations processors, to factorize the code. :param file: Either...
[ "def", "get_cited_dois", "(", "file", ")", ":", "# If file is not a pre-processed list of plaintext citations", "if", "not", "isinstance", "(", "file", ",", "list", ")", ":", "# It is either a path to a plaintext file or the content of a plaintext", "# file, we need some pre-proces...
Get the DOIs of the papers cited in a plaintext file. The file should \ have one citation per line. .. note:: This function is also used as a backend tool by most of the others \ citations processors, to factorize the code. :param file: Either the path to the plaintext file or the...
[ "Get", "the", "DOIs", "of", "the", "papers", "cited", "in", "a", "plaintext", "file", ".", "The", "file", "should", "\\", "have", "one", "citation", "per", "line", "." ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/citations/plaintext.py#L40-L103
train
Get the cited DOIs of the papers cited in a plaintext file.
swevm/scaleio-py
scaleiopy/api/scaleio/cluster/sdc.py
Sdc.set_sdc_name
def set_sdc_name(self, name, sdcObj): """ Set name for SDC :param name: Name of SDC :param sdcObj: ScaleIO SDC object :return: POST request response :rtype: Requests POST response object """ # TODO: # Check if object parameters are the correct ones...
python
def set_sdc_name(self, name, sdcObj): """ Set name for SDC :param name: Name of SDC :param sdcObj: ScaleIO SDC object :return: POST request response :rtype: Requests POST response object """ # TODO: # Check if object parameters are the correct ones...
[ "def", "set_sdc_name", "(", "self", ",", "name", ",", "sdcObj", ")", ":", "# TODO:", "# Check if object parameters are the correct ones, otherwise throw error", "self", ".", "conn", ".", "connection", ".", "_check_login", "(", ")", "sdcNameDict", "=", "{", "'sdcName'"...
Set name for SDC :param name: Name of SDC :param sdcObj: ScaleIO SDC object :return: POST request response :rtype: Requests POST response object
[ "Set", "name", "for", "SDC", ":", "param", "name", ":", "Name", "of", "SDC", ":", "param", "sdcObj", ":", "ScaleIO", "SDC", "object", ":", "return", ":", "POST", "request", "response", ":", "rtype", ":", "Requests", "POST", "response", "object" ]
d043a0137cb925987fd5c895a3210968ce1d9028
https://github.com/swevm/scaleio-py/blob/d043a0137cb925987fd5c895a3210968ce1d9028/scaleiopy/api/scaleio/cluster/sdc.py#L33-L46
train
Set the name of the SDC object for the current set of attributes.
swevm/scaleio-py
scaleiopy/api/scaleio/cluster/sdc.py
Sdc.get_sdc_by_name
def get_sdc_by_name(self, name): """ Get ScaleIO SDC object by its name :param name: Name of SDC :return: ScaleIO SDC object :raise KeyError: No SDC with specified name found :rtype: SDC object """ for sdc in self.sdc: if sdc.name == name: ...
python
def get_sdc_by_name(self, name): """ Get ScaleIO SDC object by its name :param name: Name of SDC :return: ScaleIO SDC object :raise KeyError: No SDC with specified name found :rtype: SDC object """ for sdc in self.sdc: if sdc.name == name: ...
[ "def", "get_sdc_by_name", "(", "self", ",", "name", ")", ":", "for", "sdc", "in", "self", ".", "sdc", ":", "if", "sdc", ".", "name", "==", "name", ":", "return", "sdc", "raise", "KeyError", "(", "\"SDC of that name not found\"", ")" ]
Get ScaleIO SDC object by its name :param name: Name of SDC :return: ScaleIO SDC object :raise KeyError: No SDC with specified name found :rtype: SDC object
[ "Get", "ScaleIO", "SDC", "object", "by", "its", "name", ":", "param", "name", ":", "Name", "of", "SDC", ":", "return", ":", "ScaleIO", "SDC", "object", ":", "raise", "KeyError", ":", "No", "SDC", "with", "specified", "name", "found", ":", "rtype", ":",...
d043a0137cb925987fd5c895a3210968ce1d9028
https://github.com/swevm/scaleio-py/blob/d043a0137cb925987fd5c895a3210968ce1d9028/scaleiopy/api/scaleio/cluster/sdc.py#L49-L60
train
Get ScaleIO SDC object by its name
swevm/scaleio-py
scaleiopy/api/scaleio/cluster/sdc.py
Sdc.get_sdc_by_id
def get_sdc_by_id(self, id): """ Get ScaleIO SDC object by its id :param name: id of SDC :return: ScaleIO SDC object :raise KeyError: No SDC with specified id found :rtype: SDC object """ for sdc in self.sdc: if sdc.id == id: re...
python
def get_sdc_by_id(self, id): """ Get ScaleIO SDC object by its id :param name: id of SDC :return: ScaleIO SDC object :raise KeyError: No SDC with specified id found :rtype: SDC object """ for sdc in self.sdc: if sdc.id == id: re...
[ "def", "get_sdc_by_id", "(", "self", ",", "id", ")", ":", "for", "sdc", "in", "self", ".", "sdc", ":", "if", "sdc", ".", "id", "==", "id", ":", "return", "sdc", "raise", "KeyError", "(", "\"SDC with that ID not found\"", ")" ]
Get ScaleIO SDC object by its id :param name: id of SDC :return: ScaleIO SDC object :raise KeyError: No SDC with specified id found :rtype: SDC object
[ "Get", "ScaleIO", "SDC", "object", "by", "its", "id", ":", "param", "name", ":", "id", "of", "SDC", ":", "return", ":", "ScaleIO", "SDC", "object", ":", "raise", "KeyError", ":", "No", "SDC", "with", "specified", "id", "found", ":", "rtype", ":", "SD...
d043a0137cb925987fd5c895a3210968ce1d9028
https://github.com/swevm/scaleio-py/blob/d043a0137cb925987fd5c895a3210968ce1d9028/scaleiopy/api/scaleio/cluster/sdc.py#L62-L73
train
Get ScaleIO SDC object by its id
swevm/scaleio-py
scaleiopy/api/scaleio/cluster/sdc.py
Sdc.get_sdc_by_guid
def get_sdc_by_guid(self, guid): """ Get ScaleIO SDC object by its id :param name: guid of SDC :return: ScaleIO SDC object :raise KeyError: No SDC with specified id found :rtype: SDC object """ for sdc in self.sdc: if sdc.guid == guid: ...
python
def get_sdc_by_guid(self, guid): """ Get ScaleIO SDC object by its id :param name: guid of SDC :return: ScaleIO SDC object :raise KeyError: No SDC with specified id found :rtype: SDC object """ for sdc in self.sdc: if sdc.guid == guid: ...
[ "def", "get_sdc_by_guid", "(", "self", ",", "guid", ")", ":", "for", "sdc", "in", "self", ".", "sdc", ":", "if", "sdc", ".", "guid", "==", "guid", ":", "return", "sdc", "raise", "KeyError", "(", "\"SDC with that GUID not found\"", ")" ]
Get ScaleIO SDC object by its id :param name: guid of SDC :return: ScaleIO SDC object :raise KeyError: No SDC with specified id found :rtype: SDC object
[ "Get", "ScaleIO", "SDC", "object", "by", "its", "id", ":", "param", "name", ":", "guid", "of", "SDC", ":", "return", ":", "ScaleIO", "SDC", "object", ":", "raise", "KeyError", ":", "No", "SDC", "with", "specified", "id", "found", ":", "rtype", ":", "...
d043a0137cb925987fd5c895a3210968ce1d9028
https://github.com/swevm/scaleio-py/blob/d043a0137cb925987fd5c895a3210968ce1d9028/scaleiopy/api/scaleio/cluster/sdc.py#L75-L86
train
Get ScaleIO SDC object by its GUID
swevm/scaleio-py
scaleiopy/api/scaleio/cluster/sdc.py
Sdc.get_sdc_by_ip
def get_sdc_by_ip(self, ip): """ Get ScaleIO SDC object by its ip :param name: IP address of SDC :return: ScaleIO SDC object :raise KeyError: No SDC with specified IP found :rtype: SDC object """ if self.conn.is_ip_addr(ip): for sdc in self.sdc...
python
def get_sdc_by_ip(self, ip): """ Get ScaleIO SDC object by its ip :param name: IP address of SDC :return: ScaleIO SDC object :raise KeyError: No SDC with specified IP found :rtype: SDC object """ if self.conn.is_ip_addr(ip): for sdc in self.sdc...
[ "def", "get_sdc_by_ip", "(", "self", ",", "ip", ")", ":", "if", "self", ".", "conn", ".", "is_ip_addr", "(", "ip", ")", ":", "for", "sdc", "in", "self", ".", "sdc", ":", "if", "sdc", ".", "sdcIp", "==", "ip", ":", "return", "sdc", "raise", "KeyEr...
Get ScaleIO SDC object by its ip :param name: IP address of SDC :return: ScaleIO SDC object :raise KeyError: No SDC with specified IP found :rtype: SDC object
[ "Get", "ScaleIO", "SDC", "object", "by", "its", "ip", ":", "param", "name", ":", "IP", "address", "of", "SDC", ":", "return", ":", "ScaleIO", "SDC", "object", ":", "raise", "KeyError", ":", "No", "SDC", "with", "specified", "IP", "found", ":", "rtype",...
d043a0137cb925987fd5c895a3210968ce1d9028
https://github.com/swevm/scaleio-py/blob/d043a0137cb925987fd5c895a3210968ce1d9028/scaleiopy/api/scaleio/cluster/sdc.py#L88-L102
train
Get ScaleIO SDC object by its IP address
swevm/scaleio-py
scaleiopy/api/scaleio/cluster/sdc.py
Sdc.unregisterSdc
def unregisterSdc(self, sdcObj): """ Unregister SDC from MDM/SIO Cluster :param sdcObj: ScaleIO SDC object :return: POST request response :rtype: Requests POST response object """ # TODO: # Add code that unmap volume if mapped self.conn.connection....
python
def unregisterSdc(self, sdcObj): """ Unregister SDC from MDM/SIO Cluster :param sdcObj: ScaleIO SDC object :return: POST request response :rtype: Requests POST response object """ # TODO: # Add code that unmap volume if mapped self.conn.connection....
[ "def", "unregisterSdc", "(", "self", ",", "sdcObj", ")", ":", "# TODO:", "# Add code that unmap volume if mapped", "self", ".", "conn", ".", "connection", ".", "_check_login", "(", ")", "response", "=", "self", ".", "conn", ".", "connection", ".", "_do_post", ...
Unregister SDC from MDM/SIO Cluster :param sdcObj: ScaleIO SDC object :return: POST request response :rtype: Requests POST response object
[ "Unregister", "SDC", "from", "MDM", "/", "SIO", "Cluster", ":", "param", "sdcObj", ":", "ScaleIO", "SDC", "object", ":", "return", ":", "POST", "request", "response", ":", "rtype", ":", "Requests", "POST", "response", "object" ]
d043a0137cb925987fd5c895a3210968ce1d9028
https://github.com/swevm/scaleio-py/blob/d043a0137cb925987fd5c895a3210968ce1d9028/scaleiopy/api/scaleio/cluster/sdc.py#L104-L115
train
Unregisters an SDC from MDM or SIO Cluster
ets-labs/python-domain-models
setup.py
PublishCommand.run
def run(self): """Command execution.""" self.run_command('sdist') self.run_command('upload') os.system('git tag -a {0} -m \'version {0}\''.format(version)) os.system('git push --tags')
python
def run(self): """Command execution.""" self.run_command('sdist') self.run_command('upload') os.system('git tag -a {0} -m \'version {0}\''.format(version)) os.system('git push --tags')
[ "def", "run", "(", "self", ")", ":", "self", ".", "run_command", "(", "'sdist'", ")", "self", ".", "run_command", "(", "'upload'", ")", "os", ".", "system", "(", "'git tag -a {0} -m \\'version {0}\\''", ".", "format", "(", "version", ")", ")", "os", ".", ...
Command execution.
[ "Command", "execution", "." ]
7de1816ba0338f20fdb3e0f57fad0ffd5bea13f9
https://github.com/ets-labs/python-domain-models/blob/7de1816ba0338f20fdb3e0f57fad0ffd5bea13f9/setup.py#L35-L40
train
Command execution.
Phyks/libbmc
libbmc/isbn.py
is_valid
def is_valid(isbn_id): """ Check that a given string is a valid ISBN. :param isbn_id: the isbn to be checked. :returns: boolean indicating whether the isbn is valid or not. >>> is_valid("978-3-16-148410-0") True >>> is_valid("9783161484100") True >>> is_valid("9783161484100aa") ...
python
def is_valid(isbn_id): """ Check that a given string is a valid ISBN. :param isbn_id: the isbn to be checked. :returns: boolean indicating whether the isbn is valid or not. >>> is_valid("978-3-16-148410-0") True >>> is_valid("9783161484100") True >>> is_valid("9783161484100aa") ...
[ "def", "is_valid", "(", "isbn_id", ")", ":", "return", "(", "(", "not", "isbnlib", ".", "notisbn", "(", "isbn_id", ")", ")", "and", "(", "isbnlib", ".", "get_canonical_isbn", "(", "isbn_id", ")", "==", "isbn_id", "or", "isbnlib", ".", "mask", "(", "isb...
Check that a given string is a valid ISBN. :param isbn_id: the isbn to be checked. :returns: boolean indicating whether the isbn is valid or not. >>> is_valid("978-3-16-148410-0") True >>> is_valid("9783161484100") True >>> is_valid("9783161484100aa") False >>> is_valid("abcd") ...
[ "Check", "that", "a", "given", "string", "is", "a", "valid", "ISBN", "." ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/isbn.py#L14-L49
train
Checks if a given string is a valid ISBN.
Phyks/libbmc
libbmc/isbn.py
extract_from_text
def extract_from_text(text): """ Extract ISBNs from a text. :param text: Some text. :returns: A list of canonical ISBNs found in the text. >>> extract_from_text("978-3-16-148410-0 9783161484100 9783161484100aa abcd 0136091814 0136091812 9780136091817 123456789X") ['9783161484100', '97831614841...
python
def extract_from_text(text): """ Extract ISBNs from a text. :param text: Some text. :returns: A list of canonical ISBNs found in the text. >>> extract_from_text("978-3-16-148410-0 9783161484100 9783161484100aa abcd 0136091814 0136091812 9780136091817 123456789X") ['9783161484100', '97831614841...
[ "def", "extract_from_text", "(", "text", ")", ":", "isbns", "=", "[", "isbnlib", ".", "get_canonical_isbn", "(", "isbn", ")", "for", "isbn", "in", "isbnlib", ".", "get_isbnlike", "(", "text", ")", "]", "return", "[", "i", "for", "i", "in", "isbns", "if...
Extract ISBNs from a text. :param text: Some text. :returns: A list of canonical ISBNs found in the text. >>> extract_from_text("978-3-16-148410-0 9783161484100 9783161484100aa abcd 0136091814 0136091812 9780136091817 123456789X") ['9783161484100', '9783161484100', '9783161484100', '0136091814', '1234...
[ "Extract", "ISBNs", "from", "a", "text", "." ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/isbn.py#L52-L64
train
Extract ISBNs from a text.
Phyks/libbmc
libbmc/isbn.py
get_bibtex
def get_bibtex(isbn_identifier): """ Get a BibTeX string for the given ISBN. :param isbn_identifier: ISBN to fetch BibTeX entry for. :returns: A BibTeX string or ``None`` if could not fetch it. >>> get_bibtex('9783161484100') '@book{9783161484100,\\n title = {Berkeley, Oakland: Albany, Eme...
python
def get_bibtex(isbn_identifier): """ Get a BibTeX string for the given ISBN. :param isbn_identifier: ISBN to fetch BibTeX entry for. :returns: A BibTeX string or ``None`` if could not fetch it. >>> get_bibtex('9783161484100') '@book{9783161484100,\\n title = {Berkeley, Oakland: Albany, Eme...
[ "def", "get_bibtex", "(", "isbn_identifier", ")", ":", "# Try to find the BibTeX using associated DOIs", "bibtex", "=", "doi", ".", "get_bibtex", "(", "to_doi", "(", "isbn_identifier", ")", ")", "if", "bibtex", "is", "None", ":", "# In some cases, there are no DOIs for ...
Get a BibTeX string for the given ISBN. :param isbn_identifier: ISBN to fetch BibTeX entry for. :returns: A BibTeX string or ``None`` if could not fetch it. >>> get_bibtex('9783161484100') '@book{9783161484100,\\n title = {Berkeley, Oakland: Albany, Emeryville, Alameda, Kensington},\\n author =...
[ "Get", "a", "BibTeX", "string", "for", "the", "given", "ISBN", "." ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/isbn.py#L67-L85
train
Get a BibTeX string for the given ISBN.
eonpatapon/contrail-api-cli
contrail_api_cli/parser.py
CommandParser.used_options
def used_options(self): """Return options already used in the command line rtype: command.Option generator """ for option_str in filter(lambda c: c.startswith('-'), self.words): for option in list(self.cmd.options.values()): if option_str in option.op...
python
def used_options(self): """Return options already used in the command line rtype: command.Option generator """ for option_str in filter(lambda c: c.startswith('-'), self.words): for option in list(self.cmd.options.values()): if option_str in option.op...
[ "def", "used_options", "(", "self", ")", ":", "for", "option_str", "in", "filter", "(", "lambda", "c", ":", "c", ".", "startswith", "(", "'-'", ")", ",", "self", ".", "words", ")", ":", "for", "option", "in", "list", "(", "self", ".", "cmd", ".", ...
Return options already used in the command line rtype: command.Option generator
[ "Return", "options", "already", "used", "in", "the", "command", "line" ]
1571bf523fa054f3d6bf83dba43a224fea173a73
https://github.com/eonpatapon/contrail-api-cli/blob/1571bf523fa054f3d6bf83dba43a224fea173a73/contrail_api_cli/parser.py#L40-L49
train
Return options already used in the command line
eonpatapon/contrail-api-cli
contrail_api_cli/parser.py
CommandParser.available_options
def available_options(self): """Return options that can be used given the current cmd line rtype: command.Option generator """ for option in list(self.cmd.options.values()): if (option.is_multiple or option not in list(self.used_options)): ...
python
def available_options(self): """Return options that can be used given the current cmd line rtype: command.Option generator """ for option in list(self.cmd.options.values()): if (option.is_multiple or option not in list(self.used_options)): ...
[ "def", "available_options", "(", "self", ")", ":", "for", "option", "in", "list", "(", "self", ".", "cmd", ".", "options", ".", "values", "(", ")", ")", ":", "if", "(", "option", ".", "is_multiple", "or", "option", "not", "in", "list", "(", "self", ...
Return options that can be used given the current cmd line rtype: command.Option generator
[ "Return", "options", "that", "can", "be", "used", "given", "the", "current", "cmd", "line" ]
1571bf523fa054f3d6bf83dba43a224fea173a73
https://github.com/eonpatapon/contrail-api-cli/blob/1571bf523fa054f3d6bf83dba43a224fea173a73/contrail_api_cli/parser.py#L52-L61
train
Return a generator of all available command. Option objects given the current cmd line
eonpatapon/contrail-api-cli
contrail_api_cli/parser.py
CommandParser.used_args
def used_args(self): """Return args already used in the command line rtype: command.Arg generator """ # get all arguments values from the command line values = [] for idx, c in enumerate(self.words[1:]): if c.startswith('-'): continue ...
python
def used_args(self): """Return args already used in the command line rtype: command.Arg generator """ # get all arguments values from the command line values = [] for idx, c in enumerate(self.words[1:]): if c.startswith('-'): continue ...
[ "def", "used_args", "(", "self", ")", ":", "# get all arguments values from the command line", "values", "=", "[", "]", "for", "idx", ",", "c", "in", "enumerate", "(", "self", ".", "words", "[", "1", ":", "]", ")", ":", "if", "c", ".", "startswith", "(",...
Return args already used in the command line rtype: command.Arg generator
[ "Return", "args", "already", "used", "in", "the", "command", "line" ]
1571bf523fa054f3d6bf83dba43a224fea173a73
https://github.com/eonpatapon/contrail-api-cli/blob/1571bf523fa054f3d6bf83dba43a224fea173a73/contrail_api_cli/parser.py#L64-L94
train
Return the args already used in the command line rtype : command. Arg generator
eonpatapon/contrail-api-cli
contrail_api_cli/parser.py
CommandParser.available_args
def available_args(self): """Return args that can be used given the current cmd line rtype: command.Arg generator """ used = list(self.used_args) logger.debug('Found used args: %s' % used) for arg in list(self.cmd.args.values()): if (arg.is_multiple o...
python
def available_args(self): """Return args that can be used given the current cmd line rtype: command.Arg generator """ used = list(self.used_args) logger.debug('Found used args: %s' % used) for arg in list(self.cmd.args.values()): if (arg.is_multiple o...
[ "def", "available_args", "(", "self", ")", ":", "used", "=", "list", "(", "self", ".", "used_args", ")", "logger", ".", "debug", "(", "'Found used args: %s'", "%", "used", ")", "for", "arg", "in", "list", "(", "self", ".", "cmd", ".", "args", ".", "v...
Return args that can be used given the current cmd line rtype: command.Arg generator
[ "Return", "args", "that", "can", "be", "used", "given", "the", "current", "cmd", "line" ]
1571bf523fa054f3d6bf83dba43a224fea173a73
https://github.com/eonpatapon/contrail-api-cli/blob/1571bf523fa054f3d6bf83dba43a224fea173a73/contrail_api_cli/parser.py#L97-L112
train
Return the available args given the current cmd line rtype : command. Arg generator
ph4r05/monero-serialize
monero_serialize/core/erefs.py
is_elem_ref
def is_elem_ref(elem_ref): """ Returns true if the elem_ref is an element reference :param elem_ref: :return: """ return ( elem_ref and isinstance(elem_ref, tuple) and len(elem_ref) == 3 and (elem_ref[0] == ElemRefObj or elem_ref[0] == ElemRefArr) )
python
def is_elem_ref(elem_ref): """ Returns true if the elem_ref is an element reference :param elem_ref: :return: """ return ( elem_ref and isinstance(elem_ref, tuple) and len(elem_ref) == 3 and (elem_ref[0] == ElemRefObj or elem_ref[0] == ElemRefArr) )
[ "def", "is_elem_ref", "(", "elem_ref", ")", ":", "return", "(", "elem_ref", "and", "isinstance", "(", "elem_ref", ",", "tuple", ")", "and", "len", "(", "elem_ref", ")", "==", "3", "and", "(", "elem_ref", "[", "0", "]", "==", "ElemRefObj", "or", "elem_r...
Returns true if the elem_ref is an element reference :param elem_ref: :return:
[ "Returns", "true", "if", "the", "elem_ref", "is", "an", "element", "reference" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/core/erefs.py#L11-L23
train
Returns true if the elem_ref is an element reference
ph4r05/monero-serialize
monero_serialize/core/erefs.py
has_elem
def has_elem(elem_ref): """ Has element? :param elem_ref: :return: """ if not is_elem_ref(elem_ref): return False elif elem_ref[0] == ElemRefObj: return hasattr(elem_ref[1], elem_ref[2]) elif elem_ref[0] == ElemRefArr: return elem_ref[2] in elem_ref[1]
python
def has_elem(elem_ref): """ Has element? :param elem_ref: :return: """ if not is_elem_ref(elem_ref): return False elif elem_ref[0] == ElemRefObj: return hasattr(elem_ref[1], elem_ref[2]) elif elem_ref[0] == ElemRefArr: return elem_ref[2] in elem_ref[1]
[ "def", "has_elem", "(", "elem_ref", ")", ":", "if", "not", "is_elem_ref", "(", "elem_ref", ")", ":", "return", "False", "elif", "elem_ref", "[", "0", "]", "==", "ElemRefObj", ":", "return", "hasattr", "(", "elem_ref", "[", "1", "]", ",", "elem_ref", "[...
Has element? :param elem_ref: :return:
[ "Has", "element?", ":", "param", "elem_ref", ":", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/core/erefs.py#L26-L37
train
Returns True if the element with the given elem_ref is present in the base element list.
ph4r05/monero-serialize
monero_serialize/core/erefs.py
get_elem
def get_elem(elem_ref, default=None): """ Gets the element referenced by elem_ref or returns the elem_ref directly if its not a reference. :param elem_ref: :param default: :return: """ if not is_elem_ref(elem_ref): return elem_ref elif elem_ref[0] == ElemRefObj: return g...
python
def get_elem(elem_ref, default=None): """ Gets the element referenced by elem_ref or returns the elem_ref directly if its not a reference. :param elem_ref: :param default: :return: """ if not is_elem_ref(elem_ref): return elem_ref elif elem_ref[0] == ElemRefObj: return g...
[ "def", "get_elem", "(", "elem_ref", ",", "default", "=", "None", ")", ":", "if", "not", "is_elem_ref", "(", "elem_ref", ")", ":", "return", "elem_ref", "elif", "elem_ref", "[", "0", "]", "==", "ElemRefObj", ":", "return", "getattr", "(", "elem_ref", "[",...
Gets the element referenced by elem_ref or returns the elem_ref directly if its not a reference. :param elem_ref: :param default: :return:
[ "Gets", "the", "element", "referenced", "by", "elem_ref", "or", "returns", "the", "elem_ref", "directly", "if", "its", "not", "a", "reference", "." ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/core/erefs.py#L40-L53
train
Gets the element referenced by elem_ref or returns the elem_ref directly if it s not a reference.
ph4r05/monero-serialize
monero_serialize/core/erefs.py
set_elem
def set_elem(elem_ref, elem): """ Sets element referenced by the elem_ref. Returns the elem. :param elem_ref: :param elem: :return: """ if elem_ref is None or elem_ref == elem or not is_elem_ref(elem_ref): return elem elif elem_ref[0] == ElemRefObj: setattr(elem_ref[1],...
python
def set_elem(elem_ref, elem): """ Sets element referenced by the elem_ref. Returns the elem. :param elem_ref: :param elem: :return: """ if elem_ref is None or elem_ref == elem or not is_elem_ref(elem_ref): return elem elif elem_ref[0] == ElemRefObj: setattr(elem_ref[1],...
[ "def", "set_elem", "(", "elem_ref", ",", "elem", ")", ":", "if", "elem_ref", "is", "None", "or", "elem_ref", "==", "elem", "or", "not", "is_elem_ref", "(", "elem_ref", ")", ":", "return", "elem", "elif", "elem_ref", "[", "0", "]", "==", "ElemRefObj", "...
Sets element referenced by the elem_ref. Returns the elem. :param elem_ref: :param elem: :return:
[ "Sets", "element", "referenced", "by", "the", "elem_ref", ".", "Returns", "the", "elem", "." ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/core/erefs.py#L56-L73
train
Sets the element referenced by the elem_ref. Returns the elem.
ph4r05/monero-serialize
monero_serialize/core/erefs.py
eref
def eref(obj, key, is_assoc=None): """ Returns element reference :param obj: :param key: :param is_assoc: :return: """ if obj is None: return None if isinstance(key, int) or (is_assoc is not None and is_assoc): return ElemRefArr, get_elem(obj), key else: r...
python
def eref(obj, key, is_assoc=None): """ Returns element reference :param obj: :param key: :param is_assoc: :return: """ if obj is None: return None if isinstance(key, int) or (is_assoc is not None and is_assoc): return ElemRefArr, get_elem(obj), key else: r...
[ "def", "eref", "(", "obj", ",", "key", ",", "is_assoc", "=", "None", ")", ":", "if", "obj", "is", "None", ":", "return", "None", "if", "isinstance", "(", "key", ",", "int", ")", "or", "(", "is_assoc", "is", "not", "None", "and", "is_assoc", ")", ...
Returns element reference :param obj: :param key: :param is_assoc: :return:
[ "Returns", "element", "reference", ":", "param", "obj", ":", ":", "param", "key", ":", ":", "param", "is_assoc", ":", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/core/erefs.py#L76-L89
train
Returns element reference
crm416/semantic
semantic/solver.py
MathService._preprocess
def _preprocess(inp): """Revise wording to match canonical and expected forms.""" inp = re.sub(r'(\b)a(\b)', r'\g<1>one\g<2>', inp) inp = re.sub(r'to the (.*) power', r'to \g<1>', inp) inp = re.sub(r'to the (.*?)(\b)', r'to \g<1>\g<2>', inp) inp = re.sub(r'log of', r'log', inp) ...
python
def _preprocess(inp): """Revise wording to match canonical and expected forms.""" inp = re.sub(r'(\b)a(\b)', r'\g<1>one\g<2>', inp) inp = re.sub(r'to the (.*) power', r'to \g<1>', inp) inp = re.sub(r'to the (.*?)(\b)', r'to \g<1>\g<2>', inp) inp = re.sub(r'log of', r'log', inp) ...
[ "def", "_preprocess", "(", "inp", ")", ":", "inp", "=", "re", ".", "sub", "(", "r'(\\b)a(\\b)'", ",", "r'\\g<1>one\\g<2>'", ",", "inp", ")", "inp", "=", "re", ".", "sub", "(", "r'to the (.*) power'", ",", "r'to \\g<1>'", ",", "inp", ")", "inp", "=", "r...
Revise wording to match canonical and expected forms.
[ "Revise", "wording", "to", "match", "canonical", "and", "expected", "forms", "." ]
46deb8fefb3ea58aad2fedc8d0d62f3ee254b8fe
https://github.com/crm416/semantic/blob/46deb8fefb3ea58aad2fedc8d0d62f3ee254b8fe/semantic/solver.py#L66-L123
train
Revise wording to match canonical and expected forms.
crm416/semantic
semantic/solver.py
MathService._calculate
def _calculate(numbers, symbols): """Calculates a final value given a set of numbers and symbols.""" if len(numbers) is 1: return numbers[0] precedence = [[pow], [mul, div], [add, sub]] # Find most important operation for op_group in precedence: for i, o...
python
def _calculate(numbers, symbols): """Calculates a final value given a set of numbers and symbols.""" if len(numbers) is 1: return numbers[0] precedence = [[pow], [mul, div], [add, sub]] # Find most important operation for op_group in precedence: for i, o...
[ "def", "_calculate", "(", "numbers", ",", "symbols", ")", ":", "if", "len", "(", "numbers", ")", "is", "1", ":", "return", "numbers", "[", "0", "]", "precedence", "=", "[", "[", "pow", "]", ",", "[", "mul", ",", "div", "]", ",", "[", "add", ","...
Calculates a final value given a set of numbers and symbols.
[ "Calculates", "a", "final", "value", "given", "a", "set", "of", "numbers", "and", "symbols", "." ]
46deb8fefb3ea58aad2fedc8d0d62f3ee254b8fe
https://github.com/crm416/semantic/blob/46deb8fefb3ea58aad2fedc8d0d62f3ee254b8fe/semantic/solver.py#L126-L144
train
Calculates a final value given a set of numbers and symbols.
crm416/semantic
semantic/solver.py
MathService.parseEquation
def parseEquation(self, inp): """Solves the equation specified by the input string. Args: inp (str): An equation, specified in words, containing some combination of numbers, binary, and unary operations. Returns: The floating-point result of carrying out...
python
def parseEquation(self, inp): """Solves the equation specified by the input string. Args: inp (str): An equation, specified in words, containing some combination of numbers, binary, and unary operations. Returns: The floating-point result of carrying out...
[ "def", "parseEquation", "(", "self", ",", "inp", ")", ":", "inp", "=", "MathService", ".", "_preprocess", "(", "inp", ")", "split", "=", "inp", ".", "split", "(", "' '", ")", "# Recursive call on unary operators", "for", "i", ",", "w", "in", "enumerate", ...
Solves the equation specified by the input string. Args: inp (str): An equation, specified in words, containing some combination of numbers, binary, and unary operations. Returns: The floating-point result of carrying out the computation.
[ "Solves", "the", "equation", "specified", "by", "the", "input", "string", "." ]
46deb8fefb3ea58aad2fedc8d0d62f3ee254b8fe
https://github.com/crm416/semantic/blob/46deb8fefb3ea58aad2fedc8d0d62f3ee254b8fe/semantic/solver.py#L146-L209
train
Solves the equation specified by the input string.
useblocks/groundwork
groundwork/patterns/gw_commands_pattern.py
CommandsListPlugin.register
def register(self, command, description, function, params=[]): """ Registers a new command for a plugin. :param command: Name of the command :param description: Description of the command. Is used as help message on cli :param function: function reference, which gets invoked if ...
python
def register(self, command, description, function, params=[]): """ Registers a new command for a plugin. :param command: Name of the command :param description: Description of the command. Is used as help message on cli :param function: function reference, which gets invoked if ...
[ "def", "register", "(", "self", ",", "command", ",", "description", ",", "function", ",", "params", "=", "[", "]", ")", ":", "return", "self", ".", "app", ".", "commands", ".", "register", "(", "command", ",", "description", ",", "function", ",", "para...
Registers a new command for a plugin. :param command: Name of the command :param description: Description of the command. Is used as help message on cli :param function: function reference, which gets invoked if command gets called. :param params: list of click options and arguments ...
[ "Registers", "a", "new", "command", "for", "a", "plugin", "." ]
d34fce43f54246ca4db0f7b89e450dcdc847c68c
https://github.com/useblocks/groundwork/blob/d34fce43f54246ca4db0f7b89e450dcdc847c68c/groundwork/patterns/gw_commands_pattern.py#L80-L90
train
Registers a new command for a plugin.
useblocks/groundwork
groundwork/patterns/gw_commands_pattern.py
CommandsListPlugin.get
def get(self, name=None): """ Returns commands, which can be filtered by name. :param name: name of the command :type name: str :return: None, single command or dict of commands """ return self.app.commands.get(name, self.plugin)
python
def get(self, name=None): """ Returns commands, which can be filtered by name. :param name: name of the command :type name: str :return: None, single command or dict of commands """ return self.app.commands.get(name, self.plugin)
[ "def", "get", "(", "self", ",", "name", "=", "None", ")", ":", "return", "self", ".", "app", ".", "commands", ".", "get", "(", "name", ",", "self", ".", "plugin", ")" ]
Returns commands, which can be filtered by name. :param name: name of the command :type name: str :return: None, single command or dict of commands
[ "Returns", "commands", "which", "can", "be", "filtered", "by", "name", "." ]
d34fce43f54246ca4db0f7b89e450dcdc847c68c
https://github.com/useblocks/groundwork/blob/d34fce43f54246ca4db0f7b89e450dcdc847c68c/groundwork/patterns/gw_commands_pattern.py#L101-L109
train
Returns a single command or dict of commands which can be filtered by name.
useblocks/groundwork
groundwork/patterns/gw_commands_pattern.py
CommandsListApplication.get
def get(self, name=None, plugin=None): """ Returns commands, which can be filtered by name or plugin. :param name: name of the command :type name: str :param plugin: plugin object, which registers the commands :type plugin: instance of GwBasePattern :return: None...
python
def get(self, name=None, plugin=None): """ Returns commands, which can be filtered by name or plugin. :param name: name of the command :type name: str :param plugin: plugin object, which registers the commands :type plugin: instance of GwBasePattern :return: None...
[ "def", "get", "(", "self", ",", "name", "=", "None", ",", "plugin", "=", "None", ")", ":", "if", "plugin", "is", "not", "None", ":", "if", "name", "is", "None", ":", "command_list", "=", "{", "}", "for", "key", "in", "self", ".", "_commands", "."...
Returns commands, which can be filtered by name or plugin. :param name: name of the command :type name: str :param plugin: plugin object, which registers the commands :type plugin: instance of GwBasePattern :return: None, single command or dict of commands
[ "Returns", "commands", "which", "can", "be", "filtered", "by", "name", "or", "plugin", "." ]
d34fce43f54246ca4db0f7b89e450dcdc847c68c
https://github.com/useblocks/groundwork/blob/d34fce43f54246ca4db0f7b89e450dcdc847c68c/groundwork/patterns/gw_commands_pattern.py#L130-L162
train
Returns commands which can be filtered by name or plugin.
useblocks/groundwork
groundwork/patterns/gw_commands_pattern.py
CommandsListApplication.register
def register(self, command, description, function, params=[], plugin=None): """ Registers a new command, which can be used on a command line interface (cli). :param command: Name of the command :param description: Description of the command. Is used as help message on cli :param...
python
def register(self, command, description, function, params=[], plugin=None): """ Registers a new command, which can be used on a command line interface (cli). :param command: Name of the command :param description: Description of the command. Is used as help message on cli :param...
[ "def", "register", "(", "self", ",", "command", ",", "description", ",", "function", ",", "params", "=", "[", "]", ",", "plugin", "=", "None", ")", ":", "if", "command", "in", "self", ".", "_commands", ".", "keys", "(", ")", ":", "raise", "CommandExi...
Registers a new command, which can be used on a command line interface (cli). :param command: Name of the command :param description: Description of the command. Is used as help message on cli :param function: function reference, which gets invoked if command gets called. :param params:...
[ "Registers", "a", "new", "command", "which", "can", "be", "used", "on", "a", "command", "line", "interface", "(", "cli", ")", "." ]
d34fce43f54246ca4db0f7b89e450dcdc847c68c
https://github.com/useblocks/groundwork/blob/d34fce43f54246ca4db0f7b89e450dcdc847c68c/groundwork/patterns/gw_commands_pattern.py#L164-L183
train
Registers a new command in the command line interface.
useblocks/groundwork
groundwork/patterns/gw_commands_pattern.py
CommandsListApplication.unregister
def unregister(self, command): """ Unregisters an existing command, so that this command is no longer available on the command line interface. This function is mainly used during plugin deactivation. :param command: Name of the command """ if command not in self._comman...
python
def unregister(self, command): """ Unregisters an existing command, so that this command is no longer available on the command line interface. This function is mainly used during plugin deactivation. :param command: Name of the command """ if command not in self._comman...
[ "def", "unregister", "(", "self", ",", "command", ")", ":", "if", "command", "not", "in", "self", ".", "_commands", ".", "keys", "(", ")", ":", "self", ".", "log", ".", "warning", "(", "\"Can not unregister command %s\"", "%", "command", ")", "else", ":"...
Unregisters an existing command, so that this command is no longer available on the command line interface. This function is mainly used during plugin deactivation. :param command: Name of the command
[ "Unregisters", "an", "existing", "command", "so", "that", "this", "command", "is", "no", "longer", "available", "on", "the", "command", "line", "interface", "." ]
d34fce43f54246ca4db0f7b89e450dcdc847c68c
https://github.com/useblocks/groundwork/blob/d34fce43f54246ca4db0f7b89e450dcdc847c68c/groundwork/patterns/gw_commands_pattern.py#L185-L202
train
Unregisters an existing command from the click internal commands dictionary.
vuamitom/tornado-smtpclient
tornado_smtpclient/client.py
SMTPAsync.rcpt
def rcpt(self, recip, options=[]): """SMTP 'rcpt' command -- indicates 1 recipient for this mail.""" optionlist = '' if options and self.does_esmtp: optionlist = ' ' + ' '.join(options) code, msg = yield self.docmd(b"rcpt", ("TO:%s%s" % (smtplib.quoteaddr(recip), optionlist))...
python
def rcpt(self, recip, options=[]): """SMTP 'rcpt' command -- indicates 1 recipient for this mail.""" optionlist = '' if options and self.does_esmtp: optionlist = ' ' + ' '.join(options) code, msg = yield self.docmd(b"rcpt", ("TO:%s%s" % (smtplib.quoteaddr(recip), optionlist))...
[ "def", "rcpt", "(", "self", ",", "recip", ",", "options", "=", "[", "]", ")", ":", "optionlist", "=", "''", "if", "options", "and", "self", ".", "does_esmtp", ":", "optionlist", "=", "' '", "+", "' '", ".", "join", "(", "options", ")", "code", ",",...
SMTP 'rcpt' command -- indicates 1 recipient for this mail.
[ "SMTP", "rcpt", "command", "--", "indicates", "1", "recipient", "for", "this", "mail", "." ]
a6d4b7e2ca019592a991c85328b3d9af60c27448
https://github.com/vuamitom/tornado-smtpclient/blob/a6d4b7e2ca019592a991c85328b3d9af60c27448/tornado_smtpclient/client.py#L298-L304
train
SMTP RCPT command.
vuamitom/tornado-smtpclient
tornado_smtpclient/client.py
SMTPAsync.data
def data(self, msg): """SMTP 'DATA' command -- sends message data to server. """ (code, repl) = yield self.docmd(b"data") if code != 354: raise smtplib.SMTPDataError(code, repl) else: if isinstance(msg, str): msg = smtplib._fix_eols(msg).encode('...
python
def data(self, msg): """SMTP 'DATA' command -- sends message data to server. """ (code, repl) = yield self.docmd(b"data") if code != 354: raise smtplib.SMTPDataError(code, repl) else: if isinstance(msg, str): msg = smtplib._fix_eols(msg).encode('...
[ "def", "data", "(", "self", ",", "msg", ")", ":", "(", "code", ",", "repl", ")", "=", "yield", "self", ".", "docmd", "(", "b\"data\"", ")", "if", "code", "!=", "354", ":", "raise", "smtplib", ".", "SMTPDataError", "(", "code", ",", "repl", ")", "...
SMTP 'DATA' command -- sends message data to server.
[ "SMTP", "DATA", "command", "--", "sends", "message", "data", "to", "server", "." ]
a6d4b7e2ca019592a991c85328b3d9af60c27448
https://github.com/vuamitom/tornado-smtpclient/blob/a6d4b7e2ca019592a991c85328b3d9af60c27448/tornado_smtpclient/client.py#L307-L324
train
SMTP DATA command. Sends a message to the server.
go-macaroon-bakery/py-macaroon-bakery
macaroonbakery/checkers/_caveat.py
declared_caveat
def declared_caveat(key, value): '''Returns a "declared" caveat asserting that the given key is set to the given value. If a macaroon has exactly one first party caveat asserting the value of a particular key, then infer_declared will be able to infer the value, and then the check will allow the de...
python
def declared_caveat(key, value): '''Returns a "declared" caveat asserting that the given key is set to the given value. If a macaroon has exactly one first party caveat asserting the value of a particular key, then infer_declared will be able to infer the value, and then the check will allow the de...
[ "def", "declared_caveat", "(", "key", ",", "value", ")", ":", "if", "key", ".", "find", "(", "' '", ")", ">=", "0", "or", "key", "==", "''", ":", "return", "error_caveat", "(", "'invalid caveat \\'declared\\' key \"{}\"'", ".", "format", "(", "key", ")", ...
Returns a "declared" caveat asserting that the given key is set to the given value. If a macaroon has exactly one first party caveat asserting the value of a particular key, then infer_declared will be able to infer the value, and then the check will allow the declared value if it has the value spe...
[ "Returns", "a", "declared", "caveat", "asserting", "that", "the", "given", "key", "is", "set", "to", "the", "given", "value", "." ]
63ce1ef1dabe816eb8aaec48fbb46761c34ddf77
https://github.com/go-macaroon-bakery/py-macaroon-bakery/blob/63ce1ef1dabe816eb8aaec48fbb46761c34ddf77/macaroonbakery/checkers/_caveat.py#L33-L46
train
Returns a declared caveat asserting that the given key is set to the given value.
go-macaroon-bakery/py-macaroon-bakery
macaroonbakery/checkers/_caveat.py
_operation_caveat
def _operation_caveat(cond, ops): ''' Helper for allow_caveat and deny_caveat. It checks that all operation names are valid before creating the caveat. ''' for op in ops: if op.find(' ') != -1: return error_caveat('invalid operation name "{}"'.format(op)) return _first_party(con...
python
def _operation_caveat(cond, ops): ''' Helper for allow_caveat and deny_caveat. It checks that all operation names are valid before creating the caveat. ''' for op in ops: if op.find(' ') != -1: return error_caveat('invalid operation name "{}"'.format(op)) return _first_party(con...
[ "def", "_operation_caveat", "(", "cond", ",", "ops", ")", ":", "for", "op", "in", "ops", ":", "if", "op", ".", "find", "(", "' '", ")", "!=", "-", "1", ":", "return", "error_caveat", "(", "'invalid operation name \"{}\"'", ".", "format", "(", "op", ")"...
Helper for allow_caveat and deny_caveat. It checks that all operation names are valid before creating the caveat.
[ "Helper", "for", "allow_caveat", "and", "deny_caveat", "." ]
63ce1ef1dabe816eb8aaec48fbb46761c34ddf77
https://github.com/go-macaroon-bakery/py-macaroon-bakery/blob/63ce1ef1dabe816eb8aaec48fbb46761c34ddf77/macaroonbakery/checkers/_caveat.py#L81-L89
train
Helper function for allow_caveat and deny_caveat.
go-macaroon-bakery/py-macaroon-bakery
macaroonbakery/checkers/_caveat.py
time_before_caveat
def time_before_caveat(t): '''Return a caveat that specifies that the time that it is checked at should be before t. :param t is a a UTC date in - use datetime.utcnow, not datetime.now ''' return _first_party(COND_TIME_BEFORE, pyrfc3339.generate(t, accept_naive=True, ...
python
def time_before_caveat(t): '''Return a caveat that specifies that the time that it is checked at should be before t. :param t is a a UTC date in - use datetime.utcnow, not datetime.now ''' return _first_party(COND_TIME_BEFORE, pyrfc3339.generate(t, accept_naive=True, ...
[ "def", "time_before_caveat", "(", "t", ")", ":", "return", "_first_party", "(", "COND_TIME_BEFORE", ",", "pyrfc3339", ".", "generate", "(", "t", ",", "accept_naive", "=", "True", ",", "microseconds", "=", "True", ")", ")" ]
Return a caveat that specifies that the time that it is checked at should be before t. :param t is a a UTC date in - use datetime.utcnow, not datetime.now
[ "Return", "a", "caveat", "that", "specifies", "that", "the", "time", "that", "it", "is", "checked", "at", "should", "be", "before", "t", ".", ":", "param", "t", "is", "a", "a", "UTC", "date", "in", "-", "use", "datetime", ".", "utcnow", "not", "datet...
63ce1ef1dabe816eb8aaec48fbb46761c34ddf77
https://github.com/go-macaroon-bakery/py-macaroon-bakery/blob/63ce1ef1dabe816eb8aaec48fbb46761c34ddf77/macaroonbakery/checkers/_caveat.py#L92-L100
train
Return a caveat that specifies that the time that it is checked before t.
go-macaroon-bakery/py-macaroon-bakery
macaroonbakery/checkers/_caveat.py
parse_caveat
def parse_caveat(cav): ''' Parses a caveat into an identifier, identifying the checker that should be used, and the argument to the checker (the rest of the string). The identifier is taken from all the characters before the first space character. :return two string, identifier and arg ''' ...
python
def parse_caveat(cav): ''' Parses a caveat into an identifier, identifying the checker that should be used, and the argument to the checker (the rest of the string). The identifier is taken from all the characters before the first space character. :return two string, identifier and arg ''' ...
[ "def", "parse_caveat", "(", "cav", ")", ":", "if", "cav", "==", "''", ":", "raise", "ValueError", "(", "'empty caveat'", ")", "try", ":", "i", "=", "cav", ".", "index", "(", "' '", ")", "except", "ValueError", ":", "return", "cav", ",", "''", "if", ...
Parses a caveat into an identifier, identifying the checker that should be used, and the argument to the checker (the rest of the string). The identifier is taken from all the characters before the first space character. :return two string, identifier and arg
[ "Parses", "a", "caveat", "into", "an", "identifier", "identifying", "the", "checker", "that", "should", "be", "used", "and", "the", "argument", "to", "the", "checker", "(", "the", "rest", "of", "the", "string", ")", "." ]
63ce1ef1dabe816eb8aaec48fbb46761c34ddf77
https://github.com/go-macaroon-bakery/py-macaroon-bakery/blob/63ce1ef1dabe816eb8aaec48fbb46761c34ddf77/macaroonbakery/checkers/_caveat.py#L103-L119
train
Parses a caveat into an identifier identifying the checker that should be used and the argument to the checker.
go-macaroon-bakery/py-macaroon-bakery
macaroonbakery/_utils/__init__.py
to_bytes
def to_bytes(s): '''Return s as a bytes type, using utf-8 encoding if necessary. @param s string or bytes @return bytes ''' if isinstance(s, six.binary_type): return s if isinstance(s, six.string_types): return s.encode('utf-8') raise TypeError('want string or bytes, got {}',...
python
def to_bytes(s): '''Return s as a bytes type, using utf-8 encoding if necessary. @param s string or bytes @return bytes ''' if isinstance(s, six.binary_type): return s if isinstance(s, six.string_types): return s.encode('utf-8') raise TypeError('want string or bytes, got {}',...
[ "def", "to_bytes", "(", "s", ")", ":", "if", "isinstance", "(", "s", ",", "six", ".", "binary_type", ")", ":", "return", "s", "if", "isinstance", "(", "s", ",", "six", ".", "string_types", ")", ":", "return", "s", ".", "encode", "(", "'utf-8'", ")"...
Return s as a bytes type, using utf-8 encoding if necessary. @param s string or bytes @return bytes
[ "Return", "s", "as", "a", "bytes", "type", "using", "utf", "-", "8", "encoding", "if", "necessary", "." ]
63ce1ef1dabe816eb8aaec48fbb46761c34ddf77
https://github.com/go-macaroon-bakery/py-macaroon-bakery/blob/63ce1ef1dabe816eb8aaec48fbb46761c34ddf77/macaroonbakery/_utils/__init__.py#L18-L27
train
Return s as a bytes type using utf - 8 encoding if necessary.
go-macaroon-bakery/py-macaroon-bakery
macaroonbakery/_utils/__init__.py
b64decode
def b64decode(s): '''Base64 decodes a base64-encoded string in URL-safe or normal format, with or without padding. The argument may be string or bytes. @param s bytes decode @return bytes decoded @raises ValueError on failure ''' # add padding if necessary. s = to_bytes(s) if no...
python
def b64decode(s): '''Base64 decodes a base64-encoded string in URL-safe or normal format, with or without padding. The argument may be string or bytes. @param s bytes decode @return bytes decoded @raises ValueError on failure ''' # add padding if necessary. s = to_bytes(s) if no...
[ "def", "b64decode", "(", "s", ")", ":", "# add padding if necessary.", "s", "=", "to_bytes", "(", "s", ")", "if", "not", "s", ".", "endswith", "(", "b'='", ")", ":", "s", "=", "s", "+", "b'='", "*", "(", "-", "len", "(", "s", ")", "%", "4", ")"...
Base64 decodes a base64-encoded string in URL-safe or normal format, with or without padding. The argument may be string or bytes. @param s bytes decode @return bytes decoded @raises ValueError on failure
[ "Base64", "decodes", "a", "base64", "-", "encoded", "string", "in", "URL", "-", "safe", "or", "normal", "format", "with", "or", "without", "padding", ".", "The", "argument", "may", "be", "string", "or", "bytes", "." ]
63ce1ef1dabe816eb8aaec48fbb46761c34ddf77
https://github.com/go-macaroon-bakery/py-macaroon-bakery/blob/63ce1ef1dabe816eb8aaec48fbb46761c34ddf77/macaroonbakery/_utils/__init__.py#L79-L98
train
Base64 decodes a base64 - encoded string in URL - safe or normal format with or without padding.
go-macaroon-bakery/py-macaroon-bakery
macaroonbakery/_utils/__init__.py
raw_urlsafe_b64encode
def raw_urlsafe_b64encode(b): '''Base64 encode using URL-safe encoding with padding removed. @param b bytes to decode @return bytes decoded ''' b = to_bytes(b) b = base64.urlsafe_b64encode(b) b = b.rstrip(b'=') # strip padding return b
python
def raw_urlsafe_b64encode(b): '''Base64 encode using URL-safe encoding with padding removed. @param b bytes to decode @return bytes decoded ''' b = to_bytes(b) b = base64.urlsafe_b64encode(b) b = b.rstrip(b'=') # strip padding return b
[ "def", "raw_urlsafe_b64encode", "(", "b", ")", ":", "b", "=", "to_bytes", "(", "b", ")", "b", "=", "base64", ".", "urlsafe_b64encode", "(", "b", ")", "b", "=", "b", ".", "rstrip", "(", "b'='", ")", "# strip padding", "return", "b" ]
Base64 encode using URL-safe encoding with padding removed. @param b bytes to decode @return bytes decoded
[ "Base64", "encode", "using", "URL", "-", "safe", "encoding", "with", "padding", "removed", "." ]
63ce1ef1dabe816eb8aaec48fbb46761c34ddf77
https://github.com/go-macaroon-bakery/py-macaroon-bakery/blob/63ce1ef1dabe816eb8aaec48fbb46761c34ddf77/macaroonbakery/_utils/__init__.py#L101-L110
train
Base64 encode using URL - safe encoding with padding removed.
go-macaroon-bakery/py-macaroon-bakery
macaroonbakery/_utils/__init__.py
cookie
def cookie( url, name, value, expires=None): '''Return a new Cookie using a slightly more friendly API than that provided by six.moves.http_cookiejar @param name The cookie name {str} @param value The cookie value {str} @param url The URL path of the cookie {str} ...
python
def cookie( url, name, value, expires=None): '''Return a new Cookie using a slightly more friendly API than that provided by six.moves.http_cookiejar @param name The cookie name {str} @param value The cookie value {str} @param url The URL path of the cookie {str} ...
[ "def", "cookie", "(", "url", ",", "name", ",", "value", ",", "expires", "=", "None", ")", ":", "u", "=", "urlparse", "(", "url", ")", "domain", "=", "u", ".", "hostname", "if", "'.'", "not", "in", "domain", "and", "not", "_is_ip_addr", "(", "domain...
Return a new Cookie using a slightly more friendly API than that provided by six.moves.http_cookiejar @param name The cookie name {str} @param value The cookie value {str} @param url The URL path of the cookie {str} @param expires The expiry time of the cookie {datetime}. If provided, it mu...
[ "Return", "a", "new", "Cookie", "using", "a", "slightly", "more", "friendly", "API", "than", "that", "provided", "by", "six", ".", "moves", ".", "http_cookiejar" ]
63ce1ef1dabe816eb8aaec48fbb46761c34ddf77
https://github.com/go-macaroon-bakery/py-macaroon-bakery/blob/63ce1ef1dabe816eb8aaec48fbb46761c34ddf77/macaroonbakery/_utils/__init__.py#L123-L165
train
Return a new Cookie using a slightly more efficient API than that provided by six. moves. http_cookiejar
swevm/scaleio-py
scaleiopy/im.py
Im._login
def _login(self): """ LOGIN CAN ONLY BE DONE BY POSTING TO A HTTP FORM. A COOKIE IS THEN USED FOR INTERACTING WITH THE API """ self.logger.debug("Logging into " + "{}/{}".format(self._im_api_url, "j_spring_security_check")) self._im_session.headers.update({'Content-Type':...
python
def _login(self): """ LOGIN CAN ONLY BE DONE BY POSTING TO A HTTP FORM. A COOKIE IS THEN USED FOR INTERACTING WITH THE API """ self.logger.debug("Logging into " + "{}/{}".format(self._im_api_url, "j_spring_security_check")) self._im_session.headers.update({'Content-Type':...
[ "def", "_login", "(", "self", ")", ":", "self", ".", "logger", ".", "debug", "(", "\"Logging into \"", "+", "\"{}/{}\"", ".", "format", "(", "self", ".", "_im_api_url", ",", "\"j_spring_security_check\"", ")", ")", "self", ".", "_im_session", ".", "headers",...
LOGIN CAN ONLY BE DONE BY POSTING TO A HTTP FORM. A COOKIE IS THEN USED FOR INTERACTING WITH THE API
[ "LOGIN", "CAN", "ONLY", "BE", "DONE", "BY", "POSTING", "TO", "A", "HTTP", "FORM", ".", "A", "COOKIE", "IS", "THEN", "USED", "FOR", "INTERACTING", "WITH", "THE", "API" ]
d043a0137cb925987fd5c895a3210968ce1d9028
https://github.com/swevm/scaleio-py/blob/d043a0137cb925987fd5c895a3210968ce1d9028/scaleiopy/im.py#L107-L134
train
Login to the ScaleIO IM.
swevm/scaleio-py
scaleiopy/im.py
Im._do_get
def _do_get(self, uri, **kwargs): """ Convinient method for GET requests Returns http request status value from a POST request """ #TODO: # Add error handling. Check for HTTP status here would be much more conveinent than in each calling method scaleioapi_get_head...
python
def _do_get(self, uri, **kwargs): """ Convinient method for GET requests Returns http request status value from a POST request """ #TODO: # Add error handling. Check for HTTP status here would be much more conveinent than in each calling method scaleioapi_get_head...
[ "def", "_do_get", "(", "self", ",", "uri", ",", "*", "*", "kwargs", ")", ":", "#TODO:", "# Add error handling. Check for HTTP status here would be much more conveinent than in each calling method", "scaleioapi_get_headers", "=", "{", "'Content-type'", ":", "'application/json'",...
Convinient method for GET requests Returns http request status value from a POST request
[ "Convinient", "method", "for", "GET", "requests", "Returns", "http", "request", "status", "value", "from", "a", "POST", "request" ]
d043a0137cb925987fd5c895a3210968ce1d9028
https://github.com/swevm/scaleio-py/blob/d043a0137cb925987fd5c895a3210968ce1d9028/scaleiopy/im.py#L144-L169
train
This method is used to get a specific item from a ScaleIO API.
swevm/scaleio-py
scaleiopy/im.py
Im._do_put
def _do_put(self, uri, **kwargs): """ Convinient method for POST requests Returns http request status value from a POST request """ #TODO: # Add error handling. Check for HTTP status here would be much more conveinent than in each calling method scaleioapi_put_hea...
python
def _do_put(self, uri, **kwargs): """ Convinient method for POST requests Returns http request status value from a POST request """ #TODO: # Add error handling. Check for HTTP status here would be much more conveinent than in each calling method scaleioapi_put_hea...
[ "def", "_do_put", "(", "self", ",", "uri", ",", "*", "*", "kwargs", ")", ":", "#TODO:", "# Add error handling. Check for HTTP status here would be much more conveinent than in each calling method", "scaleioapi_put_headers", "=", "{", "'content-type'", ":", "'application/json'",...
Convinient method for POST requests Returns http request status value from a POST request
[ "Convinient", "method", "for", "POST", "requests", "Returns", "http", "request", "status", "value", "from", "a", "POST", "request" ]
d043a0137cb925987fd5c895a3210968ce1d9028
https://github.com/swevm/scaleio-py/blob/d043a0137cb925987fd5c895a3210968ce1d9028/scaleiopy/im.py#L171-L200
train
This method is used to send a PUT request to a ScaleIO API.
swevm/scaleio-py
scaleiopy/im.py
Im._do_post
def _do_post(self, url, **kwargs): """ Convinient method for POST requests Returns http request status value from a POST request """ #TODO: # Add error handling. Check for HTTP status here would be much more conveinent than in each calling method scaleioapi_post_h...
python
def _do_post(self, url, **kwargs): """ Convinient method for POST requests Returns http request status value from a POST request """ #TODO: # Add error handling. Check for HTTP status here would be much more conveinent than in each calling method scaleioapi_post_h...
[ "def", "_do_post", "(", "self", ",", "url", ",", "*", "*", "kwargs", ")", ":", "#TODO:", "# Add error handling. Check for HTTP status here would be much more conveinent than in each calling method", "scaleioapi_post_headers", "=", "{", "'Content-type'", ":", "'application/json'...
Convinient method for POST requests Returns http request status value from a POST request
[ "Convinient", "method", "for", "POST", "requests", "Returns", "http", "request", "status", "value", "from", "a", "POST", "request" ]
d043a0137cb925987fd5c895a3210968ce1d9028
https://github.com/swevm/scaleio-py/blob/d043a0137cb925987fd5c895a3210968ce1d9028/scaleiopy/im.py#L202-L230
train
This method is used to send a POST request to a ScaleIO API endpoint.
swevm/scaleio-py
scaleiopy/im.py
Im.set_abort_pending
def set_abort_pending(self, newstate): """ Method to set Abort state if something goes wrong during provisioning Method also used to finish provisioning process when all is completed Method: POST """ self.logger.debug("set_abort_pending(" + "{})".format(newstate)) ...
python
def set_abort_pending(self, newstate): """ Method to set Abort state if something goes wrong during provisioning Method also used to finish provisioning process when all is completed Method: POST """ self.logger.debug("set_abort_pending(" + "{})".format(newstate)) ...
[ "def", "set_abort_pending", "(", "self", ",", "newstate", ")", ":", "self", ".", "logger", ".", "debug", "(", "\"set_abort_pending(\"", "+", "\"{})\"", ".", "format", "(", "newstate", ")", ")", "# NOT TO BE USED", "#default_minimal_cluster_config = '{\"installationId\...
Method to set Abort state if something goes wrong during provisioning Method also used to finish provisioning process when all is completed Method: POST
[ "Method", "to", "set", "Abort", "state", "if", "something", "goes", "wrong", "during", "provisioning", "Method", "also", "used", "to", "finish", "provisioning", "process", "when", "all", "is", "completed", "Method", ":", "POST" ]
d043a0137cb925987fd5c895a3210968ce1d9028
https://github.com/swevm/scaleio-py/blob/d043a0137cb925987fd5c895a3210968ce1d9028/scaleiopy/im.py#L275-L299
train
Set the state of the idle cluster to newstate.
swevm/scaleio-py
scaleiopy/im.py
Im.push_cached_cluster_configuration
def push_cached_cluster_configuration(self, mdmPassword, liaPassword, noUpload = False, noInstall= False, noConfigure = False): """ Method push cached ScaleIO cluster configuration to IM (reconfigurations that have been made to cached configuration are committed using IM) Method: POST At...
python
def push_cached_cluster_configuration(self, mdmPassword, liaPassword, noUpload = False, noInstall= False, noConfigure = False): """ Method push cached ScaleIO cluster configuration to IM (reconfigurations that have been made to cached configuration are committed using IM) Method: POST At...
[ "def", "push_cached_cluster_configuration", "(", "self", ",", "mdmPassword", ",", "liaPassword", ",", "noUpload", "=", "False", ",", "noInstall", "=", "False", ",", "noConfigure", "=", "False", ")", ":", "self", ".", "logger", ".", "debug", "(", "\"push_cached...
Method push cached ScaleIO cluster configuration to IM (reconfigurations that have been made to cached configuration are committed using IM) Method: POST Attach JSON cluster configuration as request payload (data). Add MDM and LIA passwords)
[ "Method", "push", "cached", "ScaleIO", "cluster", "configuration", "to", "IM", "(", "reconfigurations", "that", "have", "been", "made", "to", "cached", "configuration", "are", "committed", "using", "IM", ")", "Method", ":", "POST", "Attach", "JSON", "cluster", ...
d043a0137cb925987fd5c895a3210968ce1d9028
https://github.com/swevm/scaleio-py/blob/d043a0137cb925987fd5c895a3210968ce1d9028/scaleiopy/im.py#L444-L488
train
Push the current configuration to the IM
swevm/scaleio-py
scaleiopy/im.py
Im.create_minimal_scaleio_cluster
def create_minimal_scaleio_cluster(self, mdmPassword, liaPassword): """ Using IM this method create a 3-node ScaleIO cluster with 2xMDM, 1xTB, 3x SDS (using /dev/sdb), 3x SDC """ """ self.read_cluster_config_from_disk("minimal-cluster.json") #self._cluster_config_cached.s...
python
def create_minimal_scaleio_cluster(self, mdmPassword, liaPassword): """ Using IM this method create a 3-node ScaleIO cluster with 2xMDM, 1xTB, 3x SDS (using /dev/sdb), 3x SDC """ """ self.read_cluster_config_from_disk("minimal-cluster.json") #self._cluster_config_cached.s...
[ "def", "create_minimal_scaleio_cluster", "(", "self", ",", "mdmPassword", ",", "liaPassword", ")", ":", "\"\"\"\n self.read_cluster_config_from_disk(\"minimal-cluster.json\")\n #self._cluster_config_cached.setMdmPassword(setMdmPassword)\n #self._cluster_config_cached.setLiaP...
Using IM this method create a 3-node ScaleIO cluster with 2xMDM, 1xTB, 3x SDS (using /dev/sdb), 3x SDC
[ "Using", "IM", "this", "method", "create", "a", "3", "-", "node", "ScaleIO", "cluster", "with", "2xMDM", "1xTB", "3x", "SDS", "(", "using", "/", "dev", "/", "sdb", ")", "3x", "SDC" ]
d043a0137cb925987fd5c895a3210968ce1d9028
https://github.com/swevm/scaleio-py/blob/d043a0137cb925987fd5c895a3210968ce1d9028/scaleiopy/im.py#L495-L611
train
This method creates a minimal ScaleIO cluster with 2xMDM 1xTB 3x SDS and 3x SDS with 2xTB 3x SDS with 2xTB 3x MDM 1xTB 3x SDS with 2xTB 3x SDS with 2xTB 3x SDS with 2xTB 3x MDM 1xTB 3x SDS
swevm/scaleio-py
scaleiopy/im.py
Im.push_cluster_configuration
def push_cluster_configuration(self, scaleioobj, noUpload = False, noInstall= False, noConfigure = False): """ Method push cached ScaleIO cluster configuration to IM (reconfigurations that have been made to cached configuration are committed using IM) Method: POST Attach JSON cluster con...
python
def push_cluster_configuration(self, scaleioobj, noUpload = False, noInstall= False, noConfigure = False): """ Method push cached ScaleIO cluster configuration to IM (reconfigurations that have been made to cached configuration are committed using IM) Method: POST Attach JSON cluster con...
[ "def", "push_cluster_configuration", "(", "self", ",", "scaleioobj", ",", "noUpload", "=", "False", ",", "noInstall", "=", "False", ",", "noConfigure", "=", "False", ")", ":", "self", ".", "logger", ".", "debug", "(", "\"push_cluster_configuration(\"", "+", "\...
Method push cached ScaleIO cluster configuration to IM (reconfigurations that have been made to cached configuration are committed using IM) Method: POST Attach JSON cluster configuration as request payload (data). Add MDM and LIA passwords)
[ "Method", "push", "cached", "ScaleIO", "cluster", "configuration", "to", "IM", "(", "reconfigurations", "that", "have", "been", "made", "to", "cached", "configuration", "are", "committed", "using", "IM", ")", "Method", ":", "POST", "Attach", "JSON", "cluster", ...
d043a0137cb925987fd5c895a3210968ce1d9028
https://github.com/swevm/scaleio-py/blob/d043a0137cb925987fd5c895a3210968ce1d9028/scaleiopy/im.py#L613-L642
train
Method push cluster configuration to IM
swevm/scaleio-py
scaleiopy/im.py
Im.uploadPackages
def uploadPackages(self, directory): """ Not working. Am not able ot figure out how to upload. IT return status 200OK with this code but do not store the files. In tomcat.log (IM) there?s a complaint about character encoding whn uploading file. Not sure how to rectiy it in requests post ...
python
def uploadPackages(self, directory): """ Not working. Am not able ot figure out how to upload. IT return status 200OK with this code but do not store the files. In tomcat.log (IM) there?s a complaint about character encoding whn uploading file. Not sure how to rectiy it in requests post ...
[ "def", "uploadPackages", "(", "self", ",", "directory", ")", ":", "files_to_upload_dict", "=", "{", "}", "files_to_upload_list", "=", "[", "f", "for", "f", "in", "listdir", "(", "directory", ")", "if", "isfile", "(", "join", "(", "directory", ",", "f", "...
Not working. Am not able ot figure out how to upload. IT return status 200OK with this code but do not store the files. In tomcat.log (IM) there?s a complaint about character encoding whn uploading file. Not sure how to rectiy it in requests post call though
[ "Not", "working", ".", "Am", "not", "able", "ot", "figure", "out", "how", "to", "upload", ".", "IT", "return", "status", "200OK", "with", "this", "code", "but", "do", "not", "store", "the", "files", ".", "In", "tomcat", ".", "log", "(", "IM", ")", ...
d043a0137cb925987fd5c895a3210968ce1d9028
https://github.com/swevm/scaleio-py/blob/d043a0137cb925987fd5c895a3210968ce1d9028/scaleiopy/im.py#L649-L660
train
Upload all the files in the specified directory to the IM.
swevm/scaleio-py
scaleiopy/im.py
Im.uploadFileToIM
def uploadFileToIM (self, directory, filename, title): """ Parameters as they look in the form for uploading packages to IM """ self.logger.debug("uploadFileToIM(" + "{},{},{})".format(directory, filename, title)) parameters = {'data-filename-placement':'inside', ...
python
def uploadFileToIM (self, directory, filename, title): """ Parameters as they look in the form for uploading packages to IM """ self.logger.debug("uploadFileToIM(" + "{},{},{})".format(directory, filename, title)) parameters = {'data-filename-placement':'inside', ...
[ "def", "uploadFileToIM", "(", "self", ",", "directory", ",", "filename", ",", "title", ")", ":", "self", ".", "logger", ".", "debug", "(", "\"uploadFileToIM(\"", "+", "\"{},{},{})\"", ".", "format", "(", "directory", ",", "filename", ",", "title", ")", ")"...
Parameters as they look in the form for uploading packages to IM
[ "Parameters", "as", "they", "look", "in", "the", "form", "for", "uploading", "packages", "to", "IM" ]
d043a0137cb925987fd5c895a3210968ce1d9028
https://github.com/swevm/scaleio-py/blob/d043a0137cb925987fd5c895a3210968ce1d9028/scaleiopy/im.py#L670-L702
train
Uploads a file to an IM and returns the ID of the newly uploaded file.
swevm/scaleio-py
scaleiopy/im.py
Im.uploadCsvConfiguration
def uploadCsvConfiguration(self, conf_filename): """ NOT NEEDED. JSON can be POSTed to IM instead of sending a CSV that is locally parsed and converted to JSON. Remote Address:192.168.100.51:443 Request URL:https://192.168.100.51/types/Configuration/instances/actions/parseFromCS...
python
def uploadCsvConfiguration(self, conf_filename): """ NOT NEEDED. JSON can be POSTed to IM instead of sending a CSV that is locally parsed and converted to JSON. Remote Address:192.168.100.51:443 Request URL:https://192.168.100.51/types/Configuration/instances/actions/parseFromCS...
[ "def", "uploadCsvConfiguration", "(", "self", ",", "conf_filename", ")", ":", "parameters", "=", "{", "'selectInstallOrExtend'", ":", "'install'", ",", "#'install' or 'extend'", "'name'", ":", "'file'", ",", "'id'", ":", "'fileToUpload'", ",", "'filename'", ":", "...
NOT NEEDED. JSON can be POSTed to IM instead of sending a CSV that is locally parsed and converted to JSON. Remote Address:192.168.100.51:443 Request URL:https://192.168.100.51/types/Configuration/instances/actions/parseFromCSV Request Method:POST Status Code:200 OK Requ...
[ "NOT", "NEEDED", ".", "JSON", "can", "be", "POSTed", "to", "IM", "instead", "of", "sending", "a", "CSV", "that", "is", "locally", "parsed", "and", "converted", "to", "JSON", ".", "Remote", "Address", ":", "192", ".", "168", ".", "100", ".", "51", ":"...
d043a0137cb925987fd5c895a3210968ce1d9028
https://github.com/swevm/scaleio-py/blob/d043a0137cb925987fd5c895a3210968ce1d9028/scaleiopy/im.py#L716-L770
train
This method uploads a CSV file to IM.
ph4r05/monero-serialize
monero_serialize/xmrrpc.py
dump_varint_t
async def dump_varint_t(writer, type_or, pv): """ Binary dump of the integer of given type :param writer: :param type_or: :param pv: :return: """ width = int_mark_to_size(type_or) n = (pv << 2) | type_or buffer = _UINT_BUFFER for _ in range(width): buffer[0] = n & 0...
python
async def dump_varint_t(writer, type_or, pv): """ Binary dump of the integer of given type :param writer: :param type_or: :param pv: :return: """ width = int_mark_to_size(type_or) n = (pv << 2) | type_or buffer = _UINT_BUFFER for _ in range(width): buffer[0] = n & 0...
[ "async", "def", "dump_varint_t", "(", "writer", ",", "type_or", ",", "pv", ")", ":", "width", "=", "int_mark_to_size", "(", "type_or", ")", "n", "=", "(", "pv", "<<", "2", ")", "|", "type_or", "buffer", "=", "_UINT_BUFFER", "for", "_", "in", "range", ...
Binary dump of the integer of given type :param writer: :param type_or: :param pv: :return:
[ "Binary", "dump", "of", "the", "integer", "of", "given", "type" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrrpc.py#L210-L228
train
Binary dump of the integer of given type_or and pv.
ph4r05/monero-serialize
monero_serialize/xmrrpc.py
dump_varint
async def dump_varint(writer, val): """ Binary dump of the variable size integer :param writer: :param val: :return: """ if val <= 63: return await dump_varint_t(writer, PortableRawSizeMark.BYTE, val) elif val <= 16383: return await dump_varint_t(writer, PortableRawSizeM...
python
async def dump_varint(writer, val): """ Binary dump of the variable size integer :param writer: :param val: :return: """ if val <= 63: return await dump_varint_t(writer, PortableRawSizeMark.BYTE, val) elif val <= 16383: return await dump_varint_t(writer, PortableRawSizeM...
[ "async", "def", "dump_varint", "(", "writer", ",", "val", ")", ":", "if", "val", "<=", "63", ":", "return", "await", "dump_varint_t", "(", "writer", ",", "PortableRawSizeMark", ".", "BYTE", ",", "val", ")", "elif", "val", "<=", "16383", ":", "return", ...
Binary dump of the variable size integer :param writer: :param val: :return:
[ "Binary", "dump", "of", "the", "variable", "size", "integer" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrrpc.py#L231-L248
train
Binary dump of the variable size integer
ph4r05/monero-serialize
monero_serialize/xmrrpc.py
load_varint
async def load_varint(reader): """ Binary load of variable size integer serialized by dump_varint :param reader: :return: """ buffer = _UINT_BUFFER await reader.areadinto(buffer) width = int_mark_to_size(buffer[0] & PortableRawSizeMark.MASK) result = buffer[0] shift = 8 fo...
python
async def load_varint(reader): """ Binary load of variable size integer serialized by dump_varint :param reader: :return: """ buffer = _UINT_BUFFER await reader.areadinto(buffer) width = int_mark_to_size(buffer[0] & PortableRawSizeMark.MASK) result = buffer[0] shift = 8 fo...
[ "async", "def", "load_varint", "(", "reader", ")", ":", "buffer", "=", "_UINT_BUFFER", "await", "reader", ".", "areadinto", "(", "buffer", ")", "width", "=", "int_mark_to_size", "(", "buffer", "[", "0", "]", "&", "PortableRawSizeMark", ".", "MASK", ")", "r...
Binary load of variable size integer serialized by dump_varint :param reader: :return:
[ "Binary", "load", "of", "variable", "size", "integer", "serialized", "by", "dump_varint" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrrpc.py#L251-L269
train
Binary load of variable size integer serialized by dump_varint .
ph4r05/monero-serialize
monero_serialize/xmrrpc.py
dump_string
async def dump_string(writer, val): """ Binary string dump :param writer: :param val: :return: """ await dump_varint(writer, len(val)) await writer.awrite(val)
python
async def dump_string(writer, val): """ Binary string dump :param writer: :param val: :return: """ await dump_varint(writer, len(val)) await writer.awrite(val)
[ "async", "def", "dump_string", "(", "writer", ",", "val", ")", ":", "await", "dump_varint", "(", "writer", ",", "len", "(", "val", ")", ")", "await", "writer", ".", "awrite", "(", "val", ")" ]
Binary string dump :param writer: :param val: :return:
[ "Binary", "string", "dump" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrrpc.py#L272-L281
train
Dump a binary string to the writer.
ph4r05/monero-serialize
monero_serialize/xmrrpc.py
load_string
async def load_string(reader): """ Loads string from binary stream :param reader: :return: """ ivalue = await load_varint(reader) fvalue = bytearray(ivalue) await reader.areadinto(fvalue) return bytes(fvalue)
python
async def load_string(reader): """ Loads string from binary stream :param reader: :return: """ ivalue = await load_varint(reader) fvalue = bytearray(ivalue) await reader.areadinto(fvalue) return bytes(fvalue)
[ "async", "def", "load_string", "(", "reader", ")", ":", "ivalue", "=", "await", "load_varint", "(", "reader", ")", "fvalue", "=", "bytearray", "(", "ivalue", ")", "await", "reader", ".", "areadinto", "(", "fvalue", ")", "return", "bytes", "(", "fvalue", ...
Loads string from binary stream :param reader: :return:
[ "Loads", "string", "from", "binary", "stream" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrrpc.py#L284-L294
train
Loads a string from binary stream.
ph4r05/monero-serialize
monero_serialize/xmrrpc.py
dump_blob
async def dump_blob(writer, elem, elem_type, params=None): """ Dumps blob to a binary stream :param writer: :param elem: :param elem_type: :param params: :return: """ elem_is_blob = isinstance(elem, x.BlobType) data = bytes(getattr(elem, x.BlobType.DATA_ATTR) if elem_is_blob els...
python
async def dump_blob(writer, elem, elem_type, params=None): """ Dumps blob to a binary stream :param writer: :param elem: :param elem_type: :param params: :return: """ elem_is_blob = isinstance(elem, x.BlobType) data = bytes(getattr(elem, x.BlobType.DATA_ATTR) if elem_is_blob els...
[ "async", "def", "dump_blob", "(", "writer", ",", "elem", ",", "elem_type", ",", "params", "=", "None", ")", ":", "elem_is_blob", "=", "isinstance", "(", "elem", ",", "x", ".", "BlobType", ")", "data", "=", "bytes", "(", "getattr", "(", "elem", ",", "...
Dumps blob to a binary stream :param writer: :param elem: :param elem_type: :param params: :return:
[ "Dumps", "blob", "to", "a", "binary", "stream" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrrpc.py#L297-L310
train
Dumps blob to a binary stream.
ph4r05/monero-serialize
monero_serialize/xmrrpc.py
load_blob
async def load_blob(reader, elem_type, params=None, elem=None): """ Loads blob from reader to the element. Returns the loaded blob. :param reader: :param elem_type: :param params: :param elem: :return: """ ivalue = await load_varint(reader) fvalue = bytearray(ivalue) await r...
python
async def load_blob(reader, elem_type, params=None, elem=None): """ Loads blob from reader to the element. Returns the loaded blob. :param reader: :param elem_type: :param params: :param elem: :return: """ ivalue = await load_varint(reader) fvalue = bytearray(ivalue) await r...
[ "async", "def", "load_blob", "(", "reader", ",", "elem_type", ",", "params", "=", "None", ",", "elem", "=", "None", ")", ":", "ivalue", "=", "await", "load_varint", "(", "reader", ")", "fvalue", "=", "bytearray", "(", "ivalue", ")", "await", "reader", ...
Loads blob from reader to the element. Returns the loaded blob. :param reader: :param elem_type: :param params: :param elem: :return:
[ "Loads", "blob", "from", "reader", "to", "the", "element", ".", "Returns", "the", "loaded", "blob", "." ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrrpc.py#L313-L337
train
Loads blob from reader to the element. Returns the loaded blob.
ph4r05/monero-serialize
monero_serialize/xmrrpc.py
Archive.root
async def root(self): """ Root level init :return: """ if self.writing: await x.dump_uint(self.iobj, PortableStorageConsts.SIGNATUREA, 4) await x.dump_uint(self.iobj, PortableStorageConsts.SIGNATUREB, 4) await x.dump_uint(self.iobj, PortableSto...
python
async def root(self): """ Root level init :return: """ if self.writing: await x.dump_uint(self.iobj, PortableStorageConsts.SIGNATUREA, 4) await x.dump_uint(self.iobj, PortableStorageConsts.SIGNATUREB, 4) await x.dump_uint(self.iobj, PortableSto...
[ "async", "def", "root", "(", "self", ")", ":", "if", "self", ".", "writing", ":", "await", "x", ".", "dump_uint", "(", "self", ".", "iobj", ",", "PortableStorageConsts", ".", "SIGNATUREA", ",", "4", ")", "await", "x", ".", "dump_uint", "(", "self", "...
Root level init :return:
[ "Root", "level", "init", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrrpc.py#L350-L370
train
Get the root level of the at least one element.
ph4r05/monero-serialize
monero_serialize/xmrrpc.py
Archive.section
async def section(self, sec=None): """ Section / dict serialization :return: """ if self.writing: await dump_varint(self.iobj, len(sec)) for key in sec: await self.section_name(key) await self.storage_entry(sec[key]) ...
python
async def section(self, sec=None): """ Section / dict serialization :return: """ if self.writing: await dump_varint(self.iobj, len(sec)) for key in sec: await self.section_name(key) await self.storage_entry(sec[key]) ...
[ "async", "def", "section", "(", "self", ",", "sec", "=", "None", ")", ":", "if", "self", ".", "writing", ":", "await", "dump_varint", "(", "self", ".", "iobj", ",", "len", "(", "sec", ")", ")", "for", "key", "in", "sec", ":", "await", "self", "."...
Section / dict serialization :return:
[ "Section", "/", "dict", "serialization", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrrpc.py#L372-L392
train
Return a section in the file.
ph4r05/monero-serialize
monero_serialize/xmrrpc.py
Archive.section_name
async def section_name(self, sec_name=None): """ Section name :param sec_name: :return: """ if self.writing: fvalue = sec_name.encode('ascii') await x.dump_uint(self.iobj, len(fvalue), 1) await self.iobj.awrite(bytearray(fvalue)) ...
python
async def section_name(self, sec_name=None): """ Section name :param sec_name: :return: """ if self.writing: fvalue = sec_name.encode('ascii') await x.dump_uint(self.iobj, len(fvalue), 1) await self.iobj.awrite(bytearray(fvalue)) ...
[ "async", "def", "section_name", "(", "self", ",", "sec_name", "=", "None", ")", ":", "if", "self", ".", "writing", ":", "fvalue", "=", "sec_name", ".", "encode", "(", "'ascii'", ")", "await", "x", ".", "dump_uint", "(", "self", ".", "iobj", ",", "len...
Section name :param sec_name: :return:
[ "Section", "name", ":", "param", "sec_name", ":", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrrpc.py#L394-L409
train
Get the section name.
ph4r05/monero-serialize
monero_serialize/xmrrpc.py
Blobber.uvarint
async def uvarint(self, elem): """ Uvarint untouched :param elem: :return: """ if self.writing: return await dump_varint(self.iobj, elem) else: return await load_varint(self.iobj)
python
async def uvarint(self, elem): """ Uvarint untouched :param elem: :return: """ if self.writing: return await dump_varint(self.iobj, elem) else: return await load_varint(self.iobj)
[ "async", "def", "uvarint", "(", "self", ",", "elem", ")", ":", "if", "self", ".", "writing", ":", "return", "await", "dump_varint", "(", "self", ".", "iobj", ",", "elem", ")", "else", ":", "return", "await", "load_varint", "(", "self", ".", "iobj", "...
Uvarint untouched :param elem: :return:
[ "Uvarint", "untouched", ":", "param", "elem", ":", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrrpc.py#L538-L547
train
Untouched uvarint.
ph4r05/monero-serialize
monero_serialize/xmrrpc.py
Blobber.uint
async def uint(self, elem, elem_type, params=None): """ Integer types :param elem: :param elem_type: :param params: :return: """ if self.writing: return await x.dump_uint(self.iobj, elem, elem_type.WIDTH) else: return await ...
python
async def uint(self, elem, elem_type, params=None): """ Integer types :param elem: :param elem_type: :param params: :return: """ if self.writing: return await x.dump_uint(self.iobj, elem, elem_type.WIDTH) else: return await ...
[ "async", "def", "uint", "(", "self", ",", "elem", ",", "elem_type", ",", "params", "=", "None", ")", ":", "if", "self", ".", "writing", ":", "return", "await", "x", ".", "dump_uint", "(", "self", ".", "iobj", ",", "elem", ",", "elem_type", ".", "WI...
Integer types :param elem: :param elem_type: :param params: :return:
[ "Integer", "types", ":", "param", "elem", ":", ":", "param", "elem_type", ":", ":", "param", "params", ":", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrrpc.py#L549-L560
train
Reads an integer from the cache or writes it to the cache if writing is True.
ph4r05/monero-serialize
monero_serialize/xmrrpc.py
Blobber.unicode_type
async def unicode_type(self, elem): """ Unicode type :param elem: :return: """ if self.writing: return await x.dump_unicode(self.iobj, elem) else: return await x.load_unicode(self.iobj)
python
async def unicode_type(self, elem): """ Unicode type :param elem: :return: """ if self.writing: return await x.dump_unicode(self.iobj, elem) else: return await x.load_unicode(self.iobj)
[ "async", "def", "unicode_type", "(", "self", ",", "elem", ")", ":", "if", "self", ".", "writing", ":", "return", "await", "x", ".", "dump_unicode", "(", "self", ".", "iobj", ",", "elem", ")", "else", ":", "return", "await", "x", ".", "load_unicode", ...
Unicode type :param elem: :return:
[ "Unicode", "type", ":", "param", "elem", ":", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrrpc.py#L562-L571
train
Unicode type.
ph4r05/monero-serialize
monero_serialize/xmrrpc.py
Blobber.blob
async def blob(self, elem=None, elem_type=None, params=None): """ Loads/dumps blob :return: """ elem_type = elem_type if elem_type else elem.__class__ if hasattr(elem_type, 'blob_serialize'): elem = elem_type() if elem is None else elem return awai...
python
async def blob(self, elem=None, elem_type=None, params=None): """ Loads/dumps blob :return: """ elem_type = elem_type if elem_type else elem.__class__ if hasattr(elem_type, 'blob_serialize'): elem = elem_type() if elem is None else elem return awai...
[ "async", "def", "blob", "(", "self", ",", "elem", "=", "None", ",", "elem_type", "=", "None", ",", "params", "=", "None", ")", ":", "elem_type", "=", "elem_type", "if", "elem_type", "else", "elem", ".", "__class__", "if", "hasattr", "(", "elem_type", "...
Loads/dumps blob :return:
[ "Loads", "/", "dumps", "blob", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrrpc.py#L573-L586
train
Load and dump a blob from the object.
ph4r05/monero-serialize
monero_serialize/xmrrpc.py
Blobber.container
async def container(self, container=None, container_type=None, params=None): """ Loads/dumps container :return: """ if hasattr(container_type, 'blob_serialize'): container = container_type() if container is None else container return await container.blob_s...
python
async def container(self, container=None, container_type=None, params=None): """ Loads/dumps container :return: """ if hasattr(container_type, 'blob_serialize'): container = container_type() if container is None else container return await container.blob_s...
[ "async", "def", "container", "(", "self", ",", "container", "=", "None", ",", "container_type", "=", "None", ",", "params", "=", "None", ")", ":", "if", "hasattr", "(", "container_type", ",", "'blob_serialize'", ")", ":", "container", "=", "container_type", ...
Loads/dumps container :return:
[ "Loads", "/", "dumps", "container", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrrpc.py#L588-L601
train
Load or dump a container.
ph4r05/monero-serialize
monero_serialize/xmrrpc.py
Blobber.get_element_size
async def get_element_size(self, elem_type, elem=None, params=None): """ Determines element size after blob serialization. Can be quite tricky for complicated structures - another object required to implement sizeof() :param elem_type: :param elem: :param params: ...
python
async def get_element_size(self, elem_type, elem=None, params=None): """ Determines element size after blob serialization. Can be quite tricky for complicated structures - another object required to implement sizeof() :param elem_type: :param elem: :param params: ...
[ "async", "def", "get_element_size", "(", "self", ",", "elem_type", ",", "elem", "=", "None", ",", "params", "=", "None", ")", ":", "if", "hasattr", "(", "elem_type", ",", "'blob_size'", ")", ":", "elem", "=", "elem_type", "(", ")", "if", "elem", "is", ...
Determines element size after blob serialization. Can be quite tricky for complicated structures - another object required to implement sizeof() :param elem_type: :param elem: :param params: :return:
[ "Determines", "element", "size", "after", "blob", "serialization", ".", "Can", "be", "quite", "tricky", "for", "complicated", "structures", "-", "another", "object", "required", "to", "implement", "sizeof", "()" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrrpc.py#L603-L657
train
Determines the size of the element after blob serialization.
ph4r05/monero-serialize
monero_serialize/xmrrpc.py
Blobber.container_load
async def container_load(self, container_type, params=None, container=None, obj=None): """ Loads container of elements from the reader. Supports the container ref. Returns loaded container. Blob array writer as in XMRRPC is serialized without size serialization. :param container...
python
async def container_load(self, container_type, params=None, container=None, obj=None): """ Loads container of elements from the reader. Supports the container ref. Returns loaded container. Blob array writer as in XMRRPC is serialized without size serialization. :param container...
[ "async", "def", "container_load", "(", "self", ",", "container_type", ",", "params", "=", "None", ",", "container", "=", "None", ",", "obj", "=", "None", ")", ":", "elem_type", "=", "x", ".", "container_elem_type", "(", "container_type", ",", "params", ")"...
Loads container of elements from the reader. Supports the container ref. Returns loaded container. Blob array writer as in XMRRPC is serialized without size serialization. :param container_type: :param params: :param container: :param obj: :return:
[ "Loads", "container", "of", "elements", "from", "the", "reader", ".", "Supports", "the", "container", "ref", ".", "Returns", "loaded", "container", ".", "Blob", "array", "writer", "as", "in", "XMRRPC", "is", "serialized", "without", "size", "serialization", "....
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrrpc.py#L682-L721
train
Loads the container of elements from the reader. Supports the container ref. Returns loaded container.
ph4r05/monero-serialize
monero_serialize/xmrrpc.py
Blobber.tuple
async def tuple(self, elem=None, elem_type=None, params=None): """ Loads/dumps tuple :return: """ if hasattr(elem_type, 'blob_serialize'): container = elem_type() if elem is None else elem return await container.blob_serialize(self, elem=elem, elem_type=el...
python
async def tuple(self, elem=None, elem_type=None, params=None): """ Loads/dumps tuple :return: """ if hasattr(elem_type, 'blob_serialize'): container = elem_type() if elem is None else elem return await container.blob_serialize(self, elem=elem, elem_type=el...
[ "async", "def", "tuple", "(", "self", ",", "elem", "=", "None", ",", "elem_type", "=", "None", ",", "params", "=", "None", ")", ":", "if", "hasattr", "(", "elem_type", ",", "'blob_serialize'", ")", ":", "container", "=", "elem_type", "(", ")", "if", ...
Loads/dumps tuple :return:
[ "Loads", "/", "dumps", "tuple", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrrpc.py#L723-L735
train
Load and dump a tuple.
ph4r05/monero-serialize
monero_serialize/xmrrpc.py
Blobber.variant
async def variant(self, elem=None, elem_type=None, params=None): """ Loads/dumps variant type :param elem: :param elem_type: :param params: :param obj: :return: """ elem_type = elem_type if elem_type else elem.__class__ if hasattr(elem_typ...
python
async def variant(self, elem=None, elem_type=None, params=None): """ Loads/dumps variant type :param elem: :param elem_type: :param params: :param obj: :return: """ elem_type = elem_type if elem_type else elem.__class__ if hasattr(elem_typ...
[ "async", "def", "variant", "(", "self", ",", "elem", "=", "None", ",", "elem_type", "=", "None", ",", "params", "=", "None", ")", ":", "elem_type", "=", "elem_type", "if", "elem_type", "else", "elem", ".", "__class__", "if", "hasattr", "(", "elem_type", ...
Loads/dumps variant type :param elem: :param elem_type: :param params: :param obj: :return:
[ "Loads", "/", "dumps", "variant", "type", ":", "param", "elem", ":", ":", "param", "elem_type", ":", ":", "param", "params", ":", ":", "param", "obj", ":", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrrpc.py#L762-L782
train
Load and dump a single variant from the cache.
ph4r05/monero-serialize
monero_serialize/xmrrpc.py
Blobber.message
async def message(self, msg, msg_type=None): """ Loads/dumps message :param msg: :param msg_type: :param obj: :return: """ elem_type = msg_type if msg_type is not None else msg.__class__ if hasattr(elem_type, 'blob_serialize'): msg = e...
python
async def message(self, msg, msg_type=None): """ Loads/dumps message :param msg: :param msg_type: :param obj: :return: """ elem_type = msg_type if msg_type is not None else msg.__class__ if hasattr(elem_type, 'blob_serialize'): msg = e...
[ "async", "def", "message", "(", "self", ",", "msg", ",", "msg_type", "=", "None", ")", ":", "elem_type", "=", "msg_type", "if", "msg_type", "is", "not", "None", "else", "msg", ".", "__class__", "if", "hasattr", "(", "elem_type", ",", "'blob_serialize'", ...
Loads/dumps message :param msg: :param msg_type: :param obj: :return:
[ "Loads", "/", "dumps", "message", ":", "param", "msg", ":", ":", "param", "msg_type", ":", ":", "param", "obj", ":", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrrpc.py#L811-L829
train
Loads and dumps a message.
ph4r05/monero-serialize
monero_serialize/xmrrpc.py
Blobber.message_field
async def message_field(self, msg, field, fvalue=None, obj=None): """ Dumps/Loads message field :param msg: :param field: :param fvalue: explicit value for dump :param obj: :return: """ fname, ftype, params = field[0], field[1], field[2:] t...
python
async def message_field(self, msg, field, fvalue=None, obj=None): """ Dumps/Loads message field :param msg: :param field: :param fvalue: explicit value for dump :param obj: :return: """ fname, ftype, params = field[0], field[1], field[2:] t...
[ "async", "def", "message_field", "(", "self", ",", "msg", ",", "field", ",", "fvalue", "=", "None", ",", "obj", "=", "None", ")", ":", "fname", ",", "ftype", ",", "params", "=", "field", "[", "0", "]", ",", "field", "[", "1", "]", ",", "field", ...
Dumps/Loads message field :param msg: :param field: :param fvalue: explicit value for dump :param obj: :return:
[ "Dumps", "/", "Loads", "message", "field", ":", "param", "msg", ":", ":", "param", "field", ":", ":", "param", "fvalue", ":", "explicit", "value", "for", "dump", ":", "param", "obj", ":", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrrpc.py#L831-L853
train
Dumps and loads a message field.
ph4r05/monero-serialize
monero_serialize/xmrrpc.py
Blobber.message_fields
async def message_fields(self, msg, fields, obj=None): """ Load/dump individual message fields :param msg: :param fields: :param obj: :return: """ for field in fields: await self.message_field(msg, field, obj) return msg
python
async def message_fields(self, msg, fields, obj=None): """ Load/dump individual message fields :param msg: :param fields: :param obj: :return: """ for field in fields: await self.message_field(msg, field, obj) return msg
[ "async", "def", "message_fields", "(", "self", ",", "msg", ",", "fields", ",", "obj", "=", "None", ")", ":", "for", "field", "in", "fields", ":", "await", "self", ".", "message_field", "(", "msg", ",", "field", ",", "obj", ")", "return", "msg" ]
Load/dump individual message fields :param msg: :param fields: :param obj: :return:
[ "Load", "/", "dump", "individual", "message", "fields", ":", "param", "msg", ":", ":", "param", "fields", ":", ":", "param", "obj", ":", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrrpc.py#L855-L865
train
Load and dump individual message fields.
ph4r05/monero-serialize
monero_serialize/xmrrpc.py
Blobber.field
async def field(self, elem=None, elem_type=None, params=None): """ Archive field :param elem: :param elem_type: :param params: :return: """ elem_type = elem_type if elem_type else elem.__class__ fvalue = None src = elem if issubcla...
python
async def field(self, elem=None, elem_type=None, params=None): """ Archive field :param elem: :param elem_type: :param params: :return: """ elem_type = elem_type if elem_type else elem.__class__ fvalue = None src = elem if issubcla...
[ "async", "def", "field", "(", "self", ",", "elem", "=", "None", ",", "elem_type", "=", "None", ",", "params", "=", "None", ")", ":", "elem_type", "=", "elem_type", "if", "elem_type", "else", "elem", ".", "__class__", "fvalue", "=", "None", "src", "=", ...
Archive field :param elem: :param elem_type: :param params: :return:
[ "Archive", "field", ":", "param", "elem", ":", ":", "param", "elem_type", ":", ":", "param", "params", ":", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrrpc.py#L867-L906
train
Get the archive field.
ph4r05/monero-serialize
monero_serialize/xmrrpc.py
Blobber.blobize
async def blobize(self, elem=None, elem_type=None, params=None): """ Main blobbing :param elem: :param elem_type: :param params: :return: """ if self.writing: await self.field(elem=elem, elem_type=elem_type, params=params) return by...
python
async def blobize(self, elem=None, elem_type=None, params=None): """ Main blobbing :param elem: :param elem_type: :param params: :return: """ if self.writing: await self.field(elem=elem, elem_type=elem_type, params=params) return by...
[ "async", "def", "blobize", "(", "self", ",", "elem", "=", "None", ",", "elem_type", "=", "None", ",", "params", "=", "None", ")", ":", "if", "self", ".", "writing", ":", "await", "self", ".", "field", "(", "elem", "=", "elem", ",", "elem_type", "="...
Main blobbing :param elem: :param elem_type: :param params: :return:
[ "Main", "blobbing", ":", "param", "elem", ":", ":", "param", "elem_type", ":", ":", "param", "params", ":", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrrpc.py#L914-L926
train
Get the blob of the object.
ph4r05/monero-serialize
monero_serialize/xmrrpc.py
Modeler.uint
async def uint(self, elem, elem_type, params=None): """ Integer types :param elem: :param elem_type: :param params: :return: """ if self.writing: return IntegerModel(elem, elem_type.WIDTH) if self.modelize else elem else: re...
python
async def uint(self, elem, elem_type, params=None): """ Integer types :param elem: :param elem_type: :param params: :return: """ if self.writing: return IntegerModel(elem, elem_type.WIDTH) if self.modelize else elem else: re...
[ "async", "def", "uint", "(", "self", ",", "elem", ",", "elem_type", ",", "params", "=", "None", ")", ":", "if", "self", ".", "writing", ":", "return", "IntegerModel", "(", "elem", ",", "elem_type", ".", "WIDTH", ")", "if", "self", ".", "modelize", "e...
Integer types :param elem: :param elem_type: :param params: :return:
[ "Integer", "types", ":", "param", "elem", ":", ":", "param", "elem_type", ":", ":", "param", "params", ":", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrrpc.py#L961-L972
train
Return the value of an integer attribute.
ph4r05/monero-serialize
monero_serialize/xmrrpc.py
Modeler.blob
async def blob(self, elem=None, elem_type=None, params=None): """ Loads/dumps blob :return: """ elem_type = elem_type if elem_type else elem.__class__ if hasattr(elem_type, 'kv_serialize'): elem = elem_type() if elem is None else elem return await ...
python
async def blob(self, elem=None, elem_type=None, params=None): """ Loads/dumps blob :return: """ elem_type = elem_type if elem_type else elem.__class__ if hasattr(elem_type, 'kv_serialize'): elem = elem_type() if elem is None else elem return await ...
[ "async", "def", "blob", "(", "self", ",", "elem", "=", "None", ",", "elem_type", "=", "None", ",", "params", "=", "None", ")", ":", "elem_type", "=", "elem_type", "if", "elem_type", "else", "elem", ".", "__class__", "if", "hasattr", "(", "elem_type", "...
Loads/dumps blob :return:
[ "Loads", "/", "dumps", "blob", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrrpc.py#L986-L1016
train
Loads and dumps a blob.
ph4r05/monero-serialize
monero_serialize/xmrrpc.py
Modeler.container
async def container(self, container=None, container_type=None, params=None, obj=None): """ Loads/dumps container :return: """ if hasattr(container_type, 'kv_serialize'): container = container_type() if container is None else container return await containe...
python
async def container(self, container=None, container_type=None, params=None, obj=None): """ Loads/dumps container :return: """ if hasattr(container_type, 'kv_serialize'): container = container_type() if container is None else container return await containe...
[ "async", "def", "container", "(", "self", ",", "container", "=", "None", ",", "container_type", "=", "None", ",", "params", "=", "None", ",", "obj", "=", "None", ")", ":", "if", "hasattr", "(", "container_type", ",", "'kv_serialize'", ")", ":", "containe...
Loads/dumps container :return:
[ "Loads", "/", "dumps", "container", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrrpc.py#L1018-L1031
train
Load or dump a container.
ph4r05/monero-serialize
monero_serialize/xmrrpc.py
Modeler.container_dump
async def container_dump(self, container, container_type, params=None, obj=None): """ Dumps container of elements to the writer. :param container: :param container_type: :param params: :param obj: :return: """ elem_type = x.container_elem_type(con...
python
async def container_dump(self, container, container_type, params=None, obj=None): """ Dumps container of elements to the writer. :param container: :param container_type: :param params: :param obj: :return: """ elem_type = x.container_elem_type(con...
[ "async", "def", "container_dump", "(", "self", ",", "container", ",", "container_type", ",", "params", "=", "None", ",", "obj", "=", "None", ")", ":", "elem_type", "=", "x", ".", "container_elem_type", "(", "container_type", ",", "params", ")", "obj", "=",...
Dumps container of elements to the writer. :param container: :param container_type: :param params: :param obj: :return:
[ "Dumps", "container", "of", "elements", "to", "the", "writer", "." ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrrpc.py#L1033-L1062
train
Dumps a container of elements to the writer.
ph4r05/monero-serialize
monero_serialize/xmrrpc.py
Modeler.container_load
async def container_load(self, container_type, params=None, container=None, obj=None): """ Loads container of elements from the reader. Supports the container ref. Returns loaded container. :param container_type: :param params: :param container: :param obj: ...
python
async def container_load(self, container_type, params=None, container=None, obj=None): """ Loads container of elements from the reader. Supports the container ref. Returns loaded container. :param container_type: :param params: :param container: :param obj: ...
[ "async", "def", "container_load", "(", "self", ",", "container_type", ",", "params", "=", "None", ",", "container", "=", "None", ",", "obj", "=", "None", ")", ":", "if", "isinstance", "(", "obj", ",", "IModel", ")", ":", "obj", "=", "obj", ".", "val"...
Loads container of elements from the reader. Supports the container ref. Returns loaded container. :param container_type: :param params: :param container: :param obj: :return:
[ "Loads", "container", "of", "elements", "from", "the", "reader", ".", "Supports", "the", "container", "ref", ".", "Returns", "loaded", "container", "." ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrrpc.py#L1064-L1101
train
Loads a container of elements from the reader. Supports the container ref. Returns loaded container.
ph4r05/monero-serialize
monero_serialize/xmrrpc.py
Modeler.tuple
async def tuple(self, elem=None, elem_type=None, params=None, obj=None): """ Loads/dumps tuple :return: """ if hasattr(elem_type, 'kv_serialize'): container = elem_type() if elem is None else elem return await container.kv_serialize(self, elem=elem, elem_t...
python
async def tuple(self, elem=None, elem_type=None, params=None, obj=None): """ Loads/dumps tuple :return: """ if hasattr(elem_type, 'kv_serialize'): container = elem_type() if elem is None else elem return await container.kv_serialize(self, elem=elem, elem_t...
[ "async", "def", "tuple", "(", "self", ",", "elem", "=", "None", ",", "elem_type", "=", "None", ",", "params", "=", "None", ",", "obj", "=", "None", ")", ":", "if", "hasattr", "(", "elem_type", ",", "'kv_serialize'", ")", ":", "container", "=", "elem_...
Loads/dumps tuple :return:
[ "Loads", "/", "dumps", "tuple", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrrpc.py#L1103-L1116
train
Load and dump a tuple.
ph4r05/monero-serialize
monero_serialize/xmrrpc.py
Modeler.dump_tuple
async def dump_tuple(self, elem, elem_type, params=None, obj=None): """ Dumps tuple of elements to the writer. :param elem: :param elem_type: :param params: :param obj: :return: """ if len(elem) != len(elem_type.f_specs()): raise Value...
python
async def dump_tuple(self, elem, elem_type, params=None, obj=None): """ Dumps tuple of elements to the writer. :param elem: :param elem_type: :param params: :param obj: :return: """ if len(elem) != len(elem_type.f_specs()): raise Value...
[ "async", "def", "dump_tuple", "(", "self", ",", "elem", ",", "elem_type", ",", "params", "=", "None", ",", "obj", "=", "None", ")", ":", "if", "len", "(", "elem", ")", "!=", "len", "(", "elem_type", ".", "f_specs", "(", ")", ")", ":", "raise", "V...
Dumps tuple of elements to the writer. :param elem: :param elem_type: :param params: :param obj: :return:
[ "Dumps", "tuple", "of", "elements", "to", "the", "writer", "." ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrrpc.py#L1118-L1146
train
Dumps a tuple of elements to the writer.
ph4r05/monero-serialize
monero_serialize/xmrrpc.py
Modeler.load_tuple
async def load_tuple(self, elem_type, params=None, elem=None, obj=None): """ Loads tuple of elements from the reader. Supports the tuple ref. Returns loaded tuple. :param elem_type: :param params: :param elem: :param obj: :return: """ if o...
python
async def load_tuple(self, elem_type, params=None, elem=None, obj=None): """ Loads tuple of elements from the reader. Supports the tuple ref. Returns loaded tuple. :param elem_type: :param params: :param elem: :param obj: :return: """ if o...
[ "async", "def", "load_tuple", "(", "self", ",", "elem_type", ",", "params", "=", "None", ",", "elem", "=", "None", ",", "obj", "=", "None", ")", ":", "if", "obj", "is", "None", ":", "return", "None", "elem_fields", "=", "params", "[", "0", "]", "if...
Loads tuple of elements from the reader. Supports the tuple ref. Returns loaded tuple. :param elem_type: :param params: :param elem: :param obj: :return:
[ "Loads", "tuple", "of", "elements", "from", "the", "reader", ".", "Supports", "the", "tuple", "ref", ".", "Returns", "loaded", "tuple", "." ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrrpc.py#L1148-L1185
train
Loads a tuple of elements from the reader. Supports the tuple ref.
ph4r05/monero-serialize
monero_serialize/xmrrpc.py
Modeler.variant
async def variant(self, elem=None, elem_type=None, params=None, obj=None): """ Loads/dumps variant type :param elem: :param elem_type: :param params: :param obj: :return: """ elem_type = elem_type if elem_type else elem.__class__ if hasatt...
python
async def variant(self, elem=None, elem_type=None, params=None, obj=None): """ Loads/dumps variant type :param elem: :param elem_type: :param params: :param obj: :return: """ elem_type = elem_type if elem_type else elem.__class__ if hasatt...
[ "async", "def", "variant", "(", "self", ",", "elem", "=", "None", ",", "elem_type", "=", "None", ",", "params", "=", "None", ",", "obj", "=", "None", ")", ":", "elem_type", "=", "elem_type", "if", "elem_type", "else", "elem", ".", "__class__", "if", ...
Loads/dumps variant type :param elem: :param elem_type: :param params: :param obj: :return:
[ "Loads", "/", "dumps", "variant", "type", ":", "param", "elem", ":", ":", "param", "elem_type", ":", ":", "param", "params", ":", ":", "param", "obj", ":", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrrpc.py#L1187-L1207
train
Load or dump a single Variant from the cache.