repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
mrallen1/pygett
pygett/base.py
Gett.get_shares_list
def get_shares_list(self, **kwargs): """ Gets *all* shares. Input: * ``skip`` the number of shares to skip (optional) * ``limit`` the maximum number of shares to return (optional) Output: * a list of :py:mod:`pygett.shares.GettShare` objects ...
python
def get_shares_list(self, **kwargs): """ Gets *all* shares. Input: * ``skip`` the number of shares to skip (optional) * ``limit`` the maximum number of shares to return (optional) Output: * a list of :py:mod:`pygett.shares.GettShare` objects ...
[ "def", "get_shares_list", "(", "self", ",", "*", "*", "kwargs", ")", ":", "response", "=", "self", ".", "_get_shares", "(", "*", "*", "kwargs", ")", "rv", "=", "list", "(", ")", "if", "response", ".", "http_status", "==", "200", ":", "for", "share", ...
Gets *all* shares. Input: * ``skip`` the number of shares to skip (optional) * ``limit`` the maximum number of shares to return (optional) Output: * a list of :py:mod:`pygett.shares.GettShare` objects Example:: shares_list = client.get_shares_l...
[ "Gets", "*", "all", "*", "shares", "." ]
train
https://github.com/mrallen1/pygett/blob/1e21f8674a3634a901af054226670174b5ce2d87/pygett/base.py#L89-L113
mrallen1/pygett
pygett/base.py
Gett.get_share
def get_share(self, sharename): """ Get a specific share. Does not require authentication. Input: * A sharename Output: * A :py:mod:`pygett.shares.GettShare` object Example:: share = client.get_share("4ddfds") """ response ...
python
def get_share(self, sharename): """ Get a specific share. Does not require authentication. Input: * A sharename Output: * A :py:mod:`pygett.shares.GettShare` object Example:: share = client.get_share("4ddfds") """ response ...
[ "def", "get_share", "(", "self", ",", "sharename", ")", ":", "response", "=", "GettRequest", "(", ")", ".", "get", "(", "\"/shares/%s\"", "%", "sharename", ")", "if", "response", ".", "http_status", "==", "200", ":", "return", "GettShare", "(", "self", "...
Get a specific share. Does not require authentication. Input: * A sharename Output: * A :py:mod:`pygett.shares.GettShare` object Example:: share = client.get_share("4ddfds")
[ "Get", "a", "specific", "share", ".", "Does", "not", "require", "authentication", "." ]
train
https://github.com/mrallen1/pygett/blob/1e21f8674a3634a901af054226670174b5ce2d87/pygett/base.py#L115-L133
mrallen1/pygett
pygett/base.py
Gett.get_file
def get_file(self, sharename, fileid): """ Get a specific file. Does not require authentication. Input: * A sharename * A fileid - must be an integer Output: * A :py:mod:`pygett.files.GettFile` object Example:: file = client.get...
python
def get_file(self, sharename, fileid): """ Get a specific file. Does not require authentication. Input: * A sharename * A fileid - must be an integer Output: * A :py:mod:`pygett.files.GettFile` object Example:: file = client.get...
[ "def", "get_file", "(", "self", ",", "sharename", ",", "fileid", ")", ":", "if", "not", "isinstance", "(", "fileid", ",", "int", ")", ":", "raise", "TypeError", "(", "\"'fileid' must be an integer\"", ")", "response", "=", "GettRequest", "(", ")", ".", "ge...
Get a specific file. Does not require authentication. Input: * A sharename * A fileid - must be an integer Output: * A :py:mod:`pygett.files.GettFile` object Example:: file = client.get_file("4ddfds", 0)
[ "Get", "a", "specific", "file", ".", "Does", "not", "require", "authentication", "." ]
train
https://github.com/mrallen1/pygett/blob/1e21f8674a3634a901af054226670174b5ce2d87/pygett/base.py#L135-L157
mrallen1/pygett
pygett/base.py
Gett.create_share
def create_share(self, **kwargs): """ Create a new share. Takes a keyword argument. Input: * ``title`` optional share title (optional) Output: * A :py:mod:`pygett.shares.GettShare` object Example:: new_share = client.create_share( title="Ex...
python
def create_share(self, **kwargs): """ Create a new share. Takes a keyword argument. Input: * ``title`` optional share title (optional) Output: * A :py:mod:`pygett.shares.GettShare` object Example:: new_share = client.create_share( title="Ex...
[ "def", "create_share", "(", "self", ",", "*", "*", "kwargs", ")", ":", "params", "=", "None", "if", "'title'", "in", "kwargs", ":", "params", "=", "{", "\"title\"", ":", "kwargs", "[", "'title'", "]", "}", "response", "=", "GettRequest", "(", ")", "....
Create a new share. Takes a keyword argument. Input: * ``title`` optional share title (optional) Output: * A :py:mod:`pygett.shares.GettShare` object Example:: new_share = client.create_share( title="Example Title" )
[ "Create", "a", "new", "share", ".", "Takes", "a", "keyword", "argument", "." ]
train
https://github.com/mrallen1/pygett/blob/1e21f8674a3634a901af054226670174b5ce2d87/pygett/base.py#L159-L181
mrallen1/pygett
pygett/base.py
Gett.upload_file
def upload_file(self, **kwargs): """ Upload a file to the Gett service. Takes keyword arguments. Input: * ``filename`` the filename to use in the Gett service (required) * ``data`` the file contents to store in the Gett service (required) - must be a string *...
python
def upload_file(self, **kwargs): """ Upload a file to the Gett service. Takes keyword arguments. Input: * ``filename`` the filename to use in the Gett service (required) * ``data`` the file contents to store in the Gett service (required) - must be a string *...
[ "def", "upload_file", "(", "self", ",", "*", "*", "kwargs", ")", ":", "params", "=", "None", "if", "'filename'", "not", "in", "kwargs", ":", "raise", "AttributeError", "(", "\"Parameter 'filename' must be given\"", ")", "else", ":", "params", "=", "{", "\"fi...
Upload a file to the Gett service. Takes keyword arguments. Input: * ``filename`` the filename to use in the Gett service (required) * ``data`` the file contents to store in the Gett service (required) - must be a string * ``sharename`` the name of the share in which to stor...
[ "Upload", "a", "file", "to", "the", "Gett", "service", ".", "Takes", "keyword", "arguments", "." ]
train
https://github.com/mrallen1/pygett/blob/1e21f8674a3634a901af054226670174b5ce2d87/pygett/base.py#L183-L230
exekias/droplet
droplet/samba/db.py
samdb_connect
def samdb_connect(): """ Open and return a SamDB connection """ with root(): lp = samba.param.LoadParm() lp.load("/etc/samba/smb.conf") creds = Credentials() creds.guess(lp) session = system_session() samdb = SamDB("/var/lib/samba/private/sam.ldb", session_i...
python
def samdb_connect(): """ Open and return a SamDB connection """ with root(): lp = samba.param.LoadParm() lp.load("/etc/samba/smb.conf") creds = Credentials() creds.guess(lp) session = system_session() samdb = SamDB("/var/lib/samba/private/sam.ldb", session_i...
[ "def", "samdb_connect", "(", ")", ":", "with", "root", "(", ")", ":", "lp", "=", "samba", ".", "param", ".", "LoadParm", "(", ")", "lp", ".", "load", "(", "\"/etc/samba/smb.conf\"", ")", "creds", "=", "Credentials", "(", ")", "creds", ".", "guess", "...
Open and return a SamDB connection
[ "Open", "and", "return", "a", "SamDB", "connection" ]
train
https://github.com/exekias/droplet/blob/aeac573a2c1c4b774e99d5414a1c79b1bb734941/droplet/samba/db.py#L15-L29
exekias/droplet
droplet/samba/db.py
load_schema
def load_schema(ldif_file): """ Load a schema from the given file into the SamDB """ samdb = samdb_connect() dn = samdb.domain_dn() samdb.transaction_start() try: setup_add_ldif(samdb, ldif_file, { "DOMAINDN": dn, }) except: samdb.transaction_cancel()...
python
def load_schema(ldif_file): """ Load a schema from the given file into the SamDB """ samdb = samdb_connect() dn = samdb.domain_dn() samdb.transaction_start() try: setup_add_ldif(samdb, ldif_file, { "DOMAINDN": dn, }) except: samdb.transaction_cancel()...
[ "def", "load_schema", "(", "ldif_file", ")", ":", "samdb", "=", "samdb_connect", "(", ")", "dn", "=", "samdb", ".", "domain_dn", "(", ")", "samdb", ".", "transaction_start", "(", ")", "try", ":", "setup_add_ldif", "(", "samdb", ",", "ldif_file", ",", "{"...
Load a schema from the given file into the SamDB
[ "Load", "a", "schema", "from", "the", "given", "file", "into", "the", "SamDB" ]
train
https://github.com/exekias/droplet/blob/aeac573a2c1c4b774e99d5414a1c79b1bb734941/droplet/samba/db.py#L32-L48
echinopsii/net.echinopsii.ariane.community.cli.python3
ariane_clip3/rest/driver.py
Requester.call
def call(self, my_args=None): """ call the remote service. Wait the answer (blocking call) :param my_args: dict like {http_operation, operation_path, parameters} :return: response """ LOGGER.debug("rest.Requester.call") if my_args is None: raise except...
python
def call(self, my_args=None): """ call the remote service. Wait the answer (blocking call) :param my_args: dict like {http_operation, operation_path, parameters} :return: response """ LOGGER.debug("rest.Requester.call") if my_args is None: raise except...
[ "def", "call", "(", "self", ",", "my_args", "=", "None", ")", ":", "LOGGER", ".", "debug", "(", "\"rest.Requester.call\"", ")", "if", "my_args", "is", "None", ":", "raise", "exceptions", ".", "ArianeConfError", "(", "'requester call arguments'", ")", "if", "...
call the remote service. Wait the answer (blocking call) :param my_args: dict like {http_operation, operation_path, parameters} :return: response
[ "call", "the", "remote", "service", ".", "Wait", "the", "answer", "(", "blocking", "call", ")", ":", "param", "my_args", ":", "dict", "like", "{", "http_operation", "operation_path", "parameters", "}", ":", "return", ":", "response" ]
train
https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/rest/driver.py#L54-L103
echinopsii/net.echinopsii.ariane.community.cli.python3
ariane_clip3/rest/driver.py
Driver.start
def start(self): """ instanciate request session with authent :return: """ LOGGER.debug("rest.Driver.start") self.session = requests.Session() self.session.auth = (self.user, self.password)
python
def start(self): """ instanciate request session with authent :return: """ LOGGER.debug("rest.Driver.start") self.session = requests.Session() self.session.auth = (self.user, self.password)
[ "def", "start", "(", "self", ")", ":", "LOGGER", ".", "debug", "(", "\"rest.Driver.start\"", ")", "self", ".", "session", "=", "requests", ".", "Session", "(", ")", "self", ".", "session", ".", "auth", "=", "(", "self", ".", "user", ",", "self", ".",...
instanciate request session with authent :return:
[ "instanciate", "request", "session", "with", "authent", ":", "return", ":" ]
train
https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/rest/driver.py#L134-L141
echinopsii/net.echinopsii.ariane.community.cli.python3
ariane_clip3/rest/driver.py
Driver.make_requester
def make_requester(self, my_args=None): """ make a new requester :param my_args: some dict not None dict :return: instanciated Requester """ LOGGER.debug("rest.Driver.make_requester") if my_args is None: raise exceptions.ArianeConfError('requester fact...
python
def make_requester(self, my_args=None): """ make a new requester :param my_args: some dict not None dict :return: instanciated Requester """ LOGGER.debug("rest.Driver.make_requester") if my_args is None: raise exceptions.ArianeConfError('requester fact...
[ "def", "make_requester", "(", "self", ",", "my_args", "=", "None", ")", ":", "LOGGER", ".", "debug", "(", "\"rest.Driver.make_requester\"", ")", "if", "my_args", "is", "None", ":", "raise", "exceptions", ".", "ArianeConfError", "(", "'requester factory arguments'"...
make a new requester :param my_args: some dict not None dict :return: instanciated Requester
[ "make", "a", "new", "requester", ":", "param", "my_args", ":", "some", "dict", "not", "None", "dict", ":", "return", ":", "instanciated", "Requester" ]
train
https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/rest/driver.py#L159-L171
refinery29/chassis
chassis/util/tree.py
DependencyNode.add_child
def add_child(self, child): """ Add a child node """ if not isinstance(child, DependencyNode): raise TypeError('"child" must be a DependencyNode') self._children.append(child)
python
def add_child(self, child): """ Add a child node """ if not isinstance(child, DependencyNode): raise TypeError('"child" must be a DependencyNode') self._children.append(child)
[ "def", "add_child", "(", "self", ",", "child", ")", ":", "if", "not", "isinstance", "(", "child", ",", "DependencyNode", ")", ":", "raise", "TypeError", "(", "'\"child\" must be a DependencyNode'", ")", "self", ".", "_children", ".", "append", "(", "child", ...
Add a child node
[ "Add", "a", "child", "node" ]
train
https://github.com/refinery29/chassis/blob/1238d5214cbb8f3e1fe7c0dc2fa72f45bf085192/chassis/util/tree.py#L37-L41
refinery29/chassis
chassis/util/tree.py
DependencyNode.add_children
def add_children(self, children): """ Add multiple children """ if not isinstance(children, list): raise TypeError('"children" must be a list') for child in children: self.add_child(child)
python
def add_children(self, children): """ Add multiple children """ if not isinstance(children, list): raise TypeError('"children" must be a list') for child in children: self.add_child(child)
[ "def", "add_children", "(", "self", ",", "children", ")", ":", "if", "not", "isinstance", "(", "children", ",", "list", ")", ":", "raise", "TypeError", "(", "'\"children\" must be a list'", ")", "for", "child", "in", "children", ":", "self", ".", "add_child"...
Add multiple children
[ "Add", "multiple", "children" ]
train
https://github.com/refinery29/chassis/blob/1238d5214cbb8f3e1fe7c0dc2fa72f45bf085192/chassis/util/tree.py#L43-L48
refinery29/chassis
chassis/util/tree.py
DependencyTree.head_values
def head_values(self): """ Return set of the head values """ values = set() for head in self._heads: values.add(head.value) return values
python
def head_values(self): """ Return set of the head values """ values = set() for head in self._heads: values.add(head.value) return values
[ "def", "head_values", "(", "self", ")", ":", "values", "=", "set", "(", ")", "for", "head", "in", "self", ".", "_heads", ":", "values", ".", "add", "(", "head", ".", "value", ")", "return", "values" ]
Return set of the head values
[ "Return", "set", "of", "the", "head", "values" ]
train
https://github.com/refinery29/chassis/blob/1238d5214cbb8f3e1fe7c0dc2fa72f45bf085192/chassis/util/tree.py#L77-L82
refinery29/chassis
chassis/util/tree.py
DependencyTree.add_head
def add_head(self, head): """ Add head Node """ if not isinstance(head, DependencyNode): raise TypeError('"head" must be a DependencyNode') self._heads.append(head)
python
def add_head(self, head): """ Add head Node """ if not isinstance(head, DependencyNode): raise TypeError('"head" must be a DependencyNode') self._heads.append(head)
[ "def", "add_head", "(", "self", ",", "head", ")", ":", "if", "not", "isinstance", "(", "head", ",", "DependencyNode", ")", ":", "raise", "TypeError", "(", "'\"head\" must be a DependencyNode'", ")", "self", ".", "_heads", ".", "append", "(", "head", ")" ]
Add head Node
[ "Add", "head", "Node" ]
train
https://github.com/refinery29/chassis/blob/1238d5214cbb8f3e1fe7c0dc2fa72f45bf085192/chassis/util/tree.py#L95-L99
cirruscluster/cirruscluster
cirruscluster/ext/ansible/runner/action_plugins/script.py
ActionModule.run
def run(self, conn, tmp, module_name, module_args, inject): ''' handler for file transfer operations ''' tokens = shlex.split(module_args) source = tokens[0] # FIXME: error handling args = " ".join(tokens[1:]) source = utils.template(self.runner.basedir, source, in...
python
def run(self, conn, tmp, module_name, module_args, inject): ''' handler for file transfer operations ''' tokens = shlex.split(module_args) source = tokens[0] # FIXME: error handling args = " ".join(tokens[1:]) source = utils.template(self.runner.basedir, source, in...
[ "def", "run", "(", "self", ",", "conn", ",", "tmp", ",", "module_name", ",", "module_args", ",", "inject", ")", ":", "tokens", "=", "shlex", ".", "split", "(", "module_args", ")", "source", "=", "tokens", "[", "0", "]", "# FIXME: error handling", "args",...
handler for file transfer operations
[ "handler", "for", "file", "transfer", "operations" ]
train
https://github.com/cirruscluster/cirruscluster/blob/977409929dd81322d886425cdced10608117d5d7/cirruscluster/ext/ansible/runner/action_plugins/script.py#L31-L65
qzmfranklin/easyshell
easyshell/main.py
update_parser
def update_parser(parser): """Update the parser object for the shell. Arguments: parser: An instance of argparse.ArgumentParser. """ def __stdin(s): if s is None: return None if s == '-': return sys.stdin return open(s, 'r', encoding = 'utf8') ...
python
def update_parser(parser): """Update the parser object for the shell. Arguments: parser: An instance of argparse.ArgumentParser. """ def __stdin(s): if s is None: return None if s == '-': return sys.stdin return open(s, 'r', encoding = 'utf8') ...
[ "def", "update_parser", "(", "parser", ")", ":", "def", "__stdin", "(", "s", ")", ":", "if", "s", "is", "None", ":", "return", "None", "if", "s", "==", "'-'", ":", "return", "sys", ".", "stdin", "return", "open", "(", "s", ",", "'r'", ",", "encod...
Update the parser object for the shell. Arguments: parser: An instance of argparse.ArgumentParser.
[ "Update", "the", "parser", "object", "for", "the", "shell", "." ]
train
https://github.com/qzmfranklin/easyshell/blob/00c2e90e7767d32e7e127fc8c6875845aa308295/easyshell/main.py#L3-L30
jmgilman/Neolib
neolib/pyamf/util/imports.py
_init
def _init(): """ Internal function to install the module finder. """ global finder if finder is None: finder = ModuleFinder() if finder not in sys.meta_path: sys.meta_path.insert(0, finder)
python
def _init(): """ Internal function to install the module finder. """ global finder if finder is None: finder = ModuleFinder() if finder not in sys.meta_path: sys.meta_path.insert(0, finder)
[ "def", "_init", "(", ")", ":", "global", "finder", "if", "finder", "is", "None", ":", "finder", "=", "ModuleFinder", "(", ")", "if", "finder", "not", "in", "sys", ".", "meta_path", ":", "sys", ".", "meta_path", ".", "insert", "(", "0", ",", "finder",...
Internal function to install the module finder.
[ "Internal", "function", "to", "install", "the", "module", "finder", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/util/imports.py#L123-L133
jmgilman/Neolib
neolib/pyamf/util/imports.py
ModuleFinder.find_module
def find_module(self, name, path=None): """ Called when an import is made. If there are hooks waiting for this module to be imported then we stop the normal import process and manually load the module. @param name: The name of the module being imported. @param path The r...
python
def find_module(self, name, path=None): """ Called when an import is made. If there are hooks waiting for this module to be imported then we stop the normal import process and manually load the module. @param name: The name of the module being imported. @param path The r...
[ "def", "find_module", "(", "self", ",", "name", ",", "path", "=", "None", ")", ":", "if", "name", "in", "self", ".", "loaded_modules", ":", "return", "None", "hooks", "=", "self", ".", "post_load_hooks", ".", "get", "(", "name", ",", "None", ")", "if...
Called when an import is made. If there are hooks waiting for this module to be imported then we stop the normal import process and manually load the module. @param name: The name of the module being imported. @param path The root path of the module (if a package). We ignore this. ...
[ "Called", "when", "an", "import", "is", "made", ".", "If", "there", "are", "hooks", "waiting", "for", "this", "module", "to", "be", "imported", "then", "we", "stop", "the", "normal", "import", "process", "and", "manually", "load", "the", "module", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/util/imports.py#L52-L70
jmgilman/Neolib
neolib/pyamf/util/imports.py
ModuleFinder.load_module
def load_module(self, name): """ If we get this far, then there are hooks waiting to be called on import of this module. We manually load the module and then run the hooks. @param name: The name of the module to import. """ self.loaded_modules.append(name) ...
python
def load_module(self, name): """ If we get this far, then there are hooks waiting to be called on import of this module. We manually load the module and then run the hooks. @param name: The name of the module to import. """ self.loaded_modules.append(name) ...
[ "def", "load_module", "(", "self", ",", "name", ")", ":", "self", ".", "loaded_modules", ".", "append", "(", "name", ")", "try", ":", "__import__", "(", "name", ",", "{", "}", ",", "{", "}", ",", "[", "]", ")", "mod", "=", "sys", ".", "modules", ...
If we get this far, then there are hooks waiting to be called on import of this module. We manually load the module and then run the hooks. @param name: The name of the module to import.
[ "If", "we", "get", "this", "far", "then", "there", "are", "hooks", "waiting", "to", "be", "called", "on", "import", "of", "this", "module", ".", "We", "manually", "load", "the", "module", "and", "then", "run", "the", "hooks", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/util/imports.py#L72-L92
jmgilman/Neolib
neolib/pyamf/util/imports.py
ModuleFinder._run_hooks
def _run_hooks(self, name, module): """ Run all hooks for a module. """ hooks = self.post_load_hooks.pop(name, []) for hook in hooks: hook(module)
python
def _run_hooks(self, name, module): """ Run all hooks for a module. """ hooks = self.post_load_hooks.pop(name, []) for hook in hooks: hook(module)
[ "def", "_run_hooks", "(", "self", ",", "name", ",", "module", ")", ":", "hooks", "=", "self", ".", "post_load_hooks", ".", "pop", "(", "name", ",", "[", "]", ")", "for", "hook", "in", "hooks", ":", "hook", "(", "module", ")" ]
Run all hooks for a module.
[ "Run", "all", "hooks", "for", "a", "module", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/util/imports.py#L107-L114
pjuren/pyokit
src/pyokit/scripts/index.py
index_repeatmasker_alignment_by_id
def index_repeatmasker_alignment_by_id(fh, out_fh, vebrose=False): """Build an index for a repeat-masker alignment file by repeat-masker ID.""" def extract_UID(rm_alignment): return rm_alignment.meta[multipleAlignment.RM_ID_KEY] index = IndexedFile(fh, repeat_masker_alignment_iterator, extract_UID) index.w...
python
def index_repeatmasker_alignment_by_id(fh, out_fh, vebrose=False): """Build an index for a repeat-masker alignment file by repeat-masker ID.""" def extract_UID(rm_alignment): return rm_alignment.meta[multipleAlignment.RM_ID_KEY] index = IndexedFile(fh, repeat_masker_alignment_iterator, extract_UID) index.w...
[ "def", "index_repeatmasker_alignment_by_id", "(", "fh", ",", "out_fh", ",", "vebrose", "=", "False", ")", ":", "def", "extract_UID", "(", "rm_alignment", ")", ":", "return", "rm_alignment", ".", "meta", "[", "multipleAlignment", ".", "RM_ID_KEY", "]", "index", ...
Build an index for a repeat-masker alignment file by repeat-masker ID.
[ "Build", "an", "index", "for", "a", "repeat", "-", "masker", "alignment", "file", "by", "repeat", "-", "masker", "ID", "." ]
train
https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/scripts/index.py#L76-L82
pjuren/pyokit
src/pyokit/scripts/index.py
index_genome_alignment_by_locus
def index_genome_alignment_by_locus(fh, out_fh, verbose=False): """Build an index for a genome alig. using coords in ref genome as keys.""" bound_iter = functools.partial(genome_alignment_iterator, reference_species="hg19", index_friendly=True) hash_func = JustInTimeGenomeAlignmen...
python
def index_genome_alignment_by_locus(fh, out_fh, verbose=False): """Build an index for a genome alig. using coords in ref genome as keys.""" bound_iter = functools.partial(genome_alignment_iterator, reference_species="hg19", index_friendly=True) hash_func = JustInTimeGenomeAlignmen...
[ "def", "index_genome_alignment_by_locus", "(", "fh", ",", "out_fh", ",", "verbose", "=", "False", ")", ":", "bound_iter", "=", "functools", ".", "partial", "(", "genome_alignment_iterator", ",", "reference_species", "=", "\"hg19\"", ",", "index_friendly", "=", "Tr...
Build an index for a genome alig. using coords in ref genome as keys.
[ "Build", "an", "index", "for", "a", "genome", "alig", ".", "using", "coords", "in", "ref", "genome", "as", "keys", "." ]
train
https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/scripts/index.py#L85-L91
pjuren/pyokit
src/pyokit/scripts/index.py
lookup_genome_alignment_index
def lookup_genome_alignment_index(index_fh, indexed_fh, out_fh=sys.stdout, key=None, verbose=False): """Load a GA index and its indexed file and extract one or more blocks. :param index_fh: the index file to load. Can be a filename or a stream-like object. ...
python
def lookup_genome_alignment_index(index_fh, indexed_fh, out_fh=sys.stdout, key=None, verbose=False): """Load a GA index and its indexed file and extract one or more blocks. :param index_fh: the index file to load. Can be a filename or a stream-like object. ...
[ "def", "lookup_genome_alignment_index", "(", "index_fh", ",", "indexed_fh", ",", "out_fh", "=", "sys", ".", "stdout", ",", "key", "=", "None", ",", "verbose", "=", "False", ")", ":", "# load the genome alignment as a JIT object", "bound_iter", "=", "functools", "....
Load a GA index and its indexed file and extract one or more blocks. :param index_fh: the index file to load. Can be a filename or a stream-like object. :param indexed_fh: the file that the index was built for, :param key: A single key, iterable of keys, or None. This key will be ...
[ "Load", "a", "GA", "index", "and", "its", "indexed", "file", "and", "extract", "one", "or", "more", "blocks", "." ]
train
https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/scripts/index.py#L115-L146
pjuren/pyokit
src/pyokit/scripts/index.py
getUI_build_index
def getUI_build_index(prog_name, args): """ build and return a UI object for the 'build' option. :param args: raw arguments to parse """ programName = prog_name long_description = "Build an index for one or more files." short_description = long_description ui = CLI(programName, short_description, long...
python
def getUI_build_index(prog_name, args): """ build and return a UI object for the 'build' option. :param args: raw arguments to parse """ programName = prog_name long_description = "Build an index for one or more files." short_description = long_description ui = CLI(programName, short_description, long...
[ "def", "getUI_build_index", "(", "prog_name", ",", "args", ")", ":", "programName", "=", "prog_name", "long_description", "=", "\"Build an index for one or more files.\"", "short_description", "=", "long_description", "ui", "=", "CLI", "(", "programName", ",", "short_de...
build and return a UI object for the 'build' option. :param args: raw arguments to parse
[ "build", "and", "return", "a", "UI", "object", "for", "the", "build", "option", "." ]
train
https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/scripts/index.py#L170-L203
pjuren/pyokit
src/pyokit/scripts/index.py
__get_indexer
def __get_indexer(in_fns, selected_type=None): """Determine which indexer to use based on input files and type option.""" indexer = None if selected_type is not None: indexer = get_indexer_by_filetype(selected_type) else: if len(in_fns) == 0: raise IndexError("reading from stdin, unable to guess i...
python
def __get_indexer(in_fns, selected_type=None): """Determine which indexer to use based on input files and type option.""" indexer = None if selected_type is not None: indexer = get_indexer_by_filetype(selected_type) else: if len(in_fns) == 0: raise IndexError("reading from stdin, unable to guess i...
[ "def", "__get_indexer", "(", "in_fns", ",", "selected_type", "=", "None", ")", ":", "indexer", "=", "None", "if", "selected_type", "is", "not", "None", ":", "indexer", "=", "get_indexer_by_filetype", "(", "selected_type", ")", "else", ":", "if", "len", "(", ...
Determine which indexer to use based on input files and type option.
[ "Determine", "which", "indexer", "to", "use", "based", "on", "input", "files", "and", "type", "option", "." ]
train
https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/scripts/index.py#L250-L268
pjuren/pyokit
src/pyokit/scripts/index.py
__get_lookup
def __get_lookup(in_fn, selected_type=None): """Determine which lookup func to use based on inpt files and type option.""" lookup_func = None if selected_type is not None: lookup_func = get_lookup_by_filetype(selected_type) else: extension = os.path.splitext(in_fn)[1] lookup_func = get_lookup_by_fil...
python
def __get_lookup(in_fn, selected_type=None): """Determine which lookup func to use based on inpt files and type option.""" lookup_func = None if selected_type is not None: lookup_func = get_lookup_by_filetype(selected_type) else: extension = os.path.splitext(in_fn)[1] lookup_func = get_lookup_by_fil...
[ "def", "__get_lookup", "(", "in_fn", ",", "selected_type", "=", "None", ")", ":", "lookup_func", "=", "None", "if", "selected_type", "is", "not", "None", ":", "lookup_func", "=", "get_lookup_by_filetype", "(", "selected_type", ")", "else", ":", "extension", "=...
Determine which lookup func to use based on inpt files and type option.
[ "Determine", "which", "lookup", "func", "to", "use", "based", "on", "inpt", "files", "and", "type", "option", "." ]
train
https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/scripts/index.py#L271-L280
pjuren/pyokit
src/pyokit/scripts/index.py
main
def main(args=[], prog_name=sys.argv[0]): """Figure out which of the two options was used (build, get) and dispatch. :param args: the arguments for this script, as a list of string. Should already have had the script name stripped, so we expect the first item in this li...
python
def main(args=[], prog_name=sys.argv[0]): """Figure out which of the two options was used (build, get) and dispatch. :param args: the arguments for this script, as a list of string. Should already have had the script name stripped, so we expect the first item in this li...
[ "def", "main", "(", "args", "=", "[", "]", ",", "prog_name", "=", "sys", ".", "argv", "[", "0", "]", ")", ":", "helpStr", "=", "\"Build indexes and use them to extract elements from \\n\"", "+", "\"indexed files on-demand. \\n\""...
Figure out which of the two options was used (build, get) and dispatch. :param args: the arguments for this script, as a list of string. Should already have had the script name stripped, so we expect the first item in this list to specify the mode ('build' an ...
[ "Figure", "out", "which", "of", "the", "two", "options", "was", "used", "(", "build", "get", ")", "and", "dispatch", "." ]
train
https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/scripts/index.py#L289-L339
pjuren/pyokit
src/pyokit/scripts/index.py
main_lookup_index
def main_lookup_index(args=[], prog_name=sys.argv[0]): """ main entry point for the index script. :param args: the arguments for this script, as a list of string. Should already have had the script name stripped. That is, if there are no args provided, this should be ...
python
def main_lookup_index(args=[], prog_name=sys.argv[0]): """ main entry point for the index script. :param args: the arguments for this script, as a list of string. Should already have had the script name stripped. That is, if there are no args provided, this should be ...
[ "def", "main_lookup_index", "(", "args", "=", "[", "]", ",", "prog_name", "=", "sys", ".", "argv", "[", "0", "]", ")", ":", "# get options and arguments", "ui", "=", "getUI_lookup_index", "(", "prog_name", ",", "args", ")", "# just run unit tests", "if", "ui...
main entry point for the index script. :param args: the arguments for this script, as a list of string. Should already have had the script name stripped. That is, if there are no args provided, this should be an empty list. :param prog_name: the name of the script; take...
[ "main", "entry", "point", "for", "the", "index", "script", "." ]
train
https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/scripts/index.py#L342-L384
pjuren/pyokit
src/pyokit/scripts/index.py
main_build_index
def main_build_index(args=[], prog_name=sys.argv[0]): """ main entry point for the index script. :param args: the arguments for this script, as a list of string. Should already have had the script name stripped. That is, if there are no args provided, this should be a...
python
def main_build_index(args=[], prog_name=sys.argv[0]): """ main entry point for the index script. :param args: the arguments for this script, as a list of string. Should already have had the script name stripped. That is, if there are no args provided, this should be a...
[ "def", "main_build_index", "(", "args", "=", "[", "]", ",", "prog_name", "=", "sys", ".", "argv", "[", "0", "]", ")", ":", "# get options and arguments", "ui", "=", "getUI_build_index", "(", "prog_name", ",", "args", ")", "# just run unit tests", "if", "ui",...
main entry point for the index script. :param args: the arguments for this script, as a list of string. Should already have had the script name stripped. That is, if there are no args provided, this should be an empty list. :param prog_name: the name of the script; take...
[ "main", "entry", "point", "for", "the", "index", "script", "." ]
train
https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/scripts/index.py#L387-L432
tducret/precisionmapper-python
python-flask/swagger_server/controllers/user_controller.py
list_surveys
def list_surveys(): # noqa: E501 """list the surveys available List the surveys available # noqa: E501 :rtype: List[Survey] """ pm = PrecisionMapper(login=_LOGIN, password=_PASSWORD) pm.sign_in() surveys = pm.get_surveys() shared_surveys = pm.get_shared_surveys() survey_list = [...
python
def list_surveys(): # noqa: E501 """list the surveys available List the surveys available # noqa: E501 :rtype: List[Survey] """ pm = PrecisionMapper(login=_LOGIN, password=_PASSWORD) pm.sign_in() surveys = pm.get_surveys() shared_surveys = pm.get_shared_surveys() survey_list = [...
[ "def", "list_surveys", "(", ")", ":", "# noqa: E501", "pm", "=", "PrecisionMapper", "(", "login", "=", "_LOGIN", ",", "password", "=", "_PASSWORD", ")", "pm", ".", "sign_in", "(", ")", "surveys", "=", "pm", ".", "get_surveys", "(", ")", "shared_surveys", ...
list the surveys available List the surveys available # noqa: E501 :rtype: List[Survey]
[ "list", "the", "surveys", "available" ]
train
https://github.com/tducret/precisionmapper-python/blob/462dcc5bccf6edec780b8b7bc42e8c1d717db942/python-flask/swagger_server/controllers/user_controller.py#L15-L35
echinopsii/net.echinopsii.ariane.community.cli.python3
ariane_clip3/zeromq/driver.py
Publisher.call
def call(self, my_args=None): """ publish the message in the topic :param my_args: dict like {msg: 'msg'} :return: nothing """ LOGGER.debug("zeromq.Publisher.call") if my_args is None: raise exceptions.ArianeConfError("publisher call arguments") ...
python
def call(self, my_args=None): """ publish the message in the topic :param my_args: dict like {msg: 'msg'} :return: nothing """ LOGGER.debug("zeromq.Publisher.call") if my_args is None: raise exceptions.ArianeConfError("publisher call arguments") ...
[ "def", "call", "(", "self", ",", "my_args", "=", "None", ")", ":", "LOGGER", ".", "debug", "(", "\"zeromq.Publisher.call\"", ")", "if", "my_args", "is", "None", ":", "raise", "exceptions", ".", "ArianeConfError", "(", "\"publisher call arguments\"", ")", "if",...
publish the message in the topic :param my_args: dict like {msg: 'msg'} :return: nothing
[ "publish", "the", "message", "in", "the", "topic", ":", "param", "my_args", ":", "dict", "like", "{", "msg", ":", "msg", "}", ":", "return", ":", "nothing" ]
train
https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/zeromq/driver.py#L49-L62
echinopsii/net.echinopsii.ariane.community.cli.python3
ariane_clip3/zeromq/driver.py
Publisher.on_start
def on_start(self): """ start publisher """ LOGGER.debug("zeromq.Publisher.on_start") try: self.zmqsocket.bind(self.zmqbind_url) except Exception as e: LOGGER.error("zeromq.Publisher.on_start - error while binding publisher ! " + e.__cause__) ...
python
def on_start(self): """ start publisher """ LOGGER.debug("zeromq.Publisher.on_start") try: self.zmqsocket.bind(self.zmqbind_url) except Exception as e: LOGGER.error("zeromq.Publisher.on_start - error while binding publisher ! " + e.__cause__) ...
[ "def", "on_start", "(", "self", ")", ":", "LOGGER", ".", "debug", "(", "\"zeromq.Publisher.on_start\"", ")", "try", ":", "self", ".", "zmqsocket", ".", "bind", "(", "self", ".", "zmqbind_url", ")", "except", "Exception", "as", "e", ":", "LOGGER", ".", "e...
start publisher
[ "start", "publisher" ]
train
https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/zeromq/driver.py#L64-L73
echinopsii/net.echinopsii.ariane.community.cli.python3
ariane_clip3/zeromq/driver.py
Publisher.on_stop
def on_stop(self): """ stop publisher """ LOGGER.debug("zeromq.Publisher.on_stop") self.zmqsocket.close() self.zmqcontext.destroy()
python
def on_stop(self): """ stop publisher """ LOGGER.debug("zeromq.Publisher.on_stop") self.zmqsocket.close() self.zmqcontext.destroy()
[ "def", "on_stop", "(", "self", ")", ":", "LOGGER", ".", "debug", "(", "\"zeromq.Publisher.on_stop\"", ")", "self", ".", "zmqsocket", ".", "close", "(", ")", "self", ".", "zmqcontext", ".", "destroy", "(", ")" ]
stop publisher
[ "stop", "publisher" ]
train
https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/zeromq/driver.py#L75-L81
echinopsii/net.echinopsii.ariane.community.cli.python3
ariane_clip3/zeromq/driver.py
Subscriber.run
def run(self): """ consume message from channel on the consuming thread. """ LOGGER.debug("zeromq.Subscriber.run") self.running = True self.is_started = True while self.running: msg = None try: msg = self.zmqsocket.recv_stri...
python
def run(self): """ consume message from channel on the consuming thread. """ LOGGER.debug("zeromq.Subscriber.run") self.running = True self.is_started = True while self.running: msg = None try: msg = self.zmqsocket.recv_stri...
[ "def", "run", "(", "self", ")", ":", "LOGGER", ".", "debug", "(", "\"zeromq.Subscriber.run\"", ")", "self", ".", "running", "=", "True", "self", ".", "is_started", "=", "True", "while", "self", ".", "running", ":", "msg", "=", "None", "try", ":", "msg"...
consume message from channel on the consuming thread.
[ "consume", "message", "from", "channel", "on", "the", "consuming", "thread", "." ]
train
https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/zeromq/driver.py#L126-L146
echinopsii/net.echinopsii.ariane.community.cli.python3
ariane_clip3/zeromq/driver.py
Subscriber.on_start
def on_start(self): """ start subscriber """ LOGGER.debug("zeromq.Subscriber.on_start") try: self.zmqsocket.connect(self.zmqbind_url) self.zmqsocket.setsockopt_string(zmq.SUBSCRIBE, self.zmqtopic) except Exception as e: LOGGER.error("er...
python
def on_start(self): """ start subscriber """ LOGGER.debug("zeromq.Subscriber.on_start") try: self.zmqsocket.connect(self.zmqbind_url) self.zmqsocket.setsockopt_string(zmq.SUBSCRIBE, self.zmqtopic) except Exception as e: LOGGER.error("er...
[ "def", "on_start", "(", "self", ")", ":", "LOGGER", ".", "debug", "(", "\"zeromq.Subscriber.on_start\"", ")", "try", ":", "self", ".", "zmqsocket", ".", "connect", "(", "self", ".", "zmqbind_url", ")", "self", ".", "zmqsocket", ".", "setsockopt_string", "(",...
start subscriber
[ "start", "subscriber" ]
train
https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/zeromq/driver.py#L148-L160
echinopsii/net.echinopsii.ariane.community.cli.python3
ariane_clip3/zeromq/driver.py
Subscriber.on_stop
def on_stop(self): """ stop subscriber """ LOGGER.debug("zeromq.Subscriber.on_stop") self.running = False while self.is_started: time.sleep(0.1) self.zmqsocket.close() self.zmqcontext.destroy()
python
def on_stop(self): """ stop subscriber """ LOGGER.debug("zeromq.Subscriber.on_stop") self.running = False while self.is_started: time.sleep(0.1) self.zmqsocket.close() self.zmqcontext.destroy()
[ "def", "on_stop", "(", "self", ")", ":", "LOGGER", ".", "debug", "(", "\"zeromq.Subscriber.on_stop\"", ")", "self", ".", "running", "=", "False", "while", "self", ".", "is_started", ":", "time", ".", "sleep", "(", "0.1", ")", "self", ".", "zmqsocket", "....
stop subscriber
[ "stop", "subscriber" ]
train
https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/zeromq/driver.py#L162-L171
echinopsii/net.echinopsii.ariane.community.cli.python3
ariane_clip3/zeromq/driver.py
Driver.stop
def stop(self): """ Stop ZMQ tools. :return: self """ LOGGER.debug("zeromq.Driver.stop") for publisher in self.publishers_registry: publisher.stop() self.publishers_registry.clear() for subscriber in self.subscribers_registry: if su...
python
def stop(self): """ Stop ZMQ tools. :return: self """ LOGGER.debug("zeromq.Driver.stop") for publisher in self.publishers_registry: publisher.stop() self.publishers_registry.clear() for subscriber in self.subscribers_registry: if su...
[ "def", "stop", "(", "self", ")", ":", "LOGGER", ".", "debug", "(", "\"zeromq.Driver.stop\"", ")", "for", "publisher", "in", "self", ".", "publishers_registry", ":", "publisher", ".", "stop", "(", ")", "self", ".", "publishers_registry", ".", "clear", "(", ...
Stop ZMQ tools. :return: self
[ "Stop", "ZMQ", "tools", ".", ":", "return", ":", "self" ]
train
https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/zeromq/driver.py#L237-L251
echinopsii/net.echinopsii.ariane.community.cli.python3
ariane_clip3/zeromq/driver.py
Driver.make_requester
def make_requester(self, my_args=None): """ not implemented :return: """ LOGGER.debug("zeromq.Driver.make_requester") raise exceptions.ArianeNotImplemented(self.__class__.__name__ + ".make_requester")
python
def make_requester(self, my_args=None): """ not implemented :return: """ LOGGER.debug("zeromq.Driver.make_requester") raise exceptions.ArianeNotImplemented(self.__class__.__name__ + ".make_requester")
[ "def", "make_requester", "(", "self", ",", "my_args", "=", "None", ")", ":", "LOGGER", ".", "debug", "(", "\"zeromq.Driver.make_requester\"", ")", "raise", "exceptions", ".", "ArianeNotImplemented", "(", "self", ".", "__class__", ".", "__name__", "+", "\".make_r...
not implemented :return:
[ "not", "implemented", ":", "return", ":" ]
train
https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/zeromq/driver.py#L261-L267
echinopsii/net.echinopsii.ariane.community.cli.python3
ariane_clip3/zeromq/driver.py
Driver.make_publisher
def make_publisher(self): """ not implemented :return: """ LOGGER.debug("zeromq.Driver.make_publisher") if not self.configuration_OK or self.connection_args is None: raise exceptions.ArianeConfError('zeromq connection arguments') publisher = Publisher....
python
def make_publisher(self): """ not implemented :return: """ LOGGER.debug("zeromq.Driver.make_publisher") if not self.configuration_OK or self.connection_args is None: raise exceptions.ArianeConfError('zeromq connection arguments') publisher = Publisher....
[ "def", "make_publisher", "(", "self", ")", ":", "LOGGER", ".", "debug", "(", "\"zeromq.Driver.make_publisher\"", ")", "if", "not", "self", ".", "configuration_OK", "or", "self", ".", "connection_args", "is", "None", ":", "raise", "exceptions", ".", "ArianeConfEr...
not implemented :return:
[ "not", "implemented", ":", "return", ":" ]
train
https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/zeromq/driver.py#L269-L279
echinopsii/net.echinopsii.ariane.community.cli.python3
ariane_clip3/zeromq/driver.py
Driver.make_subscriber
def make_subscriber(self, my_args=None): """ not implemented :return: """ LOGGER.debug("zeromq.Driver.make_subscriber") if my_args is None: raise exceptions.ArianeConfError('subscriber arguments') if not self.configuration_OK or self.connection_args is...
python
def make_subscriber(self, my_args=None): """ not implemented :return: """ LOGGER.debug("zeromq.Driver.make_subscriber") if my_args is None: raise exceptions.ArianeConfError('subscriber arguments') if not self.configuration_OK or self.connection_args is...
[ "def", "make_subscriber", "(", "self", ",", "my_args", "=", "None", ")", ":", "LOGGER", ".", "debug", "(", "\"zeromq.Driver.make_subscriber\"", ")", "if", "my_args", "is", "None", ":", "raise", "exceptions", ".", "ArianeConfError", "(", "'subscriber arguments'", ...
not implemented :return:
[ "not", "implemented", ":", "return", ":" ]
train
https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/zeromq/driver.py#L281-L293
merryspankersltd/irenee
irenee/cog.py
pg2df
def pg2df(res): ''' takes a getlog requests result returns a table as df ''' # parse res soup = BeautifulSoup(res.text) if u'Pas de r\xe9ponse pour cette recherche.' in soup.text: pass # <-- don't pass ! else: params = urlparse.parse_qs(urlparse.urlsplit...
python
def pg2df(res): ''' takes a getlog requests result returns a table as df ''' # parse res soup = BeautifulSoup(res.text) if u'Pas de r\xe9ponse pour cette recherche.' in soup.text: pass # <-- don't pass ! else: params = urlparse.parse_qs(urlparse.urlsplit...
[ "def", "pg2df", "(", "res", ")", ":", "# parse res", "soup", "=", "BeautifulSoup", "(", "res", ".", "text", ")", "if", "u'Pas de r\\xe9ponse pour cette recherche.'", "in", "soup", ".", "text", ":", "pass", "# <-- don't pass !", "else", ":", "params", "=", "url...
takes a getlog requests result returns a table as df
[ "takes", "a", "getlog", "requests", "result", "returns", "a", "table", "as", "df" ]
train
https://github.com/merryspankersltd/irenee/blob/8bf3c7644dc69001fa4b09be5fbb770dbf06a465/irenee/cog.py#L23-L43
merryspankersltd/irenee
irenee/cog.py
getlog
def getlog(start, end, deplist=['00'], modlist=['M0'], xlsx=None): ''' batch gets changelogs for cogs ''' # entry point url api = 'http://www.insee.fr/fr/methodes/nomenclatures/cog/recherche_historique.asp' # build payloads if modlist == ['M0']: modlist = ['MA', 'MB', 'MC', 'MD',...
python
def getlog(start, end, deplist=['00'], modlist=['M0'], xlsx=None): ''' batch gets changelogs for cogs ''' # entry point url api = 'http://www.insee.fr/fr/methodes/nomenclatures/cog/recherche_historique.asp' # build payloads if modlist == ['M0']: modlist = ['MA', 'MB', 'MC', 'MD',...
[ "def", "getlog", "(", "start", ",", "end", ",", "deplist", "=", "[", "'00'", "]", ",", "modlist", "=", "[", "'M0'", "]", ",", "xlsx", "=", "None", ")", ":", "# entry point url", "api", "=", "'http://www.insee.fr/fr/methodes/nomenclatures/cog/recherche_historique...
batch gets changelogs for cogs
[ "batch", "gets", "changelogs", "for", "cogs" ]
train
https://github.com/merryspankersltd/irenee/blob/8bf3c7644dc69001fa4b09be5fbb770dbf06a465/irenee/cog.py#L45-L67
scdoshi/django-bits
bits/currency.py
currency_format
def currency_format(cents): """Format currency with symbol and decimal points. >> currency_format(-600) - $6.00 TODO: Add localization support. """ try: cents = int(cents) except ValueError: return cents negative = (cents < 0) if negative: cents = -1 * cent...
python
def currency_format(cents): """Format currency with symbol and decimal points. >> currency_format(-600) - $6.00 TODO: Add localization support. """ try: cents = int(cents) except ValueError: return cents negative = (cents < 0) if negative: cents = -1 * cent...
[ "def", "currency_format", "(", "cents", ")", ":", "try", ":", "cents", "=", "int", "(", "cents", ")", "except", "ValueError", ":", "return", "cents", "negative", "=", "(", "cents", "<", "0", ")", "if", "negative", ":", "cents", "=", "-", "1", "*", ...
Format currency with symbol and decimal points. >> currency_format(-600) - $6.00 TODO: Add localization support.
[ "Format", "currency", "with", "symbol", "and", "decimal", "points", "." ]
train
https://github.com/scdoshi/django-bits/blob/0a2f4fd9374d2a8acb8df9a7b83eebcf2782256f/bits/currency.py#L39-L68
dariosky/wfcli
wfcli/tossl.py
WebfactionWebsiteToSsl.is_website_affected
def is_website_affected(self, website): """ Tell if the website is affected by the domain change """ if self.domain is None: return True if not self.include_subdomains: return self.domain in website['subdomains'] else: dotted_domain = "." + self.domain...
python
def is_website_affected(self, website): """ Tell if the website is affected by the domain change """ if self.domain is None: return True if not self.include_subdomains: return self.domain in website['subdomains'] else: dotted_domain = "." + self.domain...
[ "def", "is_website_affected", "(", "self", ",", "website", ")", ":", "if", "self", ".", "domain", "is", "None", ":", "return", "True", "if", "not", "self", ".", "include_subdomains", ":", "return", "self", ".", "domain", "in", "website", "[", "'subdomains'...
Tell if the website is affected by the domain change
[ "Tell", "if", "the", "website", "is", "affected", "by", "the", "domain", "change" ]
train
https://github.com/dariosky/wfcli/blob/87a9ed30dbd456f801135a55099f0541b0614ccb/wfcli/tossl.py#L63-L74
dariosky/wfcli
wfcli/tossl.py
WebfactionWebsiteToSsl.get_affected_domains
def get_affected_domains(self): """ Return a list of all affected domain and subdomains """ results = set() dotted_domain = ("." + self.domain) if self.domain else None for website in self.websites: for subdomain in website['subdomains']: if self.domain is Non...
python
def get_affected_domains(self): """ Return a list of all affected domain and subdomains """ results = set() dotted_domain = ("." + self.domain) if self.domain else None for website in self.websites: for subdomain in website['subdomains']: if self.domain is Non...
[ "def", "get_affected_domains", "(", "self", ")", ":", "results", "=", "set", "(", ")", "dotted_domain", "=", "(", "\".\"", "+", "self", ".", "domain", ")", "if", "self", ".", "domain", "else", "None", "for", "website", "in", "self", ".", "websites", ":...
Return a list of all affected domain and subdomains
[ "Return", "a", "list", "of", "all", "affected", "domain", "and", "subdomains" ]
train
https://github.com/dariosky/wfcli/blob/87a9ed30dbd456f801135a55099f0541b0614ccb/wfcli/tossl.py#L76-L88
dariosky/wfcli
wfcli/tossl.py
WebfactionWebsiteToSsl.website_exists_as_secure
def website_exists_as_secure(self, website): """" Return true if the website has an equivalent that is secure we will have 2 websites with the same name, one insecure (that will contain just the redirect and the identity-verification) and one secured """ if website['https...
python
def website_exists_as_secure(self, website): """" Return true if the website has an equivalent that is secure we will have 2 websites with the same name, one insecure (that will contain just the redirect and the identity-verification) and one secured """ if website['https...
[ "def", "website_exists_as_secure", "(", "self", ",", "website", ")", ":", "if", "website", "[", "'https'", "]", ":", "logger", ".", "info", "(", "\"website %s is already secured, skip\"", "%", "website", "[", "'name'", "]", ")", "return", "website", "# changes i...
Return true if the website has an equivalent that is secure we will have 2 websites with the same name, one insecure (that will contain just the redirect and the identity-verification) and one secured
[ "Return", "true", "if", "the", "website", "has", "an", "equivalent", "that", "is", "secure", "we", "will", "have", "2", "websites", "with", "the", "same", "name", "one", "insecure", "(", "that", "will", "contain", "just", "the", "redirect", "and", "the", ...
train
https://github.com/dariosky/wfcli/blob/87a9ed30dbd456f801135a55099f0541b0614ccb/wfcli/tossl.py#L184-L198
dariosky/wfcli
wfcli/tossl.py
WebfactionWebsiteToSsl.secured_apps_copy
def secured_apps_copy(self, apps): """ Given the http app list of a website, return what should be in the secure version """ return [[app_name, path] for app_name, path in apps if app_name not in (self.LETSENCRYPT_VERIFY_APP_NAME,)]
python
def secured_apps_copy(self, apps): """ Given the http app list of a website, return what should be in the secure version """ return [[app_name, path] for app_name, path in apps if app_name not in (self.LETSENCRYPT_VERIFY_APP_NAME,)]
[ "def", "secured_apps_copy", "(", "self", ",", "apps", ")", ":", "return", "[", "[", "app_name", ",", "path", "]", "for", "app_name", ",", "path", "in", "apps", "if", "app_name", "not", "in", "(", "self", ".", "LETSENCRYPT_VERIFY_APP_NAME", ",", ")", "]" ...
Given the http app list of a website, return what should be in the secure version
[ "Given", "the", "http", "app", "list", "of", "a", "website", "return", "what", "should", "be", "in", "the", "secure", "version" ]
train
https://github.com/dariosky/wfcli/blob/87a9ed30dbd456f801135a55099f0541b0614ccb/wfcli/tossl.py#L212-L215
dariosky/wfcli
wfcli/tossl.py
WebfactionWebsiteToSsl.create_le_verification_app
def create_le_verification_app(self): """ Create the let's encrypt app to verify the ownership of the domain """ if self.LETSENCRYPT_VERIFY_APP_NAME in self._apps: logger.debug( "The LE verification APP already exists as %s" % self.LETSENCRYPT_VERIFY_APP_NAME ) ...
python
def create_le_verification_app(self): """ Create the let's encrypt app to verify the ownership of the domain """ if self.LETSENCRYPT_VERIFY_APP_NAME in self._apps: logger.debug( "The LE verification APP already exists as %s" % self.LETSENCRYPT_VERIFY_APP_NAME ) ...
[ "def", "create_le_verification_app", "(", "self", ")", ":", "if", "self", ".", "LETSENCRYPT_VERIFY_APP_NAME", "in", "self", ".", "_apps", ":", "logger", ".", "debug", "(", "\"The LE verification APP already exists as %s\"", "%", "self", ".", "LETSENCRYPT_VERIFY_APP_NAME...
Create the let's encrypt app to verify the ownership of the domain
[ "Create", "the", "let", "s", "encrypt", "app", "to", "verify", "the", "ownership", "of", "the", "domain" ]
train
https://github.com/dariosky/wfcli/blob/87a9ed30dbd456f801135a55099f0541b0614ccb/wfcli/tossl.py#L239-L263
dariosky/wfcli
wfcli/tossl.py
WebfactionWebsiteToSsl.website_verificable
def website_verificable(self, website): """ True if the website is LetsEncrypt verificable: it should have the verification app on the /.well-known path """ required_app = [self.LETSENCRYPT_VERIFY_APP_NAME, '/.well-known'] for app in website['website_apps']: if app == req...
python
def website_verificable(self, website): """ True if the website is LetsEncrypt verificable: it should have the verification app on the /.well-known path """ required_app = [self.LETSENCRYPT_VERIFY_APP_NAME, '/.well-known'] for app in website['website_apps']: if app == req...
[ "def", "website_verificable", "(", "self", ",", "website", ")", ":", "required_app", "=", "[", "self", ".", "LETSENCRYPT_VERIFY_APP_NAME", ",", "'/.well-known'", "]", "for", "app", "in", "website", "[", "'website_apps'", "]", ":", "if", "app", "==", "required_...
True if the website is LetsEncrypt verificable: it should have the verification app on the /.well-known path
[ "True", "if", "the", "website", "is", "LetsEncrypt", "verificable", ":", "it", "should", "have", "the", "verification", "app", "on", "the", "/", ".", "well", "-", "known", "path" ]
train
https://github.com/dariosky/wfcli/blob/87a9ed30dbd456f801135a55099f0541b0614ccb/wfcli/tossl.py#L314-L321
dariosky/wfcli
wfcli/tossl.py
WebfactionWebsiteToSsl.sync_certificates
def sync_certificates(self, subdomains=None): """ Check all certificates available in acme in the host and sync them with the webfaction certificates """ result = run(".acme.sh/acme.sh --list", quiet=True) logger.info("Syncing Webfaction certificates") for acme_certif...
python
def sync_certificates(self, subdomains=None): """ Check all certificates available in acme in the host and sync them with the webfaction certificates """ result = run(".acme.sh/acme.sh --list", quiet=True) logger.info("Syncing Webfaction certificates") for acme_certif...
[ "def", "sync_certificates", "(", "self", ",", "subdomains", "=", "None", ")", ":", "result", "=", "run", "(", "\".acme.sh/acme.sh --list\"", ",", "quiet", "=", "True", ")", "logger", ".", "info", "(", "\"Syncing Webfaction certificates\"", ")", "for", "acme_cert...
Check all certificates available in acme in the host and sync them with the webfaction certificates
[ "Check", "all", "certificates", "available", "in", "acme", "in", "the", "host", "and", "sync", "them", "with", "the", "webfaction", "certificates" ]
train
https://github.com/dariosky/wfcli/blob/87a9ed30dbd456f801135a55099f0541b0614ccb/wfcli/tossl.py#L323-L362
dariosky/wfcli
wfcli/tossl.py
WebfactionWebsiteToSsl.get_remote_content
def get_remote_content(filepath): """ A handy wrapper to get a remote file content """ with hide('running'): temp = BytesIO() get(filepath, temp) content = temp.getvalue().decode('utf-8') return content.strip()
python
def get_remote_content(filepath): """ A handy wrapper to get a remote file content """ with hide('running'): temp = BytesIO() get(filepath, temp) content = temp.getvalue().decode('utf-8') return content.strip()
[ "def", "get_remote_content", "(", "filepath", ")", ":", "with", "hide", "(", "'running'", ")", ":", "temp", "=", "BytesIO", "(", ")", "get", "(", "filepath", ",", "temp", ")", "content", "=", "temp", ".", "getvalue", "(", ")", ".", "decode", "(", "'u...
A handy wrapper to get a remote file content
[ "A", "handy", "wrapper", "to", "get", "a", "remote", "file", "content" ]
train
https://github.com/dariosky/wfcli/blob/87a9ed30dbd456f801135a55099f0541b0614ccb/wfcli/tossl.py#L365-L371
dariosky/wfcli
wfcli/tossl.py
WebfactionWebsiteToSsl.get_main_domain
def get_main_domain(self, website): """ Given a list of subdomains, return the main domain of them If the subdomain are across multiple domain, then we cannot have a single website it should be splitted """ subdomains = website['subdomains'] main_domains = set() ...
python
def get_main_domain(self, website): """ Given a list of subdomains, return the main domain of them If the subdomain are across multiple domain, then we cannot have a single website it should be splitted """ subdomains = website['subdomains'] main_domains = set() ...
[ "def", "get_main_domain", "(", "self", ",", "website", ")", ":", "subdomains", "=", "website", "[", "'subdomains'", "]", "main_domains", "=", "set", "(", ")", "for", "sub", "in", "subdomains", ":", "for", "d", "in", "self", ".", "_domains", ":", "if", ...
Given a list of subdomains, return the main domain of them If the subdomain are across multiple domain, then we cannot have a single website it should be splitted
[ "Given", "a", "list", "of", "subdomains", "return", "the", "main", "domain", "of", "them", "If", "the", "subdomain", "are", "across", "multiple", "domain", "then", "we", "cannot", "have", "a", "single", "website", "it", "should", "be", "splitted" ]
train
https://github.com/dariosky/wfcli/blob/87a9ed30dbd456f801135a55099f0541b0614ccb/wfcli/tossl.py#L404-L422
ryanjdillon/pyotelem
pyotelem/glides.py
get_stroke_freq
def get_stroke_freq(Ax, Az, fs_a, nperseg, peak_thresh, stroke_ratio=None): '''Determine stroke frequency to use as a cutoff for filtering Args ---- Ax: numpy.ndarray, shape (n,) x-axis accelermeter data (longitudinal) Ay: numpy.ndarray, shape (n,) x-axis accelermeter data (lateral)...
python
def get_stroke_freq(Ax, Az, fs_a, nperseg, peak_thresh, stroke_ratio=None): '''Determine stroke frequency to use as a cutoff for filtering Args ---- Ax: numpy.ndarray, shape (n,) x-axis accelermeter data (longitudinal) Ay: numpy.ndarray, shape (n,) x-axis accelermeter data (lateral)...
[ "def", "get_stroke_freq", "(", "Ax", ",", "Az", ",", "fs_a", ",", "nperseg", ",", "peak_thresh", ",", "stroke_ratio", "=", "None", ")", ":", "import", "numpy", "from", ".", "import", "dsp", "from", ".", "import", "utils", "from", ".", "plots", "import", ...
Determine stroke frequency to use as a cutoff for filtering Args ---- Ax: numpy.ndarray, shape (n,) x-axis accelermeter data (longitudinal) Ay: numpy.ndarray, shape (n,) x-axis accelermeter data (lateral) Az: numpy.ndarray, shape (n,) z-axis accelermeter data (dorso-ventral)...
[ "Determine", "stroke", "frequency", "to", "use", "as", "a", "cutoff", "for", "filtering" ]
train
https://github.com/ryanjdillon/pyotelem/blob/816563a9c3feb3fa416f1c2921c6b75db34111ad/pyotelem/glides.py#L2-L104
ryanjdillon/pyotelem
pyotelem/glides.py
get_stroke_glide_indices
def get_stroke_glide_indices(A_g_hf, fs_a, J, t_max): '''Get stroke and glide indices from high-pass accelerometer data Args ---- A_g_hf: 1-D ndarray Animal frame triaxial accelerometer matrix at sampling rate fs_a. fs_a: int Number of accelerometer samples per second J: float...
python
def get_stroke_glide_indices(A_g_hf, fs_a, J, t_max): '''Get stroke and glide indices from high-pass accelerometer data Args ---- A_g_hf: 1-D ndarray Animal frame triaxial accelerometer matrix at sampling rate fs_a. fs_a: int Number of accelerometer samples per second J: float...
[ "def", "get_stroke_glide_indices", "(", "A_g_hf", ",", "fs_a", ",", "J", ",", "t_max", ")", ":", "import", "numpy", "from", ".", "import", "dsp", "# Check if input array is 1-D", "if", "A_g_hf", ".", "ndim", ">", "1", ":", "raise", "IndexError", "(", "'A_g_h...
Get stroke and glide indices from high-pass accelerometer data Args ---- A_g_hf: 1-D ndarray Animal frame triaxial accelerometer matrix at sampling rate fs_a. fs_a: int Number of accelerometer samples per second J: float Frequency threshold for detecting a fluke stroke in ...
[ "Get", "stroke", "and", "glide", "indices", "from", "high", "-", "pass", "accelerometer", "data" ]
train
https://github.com/ryanjdillon/pyotelem/blob/816563a9c3feb3fa416f1c2921c6b75db34111ad/pyotelem/glides.py#L107-L185
ryanjdillon/pyotelem
pyotelem/glides.py
split_glides
def split_glides(n_samples, dur, fs_a, GL, min_dur=None): '''Get start/stop indices of each `dur` length sub-glide for glides in GL Args ---- dur: int Desired duration of glides GL: ndarray, (n, 2) Matrix containing the start time (first column) and end time (2nd column) of ...
python
def split_glides(n_samples, dur, fs_a, GL, min_dur=None): '''Get start/stop indices of each `dur` length sub-glide for glides in GL Args ---- dur: int Desired duration of glides GL: ndarray, (n, 2) Matrix containing the start time (first column) and end time (2nd column) of ...
[ "def", "split_glides", "(", "n_samples", ",", "dur", ",", "fs_a", ",", "GL", ",", "min_dur", "=", "None", ")", ":", "import", "numpy", "# Convert `dur` in seconds to duration in number of samples `ndur`", "ndur", "=", "dur", "*", "fs_a", "# If minimum duration not pas...
Get start/stop indices of each `dur` length sub-glide for glides in GL Args ---- dur: int Desired duration of glides GL: ndarray, (n, 2) Matrix containing the start time (first column) and end time (2nd column) of any glides.Times are in seconds. min_dur: int, default (bool ...
[ "Get", "start", "/", "stop", "indices", "of", "each", "dur", "length", "sub", "-", "glide", "for", "glides", "in", "GL" ]
train
https://github.com/ryanjdillon/pyotelem/blob/816563a9c3feb3fa416f1c2921c6b75db34111ad/pyotelem/glides.py#L189-L291
ryanjdillon/pyotelem
pyotelem/glides.py
calc_glide_des_asc
def calc_glide_des_asc(depths, pitch_lf, roll_lf, heading_lf, swim_speed, dives, SGL, pitch_lf_deg, temperature, Dsw): '''Calculate glide ascent and descent summary data Args ---- SGL: numpy.ndarray, shape (n,2) start and end index positions for sub-glides Returns ------- s...
python
def calc_glide_des_asc(depths, pitch_lf, roll_lf, heading_lf, swim_speed, dives, SGL, pitch_lf_deg, temperature, Dsw): '''Calculate glide ascent and descent summary data Args ---- SGL: numpy.ndarray, shape (n,2) start and end index positions for sub-glides Returns ------- s...
[ "def", "calc_glide_des_asc", "(", "depths", ",", "pitch_lf", ",", "roll_lf", ",", "heading_lf", ",", "swim_speed", ",", "dives", ",", "SGL", ",", "pitch_lf_deg", ",", "temperature", ",", "Dsw", ")", ":", "import", "scipy", ".", "stats", "import", "numpy", ...
Calculate glide ascent and descent summary data Args ---- SGL: numpy.ndarray, shape (n,2) start and end index positions for sub-glides Returns ------- sgls: pandas.DataFrame Sub-glide summary information defined by `SGL` start/stop indices *Columns*: * dive_ph...
[ "Calculate", "glide", "ascent", "and", "descent", "summary", "data" ]
train
https://github.com/ryanjdillon/pyotelem/blob/816563a9c3feb3fa416f1c2921c6b75db34111ad/pyotelem/glides.py#L294-L515
ryanjdillon/pyotelem
pyotelem/glides.py
calc_glide_ratios
def calc_glide_ratios(dives, des, asc, glide_mask, depths, pitch_lf): '''Calculate summary information on glides during dive ascent/descents Args ---- dives: (n,10) Numpy record array with summary information of dives in sensor data des: ndarray Boolean mask of descents over sensor ...
python
def calc_glide_ratios(dives, des, asc, glide_mask, depths, pitch_lf): '''Calculate summary information on glides during dive ascent/descents Args ---- dives: (n,10) Numpy record array with summary information of dives in sensor data des: ndarray Boolean mask of descents over sensor ...
[ "def", "calc_glide_ratios", "(", "dives", ",", "des", ",", "asc", ",", "glide_mask", ",", "depths", ",", "pitch_lf", ")", ":", "import", "numpy", "import", "pandas", "# Create empty `pandas.DataFrame` for storing data, init with `nan`s", "cols", "=", "[", "'des_durati...
Calculate summary information on glides during dive ascent/descents Args ---- dives: (n,10) Numpy record array with summary information of dives in sensor data des: ndarray Boolean mask of descents over sensor data asc: ndarray Boolean mask of descents over sensor data g...
[ "Calculate", "summary", "information", "on", "glides", "during", "dive", "ascent", "/", "descents" ]
train
https://github.com/ryanjdillon/pyotelem/blob/816563a9c3feb3fa416f1c2921c6b75db34111ad/pyotelem/glides.py#L518-L627
mikejarrett/pipcheck
pipcheck/checker.py
Checker.get_updates
def get_updates( self, display_all_distributions=False, verbose=False ): # pragma: no cover """ When called, get the environment updates and write updates to a CSV file and if a new config has been provided, write a new configuration file. Args: ...
python
def get_updates( self, display_all_distributions=False, verbose=False ): # pragma: no cover """ When called, get the environment updates and write updates to a CSV file and if a new config has been provided, write a new configuration file. Args: ...
[ "def", "get_updates", "(", "self", ",", "display_all_distributions", "=", "False", ",", "verbose", "=", "False", ")", ":", "# pragma: no cover", "if", "verbose", ":", "logging", ".", "basicConfig", "(", "stream", "=", "sys", ".", "stdout", ",", "level", "=",...
When called, get the environment updates and write updates to a CSV file and if a new config has been provided, write a new configuration file. Args: display_all_distributions (bool): Return distribution even if it is up-to-date. verbose (bool): If ``True...
[ "When", "called", "get", "the", "environment", "updates", "and", "write", "updates", "to", "a", "CSV", "file", "and", "if", "a", "new", "config", "has", "been", "provided", "write", "a", "new", "configuration", "file", "." ]
train
https://github.com/mikejarrett/pipcheck/blob/2ff47b9fd8914e1764c6e659ef39b77c1b1a12ad/pipcheck/checker.py#L34-L71
mikejarrett/pipcheck
pipcheck/checker.py
Checker.csv_writer
def csv_writer(csvfile): """ Get a CSV writer for the version of python that is being run. """ if sys.version_info >= (3,): writer = csv.writer(csvfile, delimiter=',', lineterminator='\n') else: writer = csv.writer(csvfile, delimiter=b',', lineterminator='\n') re...
python
def csv_writer(csvfile): """ Get a CSV writer for the version of python that is being run. """ if sys.version_info >= (3,): writer = csv.writer(csvfile, delimiter=',', lineterminator='\n') else: writer = csv.writer(csvfile, delimiter=b',', lineterminator='\n') re...
[ "def", "csv_writer", "(", "csvfile", ")", ":", "if", "sys", ".", "version_info", ">=", "(", "3", ",", ")", ":", "writer", "=", "csv", ".", "writer", "(", "csvfile", ",", "delimiter", "=", "','", ",", "lineterminator", "=", "'\\n'", ")", "else", ":", ...
Get a CSV writer for the version of python that is being run.
[ "Get", "a", "CSV", "writer", "for", "the", "version", "of", "python", "that", "is", "being", "run", "." ]
train
https://github.com/mikejarrett/pipcheck/blob/2ff47b9fd8914e1764c6e659ef39b77c1b1a12ad/pipcheck/checker.py#L74-L81
mikejarrett/pipcheck
pipcheck/checker.py
Checker.write_updates_to_csv
def write_updates_to_csv(self, updates): """ Given a list of updates, write the updates out to the provided CSV file. Args: updates (list): List of Update objects. """ with open(self._csv_file_name, 'w') as csvfile: csvwriter = self.csv_writer(csv...
python
def write_updates_to_csv(self, updates): """ Given a list of updates, write the updates out to the provided CSV file. Args: updates (list): List of Update objects. """ with open(self._csv_file_name, 'w') as csvfile: csvwriter = self.csv_writer(csv...
[ "def", "write_updates_to_csv", "(", "self", ",", "updates", ")", ":", "with", "open", "(", "self", ".", "_csv_file_name", ",", "'w'", ")", "as", "csvfile", ":", "csvwriter", "=", "self", ".", "csv_writer", "(", "csvfile", ")", "csvwriter", ".", "writerow",...
Given a list of updates, write the updates out to the provided CSV file. Args: updates (list): List of Update objects.
[ "Given", "a", "list", "of", "updates", "write", "the", "updates", "out", "to", "the", "provided", "CSV", "file", "." ]
train
https://github.com/mikejarrett/pipcheck/blob/2ff47b9fd8914e1764c6e659ef39b77c1b1a12ad/pipcheck/checker.py#L83-L102
mikejarrett/pipcheck
pipcheck/checker.py
Checker.write_new_config
def write_new_config(self, updates): """ Given a list of updates, write the updates out to the provided configuartion file. Args: updates (list): List of Update objects. """ with open(self._new_config, 'w') as config_file: for update in updates: ...
python
def write_new_config(self, updates): """ Given a list of updates, write the updates out to the provided configuartion file. Args: updates (list): List of Update objects. """ with open(self._new_config, 'w') as config_file: for update in updates: ...
[ "def", "write_new_config", "(", "self", ",", "updates", ")", ":", "with", "open", "(", "self", ".", "_new_config", ",", "'w'", ")", "as", "config_file", ":", "for", "update", "in", "updates", ":", "line", "=", "'{0}=={1} # The installed version is: {2}\\n'", ...
Given a list of updates, write the updates out to the provided configuartion file. Args: updates (list): List of Update objects.
[ "Given", "a", "list", "of", "updates", "write", "the", "updates", "out", "to", "the", "provided", "configuartion", "file", "." ]
train
https://github.com/mikejarrett/pipcheck/blob/2ff47b9fd8914e1764c6e659ef39b77c1b1a12ad/pipcheck/checker.py#L104-L120
mikejarrett/pipcheck
pipcheck/checker.py
Checker._get_environment_updates
def _get_environment_updates(self, display_all_distributions=False): """ Check all pacakges installed in the environment to see if there are any updates availalble. Args: display_all_distributions (bool): Return distribution even if it is up-to-date. Defaults...
python
def _get_environment_updates(self, display_all_distributions=False): """ Check all pacakges installed in the environment to see if there are any updates availalble. Args: display_all_distributions (bool): Return distribution even if it is up-to-date. Defaults...
[ "def", "_get_environment_updates", "(", "self", ",", "display_all_distributions", "=", "False", ")", ":", "updates", "=", "[", "]", "for", "distribution", "in", "self", ".", "pip", ".", "get_installed_distributions", "(", ")", ":", "versions", "=", "self", "."...
Check all pacakges installed in the environment to see if there are any updates availalble. Args: display_all_distributions (bool): Return distribution even if it is up-to-date. Defaults to ``False``. Returns: list: A list of Update objects ordered based...
[ "Check", "all", "pacakges", "installed", "in", "the", "environment", "to", "see", "if", "there", "are", "any", "updates", "availalble", "." ]
train
https://github.com/mikejarrett/pipcheck/blob/2ff47b9fd8914e1764c6e659ef39b77c1b1a12ad/pipcheck/checker.py#L122-L170
mikejarrett/pipcheck
pipcheck/checker.py
Checker.get_available_versions
def get_available_versions(self, project_name): """ Query PyPI to see if package has any available versions. Args: project_name (str): The name the project on PyPI. Returns: dict: Where keys are tuples of parsed versions and values are the versions retur...
python
def get_available_versions(self, project_name): """ Query PyPI to see if package has any available versions. Args: project_name (str): The name the project on PyPI. Returns: dict: Where keys are tuples of parsed versions and values are the versions retur...
[ "def", "get_available_versions", "(", "self", ",", "project_name", ")", ":", "available_versions", "=", "self", ".", "pypi_client", ".", "package_releases", "(", "project_name", ")", "if", "not", "available_versions", ":", "available_versions", "=", "self", ".", "...
Query PyPI to see if package has any available versions. Args: project_name (str): The name the project on PyPI. Returns: dict: Where keys are tuples of parsed versions and values are the versions returned by PyPI.
[ "Query", "PyPI", "to", "see", "if", "package", "has", "any", "available", "versions", "." ]
train
https://github.com/mikejarrett/pipcheck/blob/2ff47b9fd8914e1764c6e659ef39b77c1b1a12ad/pipcheck/checker.py#L172-L193
mikejarrett/pipcheck
pipcheck/checker.py
Checker._parse_version
def _parse_version(version): """ Parse a version string. Args: version (str): A string representing a version e.g. '1.9rc2' Returns: tuple: major, minor, patch parts cast as integer and whether or not it was a pre-release version. """ par...
python
def _parse_version(version): """ Parse a version string. Args: version (str): A string representing a version e.g. '1.9rc2' Returns: tuple: major, minor, patch parts cast as integer and whether or not it was a pre-release version. """ par...
[ "def", "_parse_version", "(", "version", ")", ":", "parsed_version", "=", "parse_version", "(", "version", ")", "return", "tuple", "(", "int", "(", "dot_version", ")", "for", "dot_version", "in", "parsed_version", ".", "base_version", ".", "split", "(", "'.'",...
Parse a version string. Args: version (str): A string representing a version e.g. '1.9rc2' Returns: tuple: major, minor, patch parts cast as integer and whether or not it was a pre-release version.
[ "Parse", "a", "version", "string", "." ]
train
https://github.com/mikejarrett/pipcheck/blob/2ff47b9fd8914e1764c6e659ef39b77c1b1a12ad/pipcheck/checker.py#L196-L210
Carreau/insupportable
insupportable/insupportable.py
S.support
def support(self, version): """ return `True` if current python version match version passed. raise a deprecation warning if only PY2 or PY3 is supported as you probably have a conditional that should be removed. """ if not self._known_version(version): ...
python
def support(self, version): """ return `True` if current python version match version passed. raise a deprecation warning if only PY2 or PY3 is supported as you probably have a conditional that should be removed. """ if not self._known_version(version): ...
[ "def", "support", "(", "self", ",", "version", ")", ":", "if", "not", "self", ".", "_known_version", "(", "version", ")", ":", "warn", "(", "\"unknown feature: %s\"", "%", "version", ")", "return", "True", "else", ":", "if", "not", "self", ".", "_get_fea...
return `True` if current python version match version passed. raise a deprecation warning if only PY2 or PY3 is supported as you probably have a conditional that should be removed.
[ "return", "True", "if", "current", "python", "version", "match", "version", "passed", ".", "raise", "a", "deprecation", "warning", "if", "only", "PY2", "or", "PY3", "is", "supported", "as", "you", "probably", "have", "a", "conditional", "that", "should", "be...
train
https://github.com/Carreau/insupportable/blob/318e05e945b33f3e7a6ead8d85a7f3a8c2b7321c/insupportable/insupportable.py#L161-L190
Carreau/insupportable
insupportable/insupportable.py
Context._default_warner
def _default_warner(self, message, stacklevel=1): """ default warner function use a pending deprecation warning, and correct for the correct stacklevel """ return warnings.warn(message, PendingDeprecationWarning, stacklevel=stacklevel+4)
python
def _default_warner(self, message, stacklevel=1): """ default warner function use a pending deprecation warning, and correct for the correct stacklevel """ return warnings.warn(message, PendingDeprecationWarning, stacklevel=stacklevel+4)
[ "def", "_default_warner", "(", "self", ",", "message", ",", "stacklevel", "=", "1", ")", ":", "return", "warnings", ".", "warn", "(", "message", ",", "PendingDeprecationWarning", ",", "stacklevel", "=", "stacklevel", "+", "4", ")" ]
default warner function use a pending deprecation warning, and correct for the correct stacklevel
[ "default", "warner", "function", "use", "a", "pending", "deprecation", "warning", "and", "correct", "for", "the", "correct", "stacklevel" ]
train
https://github.com/Carreau/insupportable/blob/318e05e945b33f3e7a6ead8d85a7f3a8c2b7321c/insupportable/insupportable.py#L218-L225
FujiMakoto/IPS-Vagrant
ips_vagrant/installer/V_4_0_11.py
Installer._check_if_complete
def _check_if_complete(self, url, json_response): """ Check if a request has been completed and return the redirect URL if it has @type url: str @type json_response: list or dict @rtype: str or bool """ if '__done' in json_response and isinstance(j...
python
def _check_if_complete(self, url, json_response): """ Check if a request has been completed and return the redirect URL if it has @type url: str @type json_response: list or dict @rtype: str or bool """ if '__done' in json_response and isinstance(j...
[ "def", "_check_if_complete", "(", "self", ",", "url", ",", "json_response", ")", ":", "if", "'__done'", "in", "json_response", "and", "isinstance", "(", "json_response", ",", "list", ")", ":", "mr_parts", "=", "list", "(", "urlparse", "(", "url", ")", ")",...
Check if a request has been completed and return the redirect URL if it has @type url: str @type json_response: list or dict @rtype: str or bool
[ "Check", "if", "a", "request", "has", "been", "completed", "and", "return", "the", "redirect", "URL", "if", "it", "has" ]
train
https://github.com/FujiMakoto/IPS-Vagrant/blob/7b1d6d095034dd8befb026d9315ecc6494d52269/ips_vagrant/installer/V_4_0_11.py#L11-L28
geertj/looping
lib/looping/util.py
setblocking
def setblocking(fd, blocking): """Set the O_NONBLOCK flag for a file descriptor. Availability: Unix.""" if not fcntl: warnings.warn('setblocking() not supported on Windows') flags = fcntl.fcntl(fd, fcntl.F_GETFL) if blocking: flags |= os.O_NONBLOCK else: flags &= ~os.O_NONBLO...
python
def setblocking(fd, blocking): """Set the O_NONBLOCK flag for a file descriptor. Availability: Unix.""" if not fcntl: warnings.warn('setblocking() not supported on Windows') flags = fcntl.fcntl(fd, fcntl.F_GETFL) if blocking: flags |= os.O_NONBLOCK else: flags &= ~os.O_NONBLO...
[ "def", "setblocking", "(", "fd", ",", "blocking", ")", ":", "if", "not", "fcntl", ":", "warnings", ".", "warn", "(", "'setblocking() not supported on Windows'", ")", "flags", "=", "fcntl", ".", "fcntl", "(", "fd", ",", "fcntl", ".", "F_GETFL", ")", "if", ...
Set the O_NONBLOCK flag for a file descriptor. Availability: Unix.
[ "Set", "the", "O_NONBLOCK", "flag", "for", "a", "file", "descriptor", ".", "Availability", ":", "Unix", "." ]
train
https://github.com/geertj/looping/blob/b60303714685aede18b37c0d80f8f55175ad7a65/lib/looping/util.py#L24-L33
telminov/sw-python-sms-devino
sms_devino/client.py
DevinoClient.send_one
def send_one(self, source_address: str, destination_address: str, message: str, validity_minutes: int = 0) -> SendSmsResult: """ http://www.devinotele.com/resheniya/dokumentaciya-po-api/http_rest_protocol/Otpravka_SMS-soobshcheny/ """ session_id = self._get_session_id() ...
python
def send_one(self, source_address: str, destination_address: str, message: str, validity_minutes: int = 0) -> SendSmsResult: """ http://www.devinotele.com/resheniya/dokumentaciya-po-api/http_rest_protocol/Otpravka_SMS-soobshcheny/ """ session_id = self._get_session_id() ...
[ "def", "send_one", "(", "self", ",", "source_address", ":", "str", ",", "destination_address", ":", "str", ",", "message", ":", "str", ",", "validity_minutes", ":", "int", "=", "0", ")", "->", "SendSmsResult", ":", "session_id", "=", "self", ".", "_get_ses...
http://www.devinotele.com/resheniya/dokumentaciya-po-api/http_rest_protocol/Otpravka_SMS-soobshcheny/
[ "http", ":", "//", "www", ".", "devinotele", ".", "com", "/", "resheniya", "/", "dokumentaciya", "-", "po", "-", "api", "/", "http_rest_protocol", "/", "Otpravka_SMS", "-", "soobshcheny", "/" ]
train
https://github.com/telminov/sw-python-sms-devino/blob/ce8a8aa67a4585ea6c8af986a280e68374a7e531/sms_devino/client.py#L93-L107
telminov/sw-python-sms-devino
sms_devino/client.py
DevinoClient.send_bulk
def send_bulk(self, source_address: str, destination_addresses: List[str], message: str, validity_minutes: int = 0) -> List[SendSmsResult]: """ http://www.devinotele.com/resheniya/dokumentaciya-po-api/http_rest_protocol/Otpravka_SMS-soobshcheny/ """ session_id = self._ge...
python
def send_bulk(self, source_address: str, destination_addresses: List[str], message: str, validity_minutes: int = 0) -> List[SendSmsResult]: """ http://www.devinotele.com/resheniya/dokumentaciya-po-api/http_rest_protocol/Otpravka_SMS-soobshcheny/ """ session_id = self._ge...
[ "def", "send_bulk", "(", "self", ",", "source_address", ":", "str", ",", "destination_addresses", ":", "List", "[", "str", "]", ",", "message", ":", "str", ",", "validity_minutes", ":", "int", "=", "0", ")", "->", "List", "[", "SendSmsResult", "]", ":", ...
http://www.devinotele.com/resheniya/dokumentaciya-po-api/http_rest_protocol/Otpravka_SMS-soobshcheny/
[ "http", ":", "//", "www", ".", "devinotele", ".", "com", "/", "resheniya", "/", "dokumentaciya", "-", "po", "-", "api", "/", "http_rest_protocol", "/", "Otpravka_SMS", "-", "soobshcheny", "/" ]
train
https://github.com/telminov/sw-python-sms-devino/blob/ce8a8aa67a4585ea6c8af986a280e68374a7e531/sms_devino/client.py#L109-L136
sykora/djournal
djournal/views.py
entry_index
def entry_index(request, limit=0, template='djournal/entry_index.html'): '''Returns a reponse of a fixed number of entries; all of them, by default. ''' entries = Entry.public.all() if limit > 0: entries = entries[:limit] context = { 'entries': entries, } return render_to_res...
python
def entry_index(request, limit=0, template='djournal/entry_index.html'): '''Returns a reponse of a fixed number of entries; all of them, by default. ''' entries = Entry.public.all() if limit > 0: entries = entries[:limit] context = { 'entries': entries, } return render_to_res...
[ "def", "entry_index", "(", "request", ",", "limit", "=", "0", ",", "template", "=", "'djournal/entry_index.html'", ")", ":", "entries", "=", "Entry", ".", "public", ".", "all", "(", ")", "if", "limit", ">", "0", ":", "entries", "=", "entries", "[", ":"...
Returns a reponse of a fixed number of entries; all of them, by default.
[ "Returns", "a", "reponse", "of", "a", "fixed", "number", "of", "entries", ";", "all", "of", "them", "by", "default", "." ]
train
https://github.com/sykora/djournal/blob/c074e1f94e07e2630034a00c7dbd768e933f85e2/djournal/views.py#L10-L26
sykora/djournal
djournal/views.py
entry_detail
def entry_detail(request, slug, template='djournal/entry_detail.html'): '''Returns a response of an individual entry, for the given slug.''' entry = get_object_or_404(Entry.public, slug=slug) context = { 'entry': entry, } return render_to_response( template, context, ...
python
def entry_detail(request, slug, template='djournal/entry_detail.html'): '''Returns a response of an individual entry, for the given slug.''' entry = get_object_or_404(Entry.public, slug=slug) context = { 'entry': entry, } return render_to_response( template, context, ...
[ "def", "entry_detail", "(", "request", ",", "slug", ",", "template", "=", "'djournal/entry_detail.html'", ")", ":", "entry", "=", "get_object_or_404", "(", "Entry", ".", "public", ",", "slug", "=", "slug", ")", "context", "=", "{", "'entry'", ":", "entry", ...
Returns a response of an individual entry, for the given slug.
[ "Returns", "a", "response", "of", "an", "individual", "entry", "for", "the", "given", "slug", "." ]
train
https://github.com/sykora/djournal/blob/c074e1f94e07e2630034a00c7dbd768e933f85e2/djournal/views.py#L28-L41
sykora/djournal
djournal/views.py
tagged_entry_index
def tagged_entry_index(request, slug, template='djournal/tagged_entry_index.html'): '''Returns a response of all entries tagged with a given tag.''' tag = get_object_or_404(Tag, slug=slug) entries = Entry.public.filter(tags__in=[tag]) context = { 'entries': entries, 'tag': tag, } ...
python
def tagged_entry_index(request, slug, template='djournal/tagged_entry_index.html'): '''Returns a response of all entries tagged with a given tag.''' tag = get_object_or_404(Tag, slug=slug) entries = Entry.public.filter(tags__in=[tag]) context = { 'entries': entries, 'tag': tag, } ...
[ "def", "tagged_entry_index", "(", "request", ",", "slug", ",", "template", "=", "'djournal/tagged_entry_index.html'", ")", ":", "tag", "=", "get_object_or_404", "(", "Tag", ",", "slug", "=", "slug", ")", "entries", "=", "Entry", ".", "public", ".", "filter", ...
Returns a response of all entries tagged with a given tag.
[ "Returns", "a", "response", "of", "all", "entries", "tagged", "with", "a", "given", "tag", "." ]
train
https://github.com/sykora/djournal/blob/c074e1f94e07e2630034a00c7dbd768e933f85e2/djournal/views.py#L43-L59
tschaume/ccsgp_get_started
ccsgp_get_started/examples/utils.py
getWorkDirs
def getWorkDirs(): """get input/output dirs (same input/output layout as for package)""" # get caller module caller_fullurl = inspect.stack()[1][1] caller_relurl = os.path.relpath(caller_fullurl) caller_modurl = os.path.splitext(caller_relurl)[0] # split caller_url & append 'Dir' to package name dirs = ca...
python
def getWorkDirs(): """get input/output dirs (same input/output layout as for package)""" # get caller module caller_fullurl = inspect.stack()[1][1] caller_relurl = os.path.relpath(caller_fullurl) caller_modurl = os.path.splitext(caller_relurl)[0] # split caller_url & append 'Dir' to package name dirs = ca...
[ "def", "getWorkDirs", "(", ")", ":", "# get caller module", "caller_fullurl", "=", "inspect", ".", "stack", "(", ")", "[", "1", "]", "[", "1", "]", "caller_relurl", "=", "os", ".", "path", ".", "relpath", "(", "caller_fullurl", ")", "caller_modurl", "=", ...
get input/output dirs (same input/output layout as for package)
[ "get", "input", "/", "output", "dirs", "(", "same", "input", "/", "output", "layout", "as", "for", "package", ")" ]
train
https://github.com/tschaume/ccsgp_get_started/blob/e4e29844a3e6fc7574e9b4b8cd84131f28ddc3f2/ccsgp_get_started/examples/utils.py#L9-L27
tschaume/ccsgp_get_started
ccsgp_get_started/examples/utils.py
getUArray
def getUArray(npArr): """uncertainty array multiplied by binwidth (col2 = dx)""" ufloats = [] for dp in npArr: u = ufloat(dp[1], abs(dp[3]), 'stat') v = ufloat(dp[1], abs(dp[4]), 'syst') r = (u+v)/2.*dp[2]*2. ufloats.append(r) # NOTE: center value ok, but both error contribs half! ...
python
def getUArray(npArr): """uncertainty array multiplied by binwidth (col2 = dx)""" ufloats = [] for dp in npArr: u = ufloat(dp[1], abs(dp[3]), 'stat') v = ufloat(dp[1], abs(dp[4]), 'syst') r = (u+v)/2.*dp[2]*2. ufloats.append(r) # NOTE: center value ok, but both error contribs half! ...
[ "def", "getUArray", "(", "npArr", ")", ":", "ufloats", "=", "[", "]", "for", "dp", "in", "npArr", ":", "u", "=", "ufloat", "(", "dp", "[", "1", "]", ",", "abs", "(", "dp", "[", "3", "]", ")", ",", "'stat'", ")", "v", "=", "ufloat", "(", "dp...
uncertainty array multiplied by binwidth (col2 = dx)
[ "uncertainty", "array", "multiplied", "by", "binwidth", "(", "col2", "=", "dx", ")" ]
train
https://github.com/tschaume/ccsgp_get_started/blob/e4e29844a3e6fc7574e9b4b8cd84131f28ddc3f2/ccsgp_get_started/examples/utils.py#L29-L39
tschaume/ccsgp_get_started
ccsgp_get_started/examples/utils.py
getErrorComponent
def getErrorComponent(result, tag): """get total error contribution for component with specific tag""" return math.sqrt(sum( (error*2)**2 for (var, error) in result.error_components().items() if var.tag == tag ))
python
def getErrorComponent(result, tag): """get total error contribution for component with specific tag""" return math.sqrt(sum( (error*2)**2 for (var, error) in result.error_components().items() if var.tag == tag ))
[ "def", "getErrorComponent", "(", "result", ",", "tag", ")", ":", "return", "math", ".", "sqrt", "(", "sum", "(", "(", "error", "*", "2", ")", "**", "2", "for", "(", "var", ",", "error", ")", "in", "result", ".", "error_components", "(", ")", ".", ...
get total error contribution for component with specific tag
[ "get", "total", "error", "contribution", "for", "component", "with", "specific", "tag" ]
train
https://github.com/tschaume/ccsgp_get_started/blob/e4e29844a3e6fc7574e9b4b8cd84131f28ddc3f2/ccsgp_get_started/examples/utils.py#L41-L47
tschaume/ccsgp_get_started
ccsgp_get_started/examples/utils.py
getEdges
def getEdges(npArr): """get np array of bin edges""" edges = np.concatenate(([0], npArr[:,0] + npArr[:,2])) return np.array([Decimal(str(i)) for i in edges])
python
def getEdges(npArr): """get np array of bin edges""" edges = np.concatenate(([0], npArr[:,0] + npArr[:,2])) return np.array([Decimal(str(i)) for i in edges])
[ "def", "getEdges", "(", "npArr", ")", ":", "edges", "=", "np", ".", "concatenate", "(", "(", "[", "0", "]", ",", "npArr", "[", ":", ",", "0", "]", "+", "npArr", "[", ":", ",", "2", "]", ")", ")", "return", "np", ".", "array", "(", "[", "Dec...
get np array of bin edges
[ "get", "np", "array", "of", "bin", "edges" ]
train
https://github.com/tschaume/ccsgp_get_started/blob/e4e29844a3e6fc7574e9b4b8cd84131f28ddc3f2/ccsgp_get_started/examples/utils.py#L49-L52
tschaume/ccsgp_get_started
ccsgp_get_started/examples/utils.py
getMaskIndices
def getMaskIndices(mask): """get lower and upper index of mask""" return [ list(mask).index(True), len(mask) - 1 - list(mask)[::-1].index(True) ]
python
def getMaskIndices(mask): """get lower and upper index of mask""" return [ list(mask).index(True), len(mask) - 1 - list(mask)[::-1].index(True) ]
[ "def", "getMaskIndices", "(", "mask", ")", ":", "return", "[", "list", "(", "mask", ")", ".", "index", "(", "True", ")", ",", "len", "(", "mask", ")", "-", "1", "-", "list", "(", "mask", ")", "[", ":", ":", "-", "1", "]", ".", "index", "(", ...
get lower and upper index of mask
[ "get", "lower", "and", "upper", "index", "of", "mask" ]
train
https://github.com/tschaume/ccsgp_get_started/blob/e4e29844a3e6fc7574e9b4b8cd84131f28ddc3f2/ccsgp_get_started/examples/utils.py#L54-L58
tschaume/ccsgp_get_started
ccsgp_get_started/examples/utils.py
getCocktailSum
def getCocktailSum(e0, e1, eCocktail, uCocktail): """get the cocktail sum for a given data bin range""" # get mask and according indices mask = (eCocktail >= e0) & (eCocktail <= e1) # data bin range wider than single cocktail bin if np.any(mask): idx = getMaskIndices(mask) # determine coinciding flags...
python
def getCocktailSum(e0, e1, eCocktail, uCocktail): """get the cocktail sum for a given data bin range""" # get mask and according indices mask = (eCocktail >= e0) & (eCocktail <= e1) # data bin range wider than single cocktail bin if np.any(mask): idx = getMaskIndices(mask) # determine coinciding flags...
[ "def", "getCocktailSum", "(", "e0", ",", "e1", ",", "eCocktail", ",", "uCocktail", ")", ":", "# get mask and according indices", "mask", "=", "(", "eCocktail", ">=", "e0", ")", "&", "(", "eCocktail", "<=", "e1", ")", "# data bin range wider than single cocktail bi...
get the cocktail sum for a given data bin range
[ "get", "the", "cocktail", "sum", "for", "a", "given", "data", "bin", "range" ]
train
https://github.com/tschaume/ccsgp_get_started/blob/e4e29844a3e6fc7574e9b4b8cd84131f28ddc3f2/ccsgp_get_started/examples/utils.py#L64-L108
Beyond-Digital/django-gaekit
gaekit/boot.py
break_sandbox
def break_sandbox(): """Patches sandbox to add match-all regex to sandbox whitelist """ class EvilCM(object): def __enter__(self): return self def __exit__(self, exc_type, exc, tb): import re tb.tb_next.tb_next.tb_next.tb_frame.f_locals[ '...
python
def break_sandbox(): """Patches sandbox to add match-all regex to sandbox whitelist """ class EvilCM(object): def __enter__(self): return self def __exit__(self, exc_type, exc, tb): import re tb.tb_next.tb_next.tb_next.tb_frame.f_locals[ '...
[ "def", "break_sandbox", "(", ")", ":", "class", "EvilCM", "(", "object", ")", ":", "def", "__enter__", "(", "self", ")", ":", "return", "self", "def", "__exit__", "(", "self", ",", "exc_type", ",", "exc", ",", "tb", ")", ":", "import", "re", "tb", ...
Patches sandbox to add match-all regex to sandbox whitelist
[ "Patches", "sandbox", "to", "add", "match", "-", "all", "regex", "to", "sandbox", "whitelist" ]
train
https://github.com/Beyond-Digital/django-gaekit/blob/b587acd52b5cfd48217a70920d4b61d5f923c8c5/gaekit/boot.py#L1-L17
kervi/kervi-core
kervi/actions/action.py
_LinkedAction.execute
def execute(self, *args, **kwargs): """Executes the action.""" timeout = kwargs.pop("timeout", -1) run_async = kwargs.pop("run_async", False) self._is_running = True result = None if self._action_lock.acquire(False): self._state = ACTION_PENDING se...
python
def execute(self, *args, **kwargs): """Executes the action.""" timeout = kwargs.pop("timeout", -1) run_async = kwargs.pop("run_async", False) self._is_running = True result = None if self._action_lock.acquire(False): self._state = ACTION_PENDING se...
[ "def", "execute", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "timeout", "=", "kwargs", ".", "pop", "(", "\"timeout\"", ",", "-", "1", ")", "run_async", "=", "kwargs", ".", "pop", "(", "\"run_async\"", ",", "False", ")", "self...
Executes the action.
[ "Executes", "the", "action", "." ]
train
https://github.com/kervi/kervi-core/blob/3c1e3c8a17a7b4d085d8a28b99180ff2a96b0e23/kervi/actions/action.py#L94-L118
kervi/kervi-core
kervi/actions/action.py
Action.execute
def execute(self, *args, **kwargs): """ Executes the action and returns the result. You dont have to call this function directly as the class is callable (implements __call__) you just call the @action marked function as normal. @action def my_actio...
python
def execute(self, *args, **kwargs): """ Executes the action and returns the result. You dont have to call this function directly as the class is callable (implements __call__) you just call the @action marked function as normal. @action def my_actio...
[ "def", "execute", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "timeout", "=", "kwargs", ".", "pop", "(", "\"timeout\"", ",", "-", "1", ")", "execute_async", "=", "kwargs", ".", "pop", "(", "\"run_async\"", ",", "False", ")", "...
Executes the action and returns the result. You dont have to call this function directly as the class is callable (implements __call__) you just call the @action marked function as normal. @action def my_action(p1) print(p1) my_action("x")
[ "Executes", "the", "action", "and", "returns", "the", "result", ".", "You", "dont", "have", "to", "call", "this", "function", "directly", "as", "the", "class", "is", "callable", "(", "implements", "__call__", ")", "you", "just", "call", "the", "@action", "...
train
https://github.com/kervi/kervi-core/blob/3c1e3c8a17a7b4d085d8a28b99180ff2a96b0e23/kervi/actions/action.py#L409-L455
kervi/kervi-core
kervi/actions/action.py
Action.set_interrupt
def set_interrupt(self, method=None, **kwargs): """ Decorator that turns a function or controller method into an action interrupt. """ def action_wrap(f): action_id = kwargs.get("action_id", f.__name__) name = kwargs.get("name", action_id) ...
python
def set_interrupt(self, method=None, **kwargs): """ Decorator that turns a function or controller method into an action interrupt. """ def action_wrap(f): action_id = kwargs.get("action_id", f.__name__) name = kwargs.get("name", action_id) ...
[ "def", "set_interrupt", "(", "self", ",", "method", "=", "None", ",", "*", "*", "kwargs", ")", ":", "def", "action_wrap", "(", "f", ")", ":", "action_id", "=", "kwargs", ".", "get", "(", "\"action_id\"", ",", "f", ".", "__name__", ")", "name", "=", ...
Decorator that turns a function or controller method into an action interrupt.
[ "Decorator", "that", "turns", "a", "function", "or", "controller", "method", "into", "an", "action", "interrupt", "." ]
train
https://github.com/kervi/kervi-core/blob/3c1e3c8a17a7b4d085d8a28b99180ff2a96b0e23/kervi/actions/action.py#L622-L650
tagcubeio/tagcube-cli
tagcube_cli/utils.py
parse_config_file
def parse_config_file(): """ Find the .tagcube config file in the current directory, or in the user's home and parse it. The one in the current directory has precedence. :return: A tuple with: - email - api_token """ for filename in ('.tagcube', os.path.expan...
python
def parse_config_file(): """ Find the .tagcube config file in the current directory, or in the user's home and parse it. The one in the current directory has precedence. :return: A tuple with: - email - api_token """ for filename in ('.tagcube', os.path.expan...
[ "def", "parse_config_file", "(", ")", ":", "for", "filename", "in", "(", "'.tagcube'", ",", "os", ".", "path", ".", "expanduser", "(", "'~/.tagcube'", ")", ")", ":", "filename", "=", "os", ".", "path", ".", "abspath", "(", "filename", ")", "if", "not",...
Find the .tagcube config file in the current directory, or in the user's home and parse it. The one in the current directory has precedence. :return: A tuple with: - email - api_token
[ "Find", "the", ".", "tagcube", "config", "file", "in", "the", "current", "directory", "or", "in", "the", "user", "s", "home", "and", "parse", "it", ".", "The", "one", "in", "the", "current", "directory", "has", "precedence", ".", ":", "return", ":", "A...
train
https://github.com/tagcubeio/tagcube-cli/blob/709e4b0b11331a4d2791dc79107e5081518d75bf/tagcube_cli/utils.py#L38-L73
tagcubeio/tagcube-cli
tagcube_cli/utils.py
_parse_config_file_impl
def _parse_config_file_impl(filename): """ Format for the file is: credentials: email: ... api_token: ... :param filename: The filename to parse :return: A tuple with: - email - api_token """ api_key = None email = ...
python
def _parse_config_file_impl(filename): """ Format for the file is: credentials: email: ... api_token: ... :param filename: The filename to parse :return: A tuple with: - email - api_token """ api_key = None email = ...
[ "def", "_parse_config_file_impl", "(", "filename", ")", ":", "api_key", "=", "None", "email", "=", "None", "try", ":", "doc", "=", "yaml", ".", "load", "(", "file", "(", "filename", ")", ".", "read", "(", ")", ")", "email", "=", "doc", "[", "'credent...
Format for the file is: credentials: email: ... api_token: ... :param filename: The filename to parse :return: A tuple with: - email - api_token
[ "Format", "for", "the", "file", "is", ":", "credentials", ":", "email", ":", "...", "api_token", ":", "...", ":", "param", "filename", ":", "The", "filename", "to", "parse", ":", "return", ":", "A", "tuple", "with", ":", "-", "email", "-", "api_token" ...
train
https://github.com/tagcubeio/tagcube-cli/blob/709e4b0b11331a4d2791dc79107e5081518d75bf/tagcube_cli/utils.py#L76-L117
tagcubeio/tagcube-cli
tagcube_cli/utils.py
is_valid_path
def is_valid_path(path): """ :return: True if the path is valid, else raise a ValueError with the specific error """ if not path.startswith('/'): msg = 'Invalid path "%s". Paths need to start with "/".' raise ValueError(msg % path[:40]) for c in ' \t': if c in p...
python
def is_valid_path(path): """ :return: True if the path is valid, else raise a ValueError with the specific error """ if not path.startswith('/'): msg = 'Invalid path "%s". Paths need to start with "/".' raise ValueError(msg % path[:40]) for c in ' \t': if c in p...
[ "def", "is_valid_path", "(", "path", ")", ":", "if", "not", "path", ".", "startswith", "(", "'/'", ")", ":", "msg", "=", "'Invalid path \"%s\". Paths need to start with \"/\".'", "raise", "ValueError", "(", "msg", "%", "path", "[", ":", "40", "]", ")", "for"...
:return: True if the path is valid, else raise a ValueError with the specific error
[ ":", "return", ":", "True", "if", "the", "path", "is", "valid", "else", "raise", "a", "ValueError", "with", "the", "specific", "error" ]
train
https://github.com/tagcubeio/tagcube-cli/blob/709e4b0b11331a4d2791dc79107e5081518d75bf/tagcube_cli/utils.py#L144-L159
tagcubeio/tagcube-cli
tagcube_cli/utils.py
path_file_to_list
def path_file_to_list(path_file): """ :return: A list with the paths which are stored in a text file in a line-by- line format. Validate each path using is_valid_path """ paths = [] path_file_fd = file(path_file) for line_no, line in enumerate(path_file_fd.readlines(), start=1): ...
python
def path_file_to_list(path_file): """ :return: A list with the paths which are stored in a text file in a line-by- line format. Validate each path using is_valid_path """ paths = [] path_file_fd = file(path_file) for line_no, line in enumerate(path_file_fd.readlines(), start=1): ...
[ "def", "path_file_to_list", "(", "path_file", ")", ":", "paths", "=", "[", "]", "path_file_fd", "=", "file", "(", "path_file", ")", "for", "line_no", ",", "line", "in", "enumerate", "(", "path_file_fd", ".", "readlines", "(", ")", ",", "start", "=", "1",...
:return: A list with the paths which are stored in a text file in a line-by- line format. Validate each path using is_valid_path
[ ":", "return", ":", "A", "list", "with", "the", "paths", "which", "are", "stored", "in", "a", "text", "file", "in", "a", "line", "-", "by", "-", "line", "format", ".", "Validate", "each", "path", "using", "is_valid_path" ]
train
https://github.com/tagcubeio/tagcube-cli/blob/709e4b0b11331a4d2791dc79107e5081518d75bf/tagcube_cli/utils.py#L205-L231
dmckeone/frosty
frosty/freezers.py
_freezer_lookup
def _freezer_lookup(freezer_string): """ Translate a string that may be a freezer name into the internal freezer constant :param freezer_string :return: """ sanitized = freezer_string.lower().strip() for freezer in FREEZER.ALL: freezer_instance = freezer() freezer_name = six...
python
def _freezer_lookup(freezer_string): """ Translate a string that may be a freezer name into the internal freezer constant :param freezer_string :return: """ sanitized = freezer_string.lower().strip() for freezer in FREEZER.ALL: freezer_instance = freezer() freezer_name = six...
[ "def", "_freezer_lookup", "(", "freezer_string", ")", ":", "sanitized", "=", "freezer_string", ".", "lower", "(", ")", ".", "strip", "(", ")", "for", "freezer", "in", "FREEZER", ".", "ALL", ":", "freezer_instance", "=", "freezer", "(", ")", "freezer_name", ...
Translate a string that may be a freezer name into the internal freezer constant :param freezer_string :return:
[ "Translate", "a", "string", "that", "may", "be", "a", "freezer", "name", "into", "the", "internal", "freezer", "constant" ]
train
https://github.com/dmckeone/frosty/blob/868d81e72b6c8e354af3697531c20f116cd1fc9a/frosty/freezers.py#L174-L192
dmckeone/frosty
frosty/freezers.py
resolve_freezer
def resolve_freezer(freezer): """ Locate the appropriate freezer given FREEZER or string input from the programmer. :param freezer: FREEZER constant or string for the freezer that is requested. (None = FREEZER.DEFAULT) :return: """ # Set default freezer if there was none if not freezer: ...
python
def resolve_freezer(freezer): """ Locate the appropriate freezer given FREEZER or string input from the programmer. :param freezer: FREEZER constant or string for the freezer that is requested. (None = FREEZER.DEFAULT) :return: """ # Set default freezer if there was none if not freezer: ...
[ "def", "resolve_freezer", "(", "freezer", ")", ":", "# Set default freezer if there was none", "if", "not", "freezer", ":", "return", "_Default", "(", ")", "# Allow character based lookups as well", "if", "isinstance", "(", "freezer", ",", "six", ".", "string_types", ...
Locate the appropriate freezer given FREEZER or string input from the programmer. :param freezer: FREEZER constant or string for the freezer that is requested. (None = FREEZER.DEFAULT) :return:
[ "Locate", "the", "appropriate", "freezer", "given", "FREEZER", "or", "string", "input", "from", "the", "programmer", "." ]
train
https://github.com/dmckeone/frosty/blob/868d81e72b6c8e354af3697531c20f116cd1fc9a/frosty/freezers.py#L195-L219
dmckeone/frosty
frosty/freezers.py
_Default._split_packages
def _split_packages(cls, include_packages): """ Split an iterable of packages into packages that need to be passed through, and those that need to have their disk location resolved. Some modules don't have a '__file__' attribute. AFAIK these aren't packages, so they can just be passed ...
python
def _split_packages(cls, include_packages): """ Split an iterable of packages into packages that need to be passed through, and those that need to have their disk location resolved. Some modules don't have a '__file__' attribute. AFAIK these aren't packages, so they can just be passed ...
[ "def", "_split_packages", "(", "cls", ",", "include_packages", ")", ":", "passthrough_includes", "=", "set", "(", "[", "six", ".", "text_type", "(", "package", ".", "__name__", ")", "for", "package", "in", "include_packages", "if", "not", "hasattr", "(", "pa...
Split an iterable of packages into packages that need to be passed through, and those that need to have their disk location resolved. Some modules don't have a '__file__' attribute. AFAIK these aren't packages, so they can just be passed through to the includes as-is :return: 2-tuple o...
[ "Split", "an", "iterable", "of", "packages", "into", "packages", "that", "need", "to", "be", "passed", "through", "and", "those", "that", "need", "to", "have", "their", "disk", "location", "resolved", "." ]
train
https://github.com/dmckeone/frosty/blob/868d81e72b6c8e354af3697531c20f116cd1fc9a/frosty/freezers.py#L22-L41
dmckeone/frosty
frosty/freezers.py
_Default.build_includes
def build_includes(cls, include_packages): """ The default include strategy is to add a star (*) wild card after all sub-packages (but not the main package). This strategy is compatible with py2app and bbfreeze. Example (From SaltStack 2014.7): salt salt.fileser...
python
def build_includes(cls, include_packages): """ The default include strategy is to add a star (*) wild card after all sub-packages (but not the main package). This strategy is compatible with py2app and bbfreeze. Example (From SaltStack 2014.7): salt salt.fileser...
[ "def", "build_includes", "(", "cls", ",", "include_packages", ")", ":", "includes", ",", "package_root_paths", "=", "cls", ".", "_split_packages", "(", "include_packages", ")", "for", "package_path", ",", "package_name", "in", "six", ".", "iteritems", "(", "pack...
The default include strategy is to add a star (*) wild card after all sub-packages (but not the main package). This strategy is compatible with py2app and bbfreeze. Example (From SaltStack 2014.7): salt salt.fileserver.* salt.modules.* etc... :p...
[ "The", "default", "include", "strategy", "is", "to", "add", "a", "star", "(", "*", ")", "wild", "card", "after", "all", "sub", "-", "packages", "(", "but", "not", "the", "main", "package", ")", ".", "This", "strategy", "is", "compatible", "with", "py2a...
train
https://github.com/dmckeone/frosty/blob/868d81e72b6c8e354af3697531c20f116cd1fc9a/frosty/freezers.py#L44-L82
dmckeone/frosty
frosty/freezers.py
_CxFreeze.build_includes
def build_includes(cls, include_packages): """ cx_freeze doesn't support the star (*) method of sub-module inclusion, so all submodules must be included explicitly. Example (From SaltStack 2014.7): salt salt.fileserver salt.fileserver.gitfs ...
python
def build_includes(cls, include_packages): """ cx_freeze doesn't support the star (*) method of sub-module inclusion, so all submodules must be included explicitly. Example (From SaltStack 2014.7): salt salt.fileserver salt.fileserver.gitfs ...
[ "def", "build_includes", "(", "cls", ",", "include_packages", ")", ":", "includes", ",", "package_root_paths", "=", "cls", ".", "_split_packages", "(", "include_packages", ")", "for", "package_path", ",", "package_name", "in", "six", ".", "iteritems", "(", "pack...
cx_freeze doesn't support the star (*) method of sub-module inclusion, so all submodules must be included explicitly. Example (From SaltStack 2014.7): salt salt.fileserver salt.fileserver.gitfs salt.fileserver.hgfs salt.fileserver.minionfs ...
[ "cx_freeze", "doesn", "t", "support", "the", "star", "(", "*", ")", "method", "of", "sub", "-", "module", "inclusion", "so", "all", "submodules", "must", "be", "included", "explicitly", "." ]
train
https://github.com/dmckeone/frosty/blob/868d81e72b6c8e354af3697531c20f116cd1fc9a/frosty/freezers.py#L120-L154
KnowledgeLinks/rdfframework
rdfframework/datasets/jsonquery.py
parse_json_qry
def parse_json_qry(qry_str): """ Parses a json query string into its parts args: qry_str: query string params: variables passed into the string """ def param_analyzer(param_list): rtn_list = [] for param in param_list: parts = param.strip().split("=") ...
python
def parse_json_qry(qry_str): """ Parses a json query string into its parts args: qry_str: query string params: variables passed into the string """ def param_analyzer(param_list): rtn_list = [] for param in param_list: parts = param.strip().split("=") ...
[ "def", "parse_json_qry", "(", "qry_str", ")", ":", "def", "param_analyzer", "(", "param_list", ")", ":", "rtn_list", "=", "[", "]", "for", "param", "in", "param_list", ":", "parts", "=", "param", ".", "strip", "(", ")", ".", "split", "(", "\"=\"", ")",...
Parses a json query string into its parts args: qry_str: query string params: variables passed into the string
[ "Parses", "a", "json", "query", "string", "into", "its", "parts" ]
train
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/datasets/jsonquery.py#L14-L63
KnowledgeLinks/rdfframework
rdfframework/datasets/jsonquery.py
get_json_qry_item
def get_json_qry_item(dataset, param, no_key=False): """ reads the paramater and returns the selected element args: dataset: the dataset to search param: the paramater to search by no_key: wheather to use the 'param' 'element' to filter the list. This is passed True afte...
python
def get_json_qry_item(dataset, param, no_key=False): """ reads the paramater and returns the selected element args: dataset: the dataset to search param: the paramater to search by no_key: wheather to use the 'param' 'element' to filter the list. This is passed True afte...
[ "def", "get_json_qry_item", "(", "dataset", ",", "param", ",", "no_key", "=", "False", ")", ":", "def", "get_dataset_vals", "(", "ds", ",", "key", ",", "filter_tup", "=", "tuple", "(", ")", ")", ":", "def", "reduce_list", "(", "value", ")", ":", "if", ...
reads the paramater and returns the selected element args: dataset: the dataset to search param: the paramater to search by no_key: wheather to use the 'param' 'element' to filter the list. This is passed True after the first run during recurssive call when t...
[ "reads", "the", "paramater", "and", "returns", "the", "selected", "element" ]
train
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/datasets/jsonquery.py#L82-L220
KnowledgeLinks/rdfframework
rdfframework/datasets/jsonquery.py
get_reverse_json_qry_item
def get_reverse_json_qry_item(dataset, param, no_key=False, initial_val=None): """ reads the paramater and returns the selected element args: dataset: the dataset to search param: the paramater to search by no_key: wheather to use the 'param' 'element' to filter the list. ...
python
def get_reverse_json_qry_item(dataset, param, no_key=False, initial_val=None): """ reads the paramater and returns the selected element args: dataset: the dataset to search param: the paramater to search by no_key: wheather to use the 'param' 'element' to filter the list. ...
[ "def", "get_reverse_json_qry_item", "(", "dataset", ",", "param", ",", "no_key", "=", "False", ",", "initial_val", "=", "None", ")", ":", "def", "get_dataset_vals", "(", "ds", ",", "key", ",", "filter_tup", "=", "tuple", "(", ")", ",", "initial_val", "=", ...
reads the paramater and returns the selected element args: dataset: the dataset to search param: the paramater to search by no_key: wheather to use the 'param' 'element' to filter the list. This is passed True after the first run during recurssive call when t...
[ "reads", "the", "paramater", "and", "returns", "the", "selected", "element" ]
train
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/datasets/jsonquery.py#L223-L385
KnowledgeLinks/rdfframework
rdfframework/datasets/jsonquery.py
json_qry
def json_qry(dataset, qry_str, params={}): """ Takes a json query string and returns the results args: dataset: RdfDataset to query against qry_str: query string params: dictionary of params """ # if qry_str.startswith("$.bf_itemOf[rdf_type=bf_Print].='print',\n"): # pdb...
python
def json_qry(dataset, qry_str, params={}): """ Takes a json query string and returns the results args: dataset: RdfDataset to query against qry_str: query string params: dictionary of params """ # if qry_str.startswith("$.bf_itemOf[rdf_type=bf_Print].='print',\n"): # pdb...
[ "def", "json_qry", "(", "dataset", ",", "qry_str", ",", "params", "=", "{", "}", ")", ":", "# if qry_str.startswith(\"$.bf_itemOf[rdf_type=bf_Print].='print',\\n\"):", "# pdb.set_trace()", "if", "not", "'$'", "in", "qry_str", ":", "qry_str", "=", "\".\"", ".", "...
Takes a json query string and returns the results args: dataset: RdfDataset to query against qry_str: query string params: dictionary of params
[ "Takes", "a", "json", "query", "string", "and", "returns", "the", "results" ]
train
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/datasets/jsonquery.py#L393-L463
jkenlooper/chill
src/chill/migrations.py
migrate1
def migrate1(): "Migrate from version 0 to 1" initial = [ "create table Chill (version integer);", "insert into Chill (version) values (1);", "alter table SelectSQL rename to Query;", "alter table Node add column template integer references Template (id) on delete set null;", "alter table N...
python
def migrate1(): "Migrate from version 0 to 1" initial = [ "create table Chill (version integer);", "insert into Chill (version) values (1);", "alter table SelectSQL rename to Query;", "alter table Node add column template integer references Template (id) on delete set null;", "alter table N...
[ "def", "migrate1", "(", ")", ":", "initial", "=", "[", "\"create table Chill (version integer);\"", ",", "\"insert into Chill (version) values (1);\"", ",", "\"alter table SelectSQL rename to Query;\"", ",", "\"alter table Node add column template integer references Template (id) on dele...
Migrate from version 0 to 1
[ "Migrate", "from", "version", "0", "to", "1" ]
train
https://github.com/jkenlooper/chill/blob/35360c17c2a3b769ecb5406c6dabcf4cc70bd76f/src/chill/migrations.py#L10-L87
jmgilman/Neolib
neolib/pyamf/amf0.py
_check_for_int
def _check_for_int(x): """ This is a compatibility function that takes a C{float} and converts it to an C{int} if the values are equal. """ try: y = int(x) except (OverflowError, ValueError): pass else: # There is no way in AMF0 to distinguish between integers and flo...
python
def _check_for_int(x): """ This is a compatibility function that takes a C{float} and converts it to an C{int} if the values are equal. """ try: y = int(x) except (OverflowError, ValueError): pass else: # There is no way in AMF0 to distinguish between integers and flo...
[ "def", "_check_for_int", "(", "x", ")", ":", "try", ":", "y", "=", "int", "(", "x", ")", "except", "(", "OverflowError", ",", "ValueError", ")", ":", "pass", "else", ":", "# There is no way in AMF0 to distinguish between integers and floats", "if", "x", "==", ...
This is a compatibility function that takes a C{float} and converts it to an C{int} if the values are equal.
[ "This", "is", "a", "compatibility", "function", "that", "takes", "a", "C", "{", "float", "}", "and", "converts", "it", "to", "an", "C", "{", "int", "}", "if", "the", "values", "are", "equal", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/amf0.py#L735-L749
jmgilman/Neolib
neolib/pyamf/amf0.py
Decoder.readString
def readString(self, bytes=False): """ Reads a C{string} from the stream. If bytes is C{True} then you will get the raw data read from the stream, otherwise a string that has been B{utf-8} decoded. """ l = self.stream.read_ushort() b = self.stream.read(l) ...
python
def readString(self, bytes=False): """ Reads a C{string} from the stream. If bytes is C{True} then you will get the raw data read from the stream, otherwise a string that has been B{utf-8} decoded. """ l = self.stream.read_ushort() b = self.stream.read(l) ...
[ "def", "readString", "(", "self", ",", "bytes", "=", "False", ")", ":", "l", "=", "self", ".", "stream", ".", "read_ushort", "(", ")", "b", "=", "self", ".", "stream", ".", "read", "(", "l", ")", "if", "bytes", ":", "return", "b", "return", "self...
Reads a C{string} from the stream. If bytes is C{True} then you will get the raw data read from the stream, otherwise a string that has been B{utf-8} decoded.
[ "Reads", "a", "C", "{", "string", "}", "from", "the", "stream", ".", "If", "bytes", "is", "C", "{", "True", "}", "then", "you", "will", "get", "the", "raw", "data", "read", "from", "the", "stream", "otherwise", "a", "string", "that", "has", "been", ...
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/amf0.py#L195-L207
jmgilman/Neolib
neolib/pyamf/amf0.py
Decoder.readMixedArray
def readMixedArray(self): """ Read mixed array. @rtype: L{pyamf.MixedArray} """ # TODO: something with the length/strict self.stream.read_ulong() # length obj = pyamf.MixedArray() self.context.addObject(obj) attrs = self.readObjectAttributes(obj...
python
def readMixedArray(self): """ Read mixed array. @rtype: L{pyamf.MixedArray} """ # TODO: something with the length/strict self.stream.read_ulong() # length obj = pyamf.MixedArray() self.context.addObject(obj) attrs = self.readObjectAttributes(obj...
[ "def", "readMixedArray", "(", "self", ")", ":", "# TODO: something with the length/strict", "self", ".", "stream", ".", "read_ulong", "(", ")", "# length", "obj", "=", "pyamf", ".", "MixedArray", "(", ")", "self", ".", "context", ".", "addObject", "(", "obj", ...
Read mixed array. @rtype: L{pyamf.MixedArray}
[ "Read", "mixed", "array", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/amf0.py#L223-L245