repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
listlengths
20
707
docstring
stringlengths
3
17.3k
docstring_tokens
listlengths
3
222
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
idx
int64
0
252k
wuher/devil
devil/auth.py
HttpBasic.authenticate
def authenticate(self, request): """ Authenticate request using HTTP Basic authentication protocl. If the user is successfully identified, the corresponding user object is stored in `request.user`. If the request has already been authenticated (i.e. `request.user` has authenticated user...
python
def authenticate(self, request): """ Authenticate request using HTTP Basic authentication protocl. If the user is successfully identified, the corresponding user object is stored in `request.user`. If the request has already been authenticated (i.e. `request.user` has authenticated user...
[ "def", "authenticate", "(", "self", ",", "request", ")", ":", "# todo: can we trust that request.user variable is even defined?", "if", "request", ".", "user", "and", "request", ".", "user", ".", "is_authenticated", "(", ")", ":", "return", "request", ".", "user", ...
Authenticate request using HTTP Basic authentication protocl. If the user is successfully identified, the corresponding user object is stored in `request.user`. If the request has already been authenticated (i.e. `request.user` has authenticated user object), this function does nothing....
[ "Authenticate", "request", "using", "HTTP", "Basic", "authentication", "protocl", "." ]
a8834d4f88d915a21754c6b96f99d0ad9123ad4d
https://github.com/wuher/devil/blob/a8834d4f88d915a21754c6b96f99d0ad9123ad4d/devil/auth.py#L15-L47
train
57,500
ymotongpoo/pyoauth2
pavement.py
clean
def clean(): """Clean up previous garbage""" os.chdir(os.path.join(project_root, 'docs')) sh("make clean") os.chdir(project_root) sh("rm -rf pyoauth2.egg-info")
python
def clean(): """Clean up previous garbage""" os.chdir(os.path.join(project_root, 'docs')) sh("make clean") os.chdir(project_root) sh("rm -rf pyoauth2.egg-info")
[ "def", "clean", "(", ")", ":", "os", ".", "chdir", "(", "os", ".", "path", ".", "join", "(", "project_root", ",", "'docs'", ")", ")", "sh", "(", "\"make clean\"", ")", "os", ".", "chdir", "(", "project_root", ")", "sh", "(", "\"rm -rf pyoauth2.egg-info...
Clean up previous garbage
[ "Clean", "up", "previous", "garbage" ]
7fddaf5fba190cfbc025961ce5948267d3d688ad
https://github.com/ymotongpoo/pyoauth2/blob/7fddaf5fba190cfbc025961ce5948267d3d688ad/pavement.py#L53-L58
train
57,501
CodyKochmann/generators
generators/average.py
average
def average(): """ generator that holds a rolling average """ count = 0 total = total() i=0 while 1: i = yield ((total.send(i)*1.0)/count if count else 0) count += 1
python
def average(): """ generator that holds a rolling average """ count = 0 total = total() i=0 while 1: i = yield ((total.send(i)*1.0)/count if count else 0) count += 1
[ "def", "average", "(", ")", ":", "count", "=", "0", "total", "=", "total", "(", ")", "i", "=", "0", "while", "1", ":", "i", "=", "yield", "(", "(", "total", ".", "send", "(", "i", ")", "*", "1.0", ")", "/", "count", "if", "count", "else", "...
generator that holds a rolling average
[ "generator", "that", "holds", "a", "rolling", "average" ]
e4ca4dd25d5023a94b0349c69d6224070cc2526f
https://github.com/CodyKochmann/generators/blob/e4ca4dd25d5023a94b0349c69d6224070cc2526f/generators/average.py#L14-L21
train
57,502
objectrocket/python-client
scripts/check_docs.py
DocParityCheck.args
def args(self): """Parsed command-line arguments.""" if self._args is None: parser = self._build_parser() self._args = parser.parse_args() return self._args
python
def args(self): """Parsed command-line arguments.""" if self._args is None: parser = self._build_parser() self._args = parser.parse_args() return self._args
[ "def", "args", "(", "self", ")", ":", "if", "self", ".", "_args", "is", "None", ":", "parser", "=", "self", ".", "_build_parser", "(", ")", "self", ".", "_args", "=", "parser", ".", "parse_args", "(", ")", "return", "self", ".", "_args" ]
Parsed command-line arguments.
[ "Parsed", "command", "-", "line", "arguments", "." ]
a65868c7511ff49a5fbe304e53bf592b7fc6d5ef
https://github.com/objectrocket/python-client/blob/a65868c7511ff49a5fbe304e53bf592b7fc6d5ef/scripts/check_docs.py#L33-L38
train
57,503
objectrocket/python-client
scripts/check_docs.py
DocParityCheck.build_pypackage_basename
def build_pypackage_basename(self, pytree, base): """Build the string representing the parsed package basename. :param str pytree: The pytree absolute path. :param str pytree: The absolute path of the pytree sub-package of which determine the parsed name. :rtype: str ...
python
def build_pypackage_basename(self, pytree, base): """Build the string representing the parsed package basename. :param str pytree: The pytree absolute path. :param str pytree: The absolute path of the pytree sub-package of which determine the parsed name. :rtype: str ...
[ "def", "build_pypackage_basename", "(", "self", ",", "pytree", ",", "base", ")", ":", "dirname", "=", "os", ".", "path", ".", "dirname", "(", "pytree", ")", "parsed_package_name", "=", "base", ".", "replace", "(", "dirname", ",", "''", ")", ".", "strip",...
Build the string representing the parsed package basename. :param str pytree: The pytree absolute path. :param str pytree: The absolute path of the pytree sub-package of which determine the parsed name. :rtype: str
[ "Build", "the", "string", "representing", "the", "parsed", "package", "basename", "." ]
a65868c7511ff49a5fbe304e53bf592b7fc6d5ef
https://github.com/objectrocket/python-client/blob/a65868c7511ff49a5fbe304e53bf592b7fc6d5ef/scripts/check_docs.py#L40-L50
train
57,504
objectrocket/python-client
scripts/check_docs.py
DocParityCheck._build_parser
def _build_parser(self): """Build the needed command-line parser.""" parser = argparse.ArgumentParser() parser.add_argument('--pytree', required=True, type=self._valid_directory, help='This is the path, absolute...
python
def _build_parser(self): """Build the needed command-line parser.""" parser = argparse.ArgumentParser() parser.add_argument('--pytree', required=True, type=self._valid_directory, help='This is the path, absolute...
[ "def", "_build_parser", "(", "self", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "parser", ".", "add_argument", "(", "'--pytree'", ",", "required", "=", "True", ",", "type", "=", "self", ".", "_valid_directory", ",", "help", "=", ...
Build the needed command-line parser.
[ "Build", "the", "needed", "command", "-", "line", "parser", "." ]
a65868c7511ff49a5fbe304e53bf592b7fc6d5ef
https://github.com/objectrocket/python-client/blob/a65868c7511ff49a5fbe304e53bf592b7fc6d5ef/scripts/check_docs.py#L52-L77
train
57,505
objectrocket/python-client
scripts/check_docs.py
DocParityCheck.build_pyfile_path_from_docname
def build_pyfile_path_from_docname(self, docfile): """Build the expected Python file name based on the given documentation file name. :param str docfile: The documentation file name from which to build the Python file name. :rtype: str """ name, ext = os.path.splitext(docfile) ...
python
def build_pyfile_path_from_docname(self, docfile): """Build the expected Python file name based on the given documentation file name. :param str docfile: The documentation file name from which to build the Python file name. :rtype: str """ name, ext = os.path.splitext(docfile) ...
[ "def", "build_pyfile_path_from_docname", "(", "self", ",", "docfile", ")", ":", "name", ",", "ext", "=", "os", ".", "path", ".", "splitext", "(", "docfile", ")", "expected_py_name", "=", "name", ".", "replace", "(", "'.'", ",", "'/'", ")", "+", "'.py'", ...
Build the expected Python file name based on the given documentation file name. :param str docfile: The documentation file name from which to build the Python file name. :rtype: str
[ "Build", "the", "expected", "Python", "file", "name", "based", "on", "the", "given", "documentation", "file", "name", "." ]
a65868c7511ff49a5fbe304e53bf592b7fc6d5ef
https://github.com/objectrocket/python-client/blob/a65868c7511ff49a5fbe304e53bf592b7fc6d5ef/scripts/check_docs.py#L89-L97
train
57,506
objectrocket/python-client
scripts/check_docs.py
DocParityCheck.calculate_tree_differences
def calculate_tree_differences(self, pytree, doctree): """Calculate the differences between the given trees. :param dict pytree: The dictionary of the parsed Python tree. :param dict doctree: The dictionary of the parsed documentation tree. :rtype: tuple :returns: A two-tuple of...
python
def calculate_tree_differences(self, pytree, doctree): """Calculate the differences between the given trees. :param dict pytree: The dictionary of the parsed Python tree. :param dict doctree: The dictionary of the parsed documentation tree. :rtype: tuple :returns: A two-tuple of...
[ "def", "calculate_tree_differences", "(", "self", ",", "pytree", ",", "doctree", ")", ":", "pykeys", "=", "set", "(", "pytree", ".", "keys", "(", ")", ")", "dockeys", "=", "set", "(", "doctree", ".", "keys", "(", ")", ")", "# Calculate the missing document...
Calculate the differences between the given trees. :param dict pytree: The dictionary of the parsed Python tree. :param dict doctree: The dictionary of the parsed documentation tree. :rtype: tuple :returns: A two-tuple of sets, where the first is the missing Python files, and the second...
[ "Calculate", "the", "differences", "between", "the", "given", "trees", "." ]
a65868c7511ff49a5fbe304e53bf592b7fc6d5ef
https://github.com/objectrocket/python-client/blob/a65868c7511ff49a5fbe304e53bf592b7fc6d5ef/scripts/check_docs.py#L99-L119
train
57,507
objectrocket/python-client
scripts/check_docs.py
DocParityCheck.compare_trees
def compare_trees(self, parsed_pytree, parsed_doctree): """Compare the given parsed trees. :param dict parsed_pytree: A dictionary representing the parsed Python tree where each key is a parsed Python file and its key is its expected rst file name. """ if parsed_pytree == pa...
python
def compare_trees(self, parsed_pytree, parsed_doctree): """Compare the given parsed trees. :param dict parsed_pytree: A dictionary representing the parsed Python tree where each key is a parsed Python file and its key is its expected rst file name. """ if parsed_pytree == pa...
[ "def", "compare_trees", "(", "self", ",", "parsed_pytree", ",", "parsed_doctree", ")", ":", "if", "parsed_pytree", "==", "parsed_doctree", ":", "return", "0", "missing_pys", ",", "missing_docs", "=", "self", ".", "calculate_tree_differences", "(", "pytree", "=", ...
Compare the given parsed trees. :param dict parsed_pytree: A dictionary representing the parsed Python tree where each key is a parsed Python file and its key is its expected rst file name.
[ "Compare", "the", "given", "parsed", "trees", "." ]
a65868c7511ff49a5fbe304e53bf592b7fc6d5ef
https://github.com/objectrocket/python-client/blob/a65868c7511ff49a5fbe304e53bf592b7fc6d5ef/scripts/check_docs.py#L121-L133
train
57,508
objectrocket/python-client
scripts/check_docs.py
DocParityCheck.parse_doc_tree
def parse_doc_tree(self, doctree, pypackages): """Parse the given documentation tree. :param str doctree: The absolute path to the documentation tree which is to be parsed. :param set pypackages: A set of all Python packages found in the pytree. :rtype: dict :returns: A dict whe...
python
def parse_doc_tree(self, doctree, pypackages): """Parse the given documentation tree. :param str doctree: The absolute path to the documentation tree which is to be parsed. :param set pypackages: A set of all Python packages found in the pytree. :rtype: dict :returns: A dict whe...
[ "def", "parse_doc_tree", "(", "self", ",", "doctree", ",", "pypackages", ")", ":", "parsed_doctree", "=", "{", "}", "for", "filename", "in", "os", ".", "listdir", "(", "doctree", ")", ":", "if", "self", ".", "_ignore_docfile", "(", "filename", ")", ":", ...
Parse the given documentation tree. :param str doctree: The absolute path to the documentation tree which is to be parsed. :param set pypackages: A set of all Python packages found in the pytree. :rtype: dict :returns: A dict where each key is the path of an expected Python module and i...
[ "Parse", "the", "given", "documentation", "tree", "." ]
a65868c7511ff49a5fbe304e53bf592b7fc6d5ef
https://github.com/objectrocket/python-client/blob/a65868c7511ff49a5fbe304e53bf592b7fc6d5ef/scripts/check_docs.py#L165-L183
train
57,509
objectrocket/python-client
scripts/check_docs.py
DocParityCheck.parse_py_tree
def parse_py_tree(self, pytree): """Parse the given Python package tree. :param str pytree: The absolute path to the Python tree which is to be parsed. :rtype: dict :returns: A two-tuple. The first element is a dict where each key is the path of a parsed Python module (relat...
python
def parse_py_tree(self, pytree): """Parse the given Python package tree. :param str pytree: The absolute path to the Python tree which is to be parsed. :rtype: dict :returns: A two-tuple. The first element is a dict where each key is the path of a parsed Python module (relat...
[ "def", "parse_py_tree", "(", "self", ",", "pytree", ")", ":", "parsed_pytree", "=", "{", "}", "pypackages", "=", "set", "(", ")", "for", "base", ",", "dirs", ",", "files", "in", "os", ".", "walk", "(", "pytree", ")", ":", "if", "self", ".", "_ignor...
Parse the given Python package tree. :param str pytree: The absolute path to the Python tree which is to be parsed. :rtype: dict :returns: A two-tuple. The first element is a dict where each key is the path of a parsed Python module (relative to the Python tree) and its value is the...
[ "Parse", "the", "given", "Python", "package", "tree", "." ]
a65868c7511ff49a5fbe304e53bf592b7fc6d5ef
https://github.com/objectrocket/python-client/blob/a65868c7511ff49a5fbe304e53bf592b7fc6d5ef/scripts/check_docs.py#L185-L217
train
57,510
objectrocket/python-client
scripts/check_docs.py
DocParityCheck.pprint_tree_differences
def pprint_tree_differences(self, missing_pys, missing_docs): """Pprint the missing files of each given set. :param set missing_pys: The set of missing Python files. :param set missing_docs: The set of missing documentation files. :rtype: None """ if missing_pys: ...
python
def pprint_tree_differences(self, missing_pys, missing_docs): """Pprint the missing files of each given set. :param set missing_pys: The set of missing Python files. :param set missing_docs: The set of missing documentation files. :rtype: None """ if missing_pys: ...
[ "def", "pprint_tree_differences", "(", "self", ",", "missing_pys", ",", "missing_docs", ")", ":", "if", "missing_pys", ":", "print", "(", "'The following Python files appear to be missing:'", ")", "for", "pyfile", "in", "missing_pys", ":", "print", "(", "pyfile", ")...
Pprint the missing files of each given set. :param set missing_pys: The set of missing Python files. :param set missing_docs: The set of missing documentation files. :rtype: None
[ "Pprint", "the", "missing", "files", "of", "each", "given", "set", "." ]
a65868c7511ff49a5fbe304e53bf592b7fc6d5ef
https://github.com/objectrocket/python-client/blob/a65868c7511ff49a5fbe304e53bf592b7fc6d5ef/scripts/check_docs.py#L219-L236
train
57,511
objectrocket/python-client
scripts/check_docs.py
DocParityCheck._valid_directory
def _valid_directory(self, path): """Ensure that the given path is valid. :param str path: A valid directory path. :raises: :py:class:`argparse.ArgumentTypeError` :returns: An absolute directory path. """ abspath = os.path.abspath(path) if not os.path.isdir(abspa...
python
def _valid_directory(self, path): """Ensure that the given path is valid. :param str path: A valid directory path. :raises: :py:class:`argparse.ArgumentTypeError` :returns: An absolute directory path. """ abspath = os.path.abspath(path) if not os.path.isdir(abspa...
[ "def", "_valid_directory", "(", "self", ",", "path", ")", ":", "abspath", "=", "os", ".", "path", ".", "abspath", "(", "path", ")", "if", "not", "os", ".", "path", ".", "isdir", "(", "abspath", ")", ":", "raise", "argparse", ".", "ArgumentTypeError", ...
Ensure that the given path is valid. :param str path: A valid directory path. :raises: :py:class:`argparse.ArgumentTypeError` :returns: An absolute directory path.
[ "Ensure", "that", "the", "given", "path", "is", "valid", "." ]
a65868c7511ff49a5fbe304e53bf592b7fc6d5ef
https://github.com/objectrocket/python-client/blob/a65868c7511ff49a5fbe304e53bf592b7fc6d5ef/scripts/check_docs.py#L238-L248
train
57,512
objectrocket/python-client
scripts/check_docs.py
DocParityCheck.main
def main(self): """Parse package trees and report on any discrepancies.""" args = self.args parsed_pytree, pypackages = self.parse_py_tree(pytree=args.pytree) parsed_doctree = self.parse_doc_tree(doctree=args.doctree, pypackages=pypackages) return self.compare_trees(parsed_pytree...
python
def main(self): """Parse package trees and report on any discrepancies.""" args = self.args parsed_pytree, pypackages = self.parse_py_tree(pytree=args.pytree) parsed_doctree = self.parse_doc_tree(doctree=args.doctree, pypackages=pypackages) return self.compare_trees(parsed_pytree...
[ "def", "main", "(", "self", ")", ":", "args", "=", "self", ".", "args", "parsed_pytree", ",", "pypackages", "=", "self", ".", "parse_py_tree", "(", "pytree", "=", "args", ".", "pytree", ")", "parsed_doctree", "=", "self", ".", "parse_doc_tree", "(", "doc...
Parse package trees and report on any discrepancies.
[ "Parse", "package", "trees", "and", "report", "on", "any", "discrepancies", "." ]
a65868c7511ff49a5fbe304e53bf592b7fc6d5ef
https://github.com/objectrocket/python-client/blob/a65868c7511ff49a5fbe304e53bf592b7fc6d5ef/scripts/check_docs.py#L250-L255
train
57,513
AtomHash/evernode
evernode/models/fail2ban_model.py
Fail2BanModel.where_unique
def where_unique(cls, ip, object_id, location): """ Get db model by username """ return cls.query.filter_by( ip=ip, object_id=object_id, location=location).first()
python
def where_unique(cls, ip, object_id, location): """ Get db model by username """ return cls.query.filter_by( ip=ip, object_id=object_id, location=location).first()
[ "def", "where_unique", "(", "cls", ",", "ip", ",", "object_id", ",", "location", ")", ":", "return", "cls", ".", "query", ".", "filter_by", "(", "ip", "=", "ip", ",", "object_id", "=", "object_id", ",", "location", "=", "location", ")", ".", "first", ...
Get db model by username
[ "Get", "db", "model", "by", "username" ]
b2fb91555fb937a3f3eba41db56dee26f9b034be
https://github.com/AtomHash/evernode/blob/b2fb91555fb937a3f3eba41db56dee26f9b034be/evernode/models/fail2ban_model.py#L27-L32
train
57,514
AtomHash/evernode
evernode/models/fail2ban_model.py
Fail2BanModel.delete_where_unique
def delete_where_unique(cls, ip, object_id, location): """ delete by ip and object id """ result = cls.where_unique(ip, object_id, location) if result is None: return None result.delete() return True
python
def delete_where_unique(cls, ip, object_id, location): """ delete by ip and object id """ result = cls.where_unique(ip, object_id, location) if result is None: return None result.delete() return True
[ "def", "delete_where_unique", "(", "cls", ",", "ip", ",", "object_id", ",", "location", ")", ":", "result", "=", "cls", ".", "where_unique", "(", "ip", ",", "object_id", ",", "location", ")", "if", "result", "is", "None", ":", "return", "None", "result",...
delete by ip and object id
[ "delete", "by", "ip", "and", "object", "id" ]
b2fb91555fb937a3f3eba41db56dee26f9b034be
https://github.com/AtomHash/evernode/blob/b2fb91555fb937a3f3eba41db56dee26f9b034be/evernode/models/fail2ban_model.py#L40-L46
train
57,515
mcash/merchant-api-python-sdk
mcash/mapi_client/mapi_client.py
MapiClient.do_req
def do_req(self, method, url, body=None, headers=None, status=None): """Used internally to send a request to the API, left public so it can be used to talk to the API more directly. """ if body is None: body = '' else: body = json.dumps(body) res =...
python
def do_req(self, method, url, body=None, headers=None, status=None): """Used internally to send a request to the API, left public so it can be used to talk to the API more directly. """ if body is None: body = '' else: body = json.dumps(body) res =...
[ "def", "do_req", "(", "self", ",", "method", ",", "url", ",", "body", "=", "None", ",", "headers", "=", "None", ",", "status", "=", "None", ")", ":", "if", "body", "is", "None", ":", "body", "=", "''", "else", ":", "body", "=", "json", ".", "du...
Used internally to send a request to the API, left public so it can be used to talk to the API more directly.
[ "Used", "internally", "to", "send", "a", "request", "to", "the", "API", "left", "public", "so", "it", "can", "be", "used", "to", "talk", "to", "the", "API", "more", "directly", "." ]
ebe8734126790354b71077aca519ff263235944e
https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/mapi_client.py#L68-L89
train
57,516
mcash/merchant-api-python-sdk
mcash/mapi_client/mapi_client.py
MapiClient._depaginate_all
def _depaginate_all(self, url): """GETs the url provided and traverses the 'next' url that's returned while storing the data in a list. Returns a single list of all items. """ items = [] for x in self._depagination_generator(url): items += x return ite...
python
def _depaginate_all(self, url): """GETs the url provided and traverses the 'next' url that's returned while storing the data in a list. Returns a single list of all items. """ items = [] for x in self._depagination_generator(url): items += x return ite...
[ "def", "_depaginate_all", "(", "self", ",", "url", ")", ":", "items", "=", "[", "]", "for", "x", "in", "self", ".", "_depagination_generator", "(", "url", ")", ":", "items", "+=", "x", "return", "items" ]
GETs the url provided and traverses the 'next' url that's returned while storing the data in a list. Returns a single list of all items.
[ "GETs", "the", "url", "provided", "and", "traverses", "the", "next", "url", "that", "s", "returned", "while", "storing", "the", "data", "in", "a", "list", ".", "Returns", "a", "single", "list", "of", "all", "items", "." ]
ebe8734126790354b71077aca519ff263235944e
https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/mapi_client.py#L101-L109
train
57,517
mcash/merchant-api-python-sdk
mcash/mapi_client/mapi_client.py
MapiClient.create_user
def create_user(self, user_id, roles=None, netmask=None, secret=None, pubkey=None): u"""Create user for the Merchant given in the X-Mcash-Merchant header. Arguments: user_id: Identifier for the user roles: R...
python
def create_user(self, user_id, roles=None, netmask=None, secret=None, pubkey=None): u"""Create user for the Merchant given in the X-Mcash-Merchant header. Arguments: user_id: Identifier for the user roles: R...
[ "def", "create_user", "(", "self", ",", "user_id", ",", "roles", "=", "None", ",", "netmask", "=", "None", ",", "secret", "=", "None", ",", "pubkey", "=", "None", ")", ":", "arguments", "=", "{", "'id'", ":", "user_id", ",", "'roles'", ":", "roles", ...
u"""Create user for the Merchant given in the X-Mcash-Merchant header. Arguments: user_id: Identifier for the user roles: Role netmask: Limit user connections by netmask, for example 192.168.1.0/24 secret: ...
[ "u", "Create", "user", "for", "the", "Merchant", "given", "in", "the", "X", "-", "Mcash", "-", "Merchant", "header", "." ]
ebe8734126790354b71077aca519ff263235944e
https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/mapi_client.py#L139-L161
train
57,518
mcash/merchant-api-python-sdk
mcash/mapi_client/mapi_client.py
MapiClient.update_user
def update_user(self, user_id, roles=None, netmask=None, secret=None, pubkey=None): """Update user. Returns the raw response object. Arguments: user_id: User id of user to update roles: Role netm...
python
def update_user(self, user_id, roles=None, netmask=None, secret=None, pubkey=None): """Update user. Returns the raw response object. Arguments: user_id: User id of user to update roles: Role netm...
[ "def", "update_user", "(", "self", ",", "user_id", ",", "roles", "=", "None", ",", "netmask", "=", "None", ",", "secret", "=", "None", ",", "pubkey", "=", "None", ")", ":", "arguments", "=", "{", "'roles'", ":", "roles", ",", "'netmask'", ":", "netma...
Update user. Returns the raw response object. Arguments: user_id: User id of user to update roles: Role netmask: Limit user connections by netmask, for example 192.168.1.0/24 secret: Secret used when...
[ "Update", "user", ".", "Returns", "the", "raw", "response", "object", "." ]
ebe8734126790354b71077aca519ff263235944e
https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/mapi_client.py#L164-L187
train
57,519
mcash/merchant-api-python-sdk
mcash/mapi_client/mapi_client.py
MapiClient.create_pos
def create_pos(self, name, pos_type, pos_id, location=None): """Create POS resource Arguments: name: Human-readable name of the POS, used for displaying payment request origin to end user pos_type: POS type ...
python
def create_pos(self, name, pos_type, pos_id, location=None): """Create POS resource Arguments: name: Human-readable name of the POS, used for displaying payment request origin to end user pos_type: POS type ...
[ "def", "create_pos", "(", "self", ",", "name", ",", "pos_type", ",", "pos_id", ",", "location", "=", "None", ")", ":", "arguments", "=", "{", "'name'", ":", "name", ",", "'type'", ":", "pos_type", ",", "'id'", ":", "pos_id", ",", "'location'", ":", "...
Create POS resource Arguments: name: Human-readable name of the POS, used for displaying payment request origin to end user pos_type: POS type location: Merchant location pos_id: The ...
[ "Create", "POS", "resource" ]
ebe8734126790354b71077aca519ff263235944e
https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/mapi_client.py#L201-L221
train
57,520
mcash/merchant-api-python-sdk
mcash/mapi_client/mapi_client.py
MapiClient.update_pos
def update_pos(self, pos_id, name, pos_type, location=None): """Update POS resource. Returns the raw response object. Arguments: pos_id: POS id as chosen on registration name: Human-readable name of the POS, used for displaying payment ...
python
def update_pos(self, pos_id, name, pos_type, location=None): """Update POS resource. Returns the raw response object. Arguments: pos_id: POS id as chosen on registration name: Human-readable name of the POS, used for displaying payment ...
[ "def", "update_pos", "(", "self", ",", "pos_id", ",", "name", ",", "pos_type", ",", "location", "=", "None", ")", ":", "arguments", "=", "{", "'name'", ":", "name", ",", "'type'", ":", "pos_type", ",", "'location'", ":", "location", "}", "return", "sel...
Update POS resource. Returns the raw response object. Arguments: pos_id: POS id as chosen on registration name: Human-readable name of the POS, used for displaying payment request origin to end user pos_type: PO...
[ "Update", "POS", "resource", ".", "Returns", "the", "raw", "response", "object", "." ]
ebe8734126790354b71077aca519ff263235944e
https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/mapi_client.py#L229-L248
train
57,521
mcash/merchant-api-python-sdk
mcash/mapi_client/mapi_client.py
MapiClient.create_payment_request
def create_payment_request(self, customer, currency, amount, allow_credit, pos_id, pos_tid, action, ledger=None, display_message_uri=None, callback_uri=None, additional_amount=None, additional_edit=None, ...
python
def create_payment_request(self, customer, currency, amount, allow_credit, pos_id, pos_tid, action, ledger=None, display_message_uri=None, callback_uri=None, additional_amount=None, additional_edit=None, ...
[ "def", "create_payment_request", "(", "self", ",", "customer", ",", "currency", ",", "amount", ",", "allow_credit", ",", "pos_id", ",", "pos_tid", ",", "action", ",", "ledger", "=", "None", ",", "display_message_uri", "=", "None", ",", "callback_uri", "=", "...
Post payment request. The call is idempotent; that is, if one posts the same pos_id and pos_tid twice, only one payment request is created. Arguments: ledger: Log entries will be added to the open report on the specified ledger display_message_uri...
[ "Post", "payment", "request", ".", "The", "call", "is", "idempotent", ";", "that", "is", "if", "one", "posts", "the", "same", "pos_id", "and", "pos_tid", "twice", "only", "one", "payment", "request", "is", "created", "." ]
ebe8734126790354b71077aca519ff263235944e
https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/mapi_client.py#L273-L369
train
57,522
mcash/merchant-api-python-sdk
mcash/mapi_client/mapi_client.py
MapiClient.update_payment_request
def update_payment_request(self, tid, currency=None, amount=None, action=None, ledger=None, callback_uri=None, display_message_uri=None, capture_id=None, additional_amount=None, text=None, refund_id=None, ...
python
def update_payment_request(self, tid, currency=None, amount=None, action=None, ledger=None, callback_uri=None, display_message_uri=None, capture_id=None, additional_amount=None, text=None, refund_id=None, ...
[ "def", "update_payment_request", "(", "self", ",", "tid", ",", "currency", "=", "None", ",", "amount", "=", "None", ",", "action", "=", "None", ",", "ledger", "=", "None", ",", "callback_uri", "=", "None", ",", "display_message_uri", "=", "None", ",", "c...
Update payment request, reauthorize, capture, release or abort It is possible to update ledger and the callback URIs for a payment request. Changes are always appended to the open report of a ledger, and notifications are sent to the callback registered at the time of notification. ...
[ "Update", "payment", "request", "reauthorize", "capture", "release", "or", "abort" ]
ebe8734126790354b71077aca519ff263235944e
https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/mapi_client.py#L372-L455
train
57,523
mcash/merchant-api-python-sdk
mcash/mapi_client/mapi_client.py
MapiClient.post_chat_message
def post_chat_message(self, merchant_id, channel_id, message): """post a chat message Arguments: channel_id: Scan token """ return self.do_req('POST', self.base_url + '/chat/v1/merchant/%s/channel/%s/message/' % (merchant_id, chann...
python
def post_chat_message(self, merchant_id, channel_id, message): """post a chat message Arguments: channel_id: Scan token """ return self.do_req('POST', self.base_url + '/chat/v1/merchant/%s/channel/%s/message/' % (merchant_id, chann...
[ "def", "post_chat_message", "(", "self", ",", "merchant_id", ",", "channel_id", ",", "message", ")", ":", "return", "self", ".", "do_req", "(", "'POST'", ",", "self", ".", "base_url", "+", "'/chat/v1/merchant/%s/channel/%s/message/'", "%", "(", "merchant_id", ",...
post a chat message Arguments: channel_id: Scan token
[ "post", "a", "chat", "message" ]
ebe8734126790354b71077aca519ff263235944e
https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/mapi_client.py#L479-L489
train
57,524
mcash/merchant-api-python-sdk
mcash/mapi_client/mapi_client.py
MapiClient.create_shortlink
def create_shortlink(self, callback_uri=None, description=None, serial_number=None): """Register new shortlink Arguments: callback_uri: URI called by mCASH when user scans shortlink description: Shortlink description displ...
python
def create_shortlink(self, callback_uri=None, description=None, serial_number=None): """Register new shortlink Arguments: callback_uri: URI called by mCASH when user scans shortlink description: Shortlink description displ...
[ "def", "create_shortlink", "(", "self", ",", "callback_uri", "=", "None", ",", "description", "=", "None", ",", "serial_number", "=", "None", ")", ":", "arguments", "=", "{", "'callback_uri'", ":", "callback_uri", ",", "'description'", ":", "description", ",",...
Register new shortlink Arguments: callback_uri: URI called by mCASH when user scans shortlink description: Shortlink description displayed in confirmation dialogs serial_number: Serial number on printed QR codes. This field is ...
[ "Register", "new", "shortlink" ]
ebe8734126790354b71077aca519ff263235944e
https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/mapi_client.py#L515-L532
train
57,525
mcash/merchant-api-python-sdk
mcash/mapi_client/mapi_client.py
MapiClient.update_shortlink
def update_shortlink(self, shortlink_id, callback_uri=None, description=None): """Update existing shortlink registration Arguments: shortlink_id: Shortlink id assigned by mCASH """ arguments = {'callback_uri': callback_uri, ...
python
def update_shortlink(self, shortlink_id, callback_uri=None, description=None): """Update existing shortlink registration Arguments: shortlink_id: Shortlink id assigned by mCASH """ arguments = {'callback_uri': callback_uri, ...
[ "def", "update_shortlink", "(", "self", ",", "shortlink_id", ",", "callback_uri", "=", "None", ",", "description", "=", "None", ")", ":", "arguments", "=", "{", "'callback_uri'", ":", "callback_uri", ",", "'description'", ":", "description", "}", "return", "se...
Update existing shortlink registration Arguments: shortlink_id: Shortlink id assigned by mCASH
[ "Update", "existing", "shortlink", "registration" ]
ebe8734126790354b71077aca519ff263235944e
https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/mapi_client.py#L547-L559
train
57,526
mcash/merchant-api-python-sdk
mcash/mapi_client/mapi_client.py
MapiClient.get_shortlink
def get_shortlink(self, shortlink_id_or_url): """Retrieve registered shortlink info Arguments: shortlink_id_or_url: Shortlink id or url, assigned by mCASH """ if "://" not in shortlink_id_or_url: shortlink_id_or_url = self.merchant_api_base_url + ...
python
def get_shortlink(self, shortlink_id_or_url): """Retrieve registered shortlink info Arguments: shortlink_id_or_url: Shortlink id or url, assigned by mCASH """ if "://" not in shortlink_id_or_url: shortlink_id_or_url = self.merchant_api_base_url + ...
[ "def", "get_shortlink", "(", "self", ",", "shortlink_id_or_url", ")", ":", "if", "\"://\"", "not", "in", "shortlink_id_or_url", ":", "shortlink_id_or_url", "=", "self", ".", "merchant_api_base_url", "+", "'/shortlink/'", "+", "shortlink_id_or_url", "+", "'/'", "retu...
Retrieve registered shortlink info Arguments: shortlink_id_or_url: Shortlink id or url, assigned by mCASH
[ "Retrieve", "registered", "shortlink", "info" ]
ebe8734126790354b71077aca519ff263235944e
https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/mapi_client.py#L572-L582
train
57,527
mcash/merchant-api-python-sdk
mcash/mapi_client/mapi_client.py
MapiClient.create_ledger
def create_ledger(self, currency, description=None): """Create a ledger """ arguments = {'currency': currency, 'description': description} return self.do_req('POST', self.merchant_api_base_url + '/ledger/', arguments).json()
python
def create_ledger(self, currency, description=None): """Create a ledger """ arguments = {'currency': currency, 'description': description} return self.do_req('POST', self.merchant_api_base_url + '/ledger/', arguments).json()
[ "def", "create_ledger", "(", "self", ",", "currency", ",", "description", "=", "None", ")", ":", "arguments", "=", "{", "'currency'", ":", "currency", ",", "'description'", ":", "description", "}", "return", "self", ".", "do_req", "(", "'POST'", ",", "self...
Create a ledger
[ "Create", "a", "ledger" ]
ebe8734126790354b71077aca519ff263235944e
https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/mapi_client.py#L585-L591
train
57,528
mcash/merchant-api-python-sdk
mcash/mapi_client/mapi_client.py
MapiClient.update_ledger
def update_ledger(self, ledger_id, description=None): """Update ledger info Arguments: ledger_id: Ledger id assigned by mCASH description: Description of the Ledger and it's usage """ arguments = {'description': description} ...
python
def update_ledger(self, ledger_id, description=None): """Update ledger info Arguments: ledger_id: Ledger id assigned by mCASH description: Description of the Ledger and it's usage """ arguments = {'description': description} ...
[ "def", "update_ledger", "(", "self", ",", "ledger_id", ",", "description", "=", "None", ")", ":", "arguments", "=", "{", "'description'", ":", "description", "}", "return", "self", ".", "do_req", "(", "'PUT'", ",", "self", ".", "merchant_api_base_url", "+", ...
Update ledger info Arguments: ledger_id: Ledger id assigned by mCASH description: Description of the Ledger and it's usage
[ "Update", "ledger", "info" ]
ebe8734126790354b71077aca519ff263235944e
https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/mapi_client.py#L599-L611
train
57,529
mcash/merchant-api-python-sdk
mcash/mapi_client/mapi_client.py
MapiClient.close_report
def close_report(self, ledger_id, report_id, callback_uri=None): u"""Close Report When you PUT to a report, it will start the process of closing it. When the closing process is complete (i.e. when report.status == 'closed') mCASH does a POST call to callback_uri, if provided. This call ...
python
def close_report(self, ledger_id, report_id, callback_uri=None): u"""Close Report When you PUT to a report, it will start the process of closing it. When the closing process is complete (i.e. when report.status == 'closed') mCASH does a POST call to callback_uri, if provided. This call ...
[ "def", "close_report", "(", "self", ",", "ledger_id", ",", "report_id", ",", "callback_uri", "=", "None", ")", ":", "arguments", "=", "{", "'callback_uri'", ":", "callback_uri", "}", "return", "self", ".", "do_req", "(", "'PUT'", ",", "self", ".", "merchan...
u"""Close Report When you PUT to a report, it will start the process of closing it. When the closing process is complete (i.e. when report.status == 'closed') mCASH does a POST call to callback_uri, if provided. This call will contain JSON data similar to when GETing the Report. ...
[ "u", "Close", "Report" ]
ebe8734126790354b71077aca519ff263235944e
https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/mapi_client.py#L648-L675
train
57,530
mcash/merchant-api-python-sdk
mcash/mapi_client/mapi_client.py
MapiClient.get_report
def get_report(self, ledger_id, report_id): """Get report info Arguments: ledger_id: Id for ledger for report report_id: Report id assigned by mCASH """ return self.do_req('GET', self.merchant_api_base_ur...
python
def get_report(self, ledger_id, report_id): """Get report info Arguments: ledger_id: Id for ledger for report report_id: Report id assigned by mCASH """ return self.do_req('GET', self.merchant_api_base_ur...
[ "def", "get_report", "(", "self", ",", "ledger_id", ",", "report_id", ")", ":", "return", "self", ".", "do_req", "(", "'GET'", ",", "self", ".", "merchant_api_base_url", "+", "'/ledger/'", "+", "ledger_id", "+", "'/report/'", "+", "report_id", "+", "'/'", ...
Get report info Arguments: ledger_id: Id for ledger for report report_id: Report id assigned by mCASH
[ "Get", "report", "info" ]
ebe8734126790354b71077aca519ff263235944e
https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/mapi_client.py#L677-L689
train
57,531
mcash/merchant-api-python-sdk
mcash/mapi_client/mapi_client.py
MapiClient.create_permission_request
def create_permission_request(self, customer, pos_id, pos_tid, scope, ledger=None, text=None, callback_uri=None, expires_in=None): """Create permission request The call is idempotent; that is, if one posts the same pos_id and p...
python
def create_permission_request(self, customer, pos_id, pos_tid, scope, ledger=None, text=None, callback_uri=None, expires_in=None): """Create permission request The call is idempotent; that is, if one posts the same pos_id and p...
[ "def", "create_permission_request", "(", "self", ",", "customer", ",", "pos_id", ",", "pos_tid", ",", "scope", ",", "ledger", "=", "None", ",", "text", "=", "None", ",", "callback_uri", "=", "None", ",", "expires_in", "=", "None", ")", ":", "arguments", ...
Create permission request The call is idempotent; that is, if one posts the same pos_id and pos_tid twice, only one Permission request is created.
[ "Create", "permission", "request" ]
ebe8734126790354b71077aca519ff263235944e
https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/mapi_client.py#L723-L741
train
57,532
mcash/merchant-api-python-sdk
mcash/mapi_client/mapi_client.py
MapiClient.upload_receipt
def upload_receipt(self, url, data): """Upload a receipt to the give url :param url: :param data: :return: """ return self.upload_attachment(url=url, data=data, mime_type='application/vnd.mcash.receipt.v1+json')
python
def upload_receipt(self, url, data): """Upload a receipt to the give url :param url: :param data: :return: """ return self.upload_attachment(url=url, data=data, mime_type='application/vnd.mcash.receipt.v1+json')
[ "def", "upload_receipt", "(", "self", ",", "url", ",", "data", ")", ":", "return", "self", ".", "upload_attachment", "(", "url", "=", "url", ",", "data", "=", "data", ",", "mime_type", "=", "'application/vnd.mcash.receipt.v1+json'", ")" ]
Upload a receipt to the give url :param url: :param data: :return:
[ "Upload", "a", "receipt", "to", "the", "give", "url" ]
ebe8734126790354b71077aca519ff263235944e
https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/mapi_client.py#L777-L784
train
57,533
MKLab-ITI/reveal-user-annotation
reveal_user_annotation/twitter/twitter_util.py
safe_twitter_request_handler
def safe_twitter_request_handler(twitter_api_func, call_rate_limit, call_counter, time_window_start, max_retries, wait_period, ...
python
def safe_twitter_request_handler(twitter_api_func, call_rate_limit, call_counter, time_window_start, max_retries, wait_period, ...
[ "def", "safe_twitter_request_handler", "(", "twitter_api_func", ",", "call_rate_limit", ",", "call_counter", ",", "time_window_start", ",", "max_retries", ",", "wait_period", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "error_count", "=", "0", "while", "Tru...
This is a safe function handler for any twitter request. Inputs: - twitter_api_func: The twython function object to be safely called. - call_rate_limit: THe call rate limit for this specific Twitter API function. - call_counter: A counter that keeps track of the number of function calls ...
[ "This", "is", "a", "safe", "function", "handler", "for", "any", "twitter", "request", "." ]
ed019c031857b091e5601f53ba3f01a499a0e3ef
https://github.com/MKLab-ITI/reveal-user-annotation/blob/ed019c031857b091e5601f53ba3f01a499a0e3ef/reveal_user_annotation/twitter/twitter_util.py#L27-L94
train
57,534
MKLab-ITI/reveal-user-annotation
reveal_user_annotation/twitter/twitter_util.py
handle_twitter_http_error
def handle_twitter_http_error(e, error_count, call_counter, time_window_start, wait_period): """ This function handles the twitter request in case of an HTTP error. Inputs: - e: A twython.TwythonError instance to be handled. - error_count: Number of failed retries of the call until now. ...
python
def handle_twitter_http_error(e, error_count, call_counter, time_window_start, wait_period): """ This function handles the twitter request in case of an HTTP error. Inputs: - e: A twython.TwythonError instance to be handled. - error_count: Number of failed retries of the call until now. ...
[ "def", "handle_twitter_http_error", "(", "e", ",", "error_count", ",", "call_counter", ",", "time_window_start", ",", "wait_period", ")", ":", "if", "e", ".", "error_code", "==", "401", ":", "# Encountered 401 Error (Not Authorized)", "raise", "e", "elif", "e", "....
This function handles the twitter request in case of an HTTP error. Inputs: - e: A twython.TwythonError instance to be handled. - error_count: Number of failed retries of the call until now. - call_counter: A counter that keeps track of the number of function calls in the current 15-minu...
[ "This", "function", "handles", "the", "twitter", "request", "in", "case", "of", "an", "HTTP", "error", "." ]
ed019c031857b091e5601f53ba3f01a499a0e3ef
https://github.com/MKLab-ITI/reveal-user-annotation/blob/ed019c031857b091e5601f53ba3f01a499a0e3ef/reveal_user_annotation/twitter/twitter_util.py#L97-L134
train
57,535
sdcooke/django_bundles
django_bundles/management/commands/create_bundles.py
make_bundle
def make_bundle(bundle, fixed_version=None): """ Does all of the processing required to create a bundle and write it to disk, returning its hash version """ tmp_output_file_name = '%s.%s.%s' % (os.path.join(bundle.bundle_file_root, bundle.bundle_filename), 'temp', bundle.bundle_type) iter_input = i...
python
def make_bundle(bundle, fixed_version=None): """ Does all of the processing required to create a bundle and write it to disk, returning its hash version """ tmp_output_file_name = '%s.%s.%s' % (os.path.join(bundle.bundle_file_root, bundle.bundle_filename), 'temp', bundle.bundle_type) iter_input = i...
[ "def", "make_bundle", "(", "bundle", ",", "fixed_version", "=", "None", ")", ":", "tmp_output_file_name", "=", "'%s.%s.%s'", "%", "(", "os", ".", "path", ".", "join", "(", "bundle", ".", "bundle_file_root", ",", "bundle", ".", "bundle_filename", ")", ",", ...
Does all of the processing required to create a bundle and write it to disk, returning its hash version
[ "Does", "all", "of", "the", "processing", "required", "to", "create", "a", "bundle", "and", "write", "it", "to", "disk", "returning", "its", "hash", "version" ]
2810fc455ec7391283792c1f108f4e8340f5d12f
https://github.com/sdcooke/django_bundles/blob/2810fc455ec7391283792c1f108f4e8340f5d12f/django_bundles/management/commands/create_bundles.py#L76-L99
train
57,536
solocompt/plugs-core
plugs_core/utils.py
html_to_text
def html_to_text(html_string): """ returns a plain text string when given a html string text handles a, p, h1 to h6 and br, inserts newline chars to create space in the string @todo handle images """ # create a valid html document from string # beware that it inserts <hmtl> <body> and <p...
python
def html_to_text(html_string): """ returns a plain text string when given a html string text handles a, p, h1 to h6 and br, inserts newline chars to create space in the string @todo handle images """ # create a valid html document from string # beware that it inserts <hmtl> <body> and <p...
[ "def", "html_to_text", "(", "html_string", ")", ":", "# create a valid html document from string", "# beware that it inserts <hmtl> <body> and <p> tags", "# where needed", "html_tree", "=", "html", ".", "document_fromstring", "(", "html_string", ")", "# handle header tags", "for"...
returns a plain text string when given a html string text handles a, p, h1 to h6 and br, inserts newline chars to create space in the string @todo handle images
[ "returns", "a", "plain", "text", "string", "when", "given", "a", "html", "string", "text", "handles", "a", "p", "h1", "to", "h6", "and", "br", "inserts", "newline", "chars", "to", "create", "space", "in", "the", "string" ]
19fd23101fcfdabe657485f0a22e6b63e2b44f9d
https://github.com/solocompt/plugs-core/blob/19fd23101fcfdabe657485f0a22e6b63e2b44f9d/plugs_core/utils.py#L82-L119
train
57,537
solocompt/plugs-core
plugs_core/utils.py
random_string
def random_string(**kwargs): """ By default generates a random string of 10 chars composed of digits and ascii lowercase letters. String length and pool can be override by using kwargs. Pool must be a list of strings """ n = kwargs.get('length', 10) pool = kwargs.get('pool') or string.digits...
python
def random_string(**kwargs): """ By default generates a random string of 10 chars composed of digits and ascii lowercase letters. String length and pool can be override by using kwargs. Pool must be a list of strings """ n = kwargs.get('length', 10) pool = kwargs.get('pool') or string.digits...
[ "def", "random_string", "(", "*", "*", "kwargs", ")", ":", "n", "=", "kwargs", ".", "get", "(", "'length'", ",", "10", ")", "pool", "=", "kwargs", ".", "get", "(", "'pool'", ")", "or", "string", ".", "digits", "+", "string", ".", "ascii_lowercase", ...
By default generates a random string of 10 chars composed of digits and ascii lowercase letters. String length and pool can be override by using kwargs. Pool must be a list of strings
[ "By", "default", "generates", "a", "random", "string", "of", "10", "chars", "composed", "of", "digits", "and", "ascii", "lowercase", "letters", ".", "String", "length", "and", "pool", "can", "be", "override", "by", "using", "kwargs", ".", "Pool", "must", "...
19fd23101fcfdabe657485f0a22e6b63e2b44f9d
https://github.com/solocompt/plugs-core/blob/19fd23101fcfdabe657485f0a22e6b63e2b44f9d/plugs_core/utils.py#L122-L130
train
57,538
pbrisk/timewave
timewave/engine.py
Engine._run_parallel_process_with_profiling
def _run_parallel_process_with_profiling(self, start_path, stop_path, queue, filename): """ wrapper for usage of profiling """ runctx('Engine._run_parallel_process(self, start_path, stop_path, queue)', globals(), locals(), filename)
python
def _run_parallel_process_with_profiling(self, start_path, stop_path, queue, filename): """ wrapper for usage of profiling """ runctx('Engine._run_parallel_process(self, start_path, stop_path, queue)', globals(), locals(), filename)
[ "def", "_run_parallel_process_with_profiling", "(", "self", ",", "start_path", ",", "stop_path", ",", "queue", ",", "filename", ")", ":", "runctx", "(", "'Engine._run_parallel_process(self, start_path, stop_path, queue)'", ",", "globals", "(", ")", ",", "locals", "(", ...
wrapper for usage of profiling
[ "wrapper", "for", "usage", "of", "profiling" ]
cf641391d1607a424042724c8b990d43ee270ef6
https://github.com/pbrisk/timewave/blob/cf641391d1607a424042724c8b990d43ee270ef6/timewave/engine.py#L159-L163
train
57,539
pbrisk/timewave
timewave/engine.py
Engine._run_parallel_process
def _run_parallel_process(self, start_path, stop_path, queue): """ The function calls _run_process and puts results produced by consumer at observations of top most consumer in to the queue """ process_num = int(current_process().name.split('-', 2)[1]) self._run_process(s...
python
def _run_parallel_process(self, start_path, stop_path, queue): """ The function calls _run_process and puts results produced by consumer at observations of top most consumer in to the queue """ process_num = int(current_process().name.split('-', 2)[1]) self._run_process(s...
[ "def", "_run_parallel_process", "(", "self", ",", "start_path", ",", "stop_path", ",", "queue", ")", ":", "process_num", "=", "int", "(", "current_process", "(", ")", ".", "name", ".", "split", "(", "'-'", ",", "2", ")", "[", "1", "]", ")", "self", "...
The function calls _run_process and puts results produced by consumer at observations of top most consumer in to the queue
[ "The", "function", "calls", "_run_process", "and", "puts", "results", "produced", "by", "consumer", "at", "observations", "of", "top", "most", "consumer", "in", "to", "the", "queue" ]
cf641391d1607a424042724c8b990d43ee270ef6
https://github.com/pbrisk/timewave/blob/cf641391d1607a424042724c8b990d43ee270ef6/timewave/engine.py#L165-L172
train
57,540
pbrisk/timewave
timewave/engine.py
Engine._run_process
def _run_process(self, start_path, stop_path, process_num=0): """ The function calls _run_path for given set of paths """ # pre processing self.producer.initialize_worker(process_num) self.consumer.initialize_worker(process_num) # processing for path in r...
python
def _run_process(self, start_path, stop_path, process_num=0): """ The function calls _run_path for given set of paths """ # pre processing self.producer.initialize_worker(process_num) self.consumer.initialize_worker(process_num) # processing for path in r...
[ "def", "_run_process", "(", "self", ",", "start_path", ",", "stop_path", ",", "process_num", "=", "0", ")", ":", "# pre processing", "self", ".", "producer", ".", "initialize_worker", "(", "process_num", ")", "self", ".", "consumer", ".", "initialize_worker", ...
The function calls _run_path for given set of paths
[ "The", "function", "calls", "_run_path", "for", "given", "set", "of", "paths" ]
cf641391d1607a424042724c8b990d43ee270ef6
https://github.com/pbrisk/timewave/blob/cf641391d1607a424042724c8b990d43ee270ef6/timewave/engine.py#L174-L187
train
57,541
pbrisk/timewave
timewave/engine.py
Engine._run_path
def _run_path(self, path_num): """ standalone function implementing a single loop of Monte Carlo It returns list produced by consumer at observation dates :param int path_num: path number """ # pre processing self.producer.initialize_path(path_num) self.c...
python
def _run_path(self, path_num): """ standalone function implementing a single loop of Monte Carlo It returns list produced by consumer at observation dates :param int path_num: path number """ # pre processing self.producer.initialize_path(path_num) self.c...
[ "def", "_run_path", "(", "self", ",", "path_num", ")", ":", "# pre processing", "self", ".", "producer", ".", "initialize_path", "(", "path_num", ")", "self", ".", "consumer", ".", "initialize_path", "(", "path_num", ")", "# processing", "for", "new_date", "in...
standalone function implementing a single loop of Monte Carlo It returns list produced by consumer at observation dates :param int path_num: path number
[ "standalone", "function", "implementing", "a", "single", "loop", "of", "Monte", "Carlo", "It", "returns", "list", "produced", "by", "consumer", "at", "observation", "dates" ]
cf641391d1607a424042724c8b990d43ee270ef6
https://github.com/pbrisk/timewave/blob/cf641391d1607a424042724c8b990d43ee270ef6/timewave/engine.py#L189-L206
train
57,542
pbrisk/timewave
timewave/engine.py
Consumer.initialize_worker
def initialize_worker(self, process_num=None): """ reinitialize consumer for process in multiprocesing """ self.initialize(self.grid, self.num_of_paths, self.seed)
python
def initialize_worker(self, process_num=None): """ reinitialize consumer for process in multiprocesing """ self.initialize(self.grid, self.num_of_paths, self.seed)
[ "def", "initialize_worker", "(", "self", ",", "process_num", "=", "None", ")", ":", "self", ".", "initialize", "(", "self", ".", "grid", ",", "self", ".", "num_of_paths", ",", "self", ".", "seed", ")" ]
reinitialize consumer for process in multiprocesing
[ "reinitialize", "consumer", "for", "process", "in", "multiprocesing" ]
cf641391d1607a424042724c8b990d43ee270ef6
https://github.com/pbrisk/timewave/blob/cf641391d1607a424042724c8b990d43ee270ef6/timewave/engine.py#L248-L252
train
57,543
pbrisk/timewave
timewave/engine.py
Consumer.initialize_path
def initialize_path(self, path_num=None): """ initialize consumer for next path """ self.state = copy(self.initial_state) return self.state
python
def initialize_path(self, path_num=None): """ initialize consumer for next path """ self.state = copy(self.initial_state) return self.state
[ "def", "initialize_path", "(", "self", ",", "path_num", "=", "None", ")", ":", "self", ".", "state", "=", "copy", "(", "self", ".", "initial_state", ")", "return", "self", ".", "state" ]
initialize consumer for next path
[ "initialize", "consumer", "for", "next", "path" ]
cf641391d1607a424042724c8b990d43ee270ef6
https://github.com/pbrisk/timewave/blob/cf641391d1607a424042724c8b990d43ee270ef6/timewave/engine.py#L254-L259
train
57,544
pbrisk/timewave
timewave/engine.py
Consumer.consume
def consume(self, state): """ consume new producer state """ self.state.append(self.func(state)) return self.state
python
def consume(self, state): """ consume new producer state """ self.state.append(self.func(state)) return self.state
[ "def", "consume", "(", "self", ",", "state", ")", ":", "self", ".", "state", ".", "append", "(", "self", ".", "func", "(", "state", ")", ")", "return", "self", ".", "state" ]
consume new producer state
[ "consume", "new", "producer", "state" ]
cf641391d1607a424042724c8b990d43ee270ef6
https://github.com/pbrisk/timewave/blob/cf641391d1607a424042724c8b990d43ee270ef6/timewave/engine.py#L261-L266
train
57,545
pbrisk/timewave
timewave/engine.py
Consumer.get
def get(self, queue_get): """ to get states from multiprocessing.queue """ if isinstance(queue_get, (tuple, list)): self.result.extend(queue_get)
python
def get(self, queue_get): """ to get states from multiprocessing.queue """ if isinstance(queue_get, (tuple, list)): self.result.extend(queue_get)
[ "def", "get", "(", "self", ",", "queue_get", ")", ":", "if", "isinstance", "(", "queue_get", ",", "(", "tuple", ",", "list", ")", ")", ":", "self", ".", "result", ".", "extend", "(", "queue_get", ")" ]
to get states from multiprocessing.queue
[ "to", "get", "states", "from", "multiprocessing", ".", "queue" ]
cf641391d1607a424042724c8b990d43ee270ef6
https://github.com/pbrisk/timewave/blob/cf641391d1607a424042724c8b990d43ee270ef6/timewave/engine.py#L296-L301
train
57,546
Jarn/jarn.mkrelease
jarn/mkrelease/setup.py
walk_revctrl
def walk_revctrl(dirname='', ff=''): """Return files found by the file-finder 'ff'. """ file_finder = None items = [] if not ff: distutils.log.error('No file-finder passed to walk_revctrl') sys.exit(1) for ep in pkg_resources.iter_entry_points('setuptools.file_finders'): ...
python
def walk_revctrl(dirname='', ff=''): """Return files found by the file-finder 'ff'. """ file_finder = None items = [] if not ff: distutils.log.error('No file-finder passed to walk_revctrl') sys.exit(1) for ep in pkg_resources.iter_entry_points('setuptools.file_finders'): ...
[ "def", "walk_revctrl", "(", "dirname", "=", "''", ",", "ff", "=", "''", ")", ":", "file_finder", "=", "None", "items", "=", "[", "]", "if", "not", "ff", ":", "distutils", ".", "log", ".", "error", "(", "'No file-finder passed to walk_revctrl'", ")", "sys...
Return files found by the file-finder 'ff'.
[ "Return", "files", "found", "by", "the", "file", "-", "finder", "ff", "." ]
844377f37a3cdc0a154148790a926f991019ec4a
https://github.com/Jarn/jarn.mkrelease/blob/844377f37a3cdc0a154148790a926f991019ec4a/jarn/mkrelease/setup.py#L29-L58
train
57,547
Jarn/jarn.mkrelease
jarn/mkrelease/setup.py
cleanup_pycache
def cleanup_pycache(): """Remove .pyc files we leave around because of import. """ try: for file in glob.glob('setup.py[co]'): os.remove(file) if isdir('__pycache__'): for file in glob.glob(join('__pycache__', 'setup.*.py[co]')): os.remove(file) ...
python
def cleanup_pycache(): """Remove .pyc files we leave around because of import. """ try: for file in glob.glob('setup.py[co]'): os.remove(file) if isdir('__pycache__'): for file in glob.glob(join('__pycache__', 'setup.*.py[co]')): os.remove(file) ...
[ "def", "cleanup_pycache", "(", ")", ":", "try", ":", "for", "file", "in", "glob", ".", "glob", "(", "'setup.py[co]'", ")", ":", "os", ".", "remove", "(", "file", ")", "if", "isdir", "(", "'__pycache__'", ")", ":", "for", "file", "in", "glob", ".", ...
Remove .pyc files we leave around because of import.
[ "Remove", ".", "pyc", "files", "we", "leave", "around", "because", "of", "import", "." ]
844377f37a3cdc0a154148790a926f991019ec4a
https://github.com/Jarn/jarn.mkrelease/blob/844377f37a3cdc0a154148790a926f991019ec4a/jarn/mkrelease/setup.py#L69-L81
train
57,548
Jarn/jarn.mkrelease
jarn/mkrelease/setup.py
run
def run(args, ff=''): """Run setup.py with monkey patches applied. """ import setuptools.command.egg_info if ff == 'none': setuptools.command.egg_info.walk_revctrl = no_walk_revctrl else: setuptools.command.egg_info.walk_revctrl = partial(walk_revctrl, ff=ff) sys.argv = ['setup....
python
def run(args, ff=''): """Run setup.py with monkey patches applied. """ import setuptools.command.egg_info if ff == 'none': setuptools.command.egg_info.walk_revctrl = no_walk_revctrl else: setuptools.command.egg_info.walk_revctrl = partial(walk_revctrl, ff=ff) sys.argv = ['setup....
[ "def", "run", "(", "args", ",", "ff", "=", "''", ")", ":", "import", "setuptools", ".", "command", ".", "egg_info", "if", "ff", "==", "'none'", ":", "setuptools", ".", "command", ".", "egg_info", ".", "walk_revctrl", "=", "no_walk_revctrl", "else", ":", ...
Run setup.py with monkey patches applied.
[ "Run", "setup", ".", "py", "with", "monkey", "patches", "applied", "." ]
844377f37a3cdc0a154148790a926f991019ec4a
https://github.com/Jarn/jarn.mkrelease/blob/844377f37a3cdc0a154148790a926f991019ec4a/jarn/mkrelease/setup.py#L84-L96
train
57,549
childsish/lhc-python
lhc/tools/sorter.py
Sorter._get_sorted_iterator
def _get_sorted_iterator(self, iterator): """ Get the iterator over the sorted items. This function decides whether the items can be sorted in memory or on disk. :return: """ lines = list(next(iterator)) if len(lines) < self.max_lines: return iter(sor...
python
def _get_sorted_iterator(self, iterator): """ Get the iterator over the sorted items. This function decides whether the items can be sorted in memory or on disk. :return: """ lines = list(next(iterator)) if len(lines) < self.max_lines: return iter(sor...
[ "def", "_get_sorted_iterator", "(", "self", ",", "iterator", ")", ":", "lines", "=", "list", "(", "next", "(", "iterator", ")", ")", "if", "len", "(", "lines", ")", "<", "self", ".", "max_lines", ":", "return", "iter", "(", "sorted", "(", "lines", ",...
Get the iterator over the sorted items. This function decides whether the items can be sorted in memory or on disk. :return:
[ "Get", "the", "iterator", "over", "the", "sorted", "items", "." ]
0a669f46a40a39f24d28665e8b5b606dc7e86beb
https://github.com/childsish/lhc-python/blob/0a669f46a40a39f24d28665e8b5b606dc7e86beb/lhc/tools/sorter.py#L20-L34
train
57,550
childsish/lhc-python
lhc/tools/sorter.py
Sorter._split
def _split(self, iterator, tmp_dir): """ Splits the file into several chunks. If the original file is too big to fit in the allocated space, the sorting will be split into several chunks, then merged. :param tmp_dir: Where to put the intermediate sorted results. :param o...
python
def _split(self, iterator, tmp_dir): """ Splits the file into several chunks. If the original file is too big to fit in the allocated space, the sorting will be split into several chunks, then merged. :param tmp_dir: Where to put the intermediate sorted results. :param o...
[ "def", "_split", "(", "self", ",", "iterator", ",", "tmp_dir", ")", ":", "fnames", "=", "[", "]", "for", "i", ",", "lines", "in", "enumerate", "(", "iterator", ")", ":", "lines", "=", "list", "(", "lines", ")", "out_fname", "=", "os", ".", "path", ...
Splits the file into several chunks. If the original file is too big to fit in the allocated space, the sorting will be split into several chunks, then merged. :param tmp_dir: Where to put the intermediate sorted results. :param orig_lines: The lines read before running out of space. ...
[ "Splits", "the", "file", "into", "several", "chunks", "." ]
0a669f46a40a39f24d28665e8b5b606dc7e86beb
https://github.com/childsish/lhc-python/blob/0a669f46a40a39f24d28665e8b5b606dc7e86beb/lhc/tools/sorter.py#L36-L54
train
57,551
childsish/lhc-python
lhc/tools/sorter.py
Sorter._write
def _write(self, lines, fname): """ Writes a intermediate temporary sorted file :param lines: The lines to write. :param fname: The name of the temporary file. :return: """ with open(fname, 'wb') as out_fhndl: for line in sorted(lines, key=self.key): ...
python
def _write(self, lines, fname): """ Writes a intermediate temporary sorted file :param lines: The lines to write. :param fname: The name of the temporary file. :return: """ with open(fname, 'wb') as out_fhndl: for line in sorted(lines, key=self.key): ...
[ "def", "_write", "(", "self", ",", "lines", ",", "fname", ")", ":", "with", "open", "(", "fname", ",", "'wb'", ")", "as", "out_fhndl", ":", "for", "line", "in", "sorted", "(", "lines", ",", "key", "=", "self", ".", "key", ")", ":", "pickle", ".",...
Writes a intermediate temporary sorted file :param lines: The lines to write. :param fname: The name of the temporary file. :return:
[ "Writes", "a", "intermediate", "temporary", "sorted", "file" ]
0a669f46a40a39f24d28665e8b5b606dc7e86beb
https://github.com/childsish/lhc-python/blob/0a669f46a40a39f24d28665e8b5b606dc7e86beb/lhc/tools/sorter.py#L56-L66
train
57,552
lamoreauxlab/srpenergy-api-client-python
srpenergy/client.py
get_iso_time
def get_iso_time(date_part, time_part): r"""Combign date and time into an iso datetime.""" str_date = datetime.datetime.strptime( date_part, '%m/%d/%Y').strftime('%Y-%m-%d') str_time = datetime.datetime.strptime( time_part, '%I:%M %p').strftime('%H:%M:%S') return str_date + "T" +...
python
def get_iso_time(date_part, time_part): r"""Combign date and time into an iso datetime.""" str_date = datetime.datetime.strptime( date_part, '%m/%d/%Y').strftime('%Y-%m-%d') str_time = datetime.datetime.strptime( time_part, '%I:%M %p').strftime('%H:%M:%S') return str_date + "T" +...
[ "def", "get_iso_time", "(", "date_part", ",", "time_part", ")", ":", "str_date", "=", "datetime", ".", "datetime", ".", "strptime", "(", "date_part", ",", "'%m/%d/%Y'", ")", ".", "strftime", "(", "'%Y-%m-%d'", ")", "str_time", "=", "datetime", ".", "datetime...
r"""Combign date and time into an iso datetime.
[ "r", "Combign", "date", "and", "time", "into", "an", "iso", "datetime", "." ]
dc703510672c2a3e7f3e82c879c9474d04874a40
https://github.com/lamoreauxlab/srpenergy-api-client-python/blob/dc703510672c2a3e7f3e82c879c9474d04874a40/srpenergy/client.py#L17-L24
train
57,553
MKLab-ITI/reveal-user-annotation
reveal_user_annotation/pserver/request.py
get_user_list
def get_user_list(host_name, client_name, client_pass): """ Pulls the list of users in a client. Inputs: - host_name: A string containing the address of the machine where the PServer instance is hosted. - client_name: The PServer client name. - client_pass: The PServer client's pass...
python
def get_user_list(host_name, client_name, client_pass): """ Pulls the list of users in a client. Inputs: - host_name: A string containing the address of the machine where the PServer instance is hosted. - client_name: The PServer client name. - client_pass: The PServer client's pass...
[ "def", "get_user_list", "(", "host_name", ",", "client_name", ",", "client_pass", ")", ":", "# Construct request.", "request", "=", "construct_request", "(", "model_type", "=", "\"pers\"", ",", "client_name", "=", "client_name", ",", "client_pass", "=", "client_pass...
Pulls the list of users in a client. Inputs: - host_name: A string containing the address of the machine where the PServer instance is hosted. - client_name: The PServer client name. - client_pass: The PServer client's password. Output: - user_id_list: A python list of user ids.
[ "Pulls", "the", "list", "of", "users", "in", "a", "client", "." ]
ed019c031857b091e5601f53ba3f01a499a0e3ef
https://github.com/MKLab-ITI/reveal-user-annotation/blob/ed019c031857b091e5601f53ba3f01a499a0e3ef/reveal_user_annotation/pserver/request.py#L8-L41
train
57,554
MKLab-ITI/reveal-user-annotation
reveal_user_annotation/pserver/request.py
add_features
def add_features(host_name, client_name, client_pass, feature_names): """ Add a number of numerical features in the client. Inputs: - host_name: A string containing the address of the machine where the PServer instance is hosted. - client_name: The PServer client name. - client_pass...
python
def add_features(host_name, client_name, client_pass, feature_names): """ Add a number of numerical features in the client. Inputs: - host_name: A string containing the address of the machine where the PServer instance is hosted. - client_name: The PServer client name. - client_pass...
[ "def", "add_features", "(", "host_name", ",", "client_name", ",", "client_pass", ",", "feature_names", ")", ":", "init_feats", "=", "(", "\"&\"", ".", "join", "(", "[", "\"%s=0\"", "]", "*", "len", "(", "feature_names", ")", ")", ")", "%", "tuple", "(", ...
Add a number of numerical features in the client. Inputs: - host_name: A string containing the address of the machine where the PServer instance is hosted. - client_name: The PServer client name. - client_pass: The PServer client's password. - feature_names: A python list of fea...
[ "Add", "a", "number", "of", "numerical", "features", "in", "the", "client", "." ]
ed019c031857b091e5601f53ba3f01a499a0e3ef
https://github.com/MKLab-ITI/reveal-user-annotation/blob/ed019c031857b091e5601f53ba3f01a499a0e3ef/reveal_user_annotation/pserver/request.py#L44-L60
train
57,555
MKLab-ITI/reveal-user-annotation
reveal_user_annotation/pserver/request.py
delete_features
def delete_features(host_name, client_name, client_pass, feature_names=None): """ Remove a number of numerical features in the client. If a list is not provided, remove all features. Inputs: - host_name: A string containing the address of the machine where the PServer instance is hosted. - cli...
python
def delete_features(host_name, client_name, client_pass, feature_names=None): """ Remove a number of numerical features in the client. If a list is not provided, remove all features. Inputs: - host_name: A string containing the address of the machine where the PServer instance is hosted. - cli...
[ "def", "delete_features", "(", "host_name", ",", "client_name", ",", "client_pass", ",", "feature_names", "=", "None", ")", ":", "# Get all features.", "if", "feature_names", "is", "None", ":", "feature_names", "=", "get_feature_names", "(", "host_name", ",", "cli...
Remove a number of numerical features in the client. If a list is not provided, remove all features. Inputs: - host_name: A string containing the address of the machine where the PServer instance is hosted. - client_name: The PServer client name. - client_pass: The PServer client's passwor...
[ "Remove", "a", "number", "of", "numerical", "features", "in", "the", "client", ".", "If", "a", "list", "is", "not", "provided", "remove", "all", "features", "." ]
ed019c031857b091e5601f53ba3f01a499a0e3ef
https://github.com/MKLab-ITI/reveal-user-annotation/blob/ed019c031857b091e5601f53ba3f01a499a0e3ef/reveal_user_annotation/pserver/request.py#L63-L86
train
57,556
MKLab-ITI/reveal-user-annotation
reveal_user_annotation/pserver/request.py
get_feature_names
def get_feature_names(host_name, client_name, client_pass): """ Get the names of all features in a PServer client. Inputs: - host_name: A string containing the address of the machine where the PServer instance is hosted. - client_name: The PServer client name. - client_pass: The PSe...
python
def get_feature_names(host_name, client_name, client_pass): """ Get the names of all features in a PServer client. Inputs: - host_name: A string containing the address of the machine where the PServer instance is hosted. - client_name: The PServer client name. - client_pass: The PSe...
[ "def", "get_feature_names", "(", "host_name", ",", "client_name", ",", "client_pass", ")", ":", "# Construct request.", "request", "=", "construct_request", "(", "model_type", "=", "\"pers\"", ",", "client_name", "=", "client_name", ",", "client_pass", "=", "client_...
Get the names of all features in a PServer client. Inputs: - host_name: A string containing the address of the machine where the PServer instance is hosted. - client_name: The PServer client name. - client_pass: The PServer client's password. Output: - feature_names: A python list of f...
[ "Get", "the", "names", "of", "all", "features", "in", "a", "PServer", "client", "." ]
ed019c031857b091e5601f53ba3f01a499a0e3ef
https://github.com/MKLab-ITI/reveal-user-annotation/blob/ed019c031857b091e5601f53ba3f01a499a0e3ef/reveal_user_annotation/pserver/request.py#L89-L123
train
57,557
MKLab-ITI/reveal-user-annotation
reveal_user_annotation/pserver/request.py
construct_request
def construct_request(model_type, client_name, client_pass, command, values): """ Construct the request url. Inputs: - model_type: PServer usage mode type. - client_name: The PServer client name. - client_pass: The PServer client's password. - command: A PServer command....
python
def construct_request(model_type, client_name, client_pass, command, values): """ Construct the request url. Inputs: - model_type: PServer usage mode type. - client_name: The PServer client name. - client_pass: The PServer client's password. - command: A PServer command....
[ "def", "construct_request", "(", "model_type", ",", "client_name", ",", "client_pass", ",", "command", ",", "values", ")", ":", "base_request", "=", "(", "\"{model_type}?\"", "\"clnt={client_name}|{client_pass}&\"", "\"com={command}&{values}\"", ".", "format", "(", "mod...
Construct the request url. Inputs: - model_type: PServer usage mode type. - client_name: The PServer client name. - client_pass: The PServer client's password. - command: A PServer command. - values: PServer command arguments. Output: - base_request: The base re...
[ "Construct", "the", "request", "url", "." ]
ed019c031857b091e5601f53ba3f01a499a0e3ef
https://github.com/MKLab-ITI/reveal-user-annotation/blob/ed019c031857b091e5601f53ba3f01a499a0e3ef/reveal_user_annotation/pserver/request.py#L155-L174
train
57,558
MKLab-ITI/reveal-user-annotation
reveal_user_annotation/pserver/request.py
send_request
def send_request(host_name, request): """ Sends a PServer url request. Inputs: - host_name: A string containing the address of the machine where the PServer instance is hosted. - request: The url request. """ request = "%s%s" % (host_name, request) # print(request) try: ...
python
def send_request(host_name, request): """ Sends a PServer url request. Inputs: - host_name: A string containing the address of the machine where the PServer instance is hosted. - request: The url request. """ request = "%s%s" % (host_name, request) # print(request) try: ...
[ "def", "send_request", "(", "host_name", ",", "request", ")", ":", "request", "=", "\"%s%s\"", "%", "(", "host_name", ",", "request", ")", "# print(request)", "try", ":", "result", "=", "requests", ".", "get", "(", "request", ")", "if", "result", ".", "s...
Sends a PServer url request. Inputs: - host_name: A string containing the address of the machine where the PServer instance is hosted. - request: The url request.
[ "Sends", "a", "PServer", "url", "request", "." ]
ed019c031857b091e5601f53ba3f01a499a0e3ef
https://github.com/MKLab-ITI/reveal-user-annotation/blob/ed019c031857b091e5601f53ba3f01a499a0e3ef/reveal_user_annotation/pserver/request.py#L177-L195
train
57,559
MKLab-ITI/reveal-user-annotation
reveal_user_annotation/pserver/request.py
update_feature_value
def update_feature_value(host_name, client_name, client_pass, user_twitter_id, feature_name, feature_score): """ Updates a single topic score, for a single user. Inputs: - host_name: A string containing the address of the machine where the PServer instance is hosted. - client_name: The PServer ...
python
def update_feature_value(host_name, client_name, client_pass, user_twitter_id, feature_name, feature_score): """ Updates a single topic score, for a single user. Inputs: - host_name: A string containing the address of the machine where the PServer instance is hosted. - client_name: The PServer ...
[ "def", "update_feature_value", "(", "host_name", ",", "client_name", ",", "client_pass", ",", "user_twitter_id", ",", "feature_name", ",", "feature_score", ")", ":", "username", "=", "str", "(", "user_twitter_id", ")", "feature_value", "=", "\"{0:.2f}\"", ".", "fo...
Updates a single topic score, for a single user. Inputs: - host_name: A string containing the address of the machine where the PServer instance is hosted. - client_name: The PServer client name. - client_pass: The PServer client's password. - user_twitter_id: A Twitter user iden...
[ "Updates", "a", "single", "topic", "score", "for", "a", "single", "user", "." ]
ed019c031857b091e5601f53ba3f01a499a0e3ef
https://github.com/MKLab-ITI/reveal-user-annotation/blob/ed019c031857b091e5601f53ba3f01a499a0e3ef/reveal_user_annotation/pserver/request.py#L198-L223
train
57,560
zerok/flask-compass
flaskext/compass.py
Compass.init_app
def init_app(self, app): """ Initialize the application once the configuration has been loaded there. """ self.app = app self.log = app.logger.getChild('compass') self.log.debug("Initializing compass integration") self.compass_path = self.app.config.get('C...
python
def init_app(self, app): """ Initialize the application once the configuration has been loaded there. """ self.app = app self.log = app.logger.getChild('compass') self.log.debug("Initializing compass integration") self.compass_path = self.app.config.get('C...
[ "def", "init_app", "(", "self", ",", "app", ")", ":", "self", ".", "app", "=", "app", "self", ".", "log", "=", "app", ".", "logger", ".", "getChild", "(", "'compass'", ")", "self", ".", "log", ".", "debug", "(", "\"Initializing compass integration\"", ...
Initialize the application once the configuration has been loaded there.
[ "Initialize", "the", "application", "once", "the", "configuration", "has", "been", "loaded", "there", "." ]
633ef4bcbfbf0882a337d84f776b3c090ef5f464
https://github.com/zerok/flask-compass/blob/633ef4bcbfbf0882a337d84f776b3c090ef5f464/flaskext/compass.py#L40-L62
train
57,561
zerok/flask-compass
flaskext/compass.py
Compass.compile
def compile(self): """ Main entry point that compiles all the specified or found compass projects. """ if self.disabled: return self._check_configs() for _, cfg in self.configs.iteritems(): cfg.parse() if cfg.changes_found() or ...
python
def compile(self): """ Main entry point that compiles all the specified or found compass projects. """ if self.disabled: return self._check_configs() for _, cfg in self.configs.iteritems(): cfg.parse() if cfg.changes_found() or ...
[ "def", "compile", "(", "self", ")", ":", "if", "self", ".", "disabled", ":", "return", "self", ".", "_check_configs", "(", ")", "for", "_", ",", "cfg", "in", "self", ".", "configs", ".", "iteritems", "(", ")", ":", "cfg", ".", "parse", "(", ")", ...
Main entry point that compiles all the specified or found compass projects.
[ "Main", "entry", "point", "that", "compiles", "all", "the", "specified", "or", "found", "compass", "projects", "." ]
633ef4bcbfbf0882a337d84f776b3c090ef5f464
https://github.com/zerok/flask-compass/blob/633ef4bcbfbf0882a337d84f776b3c090ef5f464/flaskext/compass.py#L64-L77
train
57,562
zerok/flask-compass
flaskext/compass.py
Compass.after_request
def after_request(self, response): """ after_request handler for compiling the compass projects with each request. """ if response is not None and request is not None: # When used as response processor, only run if we are requesting # anything but a static...
python
def after_request(self, response): """ after_request handler for compiling the compass projects with each request. """ if response is not None and request is not None: # When used as response processor, only run if we are requesting # anything but a static...
[ "def", "after_request", "(", "self", ",", "response", ")", ":", "if", "response", "is", "not", "None", "and", "request", "is", "not", "None", ":", "# When used as response processor, only run if we are requesting", "# anything but a static resource.", "if", "request", "...
after_request handler for compiling the compass projects with each request.
[ "after_request", "handler", "for", "compiling", "the", "compass", "projects", "with", "each", "request", "." ]
633ef4bcbfbf0882a337d84f776b3c090ef5f464
https://github.com/zerok/flask-compass/blob/633ef4bcbfbf0882a337d84f776b3c090ef5f464/flaskext/compass.py#L79-L90
train
57,563
zerok/flask-compass
flaskext/compass.py
Compass._check_configs
def _check_configs(self): """ Reloads the configuration files. """ configs = set(self._find_configs()) known_configs = set(self.configs.keys()) new_configs = configs - known_configs for cfg in (known_configs - configs): self.log.debug("Compass configur...
python
def _check_configs(self): """ Reloads the configuration files. """ configs = set(self._find_configs()) known_configs = set(self.configs.keys()) new_configs = configs - known_configs for cfg in (known_configs - configs): self.log.debug("Compass configur...
[ "def", "_check_configs", "(", "self", ")", ":", "configs", "=", "set", "(", "self", ".", "_find_configs", "(", ")", ")", "known_configs", "=", "set", "(", "self", ".", "configs", ".", "keys", "(", ")", ")", "new_configs", "=", "configs", "-", "known_co...
Reloads the configuration files.
[ "Reloads", "the", "configuration", "files", "." ]
633ef4bcbfbf0882a337d84f776b3c090ef5f464
https://github.com/zerok/flask-compass/blob/633ef4bcbfbf0882a337d84f776b3c090ef5f464/flaskext/compass.py#L92-L104
train
57,564
zerok/flask-compass
flaskext/compass.py
Compass._find_configs
def _find_configs(self): """ Scans the project directory for config files or returns the explicitly specified list of files. """ if self.config_files is not None: return self.config_files # Walk the whole project tree and look for "config.rb" files re...
python
def _find_configs(self): """ Scans the project directory for config files or returns the explicitly specified list of files. """ if self.config_files is not None: return self.config_files # Walk the whole project tree and look for "config.rb" files re...
[ "def", "_find_configs", "(", "self", ")", ":", "if", "self", ".", "config_files", "is", "not", "None", ":", "return", "self", ".", "config_files", "# Walk the whole project tree and look for \"config.rb\" files", "result", "=", "[", "]", "for", "path", ",", "_", ...
Scans the project directory for config files or returns the explicitly specified list of files.
[ "Scans", "the", "project", "directory", "for", "config", "files", "or", "returns", "the", "explicitly", "specified", "list", "of", "files", "." ]
633ef4bcbfbf0882a337d84f776b3c090ef5f464
https://github.com/zerok/flask-compass/blob/633ef4bcbfbf0882a337d84f776b3c090ef5f464/flaskext/compass.py#L106-L119
train
57,565
zerok/flask-compass
flaskext/compass.py
CompassConfig.parse
def parse(self, replace=False): """ Parse the given compass config file """ if self.last_parsed is not None \ and self.last_parsed > os.path.getmtime(self.path) \ and not replace: return self.last_parsed = time.time() with open(...
python
def parse(self, replace=False): """ Parse the given compass config file """ if self.last_parsed is not None \ and self.last_parsed > os.path.getmtime(self.path) \ and not replace: return self.last_parsed = time.time() with open(...
[ "def", "parse", "(", "self", ",", "replace", "=", "False", ")", ":", "if", "self", ".", "last_parsed", "is", "not", "None", "and", "self", ".", "last_parsed", ">", "os", ".", "path", ".", "getmtime", "(", "self", ".", "path", ")", "and", "not", "re...
Parse the given compass config file
[ "Parse", "the", "given", "compass", "config", "file" ]
633ef4bcbfbf0882a337d84f776b3c090ef5f464
https://github.com/zerok/flask-compass/blob/633ef4bcbfbf0882a337d84f776b3c090ef5f464/flaskext/compass.py#L134-L152
train
57,566
zerok/flask-compass
flaskext/compass.py
CompassConfig.changes_found
def changes_found(self): """ Returns True if the target folder is older than the source folder. """ if self.dest is None: warnings.warn("dest directory not found!") if self.src is None: warnings.warn("src directory not found!") if self.src is None ...
python
def changes_found(self): """ Returns True if the target folder is older than the source folder. """ if self.dest is None: warnings.warn("dest directory not found!") if self.src is None: warnings.warn("src directory not found!") if self.src is None ...
[ "def", "changes_found", "(", "self", ")", ":", "if", "self", ".", "dest", "is", "None", ":", "warnings", ".", "warn", "(", "\"dest directory not found!\"", ")", "if", "self", ".", "src", "is", "None", ":", "warnings", ".", "warn", "(", "\"src directory not...
Returns True if the target folder is older than the source folder.
[ "Returns", "True", "if", "the", "target", "folder", "is", "older", "than", "the", "source", "folder", "." ]
633ef4bcbfbf0882a337d84f776b3c090ef5f464
https://github.com/zerok/flask-compass/blob/633ef4bcbfbf0882a337d84f776b3c090ef5f464/flaskext/compass.py#L154-L177
train
57,567
zerok/flask-compass
flaskext/compass.py
CompassConfig.compile
def compile(self, compass): """ Calls the compass script specified in the compass extension with the paths provided by the config.rb. """ try: output = subprocess.check_output( [compass.compass_path, 'compile', '-q'], cwd=self.b...
python
def compile(self, compass): """ Calls the compass script specified in the compass extension with the paths provided by the config.rb. """ try: output = subprocess.check_output( [compass.compass_path, 'compile', '-q'], cwd=self.b...
[ "def", "compile", "(", "self", ",", "compass", ")", ":", "try", ":", "output", "=", "subprocess", ".", "check_output", "(", "[", "compass", ".", "compass_path", ",", "'compile'", ",", "'-q'", "]", ",", "cwd", "=", "self", ".", "base_dir", ")", "os", ...
Calls the compass script specified in the compass extension with the paths provided by the config.rb.
[ "Calls", "the", "compass", "script", "specified", "in", "the", "compass", "extension", "with", "the", "paths", "provided", "by", "the", "config", ".", "rb", "." ]
633ef4bcbfbf0882a337d84f776b3c090ef5f464
https://github.com/zerok/flask-compass/blob/633ef4bcbfbf0882a337d84f776b3c090ef5f464/flaskext/compass.py#L179-L197
train
57,568
LinkCareServices/period
period/main.py
_remove_otiose
def _remove_otiose(lst): """lift deeply nested expressions out of redundant parentheses""" listtype = type([]) while type(lst) == listtype and len(lst) == 1: lst = lst[0] return lst
python
def _remove_otiose(lst): """lift deeply nested expressions out of redundant parentheses""" listtype = type([]) while type(lst) == listtype and len(lst) == 1: lst = lst[0] return lst
[ "def", "_remove_otiose", "(", "lst", ")", ":", "listtype", "=", "type", "(", "[", "]", ")", "while", "type", "(", "lst", ")", "==", "listtype", "and", "len", "(", "lst", ")", "==", "1", ":", "lst", "=", "lst", "[", "0", "]", "return", "lst" ]
lift deeply nested expressions out of redundant parentheses
[ "lift", "deeply", "nested", "expressions", "out", "of", "redundant", "parentheses" ]
014f3c766940658904c52547d8cf8c12d4895e07
https://github.com/LinkCareServices/period/blob/014f3c766940658904c52547d8cf8c12d4895e07/period/main.py#L34-L40
train
57,569
asherp/hourly
hourly/hourly.py
get_work_commits
def get_work_commits(repo_addr, ascending = True, tz = 'US/Eastern', correct_times = True): """Retrives work commits from repo""" repo = git.Repo(repo_addr) commits = list(repo.iter_commits()) logs = [(c.authored_datetime, c.message.strip('\n'), str(c)) for c in repo.iter_commits()] work = pd.Dat...
python
def get_work_commits(repo_addr, ascending = True, tz = 'US/Eastern', correct_times = True): """Retrives work commits from repo""" repo = git.Repo(repo_addr) commits = list(repo.iter_commits()) logs = [(c.authored_datetime, c.message.strip('\n'), str(c)) for c in repo.iter_commits()] work = pd.Dat...
[ "def", "get_work_commits", "(", "repo_addr", ",", "ascending", "=", "True", ",", "tz", "=", "'US/Eastern'", ",", "correct_times", "=", "True", ")", ":", "repo", "=", "git", ".", "Repo", "(", "repo_addr", ")", "commits", "=", "list", "(", "repo", ".", "...
Retrives work commits from repo
[ "Retrives", "work", "commits", "from", "repo" ]
c2778a5b4dd7ac523fe3d56f5c9f7fe72b8826de
https://github.com/asherp/hourly/blob/c2778a5b4dd7ac523fe3d56f5c9f7fe72b8826de/hourly/hourly.py#L27-L44
train
57,570
MKLab-ITI/reveal-user-annotation
reveal_user_annotation/twitter/manage_resources.py
get_topic_set
def get_topic_set(file_path): """ Opens one of the topic set resource files and returns a set of topics. - Input: - file_path: The path pointing to the topic set resource file. - Output: - topic_set: A python set of strings. """ topic_set = set() file_row_gen = get_file_row_generator(file...
python
def get_topic_set(file_path): """ Opens one of the topic set resource files and returns a set of topics. - Input: - file_path: The path pointing to the topic set resource file. - Output: - topic_set: A python set of strings. """ topic_set = set() file_row_gen = get_file_row_generator(file...
[ "def", "get_topic_set", "(", "file_path", ")", ":", "topic_set", "=", "set", "(", ")", "file_row_gen", "=", "get_file_row_generator", "(", "file_path", ",", "\",\"", ")", "# The separator here is irrelevant.", "for", "file_row", "in", "file_row_gen", ":", "topic_set...
Opens one of the topic set resource files and returns a set of topics. - Input: - file_path: The path pointing to the topic set resource file. - Output: - topic_set: A python set of strings.
[ "Opens", "one", "of", "the", "topic", "set", "resource", "files", "and", "returns", "a", "set", "of", "topics", "." ]
ed019c031857b091e5601f53ba3f01a499a0e3ef
https://github.com/MKLab-ITI/reveal-user-annotation/blob/ed019c031857b091e5601f53ba3f01a499a0e3ef/reveal_user_annotation/twitter/manage_resources.py#L7-L20
train
57,571
MKLab-ITI/reveal-user-annotation
reveal_user_annotation/twitter/manage_resources.py
get_reveal_set
def get_reveal_set(): """ Returns a set of all the topics that are interesting for REVEAL use-cases. """ file_path = get_package_path() + "/twitter/res/topics/story_set.txt" story_topics = get_topic_set(file_path) file_path = get_package_path() + "/twitter/res/topics/theme_set.txt" theme_to...
python
def get_reveal_set(): """ Returns a set of all the topics that are interesting for REVEAL use-cases. """ file_path = get_package_path() + "/twitter/res/topics/story_set.txt" story_topics = get_topic_set(file_path) file_path = get_package_path() + "/twitter/res/topics/theme_set.txt" theme_to...
[ "def", "get_reveal_set", "(", ")", ":", "file_path", "=", "get_package_path", "(", ")", "+", "\"/twitter/res/topics/story_set.txt\"", "story_topics", "=", "get_topic_set", "(", "file_path", ")", "file_path", "=", "get_package_path", "(", ")", "+", "\"/twitter/res/topi...
Returns a set of all the topics that are interesting for REVEAL use-cases.
[ "Returns", "a", "set", "of", "all", "the", "topics", "that", "are", "interesting", "for", "REVEAL", "use", "-", "cases", "." ]
ed019c031857b091e5601f53ba3f01a499a0e3ef
https://github.com/MKLab-ITI/reveal-user-annotation/blob/ed019c031857b091e5601f53ba3f01a499a0e3ef/reveal_user_annotation/twitter/manage_resources.py#L83-L104
train
57,572
MKLab-ITI/reveal-user-annotation
reveal_user_annotation/twitter/manage_resources.py
get_topic_keyword_dictionary
def get_topic_keyword_dictionary(): """ Opens the topic-keyword map resource file and returns the corresponding python dictionary. - Input: - file_path: The path pointing to the topic-keyword map resource file. - Output: - topic_set: A topic to keyword python dictionary. """ topic_keyword_dic...
python
def get_topic_keyword_dictionary(): """ Opens the topic-keyword map resource file and returns the corresponding python dictionary. - Input: - file_path: The path pointing to the topic-keyword map resource file. - Output: - topic_set: A topic to keyword python dictionary. """ topic_keyword_dic...
[ "def", "get_topic_keyword_dictionary", "(", ")", ":", "topic_keyword_dictionary", "=", "dict", "(", ")", "file_row_gen", "=", "get_file_row_generator", "(", "get_package_path", "(", ")", "+", "\"/twitter/res/topics/topic_keyword_mapping\"", "+", "\".txt\"", ",", "\",\"", ...
Opens the topic-keyword map resource file and returns the corresponding python dictionary. - Input: - file_path: The path pointing to the topic-keyword map resource file. - Output: - topic_set: A topic to keyword python dictionary.
[ "Opens", "the", "topic", "-", "keyword", "map", "resource", "file", "and", "returns", "the", "corresponding", "python", "dictionary", "." ]
ed019c031857b091e5601f53ba3f01a499a0e3ef
https://github.com/MKLab-ITI/reveal-user-annotation/blob/ed019c031857b091e5601f53ba3f01a499a0e3ef/reveal_user_annotation/twitter/manage_resources.py#L107-L122
train
57,573
shoprunback/openflow
openflow/openflow.py
OpenFlow.get_input
def get_input(self, name, ds): """ Retrieves the content of an input given a DataSource. The input acts like a filter over the outputs of the DataSource. Args: name (str): The name of the input. ds (openflow.DataSource): The DataSource that will feed the data. R...
python
def get_input(self, name, ds): """ Retrieves the content of an input given a DataSource. The input acts like a filter over the outputs of the DataSource. Args: name (str): The name of the input. ds (openflow.DataSource): The DataSource that will feed the data. R...
[ "def", "get_input", "(", "self", ",", "name", ",", "ds", ")", ":", "columns", "=", "self", ".", "inputs", ".", "get", "(", "name", ")", "df", "=", "ds", ".", "get_dataframe", "(", ")", "# set defaults", "for", "column", "in", "columns", ":", "if", ...
Retrieves the content of an input given a DataSource. The input acts like a filter over the outputs of the DataSource. Args: name (str): The name of the input. ds (openflow.DataSource): The DataSource that will feed the data. Returns: pandas.DataFrame: The content o...
[ "Retrieves", "the", "content", "of", "an", "input", "given", "a", "DataSource", ".", "The", "input", "acts", "like", "a", "filter", "over", "the", "outputs", "of", "the", "DataSource", "." ]
5bd739a0890cf09198e39bb141f987abf960ee8e
https://github.com/shoprunback/openflow/blob/5bd739a0890cf09198e39bb141f987abf960ee8e/openflow/openflow.py#L9-L28
train
57,574
helixyte/everest
everest/resources/relationship.py
ResourceRelationship.domain_relationship
def domain_relationship(self): """ Returns a domain relationship equivalent with this resource relationship. """ if self.__domain_relationship is None: ent = self.relator.get_entity() self.__domain_relationship = \ self.descriptor.make_...
python
def domain_relationship(self): """ Returns a domain relationship equivalent with this resource relationship. """ if self.__domain_relationship is None: ent = self.relator.get_entity() self.__domain_relationship = \ self.descriptor.make_...
[ "def", "domain_relationship", "(", "self", ")", ":", "if", "self", ".", "__domain_relationship", "is", "None", ":", "ent", "=", "self", ".", "relator", ".", "get_entity", "(", ")", "self", ".", "__domain_relationship", "=", "self", ".", "descriptor", ".", ...
Returns a domain relationship equivalent with this resource relationship.
[ "Returns", "a", "domain", "relationship", "equivalent", "with", "this", "resource", "relationship", "." ]
70c9b93c3061db5cb62428349d18b8fb8566411b
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/resources/relationship.py#L27-L36
train
57,575
brews/snakebacon
snakebacon/agedepth.py
AgeDepthModel.fit
def fit(self): """Fit MCMC AgeDepthModel""" self._mcmcfit = self.mcmcsetup.run() self._mcmcfit.burnin(self.burnin) dmin = min(self._mcmcfit.depth_segments) dmax = max(self._mcmcfit.depth_segments) self._thick = (dmax - dmin) / len(self.mcmcfit.depth_segments) self...
python
def fit(self): """Fit MCMC AgeDepthModel""" self._mcmcfit = self.mcmcsetup.run() self._mcmcfit.burnin(self.burnin) dmin = min(self._mcmcfit.depth_segments) dmax = max(self._mcmcfit.depth_segments) self._thick = (dmax - dmin) / len(self.mcmcfit.depth_segments) self...
[ "def", "fit", "(", "self", ")", ":", "self", ".", "_mcmcfit", "=", "self", ".", "mcmcsetup", ".", "run", "(", ")", "self", ".", "_mcmcfit", ".", "burnin", "(", "self", ".", "burnin", ")", "dmin", "=", "min", "(", "self", ".", "_mcmcfit", ".", "de...
Fit MCMC AgeDepthModel
[ "Fit", "MCMC", "AgeDepthModel" ]
f5363d0d1225912adc30031bf2c13b54000de8f2
https://github.com/brews/snakebacon/blob/f5363d0d1225912adc30031bf2c13b54000de8f2/snakebacon/agedepth.py#L64-L72
train
57,576
brews/snakebacon
snakebacon/agedepth.py
AgeDepthModel.date
def date(self, proxy, how='median', n=500): """Date a proxy record Parameters ---------- proxy : ProxyRecord how : str How to perform the dating. 'median' returns the average of the MCMC ensemble. 'ensemble' returns a 'n' randomly selected members of the ...
python
def date(self, proxy, how='median', n=500): """Date a proxy record Parameters ---------- proxy : ProxyRecord how : str How to perform the dating. 'median' returns the average of the MCMC ensemble. 'ensemble' returns a 'n' randomly selected members of the ...
[ "def", "date", "(", "self", ",", "proxy", ",", "how", "=", "'median'", ",", "n", "=", "500", ")", ":", "assert", "how", "in", "[", "'median'", ",", "'ensemble'", "]", "ens_members", "=", "self", ".", "mcmcfit", ".", "n_members", "(", ")", "if", "ho...
Date a proxy record Parameters ---------- proxy : ProxyRecord how : str How to perform the dating. 'median' returns the average of the MCMC ensemble. 'ensemble' returns a 'n' randomly selected members of the MCMC ensemble. Default is 'median'. n : int ...
[ "Date", "a", "proxy", "record" ]
f5363d0d1225912adc30031bf2c13b54000de8f2
https://github.com/brews/snakebacon/blob/f5363d0d1225912adc30031bf2c13b54000de8f2/snakebacon/agedepth.py#L74-L102
train
57,577
brews/snakebacon
snakebacon/agedepth.py
AgeDepthModel.plot
def plot(self, agebins=50, p=(2.5, 97.5), ax=None): """Age-depth plot""" if ax is None: ax = plt.gca() ax.hist2d(np.repeat(self.depth, self.age_ensemble.shape[1]), self.age_ensemble.flatten(), (len(self.depth), agebins), cmin=1) ax.step(self.depth, self.age...
python
def plot(self, agebins=50, p=(2.5, 97.5), ax=None): """Age-depth plot""" if ax is None: ax = plt.gca() ax.hist2d(np.repeat(self.depth, self.age_ensemble.shape[1]), self.age_ensemble.flatten(), (len(self.depth), agebins), cmin=1) ax.step(self.depth, self.age...
[ "def", "plot", "(", "self", ",", "agebins", "=", "50", ",", "p", "=", "(", "2.5", ",", "97.5", ")", ",", "ax", "=", "None", ")", ":", "if", "ax", "is", "None", ":", "ax", "=", "plt", ".", "gca", "(", ")", "ax", ".", "hist2d", "(", "np", "...
Age-depth plot
[ "Age", "-", "depth", "plot" ]
f5363d0d1225912adc30031bf2c13b54000de8f2
https://github.com/brews/snakebacon/blob/f5363d0d1225912adc30031bf2c13b54000de8f2/snakebacon/agedepth.py#L104-L116
train
57,578
brews/snakebacon
snakebacon/agedepth.py
AgeDepthModel.agedepth
def agedepth(self, d): """Get calendar age for a depth Parameters ---------- d : float Sediment depth (in cm). Returns ------- Numeric giving true age at given depth. """ # TODO(brews): Function cannot handle hiatus # See line...
python
def agedepth(self, d): """Get calendar age for a depth Parameters ---------- d : float Sediment depth (in cm). Returns ------- Numeric giving true age at given depth. """ # TODO(brews): Function cannot handle hiatus # See line...
[ "def", "agedepth", "(", "self", ",", "d", ")", ":", "# TODO(brews): Function cannot handle hiatus", "# See lines 77 - 100 of hist2.cpp", "x", "=", "self", ".", "mcmcfit", ".", "sediment_rate", "theta0", "=", "self", ".", "mcmcfit", ".", "headage", "# Age abscissa (in ...
Get calendar age for a depth Parameters ---------- d : float Sediment depth (in cm). Returns ------- Numeric giving true age at given depth.
[ "Get", "calendar", "age", "for", "a", "depth" ]
f5363d0d1225912adc30031bf2c13b54000de8f2
https://github.com/brews/snakebacon/blob/f5363d0d1225912adc30031bf2c13b54000de8f2/snakebacon/agedepth.py#L118-L149
train
57,579
brews/snakebacon
snakebacon/agedepth.py
AgeDepthModel.plot_prior_dates
def plot_prior_dates(self, dwidth=30, ax=None): """Plot prior chronology dates in age-depth plot""" if ax is None: ax = plt.gca() depth, probs = self.prior_dates() pat = [] for i, d in enumerate(depth): p = probs[i] z = np.array([p[:, 0], dwidt...
python
def plot_prior_dates(self, dwidth=30, ax=None): """Plot prior chronology dates in age-depth plot""" if ax is None: ax = plt.gca() depth, probs = self.prior_dates() pat = [] for i, d in enumerate(depth): p = probs[i] z = np.array([p[:, 0], dwidt...
[ "def", "plot_prior_dates", "(", "self", ",", "dwidth", "=", "30", ",", "ax", "=", "None", ")", ":", "if", "ax", "is", "None", ":", "ax", "=", "plt", ".", "gca", "(", ")", "depth", ",", "probs", "=", "self", ".", "prior_dates", "(", ")", "pat", ...
Plot prior chronology dates in age-depth plot
[ "Plot", "prior", "chronology", "dates", "in", "age", "-", "depth", "plot" ]
f5363d0d1225912adc30031bf2c13b54000de8f2
https://github.com/brews/snakebacon/blob/f5363d0d1225912adc30031bf2c13b54000de8f2/snakebacon/agedepth.py#L154-L176
train
57,580
brews/snakebacon
snakebacon/agedepth.py
AgeDepthModel.plot_sediment_rate
def plot_sediment_rate(self, ax=None): """Plot sediment accumulation rate prior and posterior distributions""" if ax is None: ax = plt.gca() y_prior, x_prior = self.prior_sediment_rate() ax.plot(x_prior, y_prior, label='Prior') y_posterior = self.mcmcfit.sediment_ra...
python
def plot_sediment_rate(self, ax=None): """Plot sediment accumulation rate prior and posterior distributions""" if ax is None: ax = plt.gca() y_prior, x_prior = self.prior_sediment_rate() ax.plot(x_prior, y_prior, label='Prior') y_posterior = self.mcmcfit.sediment_ra...
[ "def", "plot_sediment_rate", "(", "self", ",", "ax", "=", "None", ")", ":", "if", "ax", "is", "None", ":", "ax", "=", "plt", ".", "gca", "(", ")", "y_prior", ",", "x_prior", "=", "self", ".", "prior_sediment_rate", "(", ")", "ax", ".", "plot", "(",...
Plot sediment accumulation rate prior and posterior distributions
[ "Plot", "sediment", "accumulation", "rate", "prior", "and", "posterior", "distributions" ]
f5363d0d1225912adc30031bf2c13b54000de8f2
https://github.com/brews/snakebacon/blob/f5363d0d1225912adc30031bf2c13b54000de8f2/snakebacon/agedepth.py#L181-L205
train
57,581
brews/snakebacon
snakebacon/agedepth.py
AgeDepthModel.plot_sediment_memory
def plot_sediment_memory(self, ax=None): """Plot sediment memory prior and posterior distributions""" if ax is None: ax = plt.gca() y_prior, x_prior = self.prior_sediment_memory() ax.plot(x_prior, y_prior, label='Prior') y_posterior = self.mcmcfit.sediment_memory ...
python
def plot_sediment_memory(self, ax=None): """Plot sediment memory prior and posterior distributions""" if ax is None: ax = plt.gca() y_prior, x_prior = self.prior_sediment_memory() ax.plot(x_prior, y_prior, label='Prior') y_posterior = self.mcmcfit.sediment_memory ...
[ "def", "plot_sediment_memory", "(", "self", ",", "ax", "=", "None", ")", ":", "if", "ax", "is", "None", ":", "ax", "=", "plt", ".", "gca", "(", ")", "y_prior", ",", "x_prior", "=", "self", ".", "prior_sediment_memory", "(", ")", "ax", ".", "plot", ...
Plot sediment memory prior and posterior distributions
[ "Plot", "sediment", "memory", "prior", "and", "posterior", "distributions" ]
f5363d0d1225912adc30031bf2c13b54000de8f2
https://github.com/brews/snakebacon/blob/f5363d0d1225912adc30031bf2c13b54000de8f2/snakebacon/agedepth.py#L210-L234
train
57,582
RI-imaging/qpformat
qpformat/cli.py
qpinfo
def qpinfo(): """Print information of a quantitative phase imaging dataset""" parser = qpinfo_parser() args = parser.parse_args() path = pathlib.Path(args.path).resolve() try: ds = load_data(path) except UnknownFileFormatError: print("Unknown file format: {}".format(path)) ...
python
def qpinfo(): """Print information of a quantitative phase imaging dataset""" parser = qpinfo_parser() args = parser.parse_args() path = pathlib.Path(args.path).resolve() try: ds = load_data(path) except UnknownFileFormatError: print("Unknown file format: {}".format(path)) ...
[ "def", "qpinfo", "(", ")", ":", "parser", "=", "qpinfo_parser", "(", ")", "args", "=", "parser", ".", "parse_args", "(", ")", "path", "=", "pathlib", ".", "Path", "(", "args", ".", "path", ")", ".", "resolve", "(", ")", "try", ":", "ds", "=", "lo...
Print information of a quantitative phase imaging dataset
[ "Print", "information", "of", "a", "quantitative", "phase", "imaging", "dataset" ]
364e29d7d9e8b9f1d7a4a25c753d1baf9d73d5eb
https://github.com/RI-imaging/qpformat/blob/364e29d7d9e8b9f1d7a4a25c753d1baf9d73d5eb/qpformat/cli.py#L9-L24
train
57,583
NORDUnet/python-norduniclient
norduniclient/core.py
get_node_meta_type
def get_node_meta_type(manager, handle_id): """ Returns the meta type of the supplied node as a string. :param manager: Neo4jDBSessionManager :param handle_id: Unique id :return: string """ node = get_node(manager=manager, handle_id=handle_id, legacy=False) for label in node.labels: ...
python
def get_node_meta_type(manager, handle_id): """ Returns the meta type of the supplied node as a string. :param manager: Neo4jDBSessionManager :param handle_id: Unique id :return: string """ node = get_node(manager=manager, handle_id=handle_id, legacy=False) for label in node.labels: ...
[ "def", "get_node_meta_type", "(", "manager", ",", "handle_id", ")", ":", "node", "=", "get_node", "(", "manager", "=", "manager", ",", "handle_id", "=", "handle_id", ",", "legacy", "=", "False", ")", "for", "label", "in", "node", ".", "labels", ":", "if"...
Returns the meta type of the supplied node as a string. :param manager: Neo4jDBSessionManager :param handle_id: Unique id :return: string
[ "Returns", "the", "meta", "type", "of", "the", "supplied", "node", "as", "a", "string", "." ]
ee5084a6f45caac614b4fda4a023749ca52f786c
https://github.com/NORDUnet/python-norduniclient/blob/ee5084a6f45caac614b4fda4a023749ca52f786c/norduniclient/core.py#L353-L365
train
57,584
NORDUnet/python-norduniclient
norduniclient/core.py
create_relationship
def create_relationship(manager, handle_id, other_handle_id, rel_type): """ Makes a relationship from node to other_node depending on which meta_type the nodes are. Returns the relationship or raises NoRelationshipPossible exception. """ meta_type = get_node_meta_type(manager, handle_id) if ...
python
def create_relationship(manager, handle_id, other_handle_id, rel_type): """ Makes a relationship from node to other_node depending on which meta_type the nodes are. Returns the relationship or raises NoRelationshipPossible exception. """ meta_type = get_node_meta_type(manager, handle_id) if ...
[ "def", "create_relationship", "(", "manager", ",", "handle_id", ",", "other_handle_id", ",", "rel_type", ")", ":", "meta_type", "=", "get_node_meta_type", "(", "manager", ",", "handle_id", ")", "if", "meta_type", "==", "'Location'", ":", "return", "create_location...
Makes a relationship from node to other_node depending on which meta_type the nodes are. Returns the relationship or raises NoRelationshipPossible exception.
[ "Makes", "a", "relationship", "from", "node", "to", "other_node", "depending", "on", "which", "meta_type", "the", "nodes", "are", ".", "Returns", "the", "relationship", "or", "raises", "NoRelationshipPossible", "exception", "." ]
ee5084a6f45caac614b4fda4a023749ca52f786c
https://github.com/NORDUnet/python-norduniclient/blob/ee5084a6f45caac614b4fda4a023749ca52f786c/norduniclient/core.py#L655-L671
train
57,585
regardscitoyens/legipy
legipy/parsers/code_parser.py
CodeParser.parse_code
def parse_code(self, url, html): """ Parse the code details and TOC from the given HTML content :type url: str :param url: source URL of the page :type html: unicode :param html: Content of the HTML :return: the code """ soup = BeautifulSoup(h...
python
def parse_code(self, url, html): """ Parse the code details and TOC from the given HTML content :type url: str :param url: source URL of the page :type html: unicode :param html: Content of the HTML :return: the code """ soup = BeautifulSoup(h...
[ "def", "parse_code", "(", "self", ",", "url", ",", "html", ")", ":", "soup", "=", "BeautifulSoup", "(", "html", ",", "'html5lib'", ",", "from_encoding", "=", "'utf-8'", ")", "# -- main text", "div", "=", "(", "soup", ".", "find", "(", "'div'", ",", "id...
Parse the code details and TOC from the given HTML content :type url: str :param url: source URL of the page :type html: unicode :param html: Content of the HTML :return: the code
[ "Parse", "the", "code", "details", "and", "TOC", "from", "the", "given", "HTML", "content" ]
3553c5a56769f23d8922adfbfe44d7b9f4a5204c
https://github.com/regardscitoyens/legipy/blob/3553c5a56769f23d8922adfbfe44d7b9f4a5204c/legipy/parsers/code_parser.py#L52-L93
train
57,586
regardscitoyens/legipy
legipy/parsers/code_parser.py
CodeParser.parse_code_ul
def parse_code_ul(self, url, ul): """Fill the toc item""" li_list = ul.find_all('li', recursive=False) li = li_list[0] span_title = li.find('span', attrs={'class': re.compile(r'TM\d+Code')}, recursive=False) section = Sec...
python
def parse_code_ul(self, url, ul): """Fill the toc item""" li_list = ul.find_all('li', recursive=False) li = li_list[0] span_title = li.find('span', attrs={'class': re.compile(r'TM\d+Code')}, recursive=False) section = Sec...
[ "def", "parse_code_ul", "(", "self", ",", "url", ",", "ul", ")", ":", "li_list", "=", "ul", ".", "find_all", "(", "'li'", ",", "recursive", "=", "False", ")", "li", "=", "li_list", "[", "0", "]", "span_title", "=", "li", ".", "find", "(", "'span'",...
Fill the toc item
[ "Fill", "the", "toc", "item" ]
3553c5a56769f23d8922adfbfe44d7b9f4a5204c
https://github.com/regardscitoyens/legipy/blob/3553c5a56769f23d8922adfbfe44d7b9f4a5204c/legipy/parsers/code_parser.py#L95-L123
train
57,587
childsish/lhc-python
lhc/indices/tracked_index.py
Track.add
def add(self, interval, offset): """ The added interval must be overlapping or beyond the last stored interval ie. added in sorted order. :param interval: interval to add :param offset: full virtual offset to add :return: """ start, stop = self.get_start_stop(int...
python
def add(self, interval, offset): """ The added interval must be overlapping or beyond the last stored interval ie. added in sorted order. :param interval: interval to add :param offset: full virtual offset to add :return: """ start, stop = self.get_start_stop(int...
[ "def", "add", "(", "self", ",", "interval", ",", "offset", ")", ":", "start", ",", "stop", "=", "self", ".", "get_start_stop", "(", "interval", ")", "if", "len", "(", "self", ".", "starts", ")", ">", "0", ":", "if", "start", "<", "self", ".", "st...
The added interval must be overlapping or beyond the last stored interval ie. added in sorted order. :param interval: interval to add :param offset: full virtual offset to add :return:
[ "The", "added", "interval", "must", "be", "overlapping", "or", "beyond", "the", "last", "stored", "interval", "ie", ".", "added", "in", "sorted", "order", "." ]
0a669f46a40a39f24d28665e8b5b606dc7e86beb
https://github.com/childsish/lhc-python/blob/0a669f46a40a39f24d28665e8b5b606dc7e86beb/lhc/indices/tracked_index.py#L30-L48
train
57,588
vicalloy/lbutils
lbutils/qs.py
get_sum
def get_sum(qs, field): """ get sum for queryset. ``qs``: queryset ``field``: The field name to sum. """ sum_field = '%s__sum' % field qty = qs.aggregate(Sum(field))[sum_field] return qty if qty else 0
python
def get_sum(qs, field): """ get sum for queryset. ``qs``: queryset ``field``: The field name to sum. """ sum_field = '%s__sum' % field qty = qs.aggregate(Sum(field))[sum_field] return qty if qty else 0
[ "def", "get_sum", "(", "qs", ",", "field", ")", ":", "sum_field", "=", "'%s__sum'", "%", "field", "qty", "=", "qs", ".", "aggregate", "(", "Sum", "(", "field", ")", ")", "[", "sum_field", "]", "return", "qty", "if", "qty", "else", "0" ]
get sum for queryset. ``qs``: queryset ``field``: The field name to sum.
[ "get", "sum", "for", "queryset", "." ]
66ae7e73bc939f073cdc1b91602a95e67caf4ba6
https://github.com/vicalloy/lbutils/blob/66ae7e73bc939f073cdc1b91602a95e67caf4ba6/lbutils/qs.py#L28-L37
train
57,589
vicalloy/lbutils
lbutils/qs.py
get_max
def get_max(qs, field): """ get max for queryset. qs: queryset field: The field name to max. """ max_field = '%s__max' % field num = qs.aggregate(Max(field))[max_field] return num if num else 0
python
def get_max(qs, field): """ get max for queryset. qs: queryset field: The field name to max. """ max_field = '%s__max' % field num = qs.aggregate(Max(field))[max_field] return num if num else 0
[ "def", "get_max", "(", "qs", ",", "field", ")", ":", "max_field", "=", "'%s__max'", "%", "field", "num", "=", "qs", ".", "aggregate", "(", "Max", "(", "field", ")", ")", "[", "max_field", "]", "return", "num", "if", "num", "else", "0" ]
get max for queryset. qs: queryset field: The field name to max.
[ "get", "max", "for", "queryset", "." ]
66ae7e73bc939f073cdc1b91602a95e67caf4ba6
https://github.com/vicalloy/lbutils/blob/66ae7e73bc939f073cdc1b91602a95e67caf4ba6/lbutils/qs.py#L40-L49
train
57,590
vicalloy/lbutils
lbutils/qs.py
do_filter
def do_filter(qs, qdata, quick_query_fields=[], int_quick_query_fields=[]): """ auto filter queryset by dict. qs: queryset need to filter. qdata: quick_query_fields: int_quick_query_fields: """ try: qs = qs.filter( __gen_quick_query_params( qdata.get(...
python
def do_filter(qs, qdata, quick_query_fields=[], int_quick_query_fields=[]): """ auto filter queryset by dict. qs: queryset need to filter. qdata: quick_query_fields: int_quick_query_fields: """ try: qs = qs.filter( __gen_quick_query_params( qdata.get(...
[ "def", "do_filter", "(", "qs", ",", "qdata", ",", "quick_query_fields", "=", "[", "]", ",", "int_quick_query_fields", "=", "[", "]", ")", ":", "try", ":", "qs", "=", "qs", ".", "filter", "(", "__gen_quick_query_params", "(", "qdata", ".", "get", "(", "...
auto filter queryset by dict. qs: queryset need to filter. qdata: quick_query_fields: int_quick_query_fields:
[ "auto", "filter", "queryset", "by", "dict", "." ]
66ae7e73bc939f073cdc1b91602a95e67caf4ba6
https://github.com/vicalloy/lbutils/blob/66ae7e73bc939f073cdc1b91602a95e67caf4ba6/lbutils/qs.py#L52-L72
train
57,591
zsiciarz/pygcvs
pygcvs/helpers.py
read_gcvs
def read_gcvs(filename): """ Reads variable star data in `GCVS format`_. :param filename: path to GCVS data file (usually ``iii.dat``) .. _`GCVS format`: http://www.sai.msu.su/gcvs/gcvs/iii/html/ """ with open(filename, 'r') as fp: parser = GcvsParser(fp) for star in parser: ...
python
def read_gcvs(filename): """ Reads variable star data in `GCVS format`_. :param filename: path to GCVS data file (usually ``iii.dat``) .. _`GCVS format`: http://www.sai.msu.su/gcvs/gcvs/iii/html/ """ with open(filename, 'r') as fp: parser = GcvsParser(fp) for star in parser: ...
[ "def", "read_gcvs", "(", "filename", ")", ":", "with", "open", "(", "filename", ",", "'r'", ")", "as", "fp", ":", "parser", "=", "GcvsParser", "(", "fp", ")", "for", "star", "in", "parser", ":", "yield", "star" ]
Reads variable star data in `GCVS format`_. :param filename: path to GCVS data file (usually ``iii.dat``) .. _`GCVS format`: http://www.sai.msu.su/gcvs/gcvs/iii/html/
[ "Reads", "variable", "star", "data", "in", "GCVS", "format", "_", "." ]
ed5522ab9cf9237592a6af7a0bc8cad079afeb67
https://github.com/zsiciarz/pygcvs/blob/ed5522ab9cf9237592a6af7a0bc8cad079afeb67/pygcvs/helpers.py#L9-L20
train
57,592
zsiciarz/pygcvs
pygcvs/helpers.py
dict_to_body
def dict_to_body(star_dict): """ Converts a dictionary of variable star data to a `Body` instance. Requires `PyEphem <http://rhodesmill.org/pyephem/>`_ to be installed. """ if ephem is None: # pragma: no cover raise NotImplementedError("Please install PyEphem in order to use dict_to_body."...
python
def dict_to_body(star_dict): """ Converts a dictionary of variable star data to a `Body` instance. Requires `PyEphem <http://rhodesmill.org/pyephem/>`_ to be installed. """ if ephem is None: # pragma: no cover raise NotImplementedError("Please install PyEphem in order to use dict_to_body."...
[ "def", "dict_to_body", "(", "star_dict", ")", ":", "if", "ephem", "is", "None", ":", "# pragma: no cover", "raise", "NotImplementedError", "(", "\"Please install PyEphem in order to use dict_to_body.\"", ")", "body", "=", "ephem", ".", "FixedBody", "(", ")", "body", ...
Converts a dictionary of variable star data to a `Body` instance. Requires `PyEphem <http://rhodesmill.org/pyephem/>`_ to be installed.
[ "Converts", "a", "dictionary", "of", "variable", "star", "data", "to", "a", "Body", "instance", "." ]
ed5522ab9cf9237592a6af7a0bc8cad079afeb67
https://github.com/zsiciarz/pygcvs/blob/ed5522ab9cf9237592a6af7a0bc8cad079afeb67/pygcvs/helpers.py#L23-L36
train
57,593
BlackEarth/bxml
bxml/xlsx.py
XLSX.tempfile
def tempfile(self): "write the docx to a named tmpfile and return the tmpfile filename" tf = tempfile.NamedTemporaryFile() tfn = tf.name tf.close() os.remove(tf.name) shutil.copy(self.fn, tfn) return tfn
python
def tempfile(self): "write the docx to a named tmpfile and return the tmpfile filename" tf = tempfile.NamedTemporaryFile() tfn = tf.name tf.close() os.remove(tf.name) shutil.copy(self.fn, tfn) return tfn
[ "def", "tempfile", "(", "self", ")", ":", "tf", "=", "tempfile", ".", "NamedTemporaryFile", "(", ")", "tfn", "=", "tf", ".", "name", "tf", ".", "close", "(", ")", "os", ".", "remove", "(", "tf", ".", "name", ")", "shutil", ".", "copy", "(", "self...
write the docx to a named tmpfile and return the tmpfile filename
[ "write", "the", "docx", "to", "a", "named", "tmpfile", "and", "return", "the", "tmpfile", "filename" ]
8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77
https://github.com/BlackEarth/bxml/blob/8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77/bxml/xlsx.py#L26-L33
train
57,594
BlackEarth/bxml
bxml/xlsx.py
XLSX.sheets
def sheets(self): """return the sheets of data.""" data = Dict() for src in [src for src in self.zipfile.namelist() if 'xl/worksheets/' in src]: name = os.path.splitext(os.path.basename(src))[0] xml = self.xml(src) data[name] = xml return data
python
def sheets(self): """return the sheets of data.""" data = Dict() for src in [src for src in self.zipfile.namelist() if 'xl/worksheets/' in src]: name = os.path.splitext(os.path.basename(src))[0] xml = self.xml(src) data[name] = xml return data
[ "def", "sheets", "(", "self", ")", ":", "data", "=", "Dict", "(", ")", "for", "src", "in", "[", "src", "for", "src", "in", "self", ".", "zipfile", ".", "namelist", "(", ")", "if", "'xl/worksheets/'", "in", "src", "]", ":", "name", "=", "os", ".",...
return the sheets of data.
[ "return", "the", "sheets", "of", "data", "." ]
8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77
https://github.com/BlackEarth/bxml/blob/8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77/bxml/xlsx.py#L50-L57
train
57,595
BlackEarth/bxml
bxml/xlsx.py
XLSX.workbook_data
def workbook_data(self): """return a readable XML form of the data.""" document = XML( fn=os.path.splitext(self.fn)[0]+'.xml', root=Element.workbook()) shared_strings = [ str(t.text) for t in self.xml('xl/sharedStrings.xml') .root...
python
def workbook_data(self): """return a readable XML form of the data.""" document = XML( fn=os.path.splitext(self.fn)[0]+'.xml', root=Element.workbook()) shared_strings = [ str(t.text) for t in self.xml('xl/sharedStrings.xml') .root...
[ "def", "workbook_data", "(", "self", ")", ":", "document", "=", "XML", "(", "fn", "=", "os", ".", "path", ".", "splitext", "(", "self", ".", "fn", ")", "[", "0", "]", "+", "'.xml'", ",", "root", "=", "Element", ".", "workbook", "(", ")", ")", "...
return a readable XML form of the data.
[ "return", "a", "readable", "XML", "form", "of", "the", "data", "." ]
8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77
https://github.com/BlackEarth/bxml/blob/8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77/bxml/xlsx.py#L63-L75
train
57,596
erikvw/django-collect-offline-files
django_collect_offline_files/file_queues/file_queue_handlers.py
RegexFileQueueHandlerIncoming.process
def process(self, event): """Put and process tasks in queue. """ logger.info(f"{self}: put {event.src_path}") self.queue.put(os.path.basename(event.src_path))
python
def process(self, event): """Put and process tasks in queue. """ logger.info(f"{self}: put {event.src_path}") self.queue.put(os.path.basename(event.src_path))
[ "def", "process", "(", "self", ",", "event", ")", ":", "logger", ".", "info", "(", "f\"{self}: put {event.src_path}\"", ")", "self", ".", "queue", ".", "put", "(", "os", ".", "path", ".", "basename", "(", "event", ".", "src_path", ")", ")" ]
Put and process tasks in queue.
[ "Put", "and", "process", "tasks", "in", "queue", "." ]
78f61c823ea3926eb88206b019b5dca3c36017da
https://github.com/erikvw/django-collect-offline-files/blob/78f61c823ea3926eb88206b019b5dca3c36017da/django_collect_offline_files/file_queues/file_queue_handlers.py#L26-L30
train
57,597
Caramel/treacle
treacle/scrape_apple_ical.py
main
def main(): """ Scrapes Apple's iCal feed for Australian public holidays and generates per- state listings. """ print "Downloading Holidays from Apple's server..." r = requests.get('http://files.apple.com/calendars/Australian32Holidays.ics') cal = Calendar.from_ical(r.text) print "Processing calendar data...
python
def main(): """ Scrapes Apple's iCal feed for Australian public holidays and generates per- state listings. """ print "Downloading Holidays from Apple's server..." r = requests.get('http://files.apple.com/calendars/Australian32Holidays.ics') cal = Calendar.from_ical(r.text) print "Processing calendar data...
[ "def", "main", "(", ")", ":", "print", "\"Downloading Holidays from Apple's server...\"", "r", "=", "requests", ".", "get", "(", "'http://files.apple.com/calendars/Australian32Holidays.ics'", ")", "cal", "=", "Calendar", ".", "from_ical", "(", "r", ".", "text", ")", ...
Scrapes Apple's iCal feed for Australian public holidays and generates per- state listings.
[ "Scrapes", "Apple", "s", "iCal", "feed", "for", "Australian", "public", "holidays", "and", "generates", "per", "-", "state", "listings", "." ]
70f85a505c0f345659850aec1715c46c687d0e48
https://github.com/Caramel/treacle/blob/70f85a505c0f345659850aec1715c46c687d0e48/treacle/scrape_apple_ical.py#L45-L101
train
57,598
SeattleTestbed/seash
pyreadline/modes/vi.py
ViMode.init_editing_mode
def init_editing_mode(self, e): # (M-C-j) '''Initialize vi editingmode''' self.show_all_if_ambiguous = 'on' self.key_dispatch = {} self.__vi_insert_mode = None self._vi_command = None self._vi_command_edit = None self._vi_key_find_char = None self._vi_key_...
python
def init_editing_mode(self, e): # (M-C-j) '''Initialize vi editingmode''' self.show_all_if_ambiguous = 'on' self.key_dispatch = {} self.__vi_insert_mode = None self._vi_command = None self._vi_command_edit = None self._vi_key_find_char = None self._vi_key_...
[ "def", "init_editing_mode", "(", "self", ",", "e", ")", ":", "# (M-C-j)", "self", ".", "show_all_if_ambiguous", "=", "'on'", "self", ".", "key_dispatch", "=", "{", "}", "self", ".", "__vi_insert_mode", "=", "None", "self", ".", "_vi_command", "=", "None", ...
Initialize vi editingmode
[ "Initialize", "vi", "editingmode" ]
40f9d2285662ff8b61e0468b4196acee089b273b
https://github.com/SeattleTestbed/seash/blob/40f9d2285662ff8b61e0468b4196acee089b273b/pyreadline/modes/vi.py#L51-L89
train
57,599