id
int32
0
252k
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
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
46,700
python-thumbnails/python-thumbnails
thumbnails/cache_backends.py
BaseCacheBackend.get
def get(self, thumbnail_name): """ Wrapper for ``_get``, which converts the thumbnail_name to String if necessary before calling ``_get`` :rtype: Thumbnail """ if isinstance(thumbnail_name, list): thumbnail_name = '/'.join(thumbnail_name) return self....
python
def get(self, thumbnail_name): """ Wrapper for ``_get``, which converts the thumbnail_name to String if necessary before calling ``_get`` :rtype: Thumbnail """ if isinstance(thumbnail_name, list): thumbnail_name = '/'.join(thumbnail_name) return self....
[ "def", "get", "(", "self", ",", "thumbnail_name", ")", ":", "if", "isinstance", "(", "thumbnail_name", ",", "list", ")", ":", "thumbnail_name", "=", "'/'", ".", "join", "(", "thumbnail_name", ")", "return", "self", ".", "_get", "(", "thumbnail_name", ")" ]
Wrapper for ``_get``, which converts the thumbnail_name to String if necessary before calling ``_get`` :rtype: Thumbnail
[ "Wrapper", "for", "_get", "which", "converts", "the", "thumbnail_name", "to", "String", "if", "necessary", "before", "calling", "_get" ]
d8dc0ff5410f730de2a0e5759e8a818b19de35b9
https://github.com/python-thumbnails/python-thumbnails/blob/d8dc0ff5410f730de2a0e5759e8a818b19de35b9/thumbnails/cache_backends.py#L17-L26
46,701
Jaymon/dsnparse
dsnparse.py
parse
def parse(dsn, parse_class=ParseResult, **defaults): """ parse a dsn to parts similar to parseurl :param dsn: string, the dsn to parse :param parse_class: ParseResult, the class that will be used to hold parsed values :param **defaults: dict, any values you want to have defaults for if they aren't ...
python
def parse(dsn, parse_class=ParseResult, **defaults): """ parse a dsn to parts similar to parseurl :param dsn: string, the dsn to parse :param parse_class: ParseResult, the class that will be used to hold parsed values :param **defaults: dict, any values you want to have defaults for if they aren't ...
[ "def", "parse", "(", "dsn", ",", "parse_class", "=", "ParseResult", ",", "*", "*", "defaults", ")", ":", "r", "=", "parse_class", "(", "dsn", ",", "*", "*", "defaults", ")", "return", "r" ]
parse a dsn to parts similar to parseurl :param dsn: string, the dsn to parse :param parse_class: ParseResult, the class that will be used to hold parsed values :param **defaults: dict, any values you want to have defaults for if they aren't in the dsn :returns: ParseResult() tuple-like instance
[ "parse", "a", "dsn", "to", "parts", "similar", "to", "parseurl" ]
2e4e1be8cc9d2dd0f6138c881b06677a6e80b029
https://github.com/Jaymon/dsnparse/blob/2e4e1be8cc9d2dd0f6138c881b06677a6e80b029/dsnparse.py#L280-L290
46,702
Jaymon/dsnparse
dsnparse.py
ParseResult.setdefault
def setdefault(self, key, val): """ set a default value for key this is different than dict's setdefault because it will set default either if the key doesn't exist, or if the value at the key evaluates to False, so an empty string or a None value will also be updated :...
python
def setdefault(self, key, val): """ set a default value for key this is different than dict's setdefault because it will set default either if the key doesn't exist, or if the value at the key evaluates to False, so an empty string or a None value will also be updated :...
[ "def", "setdefault", "(", "self", ",", "key", ",", "val", ")", ":", "if", "not", "getattr", "(", "self", ",", "key", ",", "None", ")", ":", "setattr", "(", "self", ",", "key", ",", "val", ")" ]
set a default value for key this is different than dict's setdefault because it will set default either if the key doesn't exist, or if the value at the key evaluates to False, so an empty string or a None value will also be updated :param key: string, the attribute to update :...
[ "set", "a", "default", "value", "for", "key" ]
2e4e1be8cc9d2dd0f6138c881b06677a6e80b029
https://github.com/Jaymon/dsnparse/blob/2e4e1be8cc9d2dd0f6138c881b06677a6e80b029/dsnparse.py#L197-L210
46,703
Jaymon/dsnparse
dsnparse.py
ParseResult.geturl
def geturl(self): """return the dsn back into url form""" return urlparse.urlunparse(( self.scheme, self.netloc, self.path, self.params, self.query_str, self.fragment, ))
python
def geturl(self): """return the dsn back into url form""" return urlparse.urlunparse(( self.scheme, self.netloc, self.path, self.params, self.query_str, self.fragment, ))
[ "def", "geturl", "(", "self", ")", ":", "return", "urlparse", ".", "urlunparse", "(", "(", "self", ".", "scheme", ",", "self", ".", "netloc", ",", "self", ".", "path", ",", "self", ".", "params", ",", "self", ".", "query_str", ",", "self", ".", "fr...
return the dsn back into url form
[ "return", "the", "dsn", "back", "into", "url", "form" ]
2e4e1be8cc9d2dd0f6138c881b06677a6e80b029
https://github.com/Jaymon/dsnparse/blob/2e4e1be8cc9d2dd0f6138c881b06677a6e80b029/dsnparse.py#L212-L221
46,704
zyga/guacamole
guacamole/ingredients/argparse.py
ParserIngredient.preparse
def preparse(self, context): """ Parse a portion of command line arguments with the early parser. This method relies on ``context.argv`` and ``context.early_parser`` and produces ``context.early_args``. The ``context.early_args`` object is the return value from argparse. ...
python
def preparse(self, context): """ Parse a portion of command line arguments with the early parser. This method relies on ``context.argv`` and ``context.early_parser`` and produces ``context.early_args``. The ``context.early_args`` object is the return value from argparse. ...
[ "def", "preparse", "(", "self", ",", "context", ")", ":", "context", ".", "early_args", ",", "unused", "=", "(", "context", ".", "early_parser", ".", "parse_known_args", "(", "context", ".", "argv", ")", ")" ]
Parse a portion of command line arguments with the early parser. This method relies on ``context.argv`` and ``context.early_parser`` and produces ``context.early_args``. The ``context.early_args`` object is the return value from argparse. It is the dict/object like namespace object.
[ "Parse", "a", "portion", "of", "command", "line", "arguments", "with", "the", "early", "parser", "." ]
105c10a798144e3b89659b500d7c2b84b0c76546
https://github.com/zyga/guacamole/blob/105c10a798144e3b89659b500d7c2b84b0c76546/guacamole/ingredients/argparse.py#L93-L104
46,705
zyga/guacamole
guacamole/ingredients/argparse.py
ParserIngredient.build_parser
def build_parser(self, context): """ Create the final argument parser. This method creates the non-early (full) argparse argument parser. Unlike the early counterpart it is expected to have knowledge of the full command tree. This method relies on ``context.cmd_tree`` a...
python
def build_parser(self, context): """ Create the final argument parser. This method creates the non-early (full) argparse argument parser. Unlike the early counterpart it is expected to have knowledge of the full command tree. This method relies on ``context.cmd_tree`` a...
[ "def", "build_parser", "(", "self", ",", "context", ")", ":", "context", ".", "parser", ",", "context", ".", "max_level", "=", "self", ".", "_create_parser", "(", "context", ")" ]
Create the final argument parser. This method creates the non-early (full) argparse argument parser. Unlike the early counterpart it is expected to have knowledge of the full command tree. This method relies on ``context.cmd_tree`` and produces ``context.parser``. Other ingredi...
[ "Create", "the", "final", "argument", "parser", "." ]
105c10a798144e3b89659b500d7c2b84b0c76546
https://github.com/zyga/guacamole/blob/105c10a798144e3b89659b500d7c2b84b0c76546/guacamole/ingredients/argparse.py#L106-L118
46,706
zyga/guacamole
guacamole/ingredients/argparse.py
AutocompleteIngredient.parse
def parse(self, context): """ Optionally trigger argument completion in the invoking shell. This method is called to see if bash argument completion is requested and to honor the request, if needed. This causes the process to exit (early) without giving other ingredients a chanc...
python
def parse(self, context): """ Optionally trigger argument completion in the invoking shell. This method is called to see if bash argument completion is requested and to honor the request, if needed. This causes the process to exit (early) without giving other ingredients a chanc...
[ "def", "parse", "(", "self", ",", "context", ")", ":", "try", ":", "import", "argcomplete", "except", "ImportError", ":", "return", "try", ":", "parser", "=", "context", ".", "parser", "except", "AttributeError", ":", "raise", "RecipeError", "(", "\"\"\"\n ...
Optionally trigger argument completion in the invoking shell. This method is called to see if bash argument completion is requested and to honor the request, if needed. This causes the process to exit (early) without giving other ingredients a chance to initialize or shut down. ...
[ "Optionally", "trigger", "argument", "completion", "in", "the", "invoking", "shell", "." ]
105c10a798144e3b89659b500d7c2b84b0c76546
https://github.com/zyga/guacamole/blob/105c10a798144e3b89659b500d7c2b84b0c76546/guacamole/ingredients/argparse.py#L216-L246
46,707
zyga/guacamole
guacamole/ingredients/ansi.py
ansi_cmd
def ansi_cmd(cmd, *args): """Get ANSI command code by name.""" try: obj = getattr(ANSI, str('cmd_{}'.format(cmd))) except AttributeError: raise ValueError( "incorrect command: {!r}".format(cmd)) if isinstance(obj, type("")): return obj else: return obj(*ar...
python
def ansi_cmd(cmd, *args): """Get ANSI command code by name.""" try: obj = getattr(ANSI, str('cmd_{}'.format(cmd))) except AttributeError: raise ValueError( "incorrect command: {!r}".format(cmd)) if isinstance(obj, type("")): return obj else: return obj(*ar...
[ "def", "ansi_cmd", "(", "cmd", ",", "*", "args", ")", ":", "try", ":", "obj", "=", "getattr", "(", "ANSI", ",", "str", "(", "'cmd_{}'", ".", "format", "(", "cmd", ")", ")", ")", "except", "AttributeError", ":", "raise", "ValueError", "(", "\"incorrec...
Get ANSI command code by name.
[ "Get", "ANSI", "command", "code", "by", "name", "." ]
105c10a798144e3b89659b500d7c2b84b0c76546
https://github.com/zyga/guacamole/blob/105c10a798144e3b89659b500d7c2b84b0c76546/guacamole/ingredients/ansi.py#L240-L250
46,708
zyga/guacamole
guacamole/ingredients/ansi.py
get_visible_color
def get_visible_color(color): """Get the visible counter-color.""" if isinstance(color, (str, type(""))): try: return getattr(_Visible, str('{}'.format(color))) except AttributeError: raise ValueError("incorrect color: {!r}".format(color)) elif isinstance(color, tuple...
python
def get_visible_color(color): """Get the visible counter-color.""" if isinstance(color, (str, type(""))): try: return getattr(_Visible, str('{}'.format(color))) except AttributeError: raise ValueError("incorrect color: {!r}".format(color)) elif isinstance(color, tuple...
[ "def", "get_visible_color", "(", "color", ")", ":", "if", "isinstance", "(", "color", ",", "(", "str", ",", "type", "(", "\"\"", ")", ")", ")", ":", "try", ":", "return", "getattr", "(", "_Visible", ",", "str", "(", "'{}'", ".", "format", "(", "col...
Get the visible counter-color.
[ "Get", "the", "visible", "counter", "-", "color", "." ]
105c10a798144e3b89659b500d7c2b84b0c76546
https://github.com/zyga/guacamole/blob/105c10a798144e3b89659b500d7c2b84b0c76546/guacamole/ingredients/ansi.py#L276-L302
46,709
hayd/pep8radius
pep8radius/vcs.py
using_git
def using_git(cwd): """Test whether the directory cwd is contained in a git repository.""" try: git_log = shell_out(["git", "log"], cwd=cwd) return True except (CalledProcessError, OSError): # pragma: no cover return False
python
def using_git(cwd): """Test whether the directory cwd is contained in a git repository.""" try: git_log = shell_out(["git", "log"], cwd=cwd) return True except (CalledProcessError, OSError): # pragma: no cover return False
[ "def", "using_git", "(", "cwd", ")", ":", "try", ":", "git_log", "=", "shell_out", "(", "[", "\"git\"", ",", "\"log\"", "]", ",", "cwd", "=", "cwd", ")", "return", "True", "except", "(", "CalledProcessError", ",", "OSError", ")", ":", "# pragma: no cover...
Test whether the directory cwd is contained in a git repository.
[ "Test", "whether", "the", "directory", "cwd", "is", "contained", "in", "a", "git", "repository", "." ]
0c1d14835d390f7feeb602f35a768e52ce306a0a
https://github.com/hayd/pep8radius/blob/0c1d14835d390f7feeb602f35a768e52ce306a0a/pep8radius/vcs.py#L21-L27
46,710
hayd/pep8radius
pep8radius/vcs.py
using_hg
def using_hg(cwd): """Test whether the directory cwd is contained in a mercurial repository.""" try: hg_log = shell_out(["hg", "log"], cwd=cwd) return True except (CalledProcessError, OSError): return False
python
def using_hg(cwd): """Test whether the directory cwd is contained in a mercurial repository.""" try: hg_log = shell_out(["hg", "log"], cwd=cwd) return True except (CalledProcessError, OSError): return False
[ "def", "using_hg", "(", "cwd", ")", ":", "try", ":", "hg_log", "=", "shell_out", "(", "[", "\"hg\"", ",", "\"log\"", "]", ",", "cwd", "=", "cwd", ")", "return", "True", "except", "(", "CalledProcessError", ",", "OSError", ")", ":", "return", "False" ]
Test whether the directory cwd is contained in a mercurial repository.
[ "Test", "whether", "the", "directory", "cwd", "is", "contained", "in", "a", "mercurial", "repository", "." ]
0c1d14835d390f7feeb602f35a768e52ce306a0a
https://github.com/hayd/pep8radius/blob/0c1d14835d390f7feeb602f35a768e52ce306a0a/pep8radius/vcs.py#L30-L37
46,711
hayd/pep8radius
pep8radius/vcs.py
using_bzr
def using_bzr(cwd): """Test whether the directory cwd is contained in a bazaar repository.""" try: bzr_log = shell_out(["bzr", "log"], cwd=cwd) return True except (CalledProcessError, OSError): return False
python
def using_bzr(cwd): """Test whether the directory cwd is contained in a bazaar repository.""" try: bzr_log = shell_out(["bzr", "log"], cwd=cwd) return True except (CalledProcessError, OSError): return False
[ "def", "using_bzr", "(", "cwd", ")", ":", "try", ":", "bzr_log", "=", "shell_out", "(", "[", "\"bzr\"", ",", "\"log\"", "]", ",", "cwd", "=", "cwd", ")", "return", "True", "except", "(", "CalledProcessError", ",", "OSError", ")", ":", "return", "False"...
Test whether the directory cwd is contained in a bazaar repository.
[ "Test", "whether", "the", "directory", "cwd", "is", "contained", "in", "a", "bazaar", "repository", "." ]
0c1d14835d390f7feeb602f35a768e52ce306a0a
https://github.com/hayd/pep8radius/blob/0c1d14835d390f7feeb602f35a768e52ce306a0a/pep8radius/vcs.py#L40-L46
46,712
hayd/pep8radius
pep8radius/vcs.py
VersionControl.which
def which(cwd=None): # pragma: no cover """Try to find which version control system contains the cwd directory. Returns the VersionControl superclass e.g. Git, if none were found this will raise a NotImplementedError. """ if cwd is None: cwd = os.getcwd() f...
python
def which(cwd=None): # pragma: no cover """Try to find which version control system contains the cwd directory. Returns the VersionControl superclass e.g. Git, if none were found this will raise a NotImplementedError. """ if cwd is None: cwd = os.getcwd() f...
[ "def", "which", "(", "cwd", "=", "None", ")", ":", "# pragma: no cover", "if", "cwd", "is", "None", ":", "cwd", "=", "os", ".", "getcwd", "(", ")", "for", "(", "k", ",", "using_vc", ")", "in", "globals", "(", ")", ".", "items", "(", ")", ":", "...
Try to find which version control system contains the cwd directory. Returns the VersionControl superclass e.g. Git, if none were found this will raise a NotImplementedError.
[ "Try", "to", "find", "which", "version", "control", "system", "contains", "the", "cwd", "directory", "." ]
0c1d14835d390f7feeb602f35a768e52ce306a0a
https://github.com/hayd/pep8radius/blob/0c1d14835d390f7feeb602f35a768e52ce306a0a/pep8radius/vcs.py#L74-L89
46,713
hayd/pep8radius
pep8radius/vcs.py
VersionControl.modified_lines
def modified_lines(self, r, file_name): """Returns the line numbers of a file which have been changed.""" cmd = self.file_diff_cmd(r, file_name) diff = shell_out_ignore_exitcode(cmd, cwd=self.root) return list(self.modified_lines_from_diff(diff))
python
def modified_lines(self, r, file_name): """Returns the line numbers of a file which have been changed.""" cmd = self.file_diff_cmd(r, file_name) diff = shell_out_ignore_exitcode(cmd, cwd=self.root) return list(self.modified_lines_from_diff(diff))
[ "def", "modified_lines", "(", "self", ",", "r", ",", "file_name", ")", ":", "cmd", "=", "self", ".", "file_diff_cmd", "(", "r", ",", "file_name", ")", "diff", "=", "shell_out_ignore_exitcode", "(", "cmd", ",", "cwd", "=", "self", ".", "root", ")", "ret...
Returns the line numbers of a file which have been changed.
[ "Returns", "the", "line", "numbers", "of", "a", "file", "which", "have", "been", "changed", "." ]
0c1d14835d390f7feeb602f35a768e52ce306a0a
https://github.com/hayd/pep8radius/blob/0c1d14835d390f7feeb602f35a768e52ce306a0a/pep8radius/vcs.py#L122-L126
46,714
hayd/pep8radius
pep8radius/vcs.py
VersionControl.modified_lines_from_diff
def modified_lines_from_diff(self, diff): """Returns the changed lines in a diff. - Potentially this is vc specific (if not using udiff). Note: this returns the line numbers in descending order. """ from pep8radius.diff import modified_lines_from_udiff for start, end i...
python
def modified_lines_from_diff(self, diff): """Returns the changed lines in a diff. - Potentially this is vc specific (if not using udiff). Note: this returns the line numbers in descending order. """ from pep8radius.diff import modified_lines_from_udiff for start, end i...
[ "def", "modified_lines_from_diff", "(", "self", ",", "diff", ")", ":", "from", "pep8radius", ".", "diff", "import", "modified_lines_from_udiff", "for", "start", ",", "end", "in", "modified_lines_from_udiff", "(", "diff", ")", ":", "yield", "start", ",", "end" ]
Returns the changed lines in a diff. - Potentially this is vc specific (if not using udiff). Note: this returns the line numbers in descending order.
[ "Returns", "the", "changed", "lines", "in", "a", "diff", "." ]
0c1d14835d390f7feeb602f35a768e52ce306a0a
https://github.com/hayd/pep8radius/blob/0c1d14835d390f7feeb602f35a768e52ce306a0a/pep8radius/vcs.py#L128-L138
46,715
hayd/pep8radius
pep8radius/vcs.py
VersionControl.get_filenames_diff
def get_filenames_diff(self, r): """Get the py files which have been changed since rev.""" cmd = self.filenames_diff_cmd(r) diff_files = shell_out_ignore_exitcode(cmd, cwd=self.root) diff_files = self.parse_diff_filenames(diff_files) return set(f for f in diff_files if f.endswi...
python
def get_filenames_diff(self, r): """Get the py files which have been changed since rev.""" cmd = self.filenames_diff_cmd(r) diff_files = shell_out_ignore_exitcode(cmd, cwd=self.root) diff_files = self.parse_diff_filenames(diff_files) return set(f for f in diff_files if f.endswi...
[ "def", "get_filenames_diff", "(", "self", ",", "r", ")", ":", "cmd", "=", "self", ".", "filenames_diff_cmd", "(", "r", ")", "diff_files", "=", "shell_out_ignore_exitcode", "(", "cmd", ",", "cwd", "=", "self", ".", "root", ")", "diff_files", "=", "self", ...
Get the py files which have been changed since rev.
[ "Get", "the", "py", "files", "which", "have", "been", "changed", "since", "rev", "." ]
0c1d14835d390f7feeb602f35a768e52ce306a0a
https://github.com/hayd/pep8radius/blob/0c1d14835d390f7feeb602f35a768e52ce306a0a/pep8radius/vcs.py#L140-L147
46,716
hayd/pep8radius
pep8radius/vcs.py
Bzr.parse_diff_filenames
def parse_diff_filenames(diff_files): """Parse the output of filenames_diff_cmd.""" # ? .gitignore # M 0.txt files = [] for line in diff_files.splitlines(): line = line.strip() fn = re.findall('[^ ]+\s+(.*.py)', line) if fn and not line.star...
python
def parse_diff_filenames(diff_files): """Parse the output of filenames_diff_cmd.""" # ? .gitignore # M 0.txt files = [] for line in diff_files.splitlines(): line = line.strip() fn = re.findall('[^ ]+\s+(.*.py)', line) if fn and not line.star...
[ "def", "parse_diff_filenames", "(", "diff_files", ")", ":", "# ? .gitignore", "# M 0.txt", "files", "=", "[", "]", "for", "line", "in", "diff_files", ".", "splitlines", "(", ")", ":", "line", "=", "line", ".", "strip", "(", ")", "fn", "=", "re", ".", ...
Parse the output of filenames_diff_cmd.
[ "Parse", "the", "output", "of", "filenames_diff_cmd", "." ]
0c1d14835d390f7feeb602f35a768e52ce306a0a
https://github.com/hayd/pep8radius/blob/0c1d14835d390f7feeb602f35a768e52ce306a0a/pep8radius/vcs.py#L246-L256
46,717
fusionbox/django-argonauts
argonauts/views.py
JsonRequestMixin.data
def data(self): """ Helper class for parsing JSON POST data into a Python object. """ if self.request.method == 'GET': return self.request.GET else: assert self.request.META['CONTENT_TYPE'].startswith('application/json') charset = self.request....
python
def data(self): """ Helper class for parsing JSON POST data into a Python object. """ if self.request.method == 'GET': return self.request.GET else: assert self.request.META['CONTENT_TYPE'].startswith('application/json') charset = self.request....
[ "def", "data", "(", "self", ")", ":", "if", "self", ".", "request", ".", "method", "==", "'GET'", ":", "return", "self", ".", "request", ".", "GET", "else", ":", "assert", "self", ".", "request", ".", "META", "[", "'CONTENT_TYPE'", "]", ".", "startsw...
Helper class for parsing JSON POST data into a Python object.
[ "Helper", "class", "for", "parsing", "JSON", "POST", "data", "into", "a", "Python", "object", "." ]
0f64f9700199e8c70a1cb9a055b8e31f6843933d
https://github.com/fusionbox/django-argonauts/blob/0f64f9700199e8c70a1cb9a055b8e31f6843933d/argonauts/views.py#L52-L61
46,718
fusionbox/django-argonauts
argonauts/views.py
RestView.options
def options(self, request, *args, **kwargs): """ Implements a OPTIONS HTTP method function returning all allowed HTTP methods. """ allow = [] for method in self.http_method_names: if hasattr(self, method): allow.append(method.upper()) r...
python
def options(self, request, *args, **kwargs): """ Implements a OPTIONS HTTP method function returning all allowed HTTP methods. """ allow = [] for method in self.http_method_names: if hasattr(self, method): allow.append(method.upper()) r...
[ "def", "options", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "allow", "=", "[", "]", "for", "method", "in", "self", ".", "http_method_names", ":", "if", "hasattr", "(", "self", ",", "method", ")", ":", "allow"...
Implements a OPTIONS HTTP method function returning all allowed HTTP methods.
[ "Implements", "a", "OPTIONS", "HTTP", "method", "function", "returning", "all", "allowed", "HTTP", "methods", "." ]
0f64f9700199e8c70a1cb9a055b8e31f6843933d
https://github.com/fusionbox/django-argonauts/blob/0f64f9700199e8c70a1cb9a055b8e31f6843933d/argonauts/views.py#L107-L118
46,719
hayd/pep8radius
pep8radius/main.py
main
def main(args=None, vc=None, cwd=None, apply_config=False): """PEP8 clean only the parts of the files touched since the last commit, a previous commit or branch.""" import signal try: # pragma: no cover # Exit on broken pipe. signal.signal(signal.SIGPIPE, signal.SIG_DFL) except Att...
python
def main(args=None, vc=None, cwd=None, apply_config=False): """PEP8 clean only the parts of the files touched since the last commit, a previous commit or branch.""" import signal try: # pragma: no cover # Exit on broken pipe. signal.signal(signal.SIGPIPE, signal.SIG_DFL) except Att...
[ "def", "main", "(", "args", "=", "None", ",", "vc", "=", "None", ",", "cwd", "=", "None", ",", "apply_config", "=", "False", ")", ":", "import", "signal", "try", ":", "# pragma: no cover", "# Exit on broken pipe.", "signal", ".", "signal", "(", "signal", ...
PEP8 clean only the parts of the files touched since the last commit, a previous commit or branch.
[ "PEP8", "clean", "only", "the", "parts", "of", "the", "files", "touched", "since", "the", "last", "commit", "a", "previous", "commit", "or", "branch", "." ]
0c1d14835d390f7feeb602f35a768e52ce306a0a
https://github.com/hayd/pep8radius/blob/0c1d14835d390f7feeb602f35a768e52ce306a0a/pep8radius/main.py#L31-L88
46,720
hayd/pep8radius
pep8radius/main.py
parse_args
def parse_args(arguments=None, root=None, apply_config=False): """Parse the arguments from the CLI. If apply_config then we first look up and apply configs using apply_config_defaults. """ if arguments is None: arguments = [] parser = create_parser() args = parser.parse_args(argum...
python
def parse_args(arguments=None, root=None, apply_config=False): """Parse the arguments from the CLI. If apply_config then we first look up and apply configs using apply_config_defaults. """ if arguments is None: arguments = [] parser = create_parser() args = parser.parse_args(argum...
[ "def", "parse_args", "(", "arguments", "=", "None", ",", "root", "=", "None", ",", "apply_config", "=", "False", ")", ":", "if", "arguments", "is", "None", ":", "arguments", "=", "[", "]", "parser", "=", "create_parser", "(", ")", "args", "=", "parser"...
Parse the arguments from the CLI. If apply_config then we first look up and apply configs using apply_config_defaults.
[ "Parse", "the", "arguments", "from", "the", "CLI", "." ]
0c1d14835d390f7feeb602f35a768e52ce306a0a
https://github.com/hayd/pep8radius/blob/0c1d14835d390f7feeb602f35a768e52ce306a0a/pep8radius/main.py#L204-L240
46,721
andrewsnowden/dota2py
dota2py/parser.py
Reader.read_vint32
def read_vint32(self): """ This seems to be a variable length integer ala utf-8 style """ result = 0 count = 0 while True: if count > 4: raise ValueError("Corrupt VarInt32") b = self.read_byte() result = result | (b & 0...
python
def read_vint32(self): """ This seems to be a variable length integer ala utf-8 style """ result = 0 count = 0 while True: if count > 4: raise ValueError("Corrupt VarInt32") b = self.read_byte() result = result | (b & 0...
[ "def", "read_vint32", "(", "self", ")", ":", "result", "=", "0", "count", "=", "0", "while", "True", ":", "if", "count", ">", "4", ":", "raise", "ValueError", "(", "\"Corrupt VarInt32\"", ")", "b", "=", "self", ".", "read_byte", "(", ")", "result", "...
This seems to be a variable length integer ala utf-8 style
[ "This", "seems", "to", "be", "a", "variable", "length", "integer", "ala", "utf", "-", "8", "style" ]
67637f4b9c160ea90c11b7e81545baf350affa7a
https://github.com/andrewsnowden/dota2py/blob/67637f4b9c160ea90c11b7e81545baf350affa7a/dota2py/parser.py#L100-L115
46,722
andrewsnowden/dota2py
dota2py/parser.py
Reader.read_message
def read_message(self, message_type, compressed=False, read_size=True): """ Read a protobuf message """ if read_size: size = self.read_vint32() b = self.read(size) else: b = self.read() if compressed: b = snappy.decompress(...
python
def read_message(self, message_type, compressed=False, read_size=True): """ Read a protobuf message """ if read_size: size = self.read_vint32() b = self.read(size) else: b = self.read() if compressed: b = snappy.decompress(...
[ "def", "read_message", "(", "self", ",", "message_type", ",", "compressed", "=", "False", ",", "read_size", "=", "True", ")", ":", "if", "read_size", ":", "size", "=", "self", ".", "read_vint32", "(", ")", "b", "=", "self", ".", "read", "(", "size", ...
Read a protobuf message
[ "Read", "a", "protobuf", "message" ]
67637f4b9c160ea90c11b7e81545baf350affa7a
https://github.com/andrewsnowden/dota2py/blob/67637f4b9c160ea90c11b7e81545baf350affa7a/dota2py/parser.py#L117-L132
46,723
andrewsnowden/dota2py
dota2py/parser.py
DemoParser.run_hooks
def run_hooks(self, packet): """ Run any additional functions that want to process this type of packet. These can be internal parser hooks, or external hooks that process information """ if packet.__class__ in self.internal_hooks: self.internal_hooks[packet._...
python
def run_hooks(self, packet): """ Run any additional functions that want to process this type of packet. These can be internal parser hooks, or external hooks that process information """ if packet.__class__ in self.internal_hooks: self.internal_hooks[packet._...
[ "def", "run_hooks", "(", "self", ",", "packet", ")", ":", "if", "packet", ".", "__class__", "in", "self", ".", "internal_hooks", ":", "self", ".", "internal_hooks", "[", "packet", ".", "__class__", "]", "(", "packet", ")", "if", "packet", ".", "__class__...
Run any additional functions that want to process this type of packet. These can be internal parser hooks, or external hooks that process information
[ "Run", "any", "additional", "functions", "that", "want", "to", "process", "this", "type", "of", "packet", ".", "These", "can", "be", "internal", "parser", "hooks", "or", "external", "hooks", "that", "process", "information" ]
67637f4b9c160ea90c11b7e81545baf350affa7a
https://github.com/andrewsnowden/dota2py/blob/67637f4b9c160ea90c11b7e81545baf350affa7a/dota2py/parser.py#L179-L190
46,724
andrewsnowden/dota2py
dota2py/parser.py
DemoParser.parse_string_table
def parse_string_table(self, tables): """ Need to pull out player information from string table """ self.info("String table: %s" % (tables.tables, )) for table in tables.tables: if table.table_name == "userinfo": for item in table.items: ...
python
def parse_string_table(self, tables): """ Need to pull out player information from string table """ self.info("String table: %s" % (tables.tables, )) for table in tables.tables: if table.table_name == "userinfo": for item in table.items: ...
[ "def", "parse_string_table", "(", "self", ",", "tables", ")", ":", "self", ".", "info", "(", "\"String table: %s\"", "%", "(", "tables", ".", "tables", ",", ")", ")", "for", "table", "in", "tables", ".", "tables", ":", "if", "table", ".", "table_name", ...
Need to pull out player information from string table
[ "Need", "to", "pull", "out", "player", "information", "from", "string", "table" ]
67637f4b9c160ea90c11b7e81545baf350affa7a
https://github.com/andrewsnowden/dota2py/blob/67637f4b9c160ea90c11b7e81545baf350affa7a/dota2py/parser.py#L198-L215
46,725
andrewsnowden/dota2py
dota2py/parser.py
DemoParser.parse_game_event
def parse_game_event(self, event): """ So CSVCMsg_GameEventList is a list of all events that can happen. A game event has an eventid which maps to a type of event that happened """ if event.eventid in self.event_lookup: #Bash this into a nicer data format to work wit...
python
def parse_game_event(self, event): """ So CSVCMsg_GameEventList is a list of all events that can happen. A game event has an eventid which maps to a type of event that happened """ if event.eventid in self.event_lookup: #Bash this into a nicer data format to work wit...
[ "def", "parse_game_event", "(", "self", ",", "event", ")", ":", "if", "event", ".", "eventid", "in", "self", ".", "event_lookup", ":", "#Bash this into a nicer data format to work with", "event_type", "=", "self", ".", "event_lookup", "[", "event", ".", "eventid",...
So CSVCMsg_GameEventList is a list of all events that can happen. A game event has an eventid which maps to a type of event that happened
[ "So", "CSVCMsg_GameEventList", "is", "a", "list", "of", "all", "events", "that", "can", "happen", ".", "A", "game", "event", "has", "an", "eventid", "which", "maps", "to", "a", "type", "of", "event", "that", "happened" ]
67637f4b9c160ea90c11b7e81545baf350affa7a
https://github.com/andrewsnowden/dota2py/blob/67637f4b9c160ea90c11b7e81545baf350affa7a/dota2py/parser.py#L262-L280
46,726
andrewsnowden/dota2py
dota2py/parser.py
DemoParser.parse
def parse(self): """ Parse a replay """ self.important("Parsing demo file '%s'" % (self.filename, )) with open(self.filename, 'rb') as f: reader = Reader(StringIO(f.read())) filestamp = reader.read(8) offset = reader.read_int32() ...
python
def parse(self): """ Parse a replay """ self.important("Parsing demo file '%s'" % (self.filename, )) with open(self.filename, 'rb') as f: reader = Reader(StringIO(f.read())) filestamp = reader.read(8) offset = reader.read_int32() ...
[ "def", "parse", "(", "self", ")", ":", "self", ".", "important", "(", "\"Parsing demo file '%s'\"", "%", "(", "self", ".", "filename", ",", ")", ")", "with", "open", "(", "self", ".", "filename", ",", "'rb'", ")", "as", "f", ":", "reader", "=", "Read...
Parse a replay
[ "Parse", "a", "replay" ]
67637f4b9c160ea90c11b7e81545baf350affa7a
https://github.com/andrewsnowden/dota2py/blob/67637f4b9c160ea90c11b7e81545baf350affa7a/dota2py/parser.py#L282-L327
46,727
Arello-Mobile/swagger2rst
swg2rst/swagger/abstract_type_object.py
convert
def convert(data): """ Convert from unicode to native ascii """ try: st = basestring except NameError: st = str if isinstance(data, st): return str(data) elif isinstance(data, Mapping): return dict(map(convert, data.iteritems())) elif isinstance(data, Iter...
python
def convert(data): """ Convert from unicode to native ascii """ try: st = basestring except NameError: st = str if isinstance(data, st): return str(data) elif isinstance(data, Mapping): return dict(map(convert, data.iteritems())) elif isinstance(data, Iter...
[ "def", "convert", "(", "data", ")", ":", "try", ":", "st", "=", "basestring", "except", "NameError", ":", "st", "=", "str", "if", "isinstance", "(", "data", ",", "st", ")", ":", "return", "str", "(", "data", ")", "elif", "isinstance", "(", "data", ...
Convert from unicode to native ascii
[ "Convert", "from", "unicode", "to", "native", "ascii" ]
e519f70701477dcc9f0bb237ee5b8e08e848701b
https://github.com/Arello-Mobile/swagger2rst/blob/e519f70701477dcc9f0bb237ee5b8e08e848701b/swg2rst/swagger/abstract_type_object.py#L103-L118
46,728
Arello-Mobile/swagger2rst
swg2rst/swagger/abstract_type_object.py
AbstractTypeObject.set_type_by_schema
def set_type_by_schema(self, schema_obj, schema_type): """ Set property type by schema object Schema will create, if it doesn't exists in collection :param dict schema_obj: raw schema object :param str schema_type: """ schema_id = self._get_object_schema_id(schem...
python
def set_type_by_schema(self, schema_obj, schema_type): """ Set property type by schema object Schema will create, if it doesn't exists in collection :param dict schema_obj: raw schema object :param str schema_type: """ schema_id = self._get_object_schema_id(schem...
[ "def", "set_type_by_schema", "(", "self", ",", "schema_obj", ",", "schema_type", ")", ":", "schema_id", "=", "self", ".", "_get_object_schema_id", "(", "schema_obj", ",", "schema_type", ")", "if", "not", "self", ".", "storage", ".", "contains", "(", "schema_id...
Set property type by schema object Schema will create, if it doesn't exists in collection :param dict schema_obj: raw schema object :param str schema_type:
[ "Set", "property", "type", "by", "schema", "object", "Schema", "will", "create", "if", "it", "doesn", "t", "exists", "in", "collection" ]
e519f70701477dcc9f0bb237ee5b8e08e848701b
https://github.com/Arello-Mobile/swagger2rst/blob/e519f70701477dcc9f0bb237ee5b8e08e848701b/swg2rst/swagger/abstract_type_object.py#L75-L89
46,729
joshourisman/django-tablib
django_tablib/admin/actions.py
tablib_export_action
def tablib_export_action(modeladmin, request, queryset, file_type="xls"): """ Allow the user to download the current filtered list of items :param file_type: One of the formats supported by tablib (e.g. "xls", "csv", "html", etc.) """ dataset = SimpleDataset(queryset, headers=None)...
python
def tablib_export_action(modeladmin, request, queryset, file_type="xls"): """ Allow the user to download the current filtered list of items :param file_type: One of the formats supported by tablib (e.g. "xls", "csv", "html", etc.) """ dataset = SimpleDataset(queryset, headers=None)...
[ "def", "tablib_export_action", "(", "modeladmin", ",", "request", ",", "queryset", ",", "file_type", "=", "\"xls\"", ")", ":", "dataset", "=", "SimpleDataset", "(", "queryset", ",", "headers", "=", "None", ")", "filename", "=", "'{0}.{1}'", ".", "format", "(...
Allow the user to download the current filtered list of items :param file_type: One of the formats supported by tablib (e.g. "xls", "csv", "html", etc.)
[ "Allow", "the", "user", "to", "download", "the", "current", "filtered", "list", "of", "items" ]
85b0751fa222a0498aa186714f840b1171a150f9
https://github.com/joshourisman/django-tablib/blob/85b0751fa222a0498aa186714f840b1171a150f9/django_tablib/admin/actions.py#L13-L33
46,730
Arello-Mobile/swagger2rst
swg2rst/swagger/schema.py
Schema.get_type_properties
def get_type_properties(self, property_obj, name, additional_prop=False): """ Extend parents 'Get internal properties of property'-method """ property_type, property_format, property_dict = \ super(Schema, self).get_type_properties(property_obj, name, additional_prop=addition...
python
def get_type_properties(self, property_obj, name, additional_prop=False): """ Extend parents 'Get internal properties of property'-method """ property_type, property_format, property_dict = \ super(Schema, self).get_type_properties(property_obj, name, additional_prop=addition...
[ "def", "get_type_properties", "(", "self", ",", "property_obj", ",", "name", ",", "additional_prop", "=", "False", ")", ":", "property_type", ",", "property_format", ",", "property_dict", "=", "super", "(", "Schema", ",", "self", ")", ".", "get_type_properties",...
Extend parents 'Get internal properties of property'-method
[ "Extend", "parents", "Get", "internal", "properties", "of", "property", "-", "method" ]
e519f70701477dcc9f0bb237ee5b8e08e848701b
https://github.com/Arello-Mobile/swagger2rst/blob/e519f70701477dcc9f0bb237ee5b8e08e848701b/swg2rst/swagger/schema.py#L55-L71
46,731
joshourisman/django-tablib
django_tablib/views.py
generic_export
def generic_export(request, model_name=None): """ Generic view configured through settings.TABLIB_MODELS Usage: 1. Add the view to ``urlpatterns`` in ``urls.py``:: url(r'export/(?P<model_name>[^/]+)/$', "django_tablib.views.generic_export"), 2. Create the ``setti...
python
def generic_export(request, model_name=None): """ Generic view configured through settings.TABLIB_MODELS Usage: 1. Add the view to ``urlpatterns`` in ``urls.py``:: url(r'export/(?P<model_name>[^/]+)/$', "django_tablib.views.generic_export"), 2. Create the ``setti...
[ "def", "generic_export", "(", "request", ",", "model_name", "=", "None", ")", ":", "if", "model_name", "not", "in", "settings", ".", "TABLIB_MODELS", ":", "raise", "Http404", "(", ")", "model", "=", "get_model", "(", "*", "model_name", ".", "split", "(", ...
Generic view configured through settings.TABLIB_MODELS Usage: 1. Add the view to ``urlpatterns`` in ``urls.py``:: url(r'export/(?P<model_name>[^/]+)/$', "django_tablib.views.generic_export"), 2. Create the ``settings.TABLIB_MODELS`` dictionary using model names ...
[ "Generic", "view", "configured", "through", "settings", ".", "TABLIB_MODELS" ]
85b0751fa222a0498aa186714f840b1171a150f9
https://github.com/joshourisman/django-tablib/blob/85b0751fa222a0498aa186714f840b1171a150f9/django_tablib/views.py#L39-L98
46,732
Arello-Mobile/swagger2rst
swg2rst/utils/rst.py
SwaggerObject.sorted
def sorted(collection): """ sorting dict by key, schema-collection by schema-name operations by id """ if len(collection) < 1: return collection if isinstance(collection, dict): return sorted(collection.items(), key=lambda x: x[0]) ...
python
def sorted(collection): """ sorting dict by key, schema-collection by schema-name operations by id """ if len(collection) < 1: return collection if isinstance(collection, dict): return sorted(collection.items(), key=lambda x: x[0]) ...
[ "def", "sorted", "(", "collection", ")", ":", "if", "len", "(", "collection", ")", "<", "1", ":", "return", "collection", "if", "isinstance", "(", "collection", ",", "dict", ")", ":", "return", "sorted", "(", "collection", ".", "items", "(", ")", ",", ...
sorting dict by key, schema-collection by schema-name operations by id
[ "sorting", "dict", "by", "key", "schema", "-", "collection", "by", "schema", "-", "name", "operations", "by", "id" ]
e519f70701477dcc9f0bb237ee5b8e08e848701b
https://github.com/Arello-Mobile/swagger2rst/blob/e519f70701477dcc9f0bb237ee5b8e08e848701b/swg2rst/utils/rst.py#L24-L42
46,733
ixc/python-edtf
edtf/fields.py
EDTFField.pre_save
def pre_save(self, instance, add): """ Updates the edtf value from the value of the display_field. If there's a valid edtf, then set the date values. """ if not self.natural_text_field or self.attname not in instance.__dict__: return edtf = getattr(instance, ...
python
def pre_save(self, instance, add): """ Updates the edtf value from the value of the display_field. If there's a valid edtf, then set the date values. """ if not self.natural_text_field or self.attname not in instance.__dict__: return edtf = getattr(instance, ...
[ "def", "pre_save", "(", "self", ",", "instance", ",", "add", ")", ":", "if", "not", "self", ".", "natural_text_field", "or", "self", ".", "attname", "not", "in", "instance", ".", "__dict__", ":", "return", "edtf", "=", "getattr", "(", "instance", ",", ...
Updates the edtf value from the value of the display_field. If there's a valid edtf, then set the date values.
[ "Updates", "the", "edtf", "value", "from", "the", "value", "of", "the", "display_field", ".", "If", "there", "s", "a", "valid", "edtf", "then", "set", "the", "date", "values", "." ]
ec2124d3df75f8dd72571026380ce8dd16f3dd6b
https://github.com/ixc/python-edtf/blob/ec2124d3df75f8dd72571026380ce8dd16f3dd6b/edtf/fields.py#L87-L138
46,734
ixc/python-edtf
edtf/parser/parser_classes.py
apply_delta
def apply_delta(op, time_struct, delta): """ Apply a `relativedelta` to a `struct_time` data structure. `op` is an operator function, probably always `add` or `sub`tract to correspond to `a_date + a_delta` and `a_date - a_delta`. This function is required because we cannot use standard `datetime` ...
python
def apply_delta(op, time_struct, delta): """ Apply a `relativedelta` to a `struct_time` data structure. `op` is an operator function, probably always `add` or `sub`tract to correspond to `a_date + a_delta` and `a_date - a_delta`. This function is required because we cannot use standard `datetime` ...
[ "def", "apply_delta", "(", "op", ",", "time_struct", ",", "delta", ")", ":", "if", "not", "delta", ":", "return", "time_struct", "# No work to do", "try", ":", "dt_result", "=", "op", "(", "datetime", "(", "*", "time_struct", "[", ":", "6", "]", ")", "...
Apply a `relativedelta` to a `struct_time` data structure. `op` is an operator function, probably always `add` or `sub`tract to correspond to `a_date + a_delta` and `a_date - a_delta`. This function is required because we cannot use standard `datetime` module objects for conversion when the date/time ...
[ "Apply", "a", "relativedelta", "to", "a", "struct_time", "data", "structure", "." ]
ec2124d3df75f8dd72571026380ce8dd16f3dd6b
https://github.com/ixc/python-edtf/blob/ec2124d3df75f8dd72571026380ce8dd16f3dd6b/edtf/parser/parser_classes.py#L47-L83
46,735
ixc/python-edtf
edtf/parser/parser_classes.py
Date._strict_date
def _strict_date(self, lean): """ Return a `time.struct_time` representation of the date. """ return struct_time( ( self._precise_year(lean), self._precise_month(lean), self._precise_day(lean), ) + tuple(TIME_EMPTY_T...
python
def _strict_date(self, lean): """ Return a `time.struct_time` representation of the date. """ return struct_time( ( self._precise_year(lean), self._precise_month(lean), self._precise_day(lean), ) + tuple(TIME_EMPTY_T...
[ "def", "_strict_date", "(", "self", ",", "lean", ")", ":", "return", "struct_time", "(", "(", "self", ".", "_precise_year", "(", "lean", ")", ",", "self", ".", "_precise_month", "(", "lean", ")", ",", "self", ".", "_precise_day", "(", "lean", ")", ",",...
Return a `time.struct_time` representation of the date.
[ "Return", "a", "time", ".", "struct_time", "representation", "of", "the", "date", "." ]
ec2124d3df75f8dd72571026380ce8dd16f3dd6b
https://github.com/ixc/python-edtf/blob/ec2124d3df75f8dd72571026380ce8dd16f3dd6b/edtf/parser/parser_classes.py#L290-L300
46,736
jimjkelly/lambda-deploy
src/lambda_deploy/lambda_deploy.py
LambdaDeploy.package
def package(self): """Packages lambda data for deployment into a zip""" logger.info('Packaging lambda {}'.format(self.lambda_name)) zfh = io.BytesIO() if os.path.exists(os.path.join(self.lambda_dir, '.env')): logger.warn( 'A .env file exists in your Lambda di...
python
def package(self): """Packages lambda data for deployment into a zip""" logger.info('Packaging lambda {}'.format(self.lambda_name)) zfh = io.BytesIO() if os.path.exists(os.path.join(self.lambda_dir, '.env')): logger.warn( 'A .env file exists in your Lambda di...
[ "def", "package", "(", "self", ")", ":", "logger", ".", "info", "(", "'Packaging lambda {}'", ".", "format", "(", "self", ".", "lambda_name", ")", ")", "zfh", "=", "io", ".", "BytesIO", "(", ")", "if", "os", ".", "path", ".", "exists", "(", "os", "...
Packages lambda data for deployment into a zip
[ "Packages", "lambda", "data", "for", "deployment", "into", "a", "zip" ]
012a111189f32d25de23d79fb75411b507b1a5fb
https://github.com/jimjkelly/lambda-deploy/blob/012a111189f32d25de23d79fb75411b507b1a5fb/src/lambda_deploy/lambda_deploy.py#L101-L162
46,737
jimjkelly/lambda-deploy
src/lambda_deploy/lambda_deploy.py
LambdaDeploy.deploy
def deploy(self, *lambdas): """Deploys lambdas to AWS""" if not self.role: logger.error('Missing AWS Role') raise ArgumentsError('Role required') logger.debug('Deploying lambda {}'.format(self.lambda_name)) zfh = self.package() if self.lambda_name in se...
python
def deploy(self, *lambdas): """Deploys lambdas to AWS""" if not self.role: logger.error('Missing AWS Role') raise ArgumentsError('Role required') logger.debug('Deploying lambda {}'.format(self.lambda_name)) zfh = self.package() if self.lambda_name in se...
[ "def", "deploy", "(", "self", ",", "*", "lambdas", ")", ":", "if", "not", "self", ".", "role", ":", "logger", ".", "error", "(", "'Missing AWS Role'", ")", "raise", "ArgumentsError", "(", "'Role required'", ")", "logger", ".", "debug", "(", "'Deploying lam...
Deploys lambdas to AWS
[ "Deploys", "lambdas", "to", "AWS" ]
012a111189f32d25de23d79fb75411b507b1a5fb
https://github.com/jimjkelly/lambda-deploy/blob/012a111189f32d25de23d79fb75411b507b1a5fb/src/lambda_deploy/lambda_deploy.py#L164-L231
46,738
jimjkelly/lambda-deploy
src/lambda_deploy/lambda_deploy.py
LambdaDeploy.list
def list(self): """Lists already deployed lambdas""" for function in self.client.list_functions().get('Functions', []): lines = json.dumps(function, indent=4, sort_keys=True).split('\n') for line in lines: logger.info(line)
python
def list(self): """Lists already deployed lambdas""" for function in self.client.list_functions().get('Functions', []): lines = json.dumps(function, indent=4, sort_keys=True).split('\n') for line in lines: logger.info(line)
[ "def", "list", "(", "self", ")", ":", "for", "function", "in", "self", ".", "client", ".", "list_functions", "(", ")", ".", "get", "(", "'Functions'", ",", "[", "]", ")", ":", "lines", "=", "json", ".", "dumps", "(", "function", ",", "indent", "=",...
Lists already deployed lambdas
[ "Lists", "already", "deployed", "lambdas" ]
012a111189f32d25de23d79fb75411b507b1a5fb
https://github.com/jimjkelly/lambda-deploy/blob/012a111189f32d25de23d79fb75411b507b1a5fb/src/lambda_deploy/lambda_deploy.py#L233-L238
46,739
ixc/python-edtf
edtf/jdutil.py
date_to_jd
def date_to_jd(year,month,day): """ Convert a date to Julian Day. Algorithm from 'Practical Astronomy with your Calculator or Spreadsheet', 4th ed., Duffet-Smith and Zwart, 2011. Parameters ---------- year : int Year as integer. Years preceding 1 A.D. should be 0 or negative. ...
python
def date_to_jd(year,month,day): """ Convert a date to Julian Day. Algorithm from 'Practical Astronomy with your Calculator or Spreadsheet', 4th ed., Duffet-Smith and Zwart, 2011. Parameters ---------- year : int Year as integer. Years preceding 1 A.D. should be 0 or negative. ...
[ "def", "date_to_jd", "(", "year", ",", "month", ",", "day", ")", ":", "if", "month", "==", "1", "or", "month", "==", "2", ":", "yearp", "=", "year", "-", "1", "monthp", "=", "month", "+", "12", "else", ":", "yearp", "=", "year", "monthp", "=", ...
Convert a date to Julian Day. Algorithm from 'Practical Astronomy with your Calculator or Spreadsheet', 4th ed., Duffet-Smith and Zwart, 2011. Parameters ---------- year : int Year as integer. Years preceding 1 A.D. should be 0 or negative. The year before 1 A.D. is 0, 10 B.C....
[ "Convert", "a", "date", "to", "Julian", "Day", "." ]
ec2124d3df75f8dd72571026380ce8dd16f3dd6b
https://github.com/ixc/python-edtf/blob/ec2124d3df75f8dd72571026380ce8dd16f3dd6b/edtf/jdutil.py#L57-L117
46,740
ixc/python-edtf
edtf/jdutil.py
jd_to_date
def jd_to_date(jd): """ Convert Julian Day to date. Algorithm from 'Practical Astronomy with your Calculator or Spreadsheet', 4th ed., Duffet-Smith and Zwart, 2011. Parameters ---------- jd : float Julian Day Returns ------- year : int Year as integer. Yea...
python
def jd_to_date(jd): """ Convert Julian Day to date. Algorithm from 'Practical Astronomy with your Calculator or Spreadsheet', 4th ed., Duffet-Smith and Zwart, 2011. Parameters ---------- jd : float Julian Day Returns ------- year : int Year as integer. Yea...
[ "def", "jd_to_date", "(", "jd", ")", ":", "jd", "=", "jd", "+", "0.5", "F", ",", "I", "=", "math", ".", "modf", "(", "jd", ")", "I", "=", "int", "(", "I", ")", "A", "=", "math", ".", "trunc", "(", "(", "I", "-", "1867216.25", ")", "/", "3...
Convert Julian Day to date. Algorithm from 'Practical Astronomy with your Calculator or Spreadsheet', 4th ed., Duffet-Smith and Zwart, 2011. Parameters ---------- jd : float Julian Day Returns ------- year : int Year as integer. Years preceding 1 A.D. should be 0 ...
[ "Convert", "Julian", "Day", "to", "date", "." ]
ec2124d3df75f8dd72571026380ce8dd16f3dd6b
https://github.com/ixc/python-edtf/blob/ec2124d3df75f8dd72571026380ce8dd16f3dd6b/edtf/jdutil.py#L120-L184
46,741
ixc/python-edtf
edtf/jdutil.py
hmsm_to_days
def hmsm_to_days(hour=0,min=0,sec=0,micro=0): """ Convert hours, minutes, seconds, and microseconds to fractional days. Parameters ---------- hour : int, optional Hour number. Defaults to 0. min : int, optional Minute number. Defaults to 0. sec : int, optional Seco...
python
def hmsm_to_days(hour=0,min=0,sec=0,micro=0): """ Convert hours, minutes, seconds, and microseconds to fractional days. Parameters ---------- hour : int, optional Hour number. Defaults to 0. min : int, optional Minute number. Defaults to 0. sec : int, optional Seco...
[ "def", "hmsm_to_days", "(", "hour", "=", "0", ",", "min", "=", "0", ",", "sec", "=", "0", ",", "micro", "=", "0", ")", ":", "days", "=", "sec", "+", "(", "micro", "/", "1.e6", ")", "days", "=", "min", "+", "(", "days", "/", "60.", ")", "day...
Convert hours, minutes, seconds, and microseconds to fractional days. Parameters ---------- hour : int, optional Hour number. Defaults to 0. min : int, optional Minute number. Defaults to 0. sec : int, optional Second number. Defaults to 0. micro : int, optional ...
[ "Convert", "hours", "minutes", "seconds", "and", "microseconds", "to", "fractional", "days", "." ]
ec2124d3df75f8dd72571026380ce8dd16f3dd6b
https://github.com/ixc/python-edtf/blob/ec2124d3df75f8dd72571026380ce8dd16f3dd6b/edtf/jdutil.py#L187-L222
46,742
ixc/python-edtf
edtf/jdutil.py
days_to_hmsm
def days_to_hmsm(days): """ Convert fractional days to hours, minutes, seconds, and microseconds. Precision beyond microseconds is rounded to the nearest microsecond. Parameters ---------- days : float A fractional number of days. Must be less than 1. Returns ------- hour :...
python
def days_to_hmsm(days): """ Convert fractional days to hours, minutes, seconds, and microseconds. Precision beyond microseconds is rounded to the nearest microsecond. Parameters ---------- days : float A fractional number of days. Must be less than 1. Returns ------- hour :...
[ "def", "days_to_hmsm", "(", "days", ")", ":", "hours", "=", "days", "*", "24.", "hours", ",", "hour", "=", "math", ".", "modf", "(", "hours", ")", "mins", "=", "hours", "*", "60.", "mins", ",", "min", "=", "math", ".", "modf", "(", "mins", ")", ...
Convert fractional days to hours, minutes, seconds, and microseconds. Precision beyond microseconds is rounded to the nearest microsecond. Parameters ---------- days : float A fractional number of days. Must be less than 1. Returns ------- hour : int Hour number. min :...
[ "Convert", "fractional", "days", "to", "hours", "minutes", "seconds", "and", "microseconds", ".", "Precision", "beyond", "microseconds", "is", "rounded", "to", "the", "nearest", "microsecond", "." ]
ec2124d3df75f8dd72571026380ce8dd16f3dd6b
https://github.com/ixc/python-edtf/blob/ec2124d3df75f8dd72571026380ce8dd16f3dd6b/edtf/jdutil.py#L225-L271
46,743
ixc/python-edtf
edtf/jdutil.py
datetime_to_jd
def datetime_to_jd(date): """ Convert a `datetime.datetime` object to Julian Day. Parameters ---------- date : `datetime.datetime` instance Returns ------- jd : float Julian day. Examples -------- >>> d = datetime.datetime(1985,2,17,6) >>> d datetime.date...
python
def datetime_to_jd(date): """ Convert a `datetime.datetime` object to Julian Day. Parameters ---------- date : `datetime.datetime` instance Returns ------- jd : float Julian day. Examples -------- >>> d = datetime.datetime(1985,2,17,6) >>> d datetime.date...
[ "def", "datetime_to_jd", "(", "date", ")", ":", "days", "=", "date", ".", "day", "+", "hmsm_to_days", "(", "date", ".", "hour", ",", "date", ".", "minute", ",", "date", ".", "second", ",", "date", ".", "microsecond", ")", "return", "date_to_jd", "(", ...
Convert a `datetime.datetime` object to Julian Day. Parameters ---------- date : `datetime.datetime` instance Returns ------- jd : float Julian day. Examples -------- >>> d = datetime.datetime(1985,2,17,6) >>> d datetime.datetime(1985, 2, 17, 6, 0) >>> jdutil...
[ "Convert", "a", "datetime", ".", "datetime", "object", "to", "Julian", "Day", "." ]
ec2124d3df75f8dd72571026380ce8dd16f3dd6b
https://github.com/ixc/python-edtf/blob/ec2124d3df75f8dd72571026380ce8dd16f3dd6b/edtf/jdutil.py#L274-L298
46,744
ixc/python-edtf
edtf/jdutil.py
jd_to_datetime
def jd_to_datetime(jd): """ Convert a Julian Day to an `jdutil.datetime` object. Parameters ---------- jd : float Julian day. Returns ------- dt : `jdutil.datetime` object `jdutil.datetime` equivalent of Julian day. Examples -------- >>> jd_to_datetime(2446...
python
def jd_to_datetime(jd): """ Convert a Julian Day to an `jdutil.datetime` object. Parameters ---------- jd : float Julian day. Returns ------- dt : `jdutil.datetime` object `jdutil.datetime` equivalent of Julian day. Examples -------- >>> jd_to_datetime(2446...
[ "def", "jd_to_datetime", "(", "jd", ")", ":", "year", ",", "month", ",", "day", "=", "jd_to_date", "(", "jd", ")", "frac_days", ",", "day", "=", "math", ".", "modf", "(", "day", ")", "day", "=", "int", "(", "day", ")", "hour", ",", "min", ",", ...
Convert a Julian Day to an `jdutil.datetime` object. Parameters ---------- jd : float Julian day. Returns ------- dt : `jdutil.datetime` object `jdutil.datetime` equivalent of Julian day. Examples -------- >>> jd_to_datetime(2446113.75) datetime(1985, 2, 17, 6,...
[ "Convert", "a", "Julian", "Day", "to", "an", "jdutil", ".", "datetime", "object", "." ]
ec2124d3df75f8dd72571026380ce8dd16f3dd6b
https://github.com/ixc/python-edtf/blob/ec2124d3df75f8dd72571026380ce8dd16f3dd6b/edtf/jdutil.py#L301-L328
46,745
ixc/python-edtf
edtf/jdutil.py
timedelta_to_days
def timedelta_to_days(td): """ Convert a `datetime.timedelta` object to a total number of days. Parameters ---------- td : `datetime.timedelta` instance Returns ------- days : float Total number of days in the `datetime.timedelta` object. Examples -------- >>> td =...
python
def timedelta_to_days(td): """ Convert a `datetime.timedelta` object to a total number of days. Parameters ---------- td : `datetime.timedelta` instance Returns ------- days : float Total number of days in the `datetime.timedelta` object. Examples -------- >>> td =...
[ "def", "timedelta_to_days", "(", "td", ")", ":", "seconds_in_day", "=", "24.", "*", "3600.", "days", "=", "td", ".", "days", "+", "(", "td", ".", "seconds", "+", "(", "td", ".", "microseconds", "*", "10.e6", ")", ")", "/", "seconds_in_day", "return", ...
Convert a `datetime.timedelta` object to a total number of days. Parameters ---------- td : `datetime.timedelta` instance Returns ------- days : float Total number of days in the `datetime.timedelta` object. Examples -------- >>> td = datetime.timedelta(4.5) >>> td ...
[ "Convert", "a", "datetime", ".", "timedelta", "object", "to", "a", "total", "number", "of", "days", "." ]
ec2124d3df75f8dd72571026380ce8dd16f3dd6b
https://github.com/ixc/python-edtf/blob/ec2124d3df75f8dd72571026380ce8dd16f3dd6b/edtf/jdutil.py#L331-L357
46,746
Arello-Mobile/swagger2rst
swg2rst/swagger/schema_objects.py
SchemaObjects.create_schema
def create_schema(cls, obj, name, schema_type, root): """ Create Schema object :param dict obj: swagger schema object :param str name: schema name :param str schema_type: schema location. Can be ``inline``, ``definition`` or ``mapped`` :param BaseSwaggerObject root: ...
python
def create_schema(cls, obj, name, schema_type, root): """ Create Schema object :param dict obj: swagger schema object :param str name: schema name :param str schema_type: schema location. Can be ``inline``, ``definition`` or ``mapped`` :param BaseSwaggerObject root: ...
[ "def", "create_schema", "(", "cls", ",", "obj", ",", "name", ",", "schema_type", ",", "root", ")", ":", "if", "schema_type", "==", "SchemaTypes", ".", "MAPPED", ":", "schema", "=", "SchemaMapWrapper", "(", "obj", ",", "storage", "=", "cls", ",", "name", ...
Create Schema object :param dict obj: swagger schema object :param str name: schema name :param str schema_type: schema location. Can be ``inline``, ``definition`` or ``mapped`` :param BaseSwaggerObject root: root doc :return: new schema :rtype: Schema
[ "Create", "Schema", "object" ]
e519f70701477dcc9f0bb237ee5b8e08e848701b
https://github.com/Arello-Mobile/swagger2rst/blob/e519f70701477dcc9f0bb237ee5b8e08e848701b/swg2rst/swagger/schema_objects.py#L15-L31
46,747
Arello-Mobile/swagger2rst
swg2rst/swagger/schema_objects.py
SchemaObjects.get_schemas
def get_schemas(cls, schema_types=None, sort=True): """ Get schemas by type. If ``schema_type`` is None, return all schemas :param schema_types: list of schema types :type schema_types: list or None :param bool sort: sort by name :return: list of schemas :rtype: ...
python
def get_schemas(cls, schema_types=None, sort=True): """ Get schemas by type. If ``schema_type`` is None, return all schemas :param schema_types: list of schema types :type schema_types: list or None :param bool sort: sort by name :return: list of schemas :rtype: ...
[ "def", "get_schemas", "(", "cls", ",", "schema_types", "=", "None", ",", "sort", "=", "True", ")", ":", "result", "=", "filter", "(", "lambda", "x", ":", "not", "x", ".", "is_inline_array", ",", "cls", ".", "_schemas", ".", "values", "(", ")", ")", ...
Get schemas by type. If ``schema_type`` is None, return all schemas :param schema_types: list of schema types :type schema_types: list or None :param bool sort: sort by name :return: list of schemas :rtype: list
[ "Get", "schemas", "by", "type", ".", "If", "schema_type", "is", "None", "return", "all", "schemas" ]
e519f70701477dcc9f0bb237ee5b8e08e848701b
https://github.com/Arello-Mobile/swagger2rst/blob/e519f70701477dcc9f0bb237ee5b8e08e848701b/swg2rst/swagger/schema_objects.py#L52-L67
46,748
ixc/python-edtf
edtf/convert.py
trim_struct_time
def trim_struct_time(st, strip_time=False): """ Return a `struct_time` based on the one provided but with the extra fields `tm_wday`, `tm_yday`, and `tm_isdst` reset to default values. If `strip_time` is set to true the time value are also set to zero: `tm_hour`, `tm_min`, and `tm_sec`. """ ...
python
def trim_struct_time(st, strip_time=False): """ Return a `struct_time` based on the one provided but with the extra fields `tm_wday`, `tm_yday`, and `tm_isdst` reset to default values. If `strip_time` is set to true the time value are also set to zero: `tm_hour`, `tm_min`, and `tm_sec`. """ ...
[ "def", "trim_struct_time", "(", "st", ",", "strip_time", "=", "False", ")", ":", "if", "strip_time", ":", "return", "struct_time", "(", "list", "(", "st", "[", ":", "3", "]", ")", "+", "TIME_EMPTY_TIME", "+", "TIME_EMPTY_EXTRAS", ")", "else", ":", "retur...
Return a `struct_time` based on the one provided but with the extra fields `tm_wday`, `tm_yday`, and `tm_isdst` reset to default values. If `strip_time` is set to true the time value are also set to zero: `tm_hour`, `tm_min`, and `tm_sec`.
[ "Return", "a", "struct_time", "based", "on", "the", "one", "provided", "but", "with", "the", "extra", "fields", "tm_wday", "tm_yday", "and", "tm_isdst", "reset", "to", "default", "values", "." ]
ec2124d3df75f8dd72571026380ce8dd16f3dd6b
https://github.com/ixc/python-edtf/blob/ec2124d3df75f8dd72571026380ce8dd16f3dd6b/edtf/convert.py#L52-L63
46,749
ixc/python-edtf
edtf/convert.py
struct_time_to_jd
def struct_time_to_jd(st): """ Return a float number representing the Julian Date for the given `struct_time`. NOTE: extra fields `tm_wday`, `tm_yday`, and `tm_isdst` are ignored. """ year, month, day = st[:3] hours, minutes, seconds = st[3:6] # Convert time of day to fraction of day ...
python
def struct_time_to_jd(st): """ Return a float number representing the Julian Date for the given `struct_time`. NOTE: extra fields `tm_wday`, `tm_yday`, and `tm_isdst` are ignored. """ year, month, day = st[:3] hours, minutes, seconds = st[3:6] # Convert time of day to fraction of day ...
[ "def", "struct_time_to_jd", "(", "st", ")", ":", "year", ",", "month", ",", "day", "=", "st", "[", ":", "3", "]", "hours", ",", "minutes", ",", "seconds", "=", "st", "[", "3", ":", "6", "]", "# Convert time of day to fraction of day", "day", "+=", "jdu...
Return a float number representing the Julian Date for the given `struct_time`. NOTE: extra fields `tm_wday`, `tm_yday`, and `tm_isdst` are ignored.
[ "Return", "a", "float", "number", "representing", "the", "Julian", "Date", "for", "the", "given", "struct_time", "." ]
ec2124d3df75f8dd72571026380ce8dd16f3dd6b
https://github.com/ixc/python-edtf/blob/ec2124d3df75f8dd72571026380ce8dd16f3dd6b/edtf/convert.py#L66-L79
46,750
ixc/python-edtf
edtf/convert.py
jd_to_struct_time
def jd_to_struct_time(jd): """ Return a `struct_time` converted from a Julian Date float number. WARNING: Conversion to then from Julian Date value to `struct_time` can be inaccurate and lose or gain time, especially for BC (negative) years. NOTE: extra fields `tm_wday`, `tm_yday`, and `tm_isdst` ...
python
def jd_to_struct_time(jd): """ Return a `struct_time` converted from a Julian Date float number. WARNING: Conversion to then from Julian Date value to `struct_time` can be inaccurate and lose or gain time, especially for BC (negative) years. NOTE: extra fields `tm_wday`, `tm_yday`, and `tm_isdst` ...
[ "def", "jd_to_struct_time", "(", "jd", ")", ":", "year", ",", "month", ",", "day", "=", "jdutil", ".", "jd_to_date", "(", "jd", ")", "# Convert time of day from fraction of day", "day_fraction", "=", "day", "-", "int", "(", "day", ")", "hour", ",", "minute",...
Return a `struct_time` converted from a Julian Date float number. WARNING: Conversion to then from Julian Date value to `struct_time` can be inaccurate and lose or gain time, especially for BC (negative) years. NOTE: extra fields `tm_wday`, `tm_yday`, and `tm_isdst` are set to default values, not real...
[ "Return", "a", "struct_time", "converted", "from", "a", "Julian", "Date", "float", "number", "." ]
ec2124d3df75f8dd72571026380ce8dd16f3dd6b
https://github.com/ixc/python-edtf/blob/ec2124d3df75f8dd72571026380ce8dd16f3dd6b/edtf/convert.py#L82-L106
46,751
Arello-Mobile/swagger2rst
swg2rst/utils/exampilators.py
Exampilator.get_example_by_schema
def get_example_by_schema(cls, schema, ignored_schemas=None, paths=None, name=''): """ Get example by schema object :param Schema schema: current schema :param list ignored_schemas: list of previous schemas for avoid circular references :param list paths: list object paths (...
python
def get_example_by_schema(cls, schema, ignored_schemas=None, paths=None, name=''): """ Get example by schema object :param Schema schema: current schema :param list ignored_schemas: list of previous schemas for avoid circular references :param list paths: list object paths (...
[ "def", "get_example_by_schema", "(", "cls", ",", "schema", ",", "ignored_schemas", "=", "None", ",", "paths", "=", "None", ",", "name", "=", "''", ")", ":", "if", "schema", ".", "schema_example", ":", "return", "schema", ".", "schema_example", "if", "ignor...
Get example by schema object :param Schema schema: current schema :param list ignored_schemas: list of previous schemas for avoid circular references :param list paths: list object paths (ex. #/definitions/Model.property) If nested schemas exists, custom examples checks ...
[ "Get", "example", "by", "schema", "object" ]
e519f70701477dcc9f0bb237ee5b8e08e848701b
https://github.com/Arello-Mobile/swagger2rst/blob/e519f70701477dcc9f0bb237ee5b8e08e848701b/swg2rst/utils/exampilators.py#L107-L156
46,752
Arello-Mobile/swagger2rst
swg2rst/utils/exampilators.py
Exampilator.get_body_example
def get_body_example(cls, operation): """ Get example for body parameter example by operation :param Operation operation: operation object """ path = "#/paths/'{0.path}'/{0.method}/parameters/{name}".format( operation, name=operation.body.name or 'body') return cls.g...
python
def get_body_example(cls, operation): """ Get example for body parameter example by operation :param Operation operation: operation object """ path = "#/paths/'{0.path}'/{0.method}/parameters/{name}".format( operation, name=operation.body.name or 'body') return cls.g...
[ "def", "get_body_example", "(", "cls", ",", "operation", ")", ":", "path", "=", "\"#/paths/'{0.path}'/{0.method}/parameters/{name}\"", ".", "format", "(", "operation", ",", "name", "=", "operation", ".", "body", ".", "name", "or", "'body'", ")", "return", "cls",...
Get example for body parameter example by operation :param Operation operation: operation object
[ "Get", "example", "for", "body", "parameter", "example", "by", "operation" ]
e519f70701477dcc9f0bb237ee5b8e08e848701b
https://github.com/Arello-Mobile/swagger2rst/blob/e519f70701477dcc9f0bb237ee5b8e08e848701b/swg2rst/utils/exampilators.py#L159-L166
46,753
Arello-Mobile/swagger2rst
swg2rst/utils/exampilators.py
Exampilator.get_response_example
def get_response_example(cls, operation, response): """ Get example for response object by operation object :param Operation operation: operation object :param Response response: response object """ path = "#/paths/'{}'/{}/responses/{}".format( operation.path, operat...
python
def get_response_example(cls, operation, response): """ Get example for response object by operation object :param Operation operation: operation object :param Response response: response object """ path = "#/paths/'{}'/{}/responses/{}".format( operation.path, operat...
[ "def", "get_response_example", "(", "cls", ",", "operation", ",", "response", ")", ":", "path", "=", "\"#/paths/'{}'/{}/responses/{}\"", ".", "format", "(", "operation", ".", "path", ",", "operation", ".", "method", ",", "response", ".", "name", ")", "kwargs",...
Get example for response object by operation object :param Operation operation: operation object :param Response response: response object
[ "Get", "example", "for", "response", "object", "by", "operation", "object" ]
e519f70701477dcc9f0bb237ee5b8e08e848701b
https://github.com/Arello-Mobile/swagger2rst/blob/e519f70701477dcc9f0bb237ee5b8e08e848701b/swg2rst/utils/exampilators.py#L169-L186
46,754
Arello-Mobile/swagger2rst
swg2rst/utils/exampilators.py
Exampilator.get_header_example
def get_header_example(cls, header): """ Get example for header object :param Header header: Header object :return: example :rtype: dict """ if header.is_array: result = cls.get_example_for_array(header.item) else: example_method = getattr...
python
def get_header_example(cls, header): """ Get example for header object :param Header header: Header object :return: example :rtype: dict """ if header.is_array: result = cls.get_example_for_array(header.item) else: example_method = getattr...
[ "def", "get_header_example", "(", "cls", ",", "header", ")", ":", "if", "header", ".", "is_array", ":", "result", "=", "cls", ".", "get_example_for_array", "(", "header", ".", "item", ")", "else", ":", "example_method", "=", "getattr", "(", "cls", ",", "...
Get example for header object :param Header header: Header object :return: example :rtype: dict
[ "Get", "example", "for", "header", "object" ]
e519f70701477dcc9f0bb237ee5b8e08e848701b
https://github.com/Arello-Mobile/swagger2rst/blob/e519f70701477dcc9f0bb237ee5b8e08e848701b/swg2rst/utils/exampilators.py#L189-L201
46,755
Arello-Mobile/swagger2rst
swg2rst/utils/exampilators.py
Exampilator.get_property_example
def get_property_example(cls, property_, nested=None, **kw): """ Get example for property :param dict property_: :param set nested: :return: example value """ paths = kw.get('paths', []) name = kw.get('name', '') result = None if name and paths: ...
python
def get_property_example(cls, property_, nested=None, **kw): """ Get example for property :param dict property_: :param set nested: :return: example value """ paths = kw.get('paths', []) name = kw.get('name', '') result = None if name and paths: ...
[ "def", "get_property_example", "(", "cls", ",", "property_", ",", "nested", "=", "None", ",", "*", "*", "kw", ")", ":", "paths", "=", "kw", ".", "get", "(", "'paths'", ",", "[", "]", ")", "name", "=", "kw", ".", "get", "(", "'name'", ",", "''", ...
Get example for property :param dict property_: :param set nested: :return: example value
[ "Get", "example", "for", "property" ]
e519f70701477dcc9f0bb237ee5b8e08e848701b
https://github.com/Arello-Mobile/swagger2rst/blob/e519f70701477dcc9f0bb237ee5b8e08e848701b/swg2rst/utils/exampilators.py#L204-L253
46,756
twaddington/android-asset-resizer
android_asset_resizer/resizer.py
AssetResizer.mkres
def mkres(self): """ Create a directory tree for the resized assets """ for d in DENSITY_TYPES: if d == 'ldpi' and not self.ldpi: continue # skip ldpi if d == 'xxxhdpi' and not self.xxxhdpi: continue # skip xxxhdpi tr...
python
def mkres(self): """ Create a directory tree for the resized assets """ for d in DENSITY_TYPES: if d == 'ldpi' and not self.ldpi: continue # skip ldpi if d == 'xxxhdpi' and not self.xxxhdpi: continue # skip xxxhdpi tr...
[ "def", "mkres", "(", "self", ")", ":", "for", "d", "in", "DENSITY_TYPES", ":", "if", "d", "==", "'ldpi'", "and", "not", "self", ".", "ldpi", ":", "continue", "# skip ldpi", "if", "d", "==", "'xxxhdpi'", "and", "not", "self", ".", "xxxhdpi", ":", "con...
Create a directory tree for the resized assets
[ "Create", "a", "directory", "tree", "for", "the", "resized", "assets" ]
646bbc27ded57c125e7a6bcca11ba367e8f09c18
https://github.com/twaddington/android-asset-resizer/blob/646bbc27ded57c125e7a6bcca11ba367e8f09c18/android_asset_resizer/resizer.py#L31-L45
46,757
twaddington/android-asset-resizer
android_asset_resizer/resizer.py
AssetResizer.get_size_for_density
def get_size_for_density(self, size, target_density): """ Return the new image size for the target density """ current_size = size current_density = DENSITY_MAP[self.source_density] target_density = DENSITY_MAP[target_density] return int(current_size * (target_de...
python
def get_size_for_density(self, size, target_density): """ Return the new image size for the target density """ current_size = size current_density = DENSITY_MAP[self.source_density] target_density = DENSITY_MAP[target_density] return int(current_size * (target_de...
[ "def", "get_size_for_density", "(", "self", ",", "size", ",", "target_density", ")", ":", "current_size", "=", "size", "current_density", "=", "DENSITY_MAP", "[", "self", ".", "source_density", "]", "target_density", "=", "DENSITY_MAP", "[", "target_density", "]",...
Return the new image size for the target density
[ "Return", "the", "new", "image", "size", "for", "the", "target", "density" ]
646bbc27ded57c125e7a6bcca11ba367e8f09c18
https://github.com/twaddington/android-asset-resizer/blob/646bbc27ded57c125e7a6bcca11ba367e8f09c18/android_asset_resizer/resizer.py#L53-L61
46,758
twaddington/android-asset-resizer
android_asset_resizer/resizer.py
AssetResizer.resize_image
def resize_image(self, path, im): """ Generate assets from the given image and path in case you've already called Image.open """ # Get the original filename _, filename = os.path.split(path) # Generate the new filename filename = self.get_safe_filename(fi...
python
def resize_image(self, path, im): """ Generate assets from the given image and path in case you've already called Image.open """ # Get the original filename _, filename = os.path.split(path) # Generate the new filename filename = self.get_safe_filename(fi...
[ "def", "resize_image", "(", "self", ",", "path", ",", "im", ")", ":", "# Get the original filename", "_", ",", "filename", "=", "os", ".", "path", ".", "split", "(", "path", ")", "# Generate the new filename", "filename", "=", "self", ".", "get_safe_filename",...
Generate assets from the given image and path in case you've already called Image.open
[ "Generate", "assets", "from", "the", "given", "image", "and", "path", "in", "case", "you", "ve", "already", "called", "Image", ".", "open" ]
646bbc27ded57c125e7a6bcca11ba367e8f09c18
https://github.com/twaddington/android-asset-resizer/blob/646bbc27ded57c125e7a6bcca11ba367e8f09c18/android_asset_resizer/resizer.py#L75-L106
46,759
stitchdata/python-stitch-client
stitchclient/client.py
Client.push
def push(self, message, callback_arg=None): """message should be a dict recognized by the Stitch Import API. See https://www.stitchdata.com/docs/integrations/import-api. """ if message['action'] == 'upsert': message.setdefault('key_names', self.key_names) message['...
python
def push(self, message, callback_arg=None): """message should be a dict recognized by the Stitch Import API. See https://www.stitchdata.com/docs/integrations/import-api. """ if message['action'] == 'upsert': message.setdefault('key_names', self.key_names) message['...
[ "def", "push", "(", "self", ",", "message", ",", "callback_arg", "=", "None", ")", ":", "if", "message", "[", "'action'", "]", "==", "'upsert'", ":", "message", ".", "setdefault", "(", "'key_names'", ",", "self", ".", "key_names", ")", "message", "[", ...
message should be a dict recognized by the Stitch Import API. See https://www.stitchdata.com/docs/integrations/import-api.
[ "message", "should", "be", "a", "dict", "recognized", "by", "the", "Stitch", "Import", "API", "." ]
de4dfb3db209e5d0a7b0c0dcef625f3e465c787b
https://github.com/stitchdata/python-stitch-client/blob/de4dfb3db209e5d0a7b0c0dcef625f3e465c787b/stitchclient/client.py#L117-L133
46,760
stitchdata/python-stitch-client
stitchclient/client.py
Client._take_batch
def _take_batch(self, min_records): '''If we have enough data to build a batch, returns all the data in the buffer and then clears the buffer.''' if not self._buffer: return [] enough_messages = len(self._buffer) >= min_records enough_time = time.time() - self.time_...
python
def _take_batch(self, min_records): '''If we have enough data to build a batch, returns all the data in the buffer and then clears the buffer.''' if not self._buffer: return [] enough_messages = len(self._buffer) >= min_records enough_time = time.time() - self.time_...
[ "def", "_take_batch", "(", "self", ",", "min_records", ")", ":", "if", "not", "self", ".", "_buffer", ":", "return", "[", "]", "enough_messages", "=", "len", "(", "self", ".", "_buffer", ")", ">=", "min_records", "enough_time", "=", "time", ".", "time", ...
If we have enough data to build a batch, returns all the data in the buffer and then clears the buffer.
[ "If", "we", "have", "enough", "data", "to", "build", "a", "batch", "returns", "all", "the", "data", "in", "the", "buffer", "and", "then", "clears", "the", "buffer", "." ]
de4dfb3db209e5d0a7b0c0dcef625f3e465c787b
https://github.com/stitchdata/python-stitch-client/blob/de4dfb3db209e5d0a7b0c0dcef625f3e465c787b/stitchclient/client.py#L136-L152
46,761
Arello-Mobile/swagger2rst
swg2rst/swagger/operation.py
Operation.get_parameters_by_location
def get_parameters_by_location(self, locations=None, excludes=None): """ Get parameters list by location :param locations: list of locations :type locations: list or None :param excludes: list of excludes locations :type excludes: list or None :return: list of Parameter ...
python
def get_parameters_by_location(self, locations=None, excludes=None): """ Get parameters list by location :param locations: list of locations :type locations: list or None :param excludes: list of excludes locations :type excludes: list or None :return: list of Parameter ...
[ "def", "get_parameters_by_location", "(", "self", ",", "locations", "=", "None", ",", "excludes", "=", "None", ")", ":", "result", "=", "self", ".", "parameters", "if", "locations", ":", "result", "=", "filter", "(", "lambda", "x", ":", "x", ".", "locati...
Get parameters list by location :param locations: list of locations :type locations: list or None :param excludes: list of excludes locations :type excludes: list or None :return: list of Parameter :rtype: list
[ "Get", "parameters", "list", "by", "location" ]
e519f70701477dcc9f0bb237ee5b8e08e848701b
https://github.com/Arello-Mobile/swagger2rst/blob/e519f70701477dcc9f0bb237ee5b8e08e848701b/swg2rst/swagger/operation.py#L72-L87
46,762
Arello-Mobile/swagger2rst
swg2rst/swagger/operation.py
Operation.body
def body(self): """ Return body request parameter :return: Body parameter :rtype: Parameter or None """ body = self.get_parameters_by_location(['body']) return self.root.schemas.get(body[0].type) if body else None
python
def body(self): """ Return body request parameter :return: Body parameter :rtype: Parameter or None """ body = self.get_parameters_by_location(['body']) return self.root.schemas.get(body[0].type) if body else None
[ "def", "body", "(", "self", ")", ":", "body", "=", "self", ".", "get_parameters_by_location", "(", "[", "'body'", "]", ")", "return", "self", ".", "root", ".", "schemas", ".", "get", "(", "body", "[", "0", "]", ".", "type", ")", "if", "body", "else...
Return body request parameter :return: Body parameter :rtype: Parameter or None
[ "Return", "body", "request", "parameter" ]
e519f70701477dcc9f0bb237ee5b8e08e848701b
https://github.com/Arello-Mobile/swagger2rst/blob/e519f70701477dcc9f0bb237ee5b8e08e848701b/swg2rst/swagger/operation.py#L90-L97
46,763
ixc/python-edtf
edtf/natlang/en.py
text_to_edtf
def text_to_edtf(text): """ Generate EDTF string equivalent of a given natural language date string. """ if not text: return t = text.lower() # try parsing the whole thing result = text_to_edtf_date(t) if not result: # split by list delims and move fwd with the first t...
python
def text_to_edtf(text): """ Generate EDTF string equivalent of a given natural language date string. """ if not text: return t = text.lower() # try parsing the whole thing result = text_to_edtf_date(t) if not result: # split by list delims and move fwd with the first t...
[ "def", "text_to_edtf", "(", "text", ")", ":", "if", "not", "text", ":", "return", "t", "=", "text", ".", "lower", "(", ")", "# try parsing the whole thing", "result", "=", "text_to_edtf_date", "(", "t", ")", "if", "not", "result", ":", "# split by list delim...
Generate EDTF string equivalent of a given natural language date string.
[ "Generate", "EDTF", "string", "equivalent", "of", "a", "given", "natural", "language", "date", "string", "." ]
ec2124d3df75f8dd72571026380ce8dd16f3dd6b
https://github.com/ixc/python-edtf/blob/ec2124d3df75f8dd72571026380ce8dd16f3dd6b/edtf/natlang/en.py#L27-L102
46,764
probcomp/crosscat
src/utils/unionfind.py
find
def find(node): """Find current canonical representative equivalent to node. Adjust the parent pointer of each node along the way to the root to point directly at the root for inverse-Ackerman-fast access. """ if node.parent is None: return node root = node while root.parent is not ...
python
def find(node): """Find current canonical representative equivalent to node. Adjust the parent pointer of each node along the way to the root to point directly at the root for inverse-Ackerman-fast access. """ if node.parent is None: return node root = node while root.parent is not ...
[ "def", "find", "(", "node", ")", ":", "if", "node", ".", "parent", "is", "None", ":", "return", "node", "root", "=", "node", "while", "root", ".", "parent", "is", "not", "None", ":", "root", "=", "root", ".", "parent", "parent", "=", "node", "while...
Find current canonical representative equivalent to node. Adjust the parent pointer of each node along the way to the root to point directly at the root for inverse-Ackerman-fast access.
[ "Find", "current", "canonical", "representative", "equivalent", "to", "node", "." ]
4a05bddb06a45f3b7b3e05e095720f16257d1535
https://github.com/probcomp/crosscat/blob/4a05bddb06a45f3b7b3e05e095720f16257d1535/src/utils/unionfind.py#L27-L43
46,765
probcomp/crosscat
src/utils/unionfind.py
classes
def classes(equivalences): """Compute mapping from element to list of equivalent elements. `equivalences` is an iterable of (x, y) tuples representing equivalences x ~ y. Returns an OrderedDict mapping each x to the list of elements equivalent to x. """ node = OrderedDict() def N(x): ...
python
def classes(equivalences): """Compute mapping from element to list of equivalent elements. `equivalences` is an iterable of (x, y) tuples representing equivalences x ~ y. Returns an OrderedDict mapping each x to the list of elements equivalent to x. """ node = OrderedDict() def N(x): ...
[ "def", "classes", "(", "equivalences", ")", ":", "node", "=", "OrderedDict", "(", ")", "def", "N", "(", "x", ")", ":", "if", "x", "in", "node", ":", "return", "node", "[", "x", "]", "n", "=", "node", "[", "x", "]", "=", "Node", "(", "x", ")",...
Compute mapping from element to list of equivalent elements. `equivalences` is an iterable of (x, y) tuples representing equivalences x ~ y. Returns an OrderedDict mapping each x to the list of elements equivalent to x.
[ "Compute", "mapping", "from", "element", "to", "list", "of", "equivalent", "elements", "." ]
4a05bddb06a45f3b7b3e05e095720f16257d1535
https://github.com/probcomp/crosscat/blob/4a05bddb06a45f3b7b3e05e095720f16257d1535/src/utils/unionfind.py#L58-L82
46,766
blockstack/virtualchain
virtualchain/lib/encoding.py
changebase
def changebase(string, frm, to, minlen=0): """ Change a string's characters from one base to another. Return the re-encoded string """ if frm == to: return lpad(string, get_code_string(frm)[0], minlen) return encode(decode(string, frm), to, minlen)
python
def changebase(string, frm, to, minlen=0): """ Change a string's characters from one base to another. Return the re-encoded string """ if frm == to: return lpad(string, get_code_string(frm)[0], minlen) return encode(decode(string, frm), to, minlen)
[ "def", "changebase", "(", "string", ",", "frm", ",", "to", ",", "minlen", "=", "0", ")", ":", "if", "frm", "==", "to", ":", "return", "lpad", "(", "string", ",", "get_code_string", "(", "frm", ")", "[", "0", "]", ",", "minlen", ")", "return", "en...
Change a string's characters from one base to another. Return the re-encoded string
[ "Change", "a", "string", "s", "characters", "from", "one", "base", "to", "another", ".", "Return", "the", "re", "-", "encoded", "string" ]
fcfc970064ca7dfcab26ebd3ab955870a763ea39
https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/encoding.py#L67-L75
46,767
probcomp/crosscat
src/CrossCatClient.py
get_CrossCatClient
def get_CrossCatClient(client_type, **kwargs): """Helper which instantiates the appropriate Engine and returns a Client""" client = None if client_type == 'local': import crosscat.LocalEngine as LocalEngine le = LocalEngine.LocalEngine(**kwargs) client = CrossCatClient(le) elif...
python
def get_CrossCatClient(client_type, **kwargs): """Helper which instantiates the appropriate Engine and returns a Client""" client = None if client_type == 'local': import crosscat.LocalEngine as LocalEngine le = LocalEngine.LocalEngine(**kwargs) client = CrossCatClient(le) elif...
[ "def", "get_CrossCatClient", "(", "client_type", ",", "*", "*", "kwargs", ")", ":", "client", "=", "None", "if", "client_type", "==", "'local'", ":", "import", "crosscat", ".", "LocalEngine", "as", "LocalEngine", "le", "=", "LocalEngine", ".", "LocalEngine", ...
Helper which instantiates the appropriate Engine and returns a Client
[ "Helper", "which", "instantiates", "the", "appropriate", "Engine", "and", "returns", "a", "Client" ]
4a05bddb06a45f3b7b3e05e095720f16257d1535
https://github.com/probcomp/crosscat/blob/4a05bddb06a45f3b7b3e05e095720f16257d1535/src/CrossCatClient.py#L46-L63
46,768
emory-libraries/eulxml
eulxml/xpath/ast.py
_serialize
def _serialize(xp_ast): '''Generate token strings which, when joined together, form a valid XPath serialization of the AST.''' if hasattr(xp_ast, '_serialize'): for tok in xp_ast._serialize(): yield tok elif isinstance(xp_ast, string_types): # strings in serialized xpath nee...
python
def _serialize(xp_ast): '''Generate token strings which, when joined together, form a valid XPath serialization of the AST.''' if hasattr(xp_ast, '_serialize'): for tok in xp_ast._serialize(): yield tok elif isinstance(xp_ast, string_types): # strings in serialized xpath nee...
[ "def", "_serialize", "(", "xp_ast", ")", ":", "if", "hasattr", "(", "xp_ast", ",", "'_serialize'", ")", ":", "for", "tok", "in", "xp_ast", ".", "_serialize", "(", ")", ":", "yield", "tok", "elif", "isinstance", "(", "xp_ast", ",", "string_types", ")", ...
Generate token strings which, when joined together, form a valid XPath serialization of the AST.
[ "Generate", "token", "strings", "which", "when", "joined", "together", "form", "a", "valid", "XPath", "serialization", "of", "the", "AST", "." ]
17d71c7d98c0cebda9932b7f13e72093805e1fe2
https://github.com/emory-libraries/eulxml/blob/17d71c7d98c0cebda9932b7f13e72093805e1fe2/eulxml/xpath/ast.py#L60-L74
46,769
mdickinson/bigfloat
fabfile.py
build
def build(python=PYTHON): """Build the bigfloat library for in-place testing.""" clean() local( "LIBRARY_PATH={library_path} CPATH={include_path} {python} " "setup.py build_ext --inplace".format( library_path=LIBRARY_PATH, include_path=INCLUDE_PATH, python...
python
def build(python=PYTHON): """Build the bigfloat library for in-place testing.""" clean() local( "LIBRARY_PATH={library_path} CPATH={include_path} {python} " "setup.py build_ext --inplace".format( library_path=LIBRARY_PATH, include_path=INCLUDE_PATH, python...
[ "def", "build", "(", "python", "=", "PYTHON", ")", ":", "clean", "(", ")", "local", "(", "\"LIBRARY_PATH={library_path} CPATH={include_path} {python} \"", "\"setup.py build_ext --inplace\"", ".", "format", "(", "library_path", "=", "LIBRARY_PATH", ",", "include_path", "...
Build the bigfloat library for in-place testing.
[ "Build", "the", "bigfloat", "library", "for", "in", "-", "place", "testing", "." ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/fabfile.py#L12-L21
46,770
mdickinson/bigfloat
fabfile.py
install
def install(python=PYTHON): """Install into site-packages""" local( "LIBRARY_PATH={library_path} CPATH={include_path} {python} " "setup.py build".format( library_path=LIBRARY_PATH, include_path=INCLUDE_PATH, python=python, )) local("sudo {python} s...
python
def install(python=PYTHON): """Install into site-packages""" local( "LIBRARY_PATH={library_path} CPATH={include_path} {python} " "setup.py build".format( library_path=LIBRARY_PATH, include_path=INCLUDE_PATH, python=python, )) local("sudo {python} s...
[ "def", "install", "(", "python", "=", "PYTHON", ")", ":", "local", "(", "\"LIBRARY_PATH={library_path} CPATH={include_path} {python} \"", "\"setup.py build\"", ".", "format", "(", "library_path", "=", "LIBRARY_PATH", ",", "include_path", "=", "INCLUDE_PATH", ",", "pytho...
Install into site-packages
[ "Install", "into", "site", "-", "packages" ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/fabfile.py#L24-L33
46,771
mdickinson/bigfloat
fabfile.py
uninstall
def uninstall(python=PYTHON): """Uninstall from site-packages""" site_packages = local( "{python} -c 'from distutils.sysconfig import " "get_python_lib; print(get_python_lib())'".format(python=python), capture=True, ) with lcd(site_packages): local("sudo rm mpfr.so") ...
python
def uninstall(python=PYTHON): """Uninstall from site-packages""" site_packages = local( "{python} -c 'from distutils.sysconfig import " "get_python_lib; print(get_python_lib())'".format(python=python), capture=True, ) with lcd(site_packages): local("sudo rm mpfr.so") ...
[ "def", "uninstall", "(", "python", "=", "PYTHON", ")", ":", "site_packages", "=", "local", "(", "\"{python} -c 'from distutils.sysconfig import \"", "\"get_python_lib; print(get_python_lib())'\"", ".", "format", "(", "python", "=", "python", ")", ",", "capture", "=", ...
Uninstall from site-packages
[ "Uninstall", "from", "site", "-", "packages" ]
e5fdd1048615191ed32a2b7460e14b3b3ff24662
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/fabfile.py#L36-L46
46,772
blockstack/virtualchain
virtualchain/virtualchain.py
sync_virtualchain
def sync_virtualchain(blockchain_opts, last_block, state_engine, expected_snapshots={}, tx_filter=None ): """ Synchronize the virtual blockchain state up until a given block. Obtain the operation sequence from the blockchain, up to and including last_block. That is, go and fetch each block we haven't s...
python
def sync_virtualchain(blockchain_opts, last_block, state_engine, expected_snapshots={}, tx_filter=None ): """ Synchronize the virtual blockchain state up until a given block. Obtain the operation sequence from the blockchain, up to and including last_block. That is, go and fetch each block we haven't s...
[ "def", "sync_virtualchain", "(", "blockchain_opts", ",", "last_block", ",", "state_engine", ",", "expected_snapshots", "=", "{", "}", ",", "tx_filter", "=", "None", ")", ":", "rc", "=", "False", "start", "=", "datetime", ".", "datetime", ".", "now", "(", "...
Synchronize the virtual blockchain state up until a given block. Obtain the operation sequence from the blockchain, up to and including last_block. That is, go and fetch each block we haven't seen since the last call to this method, extract the operations from them, and record in the given working_dir wher...
[ "Synchronize", "the", "virtual", "blockchain", "state", "up", "until", "a", "given", "block", "." ]
fcfc970064ca7dfcab26ebd3ab955870a763ea39
https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/virtualchain.py#L32-L64
46,773
blockstack/virtualchain
virtualchain/virtualchain.py
virtualchain_set_opfields
def virtualchain_set_opfields( op, **fields ): """ Pass along virtualchain-reserved fields to a virtualchain operation. This layer of indirection is meant to help with future compatibility, so virtualchain implementations do not try to set operation fields directly. """ # warn about unsuppo...
python
def virtualchain_set_opfields( op, **fields ): """ Pass along virtualchain-reserved fields to a virtualchain operation. This layer of indirection is meant to help with future compatibility, so virtualchain implementations do not try to set operation fields directly. """ # warn about unsuppo...
[ "def", "virtualchain_set_opfields", "(", "op", ",", "*", "*", "fields", ")", ":", "# warn about unsupported fields", "for", "f", "in", "fields", ".", "keys", "(", ")", ":", "if", "f", "not", "in", "indexer", ".", "RESERVED_KEYS", ":", "log", ".", "warning"...
Pass along virtualchain-reserved fields to a virtualchain operation. This layer of indirection is meant to help with future compatibility, so virtualchain implementations do not try to set operation fields directly.
[ "Pass", "along", "virtualchain", "-", "reserved", "fields", "to", "a", "virtualchain", "operation", ".", "This", "layer", "of", "indirection", "is", "meant", "to", "help", "with", "future", "compatibility", "so", "virtualchain", "implementations", "do", "not", "...
fcfc970064ca7dfcab26ebd3ab955870a763ea39
https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/virtualchain.py#L67-L85
46,774
gregreen/dustmaps
dustmaps/iphas.py
ascii2h5
def ascii2h5(dirname, output_fname): """ Converts from a directory of tarballed ASCII ".samp" files to a single HDF5 file. Essentially, converts from the original release format to a single HDF5 file. """ import tarfile import sys from glob import glob from contextlib import closing...
python
def ascii2h5(dirname, output_fname): """ Converts from a directory of tarballed ASCII ".samp" files to a single HDF5 file. Essentially, converts from the original release format to a single HDF5 file. """ import tarfile import sys from glob import glob from contextlib import closing...
[ "def", "ascii2h5", "(", "dirname", ",", "output_fname", ")", ":", "import", "tarfile", "import", "sys", "from", "glob", "import", "glob", "from", "contextlib", "import", "closing", "# The datatype that will be used to store extinction, A0", "A0_dtype", "=", "'float16'",...
Converts from a directory of tarballed ASCII ".samp" files to a single HDF5 file. Essentially, converts from the original release format to a single HDF5 file.
[ "Converts", "from", "a", "directory", "of", "tarballed", "ASCII", ".", "samp", "files", "to", "a", "single", "HDF5", "file", ".", "Essentially", "converts", "from", "the", "original", "release", "format", "to", "a", "single", "HDF5", "file", "." ]
c8f571a71da0d951bf8ea865621bee14492bdfd9
https://github.com/gregreen/dustmaps/blob/c8f571a71da0d951bf8ea865621bee14492bdfd9/dustmaps/iphas.py#L227-L316
46,775
mcocdawc/chemcoord
src/chemcoord/cartesian_coordinates/_cartesian_class_get_zmat.py
CartesianGetZmat.check_dihedral
def check_dihedral(self, construction_table): """Checks, if the dihedral defining atom is colinear. Checks for each index starting from the third row of the ``construction_table``, if the reference atoms are colinear. Args: construction_table (pd.DataFrame): Return...
python
def check_dihedral(self, construction_table): """Checks, if the dihedral defining atom is colinear. Checks for each index starting from the third row of the ``construction_table``, if the reference atoms are colinear. Args: construction_table (pd.DataFrame): Return...
[ "def", "check_dihedral", "(", "self", ",", "construction_table", ")", ":", "c_table", "=", "construction_table", "angles", "=", "self", ".", "get_angle_degrees", "(", "c_table", ".", "iloc", "[", "3", ":", ",", ":", "]", ".", "values", ")", "problem_index", ...
Checks, if the dihedral defining atom is colinear. Checks for each index starting from the third row of the ``construction_table``, if the reference atoms are colinear. Args: construction_table (pd.DataFrame): Returns: list: A list of problematic indices.
[ "Checks", "if", "the", "dihedral", "defining", "atom", "is", "colinear", "." ]
95561ce387c142227c38fb14a1d182179aef8f5f
https://github.com/mcocdawc/chemcoord/blob/95561ce387c142227c38fb14a1d182179aef8f5f/src/chemcoord/cartesian_coordinates/_cartesian_class_get_zmat.py#L339-L356
46,776
mcocdawc/chemcoord
src/chemcoord/cartesian_coordinates/_cartesian_class_get_zmat.py
CartesianGetZmat.correct_dihedral
def correct_dihedral(self, construction_table, use_lookup=None): """Reindexe the dihedral defining atom if linear reference is used. Uses :meth:`~Cartesian.check_dihedral` to obtain the problematic indices. Args: construction_table (pd.DataFrame): ...
python
def correct_dihedral(self, construction_table, use_lookup=None): """Reindexe the dihedral defining atom if linear reference is used. Uses :meth:`~Cartesian.check_dihedral` to obtain the problematic indices. Args: construction_table (pd.DataFrame): ...
[ "def", "correct_dihedral", "(", "self", ",", "construction_table", ",", "use_lookup", "=", "None", ")", ":", "if", "use_lookup", "is", "None", ":", "use_lookup", "=", "settings", "[", "'defaults'", "]", "[", "'use_lookup'", "]", "problem_index", "=", "self", ...
Reindexe the dihedral defining atom if linear reference is used. Uses :meth:`~Cartesian.check_dihedral` to obtain the problematic indices. Args: construction_table (pd.DataFrame): use_lookup (bool): Use a lookup variable for :meth:`~chemcoord.Cartesian.g...
[ "Reindexe", "the", "dihedral", "defining", "atom", "if", "linear", "reference", "is", "used", "." ]
95561ce387c142227c38fb14a1d182179aef8f5f
https://github.com/mcocdawc/chemcoord/blob/95561ce387c142227c38fb14a1d182179aef8f5f/src/chemcoord/cartesian_coordinates/_cartesian_class_get_zmat.py#L358-L421
46,777
mcocdawc/chemcoord
src/chemcoord/cartesian_coordinates/_cartesian_class_get_zmat.py
CartesianGetZmat._has_valid_abs_ref
def _has_valid_abs_ref(self, i, construction_table): """Checks, if ``i`` uses valid absolute references. Checks for each index from first to third row of the ``construction_table``, if the references are colinear. This case has to be specially treated, because the references are...
python
def _has_valid_abs_ref(self, i, construction_table): """Checks, if ``i`` uses valid absolute references. Checks for each index from first to third row of the ``construction_table``, if the references are colinear. This case has to be specially treated, because the references are...
[ "def", "_has_valid_abs_ref", "(", "self", ",", "i", ",", "construction_table", ")", ":", "c_table", "=", "construction_table", "abs_refs", "=", "constants", ".", "absolute_refs", "A", "=", "np", ".", "empty", "(", "(", "3", ",", "3", ")", ")", "row", "="...
Checks, if ``i`` uses valid absolute references. Checks for each index from first to third row of the ``construction_table``, if the references are colinear. This case has to be specially treated, because the references are not only atoms (to fix internal degrees of freedom) but also po...
[ "Checks", "if", "i", "uses", "valid", "absolute", "references", "." ]
95561ce387c142227c38fb14a1d182179aef8f5f
https://github.com/mcocdawc/chemcoord/blob/95561ce387c142227c38fb14a1d182179aef8f5f/src/chemcoord/cartesian_coordinates/_cartesian_class_get_zmat.py#L423-L456
46,778
mcocdawc/chemcoord
src/chemcoord/cartesian_coordinates/_cartesian_class_get_zmat.py
CartesianGetZmat.check_absolute_refs
def check_absolute_refs(self, construction_table): """Checks first three rows of ``construction_table`` for linear references Checks for each index from first to third row of the ``construction_table``, if the references are colinear. This case has to be specially treated, because the r...
python
def check_absolute_refs(self, construction_table): """Checks first three rows of ``construction_table`` for linear references Checks for each index from first to third row of the ``construction_table``, if the references are colinear. This case has to be specially treated, because the r...
[ "def", "check_absolute_refs", "(", "self", ",", "construction_table", ")", ":", "c_table", "=", "construction_table", "problem_index", "=", "[", "i", "for", "i", "in", "c_table", ".", "index", "[", ":", "3", "]", "if", "not", "self", ".", "_has_valid_abs_ref...
Checks first three rows of ``construction_table`` for linear references Checks for each index from first to third row of the ``construction_table``, if the references are colinear. This case has to be specially treated, because the references are not only atoms (to fix internal degrees ...
[ "Checks", "first", "three", "rows", "of", "construction_table", "for", "linear", "references" ]
95561ce387c142227c38fb14a1d182179aef8f5f
https://github.com/mcocdawc/chemcoord/blob/95561ce387c142227c38fb14a1d182179aef8f5f/src/chemcoord/cartesian_coordinates/_cartesian_class_get_zmat.py#L458-L477
46,779
mcocdawc/chemcoord
src/chemcoord/cartesian_coordinates/_cartesian_class_get_zmat.py
CartesianGetZmat.correct_absolute_refs
def correct_absolute_refs(self, construction_table): """Reindexe construction_table if linear reference in first three rows present. Uses :meth:`~Cartesian.check_absolute_refs` to obtain the problematic indices. Args: construction_table (pd.DataFrame): Retu...
python
def correct_absolute_refs(self, construction_table): """Reindexe construction_table if linear reference in first three rows present. Uses :meth:`~Cartesian.check_absolute_refs` to obtain the problematic indices. Args: construction_table (pd.DataFrame): Retu...
[ "def", "correct_absolute_refs", "(", "self", ",", "construction_table", ")", ":", "c_table", "=", "construction_table", ".", "copy", "(", ")", "abs_refs", "=", "constants", ".", "absolute_refs", "problem_index", "=", "self", ".", "check_absolute_refs", "(", "c_tab...
Reindexe construction_table if linear reference in first three rows present. Uses :meth:`~Cartesian.check_absolute_refs` to obtain the problematic indices. Args: construction_table (pd.DataFrame): Returns: pd.DataFrame: Appropiately renamed construction...
[ "Reindexe", "construction_table", "if", "linear", "reference", "in", "first", "three", "rows", "present", "." ]
95561ce387c142227c38fb14a1d182179aef8f5f
https://github.com/mcocdawc/chemcoord/blob/95561ce387c142227c38fb14a1d182179aef8f5f/src/chemcoord/cartesian_coordinates/_cartesian_class_get_zmat.py#L479-L504
46,780
mcocdawc/chemcoord
src/chemcoord/cartesian_coordinates/_cartesian_class_get_zmat.py
CartesianGetZmat._build_zmat
def _build_zmat(self, construction_table): """Create the Zmatrix from a construction table. Args: Construction table (pd.DataFrame): Returns: Zmat: A new instance of :class:`Zmat`. """ c_table = construction_table default_cols = ['atom', 'b', 'bo...
python
def _build_zmat(self, construction_table): """Create the Zmatrix from a construction table. Args: Construction table (pd.DataFrame): Returns: Zmat: A new instance of :class:`Zmat`. """ c_table = construction_table default_cols = ['atom', 'b', 'bo...
[ "def", "_build_zmat", "(", "self", ",", "construction_table", ")", ":", "c_table", "=", "construction_table", "default_cols", "=", "[", "'atom'", ",", "'b'", ",", "'bond'", ",", "'a'", ",", "'angle'", ",", "'d'", ",", "'dihedral'", "]", "optional_cols", "=",...
Create the Zmatrix from a construction table. Args: Construction table (pd.DataFrame): Returns: Zmat: A new instance of :class:`Zmat`.
[ "Create", "the", "Zmatrix", "from", "a", "construction", "table", "." ]
95561ce387c142227c38fb14a1d182179aef8f5f
https://github.com/mcocdawc/chemcoord/blob/95561ce387c142227c38fb14a1d182179aef8f5f/src/chemcoord/cartesian_coordinates/_cartesian_class_get_zmat.py#L531-L558
46,781
mcocdawc/chemcoord
src/chemcoord/cartesian_coordinates/_cartesian_class_get_zmat.py
CartesianGetZmat.get_zmat
def get_zmat(self, construction_table=None, use_lookup=None): """Transform to internal coordinates. Transforming to internal coordinates involves basically three steps: 1. Define an order of how to build and define for each atom the used reference atoms. ...
python
def get_zmat(self, construction_table=None, use_lookup=None): """Transform to internal coordinates. Transforming to internal coordinates involves basically three steps: 1. Define an order of how to build and define for each atom the used reference atoms. ...
[ "def", "get_zmat", "(", "self", ",", "construction_table", "=", "None", ",", "use_lookup", "=", "None", ")", ":", "if", "use_lookup", "is", "None", ":", "use_lookup", "=", "settings", "[", "'defaults'", "]", "[", "'use_lookup'", "]", "self", ".", "get_bond...
Transform to internal coordinates. Transforming to internal coordinates involves basically three steps: 1. Define an order of how to build and define for each atom the used reference atoms. 2. Check for problematic local linearity. In this algorithm an angle with ``170...
[ "Transform", "to", "internal", "coordinates", "." ]
95561ce387c142227c38fb14a1d182179aef8f5f
https://github.com/mcocdawc/chemcoord/blob/95561ce387c142227c38fb14a1d182179aef8f5f/src/chemcoord/cartesian_coordinates/_cartesian_class_get_zmat.py#L560-L635
46,782
mcocdawc/chemcoord
src/chemcoord/cartesian_coordinates/_cartesian_class_get_zmat.py
CartesianGetZmat.get_grad_zmat
def get_grad_zmat(self, construction_table, as_function=True): r"""Return the gradient for the transformation to a Zmatrix. If ``as_function`` is True, a function is returned that can be directly applied onto instances of :class:`~Cartesian`, which contain the applied distortions in car...
python
def get_grad_zmat(self, construction_table, as_function=True): r"""Return the gradient for the transformation to a Zmatrix. If ``as_function`` is True, a function is returned that can be directly applied onto instances of :class:`~Cartesian`, which contain the applied distortions in car...
[ "def", "get_grad_zmat", "(", "self", ",", "construction_table", ",", "as_function", "=", "True", ")", ":", "if", "(", "construction_table", ".", "index", "!=", "self", ".", "index", ")", ".", "any", "(", ")", ":", "message", "=", "\"construction_table and se...
r"""Return the gradient for the transformation to a Zmatrix. If ``as_function`` is True, a function is returned that can be directly applied onto instances of :class:`~Cartesian`, which contain the applied distortions in cartesian space. In this case the user does not have to worry abou...
[ "r", "Return", "the", "gradient", "for", "the", "transformation", "to", "a", "Zmatrix", "." ]
95561ce387c142227c38fb14a1d182179aef8f5f
https://github.com/mcocdawc/chemcoord/blob/95561ce387c142227c38fb14a1d182179aef8f5f/src/chemcoord/cartesian_coordinates/_cartesian_class_get_zmat.py#L637-L739
46,783
mcocdawc/chemcoord
src/chemcoord/_generic_classes/generic_core.py
GenericCore.add_data
def add_data(self, new_cols=None): """Adds a column with the requested data. If you want to see for example the mass, the colormap used in jmol and the block of the element, just use:: ['mass', 'jmol_color', 'block'] The underlying ``pd.DataFrame`` can be accessed with ...
python
def add_data(self, new_cols=None): """Adds a column with the requested data. If you want to see for example the mass, the colormap used in jmol and the block of the element, just use:: ['mass', 'jmol_color', 'block'] The underlying ``pd.DataFrame`` can be accessed with ...
[ "def", "add_data", "(", "self", ",", "new_cols", "=", "None", ")", ":", "atoms", "=", "self", "[", "'atom'", "]", "data", "=", "constants", ".", "elements", "if", "pd", ".", "api", ".", "types", ".", "is_list_like", "(", "new_cols", ")", ":", "new_co...
Adds a column with the requested data. If you want to see for example the mass, the colormap used in jmol and the block of the element, just use:: ['mass', 'jmol_color', 'block'] The underlying ``pd.DataFrame`` can be accessed with ``constants.elements``. To see al...
[ "Adds", "a", "column", "with", "the", "requested", "data", "." ]
95561ce387c142227c38fb14a1d182179aef8f5f
https://github.com/mcocdawc/chemcoord/blob/95561ce387c142227c38fb14a1d182179aef8f5f/src/chemcoord/_generic_classes/generic_core.py#L12-L58
46,784
mcocdawc/chemcoord
src/chemcoord/_generic_classes/generic_core.py
GenericCore.has_same_sumformula
def has_same_sumformula(self, other): """Determines if ``other`` has the same sumformula Args: other (molecule): Returns: bool: """ same_atoms = True for atom in set(self['atom']): own_atom_number = len(self[self['atom'] == atom]) ...
python
def has_same_sumformula(self, other): """Determines if ``other`` has the same sumformula Args: other (molecule): Returns: bool: """ same_atoms = True for atom in set(self['atom']): own_atom_number = len(self[self['atom'] == atom]) ...
[ "def", "has_same_sumformula", "(", "self", ",", "other", ")", ":", "same_atoms", "=", "True", "for", "atom", "in", "set", "(", "self", "[", "'atom'", "]", ")", ":", "own_atom_number", "=", "len", "(", "self", "[", "self", "[", "'atom'", "]", "==", "a...
Determines if ``other`` has the same sumformula Args: other (molecule): Returns: bool:
[ "Determines", "if", "other", "has", "the", "same", "sumformula" ]
95561ce387c142227c38fb14a1d182179aef8f5f
https://github.com/mcocdawc/chemcoord/blob/95561ce387c142227c38fb14a1d182179aef8f5f/src/chemcoord/_generic_classes/generic_core.py#L76-L92
46,785
mcocdawc/chemcoord
src/chemcoord/_generic_classes/generic_core.py
GenericCore.get_electron_number
def get_electron_number(self, charge=0): """Return the number of electrons. Args: charge (int): Charge of the molecule. Returns: int: """ atomic_number = constants.elements['atomic_number'].to_dict() return sum([atomic_number[atom] for atom in se...
python
def get_electron_number(self, charge=0): """Return the number of electrons. Args: charge (int): Charge of the molecule. Returns: int: """ atomic_number = constants.elements['atomic_number'].to_dict() return sum([atomic_number[atom] for atom in se...
[ "def", "get_electron_number", "(", "self", ",", "charge", "=", "0", ")", ":", "atomic_number", "=", "constants", ".", "elements", "[", "'atomic_number'", "]", ".", "to_dict", "(", ")", "return", "sum", "(", "[", "atomic_number", "[", "atom", "]", "for", ...
Return the number of electrons. Args: charge (int): Charge of the molecule. Returns: int:
[ "Return", "the", "number", "of", "electrons", "." ]
95561ce387c142227c38fb14a1d182179aef8f5f
https://github.com/mcocdawc/chemcoord/blob/95561ce387c142227c38fb14a1d182179aef8f5f/src/chemcoord/_generic_classes/generic_core.py#L94-L104
46,786
anjianshi/flask-restful-extend
flask_restful_extend/extend_json.py
support_jsonp
def support_jsonp(api_instance, callback_name_source='callback'): """Let API instance can respond jsonp request automatically. `callback_name_source` can be a string or a callback. If it is a string, the system will find the argument that named by this string in `query string`. If found, deter...
python
def support_jsonp(api_instance, callback_name_source='callback'): """Let API instance can respond jsonp request automatically. `callback_name_source` can be a string or a callback. If it is a string, the system will find the argument that named by this string in `query string`. If found, deter...
[ "def", "support_jsonp", "(", "api_instance", ",", "callback_name_source", "=", "'callback'", ")", ":", "output_json", "=", "api_instance", ".", "representations", "[", "'application/json'", "]", "@", "api_instance", ".", "representation", "(", "'application/json'", ")...
Let API instance can respond jsonp request automatically. `callback_name_source` can be a string or a callback. If it is a string, the system will find the argument that named by this string in `query string`. If found, determine this request to be a jsonp request, and use the argument's value as ...
[ "Let", "API", "instance", "can", "respond", "jsonp", "request", "automatically", "." ]
cc168729bf341d4f9c0f6938be30463acbf770f1
https://github.com/anjianshi/flask-restful-extend/blob/cc168729bf341d4f9c0f6938be30463acbf770f1/flask_restful_extend/extend_json.py#L32-L57
46,787
mcocdawc/chemcoord
src/chemcoord/internal_coordinates/_zmat_class_pandas_wrapper.py
PandasWrapper.insert
def insert(self, loc, column, value, allow_duplicates=False, inplace=False): """Insert column into molecule at specified location. Wrapper around the :meth:`pandas.DataFrame.insert` method. """ out = self if inplace else self.copy() out._frame.insert(loc, column, ...
python
def insert(self, loc, column, value, allow_duplicates=False, inplace=False): """Insert column into molecule at specified location. Wrapper around the :meth:`pandas.DataFrame.insert` method. """ out = self if inplace else self.copy() out._frame.insert(loc, column, ...
[ "def", "insert", "(", "self", ",", "loc", ",", "column", ",", "value", ",", "allow_duplicates", "=", "False", ",", "inplace", "=", "False", ")", ":", "out", "=", "self", "if", "inplace", "else", "self", ".", "copy", "(", ")", "out", ".", "_frame", ...
Insert column into molecule at specified location. Wrapper around the :meth:`pandas.DataFrame.insert` method.
[ "Insert", "column", "into", "molecule", "at", "specified", "location", "." ]
95561ce387c142227c38fb14a1d182179aef8f5f
https://github.com/mcocdawc/chemcoord/blob/95561ce387c142227c38fb14a1d182179aef8f5f/src/chemcoord/internal_coordinates/_zmat_class_pandas_wrapper.py#L85-L95
46,788
blockstack/virtualchain
virtualchain/lib/blockchain/bitcoin_blockchain/multisig.py
make_multisig_segwit_info
def make_multisig_segwit_info( m, pks ): """ Make either a p2sh-p2wpkh or p2sh-p2wsh redeem script and p2sh address. Return {'address': p2sh address, 'redeem_script': **the witness script**, 'private_keys': privkeys, 'segwit': True} * privkeys and redeem_script will be hex-encoded """ pubs ...
python
def make_multisig_segwit_info( m, pks ): """ Make either a p2sh-p2wpkh or p2sh-p2wsh redeem script and p2sh address. Return {'address': p2sh address, 'redeem_script': **the witness script**, 'private_keys': privkeys, 'segwit': True} * privkeys and redeem_script will be hex-encoded """ pubs ...
[ "def", "make_multisig_segwit_info", "(", "m", ",", "pks", ")", ":", "pubs", "=", "[", "]", "privkeys", "=", "[", "]", "for", "pk", "in", "pks", ":", "priv", "=", "BitcoinPrivateKey", "(", "pk", ",", "compressed", "=", "True", ")", "priv_hex", "=", "p...
Make either a p2sh-p2wpkh or p2sh-p2wsh redeem script and p2sh address. Return {'address': p2sh address, 'redeem_script': **the witness script**, 'private_keys': privkeys, 'segwit': True} * privkeys and redeem_script will be hex-encoded
[ "Make", "either", "a", "p2sh", "-", "p2wpkh", "or", "p2sh", "-", "p2wsh", "redeem", "script", "and", "p2sh", "address", "." ]
fcfc970064ca7dfcab26ebd3ab955870a763ea39
https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/blockchain/bitcoin_blockchain/multisig.py#L106-L146
46,789
blockstack/virtualchain
virtualchain/lib/blockchain/bitcoin_blockchain/multisig.py
make_multisig_wallet
def make_multisig_wallet( m, n ): """ Create a bundle of information that can be used to generate an m-of-n multisig scriptsig. """ if m <= 1 and n <= 1: raise ValueError("Invalid multisig parameters") pks = [] for i in xrange(0, n): pk = BitcoinPrivateKey(compressed=T...
python
def make_multisig_wallet( m, n ): """ Create a bundle of information that can be used to generate an m-of-n multisig scriptsig. """ if m <= 1 and n <= 1: raise ValueError("Invalid multisig parameters") pks = [] for i in xrange(0, n): pk = BitcoinPrivateKey(compressed=T...
[ "def", "make_multisig_wallet", "(", "m", ",", "n", ")", ":", "if", "m", "<=", "1", "and", "n", "<=", "1", ":", "raise", "ValueError", "(", "\"Invalid multisig parameters\"", ")", "pks", "=", "[", "]", "for", "i", "in", "xrange", "(", "0", ",", "n", ...
Create a bundle of information that can be used to generate an m-of-n multisig scriptsig.
[ "Create", "a", "bundle", "of", "information", "that", "can", "be", "used", "to", "generate", "an", "m", "-", "of", "-", "n", "multisig", "scriptsig", "." ]
fcfc970064ca7dfcab26ebd3ab955870a763ea39
https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/blockchain/bitcoin_blockchain/multisig.py#L149-L164
46,790
blockstack/virtualchain
virtualchain/lib/blockchain/bitcoin_blockchain/multisig.py
make_segwit_info
def make_segwit_info(privkey=None): """ Create a bundle of information that can be used to generate a p2sh-p2wpkh transaction """ if privkey is None: privkey = BitcoinPrivateKey(compressed=True).to_wif() return make_multisig_segwit_info(1, [privkey])
python
def make_segwit_info(privkey=None): """ Create a bundle of information that can be used to generate a p2sh-p2wpkh transaction """ if privkey is None: privkey = BitcoinPrivateKey(compressed=True).to_wif() return make_multisig_segwit_info(1, [privkey])
[ "def", "make_segwit_info", "(", "privkey", "=", "None", ")", ":", "if", "privkey", "is", "None", ":", "privkey", "=", "BitcoinPrivateKey", "(", "compressed", "=", "True", ")", ".", "to_wif", "(", ")", "return", "make_multisig_segwit_info", "(", "1", ",", "...
Create a bundle of information that can be used to generate a p2sh-p2wpkh transaction
[ "Create", "a", "bundle", "of", "information", "that", "can", "be", "used", "to", "generate", "a", "p2sh", "-", "p2wpkh", "transaction" ]
fcfc970064ca7dfcab26ebd3ab955870a763ea39
https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/blockchain/bitcoin_blockchain/multisig.py#L167-L177
46,791
blockstack/virtualchain
virtualchain/lib/blockchain/bitcoin_blockchain/multisig.py
make_multisig_segwit_wallet
def make_multisig_segwit_wallet( m, n ): """ Create a bundle of information that can be used to generate an m-of-n multisig witness script. """ pks = [] for i in xrange(0, n): pk = BitcoinPrivateKey(compressed=True).to_wif() pks.append(pk) return make_multisig_segwit_inf...
python
def make_multisig_segwit_wallet( m, n ): """ Create a bundle of information that can be used to generate an m-of-n multisig witness script. """ pks = [] for i in xrange(0, n): pk = BitcoinPrivateKey(compressed=True).to_wif() pks.append(pk) return make_multisig_segwit_inf...
[ "def", "make_multisig_segwit_wallet", "(", "m", ",", "n", ")", ":", "pks", "=", "[", "]", "for", "i", "in", "xrange", "(", "0", ",", "n", ")", ":", "pk", "=", "BitcoinPrivateKey", "(", "compressed", "=", "True", ")", ".", "to_wif", "(", ")", "pks",...
Create a bundle of information that can be used to generate an m-of-n multisig witness script.
[ "Create", "a", "bundle", "of", "information", "that", "can", "be", "used", "to", "generate", "an", "m", "-", "of", "-", "n", "multisig", "witness", "script", "." ]
fcfc970064ca7dfcab26ebd3ab955870a763ea39
https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/blockchain/bitcoin_blockchain/multisig.py#L180-L191
46,792
sacrud/pyramid_sacrud
pyramid_sacrud/routes.py
resources_preparing_factory
def resources_preparing_factory(app, wrapper): """ Factory which wrap all resources in settings. """ settings = app.app.registry.settings config = settings.get(CONFIG_RESOURCES, None) if not config: return resources = [(k, [wrapper(r, GroupResource(k, v)) for r in v]) f...
python
def resources_preparing_factory(app, wrapper): """ Factory which wrap all resources in settings. """ settings = app.app.registry.settings config = settings.get(CONFIG_RESOURCES, None) if not config: return resources = [(k, [wrapper(r, GroupResource(k, v)) for r in v]) f...
[ "def", "resources_preparing_factory", "(", "app", ",", "wrapper", ")", ":", "settings", "=", "app", ".", "app", ".", "registry", ".", "settings", "config", "=", "settings", ".", "get", "(", "CONFIG_RESOURCES", ",", "None", ")", "if", "not", "config", ":", ...
Factory which wrap all resources in settings.
[ "Factory", "which", "wrap", "all", "resources", "in", "settings", "." ]
05c30e219a32166b4e09ec3524767fe4a4d3c788
https://github.com/sacrud/pyramid_sacrud/blob/05c30e219a32166b4e09ec3524767fe4a4d3c788/pyramid_sacrud/routes.py#L27-L37
46,793
blockstack/virtualchain
virtualchain/lib/blockchain/bitcoin_blockchain/fees.py
get_tx_fee_per_byte
def get_tx_fee_per_byte(bitcoind_opts=None, config_path=None, bitcoind_client=None): """ Get the tx fee per byte from the underlying blockchain Return the fee on success Return None on error """ if bitcoind_client is None: bitcoind_client = get_bitcoind_client(bitcoind_opts=bitcoind_opts...
python
def get_tx_fee_per_byte(bitcoind_opts=None, config_path=None, bitcoind_client=None): """ Get the tx fee per byte from the underlying blockchain Return the fee on success Return None on error """ if bitcoind_client is None: bitcoind_client = get_bitcoind_client(bitcoind_opts=bitcoind_opts...
[ "def", "get_tx_fee_per_byte", "(", "bitcoind_opts", "=", "None", ",", "config_path", "=", "None", ",", "bitcoind_client", "=", "None", ")", ":", "if", "bitcoind_client", "is", "None", ":", "bitcoind_client", "=", "get_bitcoind_client", "(", "bitcoind_opts", "=", ...
Get the tx fee per byte from the underlying blockchain Return the fee on success Return None on error
[ "Get", "the", "tx", "fee", "per", "byte", "from", "the", "underlying", "blockchain", "Return", "the", "fee", "on", "success", "Return", "None", "on", "error" ]
fcfc970064ca7dfcab26ebd3ab955870a763ea39
https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/blockchain/bitcoin_blockchain/fees.py#L68-L112
46,794
blockstack/virtualchain
virtualchain/lib/blockchain/bitcoin_blockchain/fees.py
get_tx_fee
def get_tx_fee(tx_hex, config_path=None, bitcoind_opts=None, bitcoind_client=None): """ Get the tx fee for a tx Return the fee on success Return None on error """ tx_fee_per_byte = get_tx_fee_per_byte(config_path=config_path, bitcoind_opts=bitcoind_opts, bitcoind_client=bitcoind_client) if t...
python
def get_tx_fee(tx_hex, config_path=None, bitcoind_opts=None, bitcoind_client=None): """ Get the tx fee for a tx Return the fee on success Return None on error """ tx_fee_per_byte = get_tx_fee_per_byte(config_path=config_path, bitcoind_opts=bitcoind_opts, bitcoind_client=bitcoind_client) if t...
[ "def", "get_tx_fee", "(", "tx_hex", ",", "config_path", "=", "None", ",", "bitcoind_opts", "=", "None", ",", "bitcoind_client", "=", "None", ")", ":", "tx_fee_per_byte", "=", "get_tx_fee_per_byte", "(", "config_path", "=", "config_path", ",", "bitcoind_opts", "=...
Get the tx fee for a tx Return the fee on success Return None on error
[ "Get", "the", "tx", "fee", "for", "a", "tx", "Return", "the", "fee", "on", "success", "Return", "None", "on", "error" ]
fcfc970064ca7dfcab26ebd3ab955870a763ea39
https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/blockchain/bitcoin_blockchain/fees.py#L115-L125
46,795
anjianshi/flask-restful-extend
flask_restful_extend/error_handling.py
ErrorHandledApi.handle_error
def handle_error(self, e): """ Resolve the problem about sometimes error message specified by programmer won't output to user. Flask-RESTFul's error handler handling format different exceptions has different behavior. If we raise an normal Exception, it will raise it again. If ...
python
def handle_error(self, e): """ Resolve the problem about sometimes error message specified by programmer won't output to user. Flask-RESTFul's error handler handling format different exceptions has different behavior. If we raise an normal Exception, it will raise it again. If ...
[ "def", "handle_error", "(", "self", ",", "e", ")", ":", "if", "isinstance", "(", "e", ",", "HTTPException", ")", "and", "not", "hasattr", "(", "e", ",", "'data'", ")", ":", "e", ".", "data", "=", "dict", "(", "message", "=", "e", ".", "description"...
Resolve the problem about sometimes error message specified by programmer won't output to user. Flask-RESTFul's error handler handling format different exceptions has different behavior. If we raise an normal Exception, it will raise it again. If we report error by `restful.abort()`, ...
[ "Resolve", "the", "problem", "about", "sometimes", "error", "message", "specified", "by", "programmer", "won", "t", "output", "to", "user", "." ]
cc168729bf341d4f9c0f6938be30463acbf770f1
https://github.com/anjianshi/flask-restful-extend/blob/cc168729bf341d4f9c0f6938be30463acbf770f1/flask_restful_extend/error_handling.py#L16-L64
46,796
sacrud/pyramid_sacrud
examples/docker_crud/ps_docker_example.py
main
def main(global_settings, **settings): """Entrypoint for WSGI app.""" my_session_factory = SignedCookieSessionFactory('itsaseekreet') # Add session engine config = Configurator( settings=settings, session_factory=my_session_factory ) # Add static and templates config.add_stat...
python
def main(global_settings, **settings): """Entrypoint for WSGI app.""" my_session_factory = SignedCookieSessionFactory('itsaseekreet') # Add session engine config = Configurator( settings=settings, session_factory=my_session_factory ) # Add static and templates config.add_stat...
[ "def", "main", "(", "global_settings", ",", "*", "*", "settings", ")", ":", "my_session_factory", "=", "SignedCookieSessionFactory", "(", "'itsaseekreet'", ")", "# Add session engine", "config", "=", "Configurator", "(", "settings", "=", "settings", ",", "session_fa...
Entrypoint for WSGI app.
[ "Entrypoint", "for", "WSGI", "app", "." ]
05c30e219a32166b4e09ec3524767fe4a4d3c788
https://github.com/sacrud/pyramid_sacrud/blob/05c30e219a32166b4e09ec3524767fe4a4d3c788/examples/docker_crud/ps_docker_example.py#L17-L40
46,797
emory-libraries/eulxml
eulxml/catalog.py
download_schema
def download_schema(uri, path, comment=None): """Download a schema from a specified URI and save it locally. :param uri: url where the schema should be downloaded :param path: local file path where the schema should be saved :param comment: optional comment; if specified, will be added to the d...
python
def download_schema(uri, path, comment=None): """Download a schema from a specified URI and save it locally. :param uri: url where the schema should be downloaded :param path: local file path where the schema should be saved :param comment: optional comment; if specified, will be added to the d...
[ "def", "download_schema", "(", "uri", ",", "path", ",", "comment", "=", "None", ")", ":", "# if requests isn't available, warn and bail out", "if", "requests", "is", "None", ":", "sys", ".", "stderr", ".", "write", "(", "req_requests_msg", ")", "return", "# shor...
Download a schema from a specified URI and save it locally. :param uri: url where the schema should be downloaded :param path: local file path where the schema should be saved :param comment: optional comment; if specified, will be added to the downloaded schema :returns: true on success, false...
[ "Download", "a", "schema", "from", "a", "specified", "URI", "and", "save", "it", "locally", "." ]
17d71c7d98c0cebda9932b7f13e72093805e1fe2
https://github.com/emory-libraries/eulxml/blob/17d71c7d98c0cebda9932b7f13e72093805e1fe2/eulxml/catalog.py#L86-L127
46,798
emory-libraries/eulxml
eulxml/catalog.py
generate_catalog
def generate_catalog(xsd_schemas=None, xmlcatalog_dir=None, xmlcatalog_file=None): """Generating an XML catalog for use in resolving schemas Creates the XML Catalog directory if it doesn't already exist. Uses :meth:`download_schema` to save local copies of schemas, adding a comment indicating the date ...
python
def generate_catalog(xsd_schemas=None, xmlcatalog_dir=None, xmlcatalog_file=None): """Generating an XML catalog for use in resolving schemas Creates the XML Catalog directory if it doesn't already exist. Uses :meth:`download_schema` to save local copies of schemas, adding a comment indicating the date ...
[ "def", "generate_catalog", "(", "xsd_schemas", "=", "None", ",", "xmlcatalog_dir", "=", "None", ",", "xmlcatalog_file", "=", "None", ")", ":", "# if requests isn't available, warn and bail out", "if", "requests", "is", "None", ":", "sys", ".", "stderr", ".", "writ...
Generating an XML catalog for use in resolving schemas Creates the XML Catalog directory if it doesn't already exist. Uses :meth:`download_schema` to save local copies of schemas, adding a comment indicating the date downloaded by eulxml. Generates a new catalog.xml file, with entries for all schemas ...
[ "Generating", "an", "XML", "catalog", "for", "use", "in", "resolving", "schemas" ]
17d71c7d98c0cebda9932b7f13e72093805e1fe2
https://github.com/emory-libraries/eulxml/blob/17d71c7d98c0cebda9932b7f13e72093805e1fe2/eulxml/catalog.py#L130-L188
46,799
blockstack/virtualchain
virtualchain/lib/indexer.py
sqlite3_find_tool
def sqlite3_find_tool(): """ Find the sqlite3 binary Return the path to the binary on success Return None on error """ # find sqlite3 path = os.environ.get("PATH", None) if path is None: path = "/usr/local/bin:/usr/bin:/bin" sqlite3_path = None dirs = path.split(":") ...
python
def sqlite3_find_tool(): """ Find the sqlite3 binary Return the path to the binary on success Return None on error """ # find sqlite3 path = os.environ.get("PATH", None) if path is None: path = "/usr/local/bin:/usr/bin:/bin" sqlite3_path = None dirs = path.split(":") ...
[ "def", "sqlite3_find_tool", "(", ")", ":", "# find sqlite3", "path", "=", "os", ".", "environ", ".", "get", "(", "\"PATH\"", ",", "None", ")", "if", "path", "is", "None", ":", "path", "=", "\"/usr/local/bin:/usr/bin:/bin\"", "sqlite3_path", "=", "None", "dir...
Find the sqlite3 binary Return the path to the binary on success Return None on error
[ "Find", "the", "sqlite3", "binary", "Return", "the", "path", "to", "the", "binary", "on", "success", "Return", "None", "on", "error" ]
fcfc970064ca7dfcab26ebd3ab955870a763ea39
https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/indexer.py#L1644-L1678