repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
sveetch/boussole
boussole/finder.py
ScssFinder.change_extension
def change_extension(self, filepath, new_extension): """ Change final filename extension. Args: filepath (str): A file path (relative or absolute). new_extension (str): New extension name (without leading dot) to apply. Returns: str: ...
python
def change_extension(self, filepath, new_extension): """ Change final filename extension. Args: filepath (str): A file path (relative or absolute). new_extension (str): New extension name (without leading dot) to apply. Returns: str: ...
[ "def", "change_extension", "(", "self", ",", "filepath", ",", "new_extension", ")", ":", "filename", ",", "ext", "=", "os", ".", "path", ".", "splitext", "(", "filepath", ")", "return", "'.'", ".", "join", "(", "[", "filename", ",", "new_extension", "]",...
Change final filename extension. Args: filepath (str): A file path (relative or absolute). new_extension (str): New extension name (without leading dot) to apply. Returns: str: Filepath with new extension.
[ "Change", "final", "filename", "extension", "." ]
train
https://github.com/sveetch/boussole/blob/22cc644e9d633f41ebfc167d427a71c1726cee21/boussole/finder.py#L183-L196
sveetch/boussole
boussole/finder.py
ScssFinder.get_destination
def get_destination(self, filepath, targetdir=None): """ Return destination path from given source file path. Destination is allways a file with extension ``.css``. Args: filepath (str): A file path. The path is allways relative to sources directory. If not ...
python
def get_destination(self, filepath, targetdir=None): """ Return destination path from given source file path. Destination is allways a file with extension ``.css``. Args: filepath (str): A file path. The path is allways relative to sources directory. If not ...
[ "def", "get_destination", "(", "self", ",", "filepath", ",", "targetdir", "=", "None", ")", ":", "dst", "=", "self", ".", "change_extension", "(", "filepath", ",", "'css'", ")", "if", "targetdir", ":", "dst", "=", "os", ".", "path", ".", "join", "(", ...
Return destination path from given source file path. Destination is allways a file with extension ``.css``. Args: filepath (str): A file path. The path is allways relative to sources directory. If not relative, ``targetdir`` won't be joined. abso...
[ "Return", "destination", "path", "from", "given", "source", "file", "path", "." ]
train
https://github.com/sveetch/boussole/blob/22cc644e9d633f41ebfc167d427a71c1726cee21/boussole/finder.py#L198-L217
sveetch/boussole
boussole/finder.py
ScssFinder.compilable_sources
def compilable_sources(self, sourcedir, absolute=False, recursive=True, excludes=[]): """ Find all scss sources that should be compiled, aka all sources that are not "partials" Sass sources. Args: sourcedir (str): Directory path to scan. ...
python
def compilable_sources(self, sourcedir, absolute=False, recursive=True, excludes=[]): """ Find all scss sources that should be compiled, aka all sources that are not "partials" Sass sources. Args: sourcedir (str): Directory path to scan. ...
[ "def", "compilable_sources", "(", "self", ",", "sourcedir", ",", "absolute", "=", "False", ",", "recursive", "=", "True", ",", "excludes", "=", "[", "]", ")", ":", "filepaths", "=", "[", "]", "for", "root", ",", "dirs", ",", "files", "in", "os", ".",...
Find all scss sources that should be compiled, aka all sources that are not "partials" Sass sources. Args: sourcedir (str): Directory path to scan. Keyword Arguments: absolute (bool): Returned paths will be absolute using ``sourcedir`` argument (if True...
[ "Find", "all", "scss", "sources", "that", "should", "be", "compiled", "aka", "all", "sources", "that", "are", "not", "partials", "Sass", "sources", "." ]
train
https://github.com/sveetch/boussole/blob/22cc644e9d633f41ebfc167d427a71c1726cee21/boussole/finder.py#L219-L275
sveetch/boussole
boussole/finder.py
ScssFinder.mirror_sources
def mirror_sources(self, sourcedir, targetdir=None, recursive=True, excludes=[]): """ Mirroring compilable sources filepaths to their targets. Args: sourcedir (str): Directory path to scan. Keyword Arguments: absolute (bool): Returned path...
python
def mirror_sources(self, sourcedir, targetdir=None, recursive=True, excludes=[]): """ Mirroring compilable sources filepaths to their targets. Args: sourcedir (str): Directory path to scan. Keyword Arguments: absolute (bool): Returned path...
[ "def", "mirror_sources", "(", "self", ",", "sourcedir", ",", "targetdir", "=", "None", ",", "recursive", "=", "True", ",", "excludes", "=", "[", "]", ")", ":", "sources", "=", "self", ".", "compilable_sources", "(", "sourcedir", ",", "absolute", "=", "Fa...
Mirroring compilable sources filepaths to their targets. Args: sourcedir (str): Directory path to scan. Keyword Arguments: absolute (bool): Returned paths will be absolute using ``sourcedir`` argument (if True), else return relative paths. recursive ...
[ "Mirroring", "compilable", "sources", "filepaths", "to", "their", "targets", "." ]
train
https://github.com/sveetch/boussole/blob/22cc644e9d633f41ebfc167d427a71c1726cee21/boussole/finder.py#L277-L319
Clinical-Genomics/housekeeper
housekeeper/add/core.py
AddHandler.add_bundle
def add_bundle(self, data: dict) -> models.Bundle: """Build a new bundle version of files. The format of the input dict is defined in the `schema` module. """ bundle_obj = self.bundle(data['name']) if bundle_obj and self.version(bundle_obj.name, data['created']): LOG...
python
def add_bundle(self, data: dict) -> models.Bundle: """Build a new bundle version of files. The format of the input dict is defined in the `schema` module. """ bundle_obj = self.bundle(data['name']) if bundle_obj and self.version(bundle_obj.name, data['created']): LOG...
[ "def", "add_bundle", "(", "self", ",", "data", ":", "dict", ")", "->", "models", ".", "Bundle", ":", "bundle_obj", "=", "self", ".", "bundle", "(", "data", "[", "'name'", "]", ")", "if", "bundle_obj", "and", "self", ".", "version", "(", "bundle_obj", ...
Build a new bundle version of files. The format of the input dict is defined in the `schema` module.
[ "Build", "a", "new", "bundle", "version", "of", "files", "." ]
train
https://github.com/Clinical-Genomics/housekeeper/blob/a7d10d327dc9f06274bdef5504ed1b9413f2c8c1/housekeeper/add/core.py#L13-L40
Clinical-Genomics/housekeeper
housekeeper/add/core.py
AddHandler._build_tags
def _build_tags(self, tag_names: List[str]) -> dict: """Build a list of tag objects.""" tags = {} for tag_name in tag_names: tag_obj = self.tag(tag_name) if tag_obj is None: LOG.debug(f"create new tag: {tag_name}") tag_obj = self.new_tag(ta...
python
def _build_tags(self, tag_names: List[str]) -> dict: """Build a list of tag objects.""" tags = {} for tag_name in tag_names: tag_obj = self.tag(tag_name) if tag_obj is None: LOG.debug(f"create new tag: {tag_name}") tag_obj = self.new_tag(ta...
[ "def", "_build_tags", "(", "self", ",", "tag_names", ":", "List", "[", "str", "]", ")", "->", "dict", ":", "tags", "=", "{", "}", "for", "tag_name", "in", "tag_names", ":", "tag_obj", "=", "self", ".", "tag", "(", "tag_name", ")", "if", "tag_obj", ...
Build a list of tag objects.
[ "Build", "a", "list", "of", "tag", "objects", "." ]
train
https://github.com/Clinical-Genomics/housekeeper/blob/a7d10d327dc9f06274bdef5504ed1b9413f2c8c1/housekeeper/add/core.py#L42-L51
magrathealabs/feito
feito/github/api.py
API.create_comment_commit
def create_comment_commit(self, body, commit_id, path, position, pr_id): """ Posts a comment to a given commit at a certain pull request. Check https://developer.github.com/v3/pulls/comments/#create-a-comment param body: str -> Comment text param commit_id: str -> SHA of the com...
python
def create_comment_commit(self, body, commit_id, path, position, pr_id): """ Posts a comment to a given commit at a certain pull request. Check https://developer.github.com/v3/pulls/comments/#create-a-comment param body: str -> Comment text param commit_id: str -> SHA of the com...
[ "def", "create_comment_commit", "(", "self", ",", "body", ",", "commit_id", ",", "path", ",", "position", ",", "pr_id", ")", ":", "comments_url", "=", "f\"{self.GITHUB_API_URL}/repos/{self.user}/{self.repo}/pulls/{pr_id}/comments\"", "data", "=", "{", "'body'", ":", "...
Posts a comment to a given commit at a certain pull request. Check https://developer.github.com/v3/pulls/comments/#create-a-comment param body: str -> Comment text param commit_id: str -> SHA of the commit param path: str -> Relative path of the file to be commented param positi...
[ "Posts", "a", "comment", "to", "a", "given", "commit", "at", "a", "certain", "pull", "request", ".", "Check", "https", ":", "//", "developer", ".", "github", ".", "com", "/", "v3", "/", "pulls", "/", "comments", "/", "#create", "-", "a", "-", "commen...
train
https://github.com/magrathealabs/feito/blob/4179e40233ccf6e5a6c9892e528595690ce9ef43/feito/github/api.py#L23-L37
openmicroscopy/omero-marshal
omero_marshal/legacy/affinetransform.py
AffineTransformI.convert_svg_transform
def convert_svg_transform(self, transform): """ Converts a string representing a SVG transform into AffineTransform fields. See https://www.w3.org/TR/SVG/coords.html#TransformAttribute for the specification of the transform strings. skewX and skewY are not supported. ...
python
def convert_svg_transform(self, transform): """ Converts a string representing a SVG transform into AffineTransform fields. See https://www.w3.org/TR/SVG/coords.html#TransformAttribute for the specification of the transform strings. skewX and skewY are not supported. ...
[ "def", "convert_svg_transform", "(", "self", ",", "transform", ")", ":", "tr", ",", "args", "=", "transform", "[", ":", "-", "1", "]", ".", "split", "(", "'('", ")", "a", "=", "map", "(", "float", ",", "args", ".", "split", "(", "' '", ")", ")", ...
Converts a string representing a SVG transform into AffineTransform fields. See https://www.w3.org/TR/SVG/coords.html#TransformAttribute for the specification of the transform strings. skewX and skewY are not supported. Raises: ValueError: If transform is not a valid ...
[ "Converts", "a", "string", "representing", "a", "SVG", "transform", "into", "AffineTransform", "fields", ".", "See", "https", ":", "//", "www", ".", "w3", ".", "org", "/", "TR", "/", "SVG", "/", "coords", ".", "html#TransformAttribute", "for", "the", "spec...
train
https://github.com/openmicroscopy/omero-marshal/blob/0f427927b471a19f14b434452de88e16d621c487/omero_marshal/legacy/affinetransform.py#L38-L83
magrathealabs/feito
feito/prospector.py
Prospector.run
def run(self): """ Runs prospector in the input files and returns a json with the analysis """ arg_prospector = f'prospector --output-format json {self.repo.diff_files()}' analysis = subprocess.run(arg_prospector, stdout=subprocess.PIPE, shell=True) return json.loads(anal...
python
def run(self): """ Runs prospector in the input files and returns a json with the analysis """ arg_prospector = f'prospector --output-format json {self.repo.diff_files()}' analysis = subprocess.run(arg_prospector, stdout=subprocess.PIPE, shell=True) return json.loads(anal...
[ "def", "run", "(", "self", ")", ":", "arg_prospector", "=", "f'prospector --output-format json {self.repo.diff_files()}'", "analysis", "=", "subprocess", ".", "run", "(", "arg_prospector", ",", "stdout", "=", "subprocess", ".", "PIPE", ",", "shell", "=", "True", "...
Runs prospector in the input files and returns a json with the analysis
[ "Runs", "prospector", "in", "the", "input", "files", "and", "returns", "a", "json", "with", "the", "analysis" ]
train
https://github.com/magrathealabs/feito/blob/4179e40233ccf6e5a6c9892e528595690ce9ef43/feito/prospector.py#L10-L16
disqus/nose-performance
src/noseperf/wrappers/django.py
DjangoCursorWrapper.execute
def execute(self, operation, parameters=()): """ Wraps execute method to record the query, execution duration and stackframe. """ __traceback_hide__ = True # NOQ # Time the exection of the query start = time.time() try: return self.cursor.ex...
python
def execute(self, operation, parameters=()): """ Wraps execute method to record the query, execution duration and stackframe. """ __traceback_hide__ = True # NOQ # Time the exection of the query start = time.time() try: return self.cursor.ex...
[ "def", "execute", "(", "self", ",", "operation", ",", "parameters", "=", "(", ")", ")", ":", "__traceback_hide__", "=", "True", "# NOQ", "# Time the exection of the query", "start", "=", "time", ".", "time", "(", ")", "try", ":", "return", "self", ".", "cu...
Wraps execute method to record the query, execution duration and stackframe.
[ "Wraps", "execute", "method", "to", "record", "the", "query", "execution", "duration", "and", "stackframe", "." ]
train
https://github.com/disqus/nose-performance/blob/916c8bd7fe7f30e4b7cba24a79a4157fd7889ec2/src/noseperf/wrappers/django.py#L55-L77
robertpeteuil/aws-shortcuts
awss/core.py
main
def main(): """Collect user args and call command funct. Collect command line args and setup environment then call function for command specified in args. """ parser = parser_setup() options = parser.parse_args() debug = bool(options.debug > 0) debugall = bool(options.debug > 1) ...
python
def main(): """Collect user args and call command funct. Collect command line args and setup environment then call function for command specified in args. """ parser = parser_setup() options = parser.parse_args() debug = bool(options.debug > 0) debugall = bool(options.debug > 1) ...
[ "def", "main", "(", ")", ":", "parser", "=", "parser_setup", "(", ")", "options", "=", "parser", ".", "parse_args", "(", ")", "debug", "=", "bool", "(", "options", ".", "debug", ">", "0", ")", "debugall", "=", "bool", "(", "options", ".", "debug", ...
Collect user args and call command funct. Collect command line args and setup environment then call function for command specified in args.
[ "Collect", "user", "args", "and", "call", "command", "funct", "." ]
train
https://github.com/robertpeteuil/aws-shortcuts/blob/cf453ca996978a4d88015d1cf6125bce8ca4873b/awss/core.py#L42-L61
robertpeteuil/aws-shortcuts
awss/core.py
parser_setup
def parser_setup(): """Create ArgumentParser object to parse command line arguments. Returns: parser (object): containing ArgumentParser data and methods. Raises: SystemExit: if the user enters invalid args. """ parser = argparse.ArgumentParser(description="Control AWS instances fr...
python
def parser_setup(): """Create ArgumentParser object to parse command line arguments. Returns: parser (object): containing ArgumentParser data and methods. Raises: SystemExit: if the user enters invalid args. """ parser = argparse.ArgumentParser(description="Control AWS instances fr...
[ "def", "parser_setup", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "\"Control AWS instances from\"", "\" the command line with: list, start,\"", "\" stop or ssh.\"", ",", "prog", "=", "'awss'", ",", "usage", "=", "\"\\tawss ...
Create ArgumentParser object to parse command line arguments. Returns: parser (object): containing ArgumentParser data and methods. Raises: SystemExit: if the user enters invalid args.
[ "Create", "ArgumentParser", "object", "to", "parse", "command", "line", "arguments", "." ]
train
https://github.com/robertpeteuil/aws-shortcuts/blob/cf453ca996978a4d88015d1cf6125bce8ca4873b/awss/core.py#L64-L157
robertpeteuil/aws-shortcuts
awss/core.py
cmd_list
def cmd_list(options): """Gather data for instances matching args and call display func. Args: options (object): contains args and data from parser. """ (i_info, param_str) = gather_data(options) if i_info: awsc.get_all_aminames(i_info) param_str = "Instance List - " + para...
python
def cmd_list(options): """Gather data for instances matching args and call display func. Args: options (object): contains args and data from parser. """ (i_info, param_str) = gather_data(options) if i_info: awsc.get_all_aminames(i_info) param_str = "Instance List - " + para...
[ "def", "cmd_list", "(", "options", ")", ":", "(", "i_info", ",", "param_str", ")", "=", "gather_data", "(", "options", ")", "if", "i_info", ":", "awsc", ".", "get_all_aminames", "(", "i_info", ")", "param_str", "=", "\"Instance List - \"", "+", "param_str", ...
Gather data for instances matching args and call display func. Args: options (object): contains args and data from parser.
[ "Gather", "data", "for", "instances", "matching", "args", "and", "call", "display", "func", "." ]
train
https://github.com/robertpeteuil/aws-shortcuts/blob/cf453ca996978a4d88015d1cf6125bce8ca4873b/awss/core.py#L160-L173
robertpeteuil/aws-shortcuts
awss/core.py
cmd_startstop
def cmd_startstop(options): """Start or Stop the specified instance. Finds instances that match args and instance-state expected by the command. Then, the target instance is determined, the action is performed on the instance, and the eturn information is displayed. Args: options (object)...
python
def cmd_startstop(options): """Start or Stop the specified instance. Finds instances that match args and instance-state expected by the command. Then, the target instance is determined, the action is performed on the instance, and the eturn information is displayed. Args: options (object)...
[ "def", "cmd_startstop", "(", "options", ")", ":", "statelu", "=", "{", "\"start\"", ":", "\"stopped\"", ",", "\"stop\"", ":", "\"running\"", "}", "options", ".", "inst_state", "=", "statelu", "[", "options", ".", "command", "]", "debg", ".", "dprint", "(",...
Start or Stop the specified instance. Finds instances that match args and instance-state expected by the command. Then, the target instance is determined, the action is performed on the instance, and the eturn information is displayed. Args: options (object): contains args and data from parse...
[ "Start", "or", "Stop", "the", "specified", "instance", "." ]
train
https://github.com/robertpeteuil/aws-shortcuts/blob/cf453ca996978a4d88015d1cf6125bce8ca4873b/awss/core.py#L176-L201
robertpeteuil/aws-shortcuts
awss/core.py
cmd_ssh
def cmd_ssh(options): """Connect to the specified instance via ssh. Finds instances that match the user specified args that are also in the 'running' state. The target instance is determined, the required connection information is retreived (IP, key and ssh user-name), then an 'ssh' connection is ...
python
def cmd_ssh(options): """Connect to the specified instance via ssh. Finds instances that match the user specified args that are also in the 'running' state. The target instance is determined, the required connection information is retreived (IP, key and ssh user-name), then an 'ssh' connection is ...
[ "def", "cmd_ssh", "(", "options", ")", ":", "import", "os", "import", "subprocess", "from", "os", ".", "path", "import", "expanduser", "options", ".", "inst_state", "=", "\"running\"", "(", "i_info", ",", "param_str", ")", "=", "gather_data", "(", "options",...
Connect to the specified instance via ssh. Finds instances that match the user specified args that are also in the 'running' state. The target instance is determined, the required connection information is retreived (IP, key and ssh user-name), then an 'ssh' connection is made to the instance. Ar...
[ "Connect", "to", "the", "specified", "instance", "via", "ssh", "." ]
train
https://github.com/robertpeteuil/aws-shortcuts/blob/cf453ca996978a4d88015d1cf6125bce8ca4873b/awss/core.py#L204-L242
robertpeteuil/aws-shortcuts
awss/core.py
cmd_ssh_user
def cmd_ssh_user(tar_aminame, inst_name): """Calculate instance login-username based on image-name. Args: tar_aminame (str): name of the image instance created with. inst_name (str): name of the instance. Returns: username (str): name for ssh based on AMI-name. """ if tar_a...
python
def cmd_ssh_user(tar_aminame, inst_name): """Calculate instance login-username based on image-name. Args: tar_aminame (str): name of the image instance created with. inst_name (str): name of the instance. Returns: username (str): name for ssh based on AMI-name. """ if tar_a...
[ "def", "cmd_ssh_user", "(", "tar_aminame", ",", "inst_name", ")", ":", "if", "tar_aminame", "==", "\"Unknown\"", ":", "tar_aminame", "=", "inst_name", "# first 5 chars of AMI-name can be anywhere in AMI-Name", "userlu", "=", "{", "\"ubunt\"", ":", "\"ubuntu\"", ",", "...
Calculate instance login-username based on image-name. Args: tar_aminame (str): name of the image instance created with. inst_name (str): name of the instance. Returns: username (str): name for ssh based on AMI-name.
[ "Calculate", "instance", "login", "-", "username", "based", "on", "image", "-", "name", "." ]
train
https://github.com/robertpeteuil/aws-shortcuts/blob/cf453ca996978a4d88015d1cf6125bce8ca4873b/awss/core.py#L245-L265
robertpeteuil/aws-shortcuts
awss/core.py
gather_data
def gather_data(options): """Get Data specific for command selected. Create ec2 specific query and output title based on options specified, retrieves the raw response data from aws, then processes it into the i_info dict, which is used throughout this module. Args: options (object): co...
python
def gather_data(options): """Get Data specific for command selected. Create ec2 specific query and output title based on options specified, retrieves the raw response data from aws, then processes it into the i_info dict, which is used throughout this module. Args: options (object): co...
[ "def", "gather_data", "(", "options", ")", ":", "(", "qry_string", ",", "param_str", ")", "=", "qry_create", "(", "options", ")", "qry_results", "=", "awsc", ".", "get_inst_info", "(", "qry_string", ")", "i_info", "=", "process_results", "(", "qry_results", ...
Get Data specific for command selected. Create ec2 specific query and output title based on options specified, retrieves the raw response data from aws, then processes it into the i_info dict, which is used throughout this module. Args: options (object): contains args and data from parser,...
[ "Get", "Data", "specific", "for", "command", "selected", "." ]
train
https://github.com/robertpeteuil/aws-shortcuts/blob/cf453ca996978a4d88015d1cf6125bce8ca4873b/awss/core.py#L268-L288
robertpeteuil/aws-shortcuts
awss/core.py
process_results
def process_results(qry_results): """Generate dictionary of results from query. Decodes the large dict recturned from the AWS query. Args: qry_results (dict): results from awsc.get_inst_info Returns: i_info (dict): information on instances and details. """ i_info = {} for ...
python
def process_results(qry_results): """Generate dictionary of results from query. Decodes the large dict recturned from the AWS query. Args: qry_results (dict): results from awsc.get_inst_info Returns: i_info (dict): information on instances and details. """ i_info = {} for ...
[ "def", "process_results", "(", "qry_results", ")", ":", "i_info", "=", "{", "}", "for", "i", ",", "j", "in", "enumerate", "(", "qry_results", "[", "'Reservations'", "]", ")", ":", "i_info", "[", "i", "]", "=", "{", "'id'", ":", "j", "[", "'Instances'...
Generate dictionary of results from query. Decodes the large dict recturned from the AWS query. Args: qry_results (dict): results from awsc.get_inst_info Returns: i_info (dict): information on instances and details.
[ "Generate", "dictionary", "of", "results", "from", "query", "." ]
train
https://github.com/robertpeteuil/aws-shortcuts/blob/cf453ca996978a4d88015d1cf6125bce8ca4873b/awss/core.py#L291-L316
robertpeteuil/aws-shortcuts
awss/core.py
process_tags
def process_tags(inst_tags): """Create dict of instance tags as only name:value pairs.""" tag_dict = {} for k in range(len(inst_tags)): tag_dict[inst_tags[k]['Key']] = inst_tags[k]['Value'] return tag_dict
python
def process_tags(inst_tags): """Create dict of instance tags as only name:value pairs.""" tag_dict = {} for k in range(len(inst_tags)): tag_dict[inst_tags[k]['Key']] = inst_tags[k]['Value'] return tag_dict
[ "def", "process_tags", "(", "inst_tags", ")", ":", "tag_dict", "=", "{", "}", "for", "k", "in", "range", "(", "len", "(", "inst_tags", ")", ")", ":", "tag_dict", "[", "inst_tags", "[", "k", "]", "[", "'Key'", "]", "]", "=", "inst_tags", "[", "k", ...
Create dict of instance tags as only name:value pairs.
[ "Create", "dict", "of", "instance", "tags", "as", "only", "name", ":", "value", "pairs", "." ]
train
https://github.com/robertpeteuil/aws-shortcuts/blob/cf453ca996978a4d88015d1cf6125bce8ca4873b/awss/core.py#L319-L324
robertpeteuil/aws-shortcuts
awss/core.py
qry_create
def qry_create(options): """Create query from the args specified and command chosen. Creates a query string that incorporates the args in the options object, and creates the title for the 'list' function. Args: options (object): contains args and data from parser Returns: qry_strin...
python
def qry_create(options): """Create query from the args specified and command chosen. Creates a query string that incorporates the args in the options object, and creates the title for the 'list' function. Args: options (object): contains args and data from parser Returns: qry_strin...
[ "def", "qry_create", "(", "options", ")", ":", "qry_string", "=", "filt_end", "=", "param_str", "=", "\"\"", "filt_st", "=", "\"Filters=[\"", "param_str_default", "=", "\"All\"", "if", "options", ".", "id", ":", "qry_string", "+=", "\"InstanceIds=['%s']\"", "%",...
Create query from the args specified and command chosen. Creates a query string that incorporates the args in the options object, and creates the title for the 'list' function. Args: options (object): contains args and data from parser Returns: qry_string (str): the query to be used ag...
[ "Create", "query", "from", "the", "args", "specified", "and", "command", "chosen", "." ]
train
https://github.com/robertpeteuil/aws-shortcuts/blob/cf453ca996978a4d88015d1cf6125bce8ca4873b/awss/core.py#L327-L373
robertpeteuil/aws-shortcuts
awss/core.py
qry_helper
def qry_helper(flag_id, qry_string, param_str, flag_filt=False, filt_st=""): """Dynamically add syntaxtical elements to query. This functions adds syntactical elements to the query string, and report title, based on the types and number of items added thus far. Args: flag_filt (bool): at least...
python
def qry_helper(flag_id, qry_string, param_str, flag_filt=False, filt_st=""): """Dynamically add syntaxtical elements to query. This functions adds syntactical elements to the query string, and report title, based on the types and number of items added thus far. Args: flag_filt (bool): at least...
[ "def", "qry_helper", "(", "flag_id", ",", "qry_string", ",", "param_str", ",", "flag_filt", "=", "False", ",", "filt_st", "=", "\"\"", ")", ":", "if", "flag_id", "or", "flag_filt", ":", "qry_string", "+=", "\", \"", "param_str", "+=", "\", \"", "if", "not"...
Dynamically add syntaxtical elements to query. This functions adds syntactical elements to the query string, and report title, based on the types and number of items added thus far. Args: flag_filt (bool): at least one filter item specified. qry_string (str): portion of the query construct...
[ "Dynamically", "add", "syntaxtical", "elements", "to", "query", "." ]
train
https://github.com/robertpeteuil/aws-shortcuts/blob/cf453ca996978a4d88015d1cf6125bce8ca4873b/awss/core.py#L376-L400
robertpeteuil/aws-shortcuts
awss/core.py
list_instances
def list_instances(i_info, param_str, numbered=False): """Display a list of all instances and their details. Iterates through all the instances in the dict, and displays information for each instance. Args: i_info (dict): information on instances and details. param_str (str): the title...
python
def list_instances(i_info, param_str, numbered=False): """Display a list of all instances and their details. Iterates through all the instances in the dict, and displays information for each instance. Args: i_info (dict): information on instances and details. param_str (str): the title...
[ "def", "list_instances", "(", "i_info", ",", "param_str", ",", "numbered", "=", "False", ")", ":", "print", "(", "param_str", ")", "for", "i", "in", "i_info", ":", "if", "numbered", ":", "print", "(", "\"Instance {}#{}{}\"", ".", "format", "(", "C_WARN", ...
Display a list of all instances and their details. Iterates through all the instances in the dict, and displays information for each instance. Args: i_info (dict): information on instances and details. param_str (str): the title to display before the list. numbered (bool): optional...
[ "Display", "a", "list", "of", "all", "instances", "and", "their", "details", "." ]
train
https://github.com/robertpeteuil/aws-shortcuts/blob/cf453ca996978a4d88015d1cf6125bce8ca4873b/awss/core.py#L403-L431
robertpeteuil/aws-shortcuts
awss/core.py
list_tags
def list_tags(tags): """Print tags in dict so they allign with listing above.""" tags_sorted = sorted(list(tags.items()), key=operator.itemgetter(0)) tag_sec_spacer = "" c = 1 ignored_keys = ["Name", "aws:ec2spot:fleet-request-id"] pad_col = {1: 38, 2: 49} for k, v in tags_sorted: # ...
python
def list_tags(tags): """Print tags in dict so they allign with listing above.""" tags_sorted = sorted(list(tags.items()), key=operator.itemgetter(0)) tag_sec_spacer = "" c = 1 ignored_keys = ["Name", "aws:ec2spot:fleet-request-id"] pad_col = {1: 38, 2: 49} for k, v in tags_sorted: # ...
[ "def", "list_tags", "(", "tags", ")", ":", "tags_sorted", "=", "sorted", "(", "list", "(", "tags", ".", "items", "(", ")", ")", ",", "key", "=", "operator", ".", "itemgetter", "(", "0", ")", ")", "tag_sec_spacer", "=", "\"\"", "c", "=", "1", "ignor...
Print tags in dict so they allign with listing above.
[ "Print", "tags", "in", "dict", "so", "they", "allign", "with", "listing", "above", "." ]
train
https://github.com/robertpeteuil/aws-shortcuts/blob/cf453ca996978a4d88015d1cf6125bce8ca4873b/awss/core.py#L434-L455
robertpeteuil/aws-shortcuts
awss/core.py
determine_inst
def determine_inst(i_info, param_str, command): """Determine the instance-id of the target instance. Inspect the number of instance-ids collected and take the appropriate action: exit if no ids, return if single id, and call user_picklist function if multiple ids exist. Args: i_info (dict)...
python
def determine_inst(i_info, param_str, command): """Determine the instance-id of the target instance. Inspect the number of instance-ids collected and take the appropriate action: exit if no ids, return if single id, and call user_picklist function if multiple ids exist. Args: i_info (dict)...
[ "def", "determine_inst", "(", "i_info", ",", "param_str", ",", "command", ")", ":", "qty_instances", "=", "len", "(", "i_info", ")", "if", "not", "qty_instances", ":", "print", "(", "\"No instances found with parameters: {}\"", ".", "format", "(", "param_str", "...
Determine the instance-id of the target instance. Inspect the number of instance-ids collected and take the appropriate action: exit if no ids, return if single id, and call user_picklist function if multiple ids exist. Args: i_info (dict): information and details for instances. param_...
[ "Determine", "the", "instance", "-", "id", "of", "the", "target", "instance", "." ]
train
https://github.com/robertpeteuil/aws-shortcuts/blob/cf453ca996978a4d88015d1cf6125bce8ca4873b/awss/core.py#L458-L489
robertpeteuil/aws-shortcuts
awss/core.py
user_picklist
def user_picklist(i_info, command): """Display list of instances matching args and ask user to select target. Instance list displayed and user asked to enter the number corresponding to the desired target instance, or '0' to abort. Args: i_info (dict): information on instances and details. ...
python
def user_picklist(i_info, command): """Display list of instances matching args and ask user to select target. Instance list displayed and user asked to enter the number corresponding to the desired target instance, or '0' to abort. Args: i_info (dict): information on instances and details. ...
[ "def", "user_picklist", "(", "i_info", ",", "command", ")", ":", "valid_entry", "=", "False", "awsc", ".", "get_all_aminames", "(", "i_info", ")", "list_instances", "(", "i_info", ",", "\"\"", ",", "True", ")", "msg_txt", "=", "(", "\"Enter {0}#{1} of instance...
Display list of instances matching args and ask user to select target. Instance list displayed and user asked to enter the number corresponding to the desired target instance, or '0' to abort. Args: i_info (dict): information on instances and details. command (str): command specified on th...
[ "Display", "list", "of", "instances", "matching", "args", "and", "ask", "user", "to", "select", "target", "." ]
train
https://github.com/robertpeteuil/aws-shortcuts/blob/cf453ca996978a4d88015d1cf6125bce8ca4873b/awss/core.py#L492-L518
robertpeteuil/aws-shortcuts
awss/core.py
user_entry
def user_entry(entry_int, num_inst, command): """Validate user entry and returns index and validity flag. Processes the user entry and take the appropriate action: abort if '0' entered, set validity flag and index is valid entry, else return invalid index and the still unset validity flag. Args: ...
python
def user_entry(entry_int, num_inst, command): """Validate user entry and returns index and validity flag. Processes the user entry and take the appropriate action: abort if '0' entered, set validity flag and index is valid entry, else return invalid index and the still unset validity flag. Args: ...
[ "def", "user_entry", "(", "entry_int", ",", "num_inst", ",", "command", ")", ":", "valid_entry", "=", "False", "if", "not", "entry_int", ":", "print", "(", "\"{}aborting{} - {} instance\\n\"", ".", "format", "(", "C_ERR", ",", "C_NORM", ",", "command", ")", ...
Validate user entry and returns index and validity flag. Processes the user entry and take the appropriate action: abort if '0' entered, set validity flag and index is valid entry, else return invalid index and the still unset validity flag. Args: entry_int (int): a number entered or 999 if a ...
[ "Validate", "user", "entry", "and", "returns", "index", "and", "validity", "flag", "." ]
train
https://github.com/robertpeteuil/aws-shortcuts/blob/cf453ca996978a4d88015d1cf6125bce8ca4873b/awss/core.py#L526-L557
ChaosinaCan/pyvswhere
vswhere/__init__.py
execute
def execute(args): """ Call vswhere with the given arguments and return an array of results. `args` is a list of command line arguments to pass to vswhere. If the argument list contains '-property', this returns an array with the property value for each result. Otherwise, this returns an array of ...
python
def execute(args): """ Call vswhere with the given arguments and return an array of results. `args` is a list of command line arguments to pass to vswhere. If the argument list contains '-property', this returns an array with the property value for each result. Otherwise, this returns an array of ...
[ "def", "execute", "(", "args", ")", ":", "is_property", "=", "'-property'", "in", "args", "args", "=", "[", "get_vswhere_path", "(", ")", ",", "'-utf8'", "]", "+", "args", "if", "not", "is_property", ":", "args", ".", "extend", "(", "[", "'-format'", "...
Call vswhere with the given arguments and return an array of results. `args` is a list of command line arguments to pass to vswhere. If the argument list contains '-property', this returns an array with the property value for each result. Otherwise, this returns an array of dictionaries containing the...
[ "Call", "vswhere", "with", "the", "given", "arguments", "and", "return", "an", "array", "of", "results", "." ]
train
https://github.com/ChaosinaCan/pyvswhere/blob/e1b0acc92b851c7ada23ed6415406d688dc6bfce/vswhere/__init__.py#L30-L52
ChaosinaCan/pyvswhere
vswhere/__init__.py
find
def find(find_all=False, latest=False, legacy=False, prerelease=False, products=None, prop=None, requires=None, requires_any=False, version=None): """ Call vswhere and return an array of the results. If `find_all` is true, finds all instances even if they are incomplete and may not launch. If `latest`...
python
def find(find_all=False, latest=False, legacy=False, prerelease=False, products=None, prop=None, requires=None, requires_any=False, version=None): """ Call vswhere and return an array of the results. If `find_all` is true, finds all instances even if they are incomplete and may not launch. If `latest`...
[ "def", "find", "(", "find_all", "=", "False", ",", "latest", "=", "False", ",", "legacy", "=", "False", ",", "prerelease", "=", "False", ",", "products", "=", "None", ",", "prop", "=", "None", ",", "requires", "=", "None", ",", "requires_any", "=", "...
Call vswhere and return an array of the results. If `find_all` is true, finds all instances even if they are incomplete and may not launch. If `latest` is true, returns only the newest version and last installed. If `legacy` is true, also searches Visual Studio 2015 and older products. Information is...
[ "Call", "vswhere", "and", "return", "an", "array", "of", "the", "results", "." ]
train
https://github.com/ChaosinaCan/pyvswhere/blob/e1b0acc92b851c7ada23ed6415406d688dc6bfce/vswhere/__init__.py#L55-L116
ChaosinaCan/pyvswhere
vswhere/__init__.py
get_vswhere_path
def get_vswhere_path(): """ Get the path to vshwere.exe. If vswhere is not already installed as part of Visual Studio, and no alternate path is given using `set_vswhere_path()`, the latest release will be downloaded and stored alongside this script. """ if alternate_path and os.path.exists(...
python
def get_vswhere_path(): """ Get the path to vshwere.exe. If vswhere is not already installed as part of Visual Studio, and no alternate path is given using `set_vswhere_path()`, the latest release will be downloaded and stored alongside this script. """ if alternate_path and os.path.exists(...
[ "def", "get_vswhere_path", "(", ")", ":", "if", "alternate_path", "and", "os", ".", "path", ".", "exists", "(", "alternate_path", ")", ":", "return", "alternate_path", "if", "DEFAULT_PATH", "and", "os", ".", "path", ".", "exists", "(", "DEFAULT_PATH", ")", ...
Get the path to vshwere.exe. If vswhere is not already installed as part of Visual Studio, and no alternate path is given using `set_vswhere_path()`, the latest release will be downloaded and stored alongside this script.
[ "Get", "the", "path", "to", "vshwere", ".", "exe", "." ]
train
https://github.com/ChaosinaCan/pyvswhere/blob/e1b0acc92b851c7ada23ed6415406d688dc6bfce/vswhere/__init__.py#L167-L185
ChaosinaCan/pyvswhere
vswhere/__init__.py
_download_vswhere
def _download_vswhere(): """ Download vswhere to DOWNLOAD_PATH. """ print('downloading from', _get_latest_release_url()) try: from urllib.request import urlopen with urlopen(_get_latest_release_url()) as response, open(DOWNLOAD_PATH, 'wb') as outfile: shutil.copyfileobj(r...
python
def _download_vswhere(): """ Download vswhere to DOWNLOAD_PATH. """ print('downloading from', _get_latest_release_url()) try: from urllib.request import urlopen with urlopen(_get_latest_release_url()) as response, open(DOWNLOAD_PATH, 'wb') as outfile: shutil.copyfileobj(r...
[ "def", "_download_vswhere", "(", ")", ":", "print", "(", "'downloading from'", ",", "_get_latest_release_url", "(", ")", ")", "try", ":", "from", "urllib", ".", "request", "import", "urlopen", "with", "urlopen", "(", "_get_latest_release_url", "(", ")", ")", "...
Download vswhere to DOWNLOAD_PATH.
[ "Download", "vswhere", "to", "DOWNLOAD_PATH", "." ]
train
https://github.com/ChaosinaCan/pyvswhere/blob/e1b0acc92b851c7ada23ed6415406d688dc6bfce/vswhere/__init__.py#L208-L220
jantman/webhook2lambda2sqs
webhook2lambda2sqs/func_generator.py
LambdaFuncGenerator._get_source
def _get_source(self): """ Get the lambda function source template. Strip the leading docstring. Note that it's a real module in this project so we can test it. :return: function source code, with leading docstring stripped. :rtype: str """ logger.debug('Getting ...
python
def _get_source(self): """ Get the lambda function source template. Strip the leading docstring. Note that it's a real module in this project so we can test it. :return: function source code, with leading docstring stripped. :rtype: str """ logger.debug('Getting ...
[ "def", "_get_source", "(", "self", ")", ":", "logger", ".", "debug", "(", "'Getting module source for webhook2lambda2sqs.lambda_func'", ")", "orig", "=", "getsourcelines", "(", "lambda_func", ")", "src", "=", "''", "in_docstr", "=", "False", "have_docstr", "=", "F...
Get the lambda function source template. Strip the leading docstring. Note that it's a real module in this project so we can test it. :return: function source code, with leading docstring stripped. :rtype: str
[ "Get", "the", "lambda", "function", "source", "template", ".", "Strip", "the", "leading", "docstring", ".", "Note", "that", "it", "s", "a", "real", "module", "in", "this", "project", "so", "we", "can", "test", "it", "." ]
train
https://github.com/jantman/webhook2lambda2sqs/blob/c80c18d5a908ba8b8ee624dc3a977c633fba2b7c/webhook2lambda2sqs/func_generator.py#L58-L81
jantman/webhook2lambda2sqs
webhook2lambda2sqs/func_generator.py
LambdaFuncGenerator._docstring
def _docstring(self): """ Generate a docstring for the generated source file. :return: new docstring :rtype: str """ s = '"""' + "\n" s += "webhook2lambda2sqs generated function source\n" s += "this code was generated by webhook2lambda2sqs v%s\n" % VERSIO...
python
def _docstring(self): """ Generate a docstring for the generated source file. :return: new docstring :rtype: str """ s = '"""' + "\n" s += "webhook2lambda2sqs generated function source\n" s += "this code was generated by webhook2lambda2sqs v%s\n" % VERSIO...
[ "def", "_docstring", "(", "self", ")", ":", "s", "=", "'\"\"\"'", "+", "\"\\n\"", "s", "+=", "\"webhook2lambda2sqs generated function source\\n\"", "s", "+=", "\"this code was generated by webhook2lambda2sqs v%s\\n\"", "%", "VERSION", "s", "+=", "\"<%s>\\n\"", "%", "PRO...
Generate a docstring for the generated source file. :return: new docstring :rtype: str
[ "Generate", "a", "docstring", "for", "the", "generated", "source", "file", "." ]
train
https://github.com/jantman/webhook2lambda2sqs/blob/c80c18d5a908ba8b8ee624dc3a977c633fba2b7c/webhook2lambda2sqs/func_generator.py#L84-L101
jantman/webhook2lambda2sqs
webhook2lambda2sqs/func_generator.py
LambdaFuncGenerator.generate
def generate(self): """ Generate Lambda function source; return it as a string. :rtype: str :returns: lambda function source """ s = self._docstring s += self._get_source().replace( 'endpoints = {}', 'endpoints = ' + self._config_src ...
python
def generate(self): """ Generate Lambda function source; return it as a string. :rtype: str :returns: lambda function source """ s = self._docstring s += self._get_source().replace( 'endpoints = {}', 'endpoints = ' + self._config_src ...
[ "def", "generate", "(", "self", ")", ":", "s", "=", "self", ".", "_docstring", "s", "+=", "self", ".", "_get_source", "(", ")", ".", "replace", "(", "'endpoints = {}'", ",", "'endpoints = '", "+", "self", ".", "_config_src", ")", ".", "replace", "(", "...
Generate Lambda function source; return it as a string. :rtype: str :returns: lambda function source
[ "Generate", "Lambda", "function", "source", ";", "return", "it", "as", "a", "string", "." ]
train
https://github.com/jantman/webhook2lambda2sqs/blob/c80c18d5a908ba8b8ee624dc3a977c633fba2b7c/webhook2lambda2sqs/func_generator.py#L114-L129
UDICatNCHU/KEM
kem/views.py
kem
def kem(request): """ due to the base directory settings of django, the model_path needs to be different when testing with this section. """ keyword = request.GET['keyword'] lang = request.GET['lang'] ontology = 'ontology' if 'ontology' in request.GET and bool(json.loads(request.GET['ontology'].lower())) else 'o...
python
def kem(request): """ due to the base directory settings of django, the model_path needs to be different when testing with this section. """ keyword = request.GET['keyword'] lang = request.GET['lang'] ontology = 'ontology' if 'ontology' in request.GET and bool(json.loads(request.GET['ontology'].lower())) else 'o...
[ "def", "kem", "(", "request", ")", ":", "keyword", "=", "request", ".", "GET", "[", "'keyword'", "]", "lang", "=", "request", ".", "GET", "[", "'lang'", "]", "ontology", "=", "'ontology'", "if", "'ontology'", "in", "request", ".", "GET", "and", "bool",...
due to the base directory settings of django, the model_path needs to be different when testing with this section.
[ "due", "to", "the", "base", "directory", "settings", "of", "django", "the", "model_path", "needs", "to", "be", "different", "when", "testing", "with", "this", "section", "." ]
train
https://github.com/UDICatNCHU/KEM/blob/c5fe8894cd87525fcd620c67a4930d192fae030f/kem/views.py#L20-L29
planetlabs/datalake-common
datalake_common/metadata.py
Metadata.normalize_date
def normalize_date(date): '''normalize the specified date to milliseconds since the epoch If it is a string, it is assumed to be some sort of datetime such as "2015-12-27" or "2015-12-27T11:01:20.954". If date is a naive datetime, it is assumed to be UTC. If numeric arguments a...
python
def normalize_date(date): '''normalize the specified date to milliseconds since the epoch If it is a string, it is assumed to be some sort of datetime such as "2015-12-27" or "2015-12-27T11:01:20.954". If date is a naive datetime, it is assumed to be UTC. If numeric arguments a...
[ "def", "normalize_date", "(", "date", ")", ":", "if", "isinstance", "(", "date", ",", "datetime", ")", ":", "pass", "elif", "date", "==", "\"now\"", ":", "date", "=", "datetime", ".", "now", "(", "pytz", ".", "UTC", ")", "elif", "isinstance", "(", "d...
normalize the specified date to milliseconds since the epoch If it is a string, it is assumed to be some sort of datetime such as "2015-12-27" or "2015-12-27T11:01:20.954". If date is a naive datetime, it is assumed to be UTC. If numeric arguments are beyond 5138-11-16 (100,000,000,000...
[ "normalize", "the", "specified", "date", "to", "milliseconds", "since", "the", "epoch" ]
train
https://github.com/planetlabs/datalake-common/blob/f0864732ac8cf26df4bea62600aee13b19321a93/datalake_common/metadata.py#L181-L213
mpasternak/djorm-ext-filtered-contenttypes
filtered_contenttypes/utils.py
amalgamate_sql
def amalgamate_sql(app, model, extra_fields=None, table_name=None, view_name=None): """This function returns a string, containing SQL to create a view exposing given model's content_type_id and object_id, with some extra_fields optionally. This function does *not* escape or quote its...
python
def amalgamate_sql(app, model, extra_fields=None, table_name=None, view_name=None): """This function returns a string, containing SQL to create a view exposing given model's content_type_id and object_id, with some extra_fields optionally. This function does *not* escape or quote its...
[ "def", "amalgamate_sql", "(", "app", ",", "model", ",", "extra_fields", "=", "None", ",", "table_name", "=", "None", ",", "view_name", "=", "None", ")", ":", "if", "extra_fields", "==", "None", ":", "extra_fields", "=", "[", "]", "extra_fields", "=", "\"...
This function returns a string, containing SQL to create a view exposing given model's content_type_id and object_id, with some extra_fields optionally. This function does *not* escape or quote its arguments. >>> print(utils.amalgamate_sql('tests', 'phone', ['foo', 'x as y'])) CREATE VIEW...
[ "This", "function", "returns", "a", "string", "containing", "SQL", "to", "create", "a", "view", "exposing", "given", "model", "s", "content_type_id", "and", "object_id", "with", "some", "extra_fields", "optionally", "." ]
train
https://github.com/mpasternak/djorm-ext-filtered-contenttypes/blob/63fa209d13891282adcec92250ff78b6442f4cd3/filtered_contenttypes/utils.py#L3-L65
mpasternak/djorm-ext-filtered-contenttypes
filtered_contenttypes/utils.py
union_sql
def union_sql(view_name, *tables): """This function generates string containing SQL code, that creates a big VIEW, that consists of many SELECTs. >>> utils.union_sql('global', 'foo', 'bar', 'baz') 'CREATE VIEW global SELECT * FROM foo UNION SELECT * FROM bar UNION SELECT * FROM baz' """ if not...
python
def union_sql(view_name, *tables): """This function generates string containing SQL code, that creates a big VIEW, that consists of many SELECTs. >>> utils.union_sql('global', 'foo', 'bar', 'baz') 'CREATE VIEW global SELECT * FROM foo UNION SELECT * FROM bar UNION SELECT * FROM baz' """ if not...
[ "def", "union_sql", "(", "view_name", ",", "*", "tables", ")", ":", "if", "not", "tables", ":", "raise", "Exception", "(", "\"no tables given\"", ")", "ret", "=", "\"\"", "pre", "=", "\"CREATE VIEW %s AS SELECT * FROM \"", "%", "view_name", "for", "table", "in...
This function generates string containing SQL code, that creates a big VIEW, that consists of many SELECTs. >>> utils.union_sql('global', 'foo', 'bar', 'baz') 'CREATE VIEW global SELECT * FROM foo UNION SELECT * FROM bar UNION SELECT * FROM baz'
[ "This", "function", "generates", "string", "containing", "SQL", "code", "that", "creates", "a", "big", "VIEW", "that", "consists", "of", "many", "SELECTs", "." ]
train
https://github.com/mpasternak/djorm-ext-filtered-contenttypes/blob/63fa209d13891282adcec92250ff78b6442f4cd3/filtered_contenttypes/utils.py#L68-L86
aiidateam/aiida-nwchem
aiida_nwchem/parsers/nwcpymatgen.py
NwcpymatgenParser._get_output_nodes
def _get_output_nodes(self, output_path, error_path): """ Extracts output nodes from the standard output and standard error files. """ from pymatgen.io.nwchem import NwOutput from aiida.orm.data.structure import StructureData from aiida.orm.data.array.trajectory i...
python
def _get_output_nodes(self, output_path, error_path): """ Extracts output nodes from the standard output and standard error files. """ from pymatgen.io.nwchem import NwOutput from aiida.orm.data.structure import StructureData from aiida.orm.data.array.trajectory i...
[ "def", "_get_output_nodes", "(", "self", ",", "output_path", ",", "error_path", ")", ":", "from", "pymatgen", ".", "io", ".", "nwchem", "import", "NwOutput", "from", "aiida", ".", "orm", ".", "data", ".", "structure", "import", "StructureData", "from", "aiid...
Extracts output nodes from the standard output and standard error files.
[ "Extracts", "output", "nodes", "from", "the", "standard", "output", "and", "standard", "error", "files", "." ]
train
https://github.com/aiidateam/aiida-nwchem/blob/21034e7f8ea8249948065c28030f4b572a6ecf05/aiida_nwchem/parsers/nwcpymatgen.py#L32-L65
Clinical-Genomics/housekeeper
housekeeper/cli/init.py
init
def init(context, reset, force): """Setup the database.""" store = Store(context.obj['database'], context.obj['root']) existing_tables = store.engine.table_names() if force or reset: if existing_tables and not force: message = f"Delete existing tables? [{', '.join(existing_tables)}]"...
python
def init(context, reset, force): """Setup the database.""" store = Store(context.obj['database'], context.obj['root']) existing_tables = store.engine.table_names() if force or reset: if existing_tables and not force: message = f"Delete existing tables? [{', '.join(existing_tables)}]"...
[ "def", "init", "(", "context", ",", "reset", ",", "force", ")", ":", "store", "=", "Store", "(", "context", ".", "obj", "[", "'database'", "]", ",", "context", ".", "obj", "[", "'root'", "]", ")", "existing_tables", "=", "store", ".", "engine", ".", ...
Setup the database.
[ "Setup", "the", "database", "." ]
train
https://github.com/Clinical-Genomics/housekeeper/blob/a7d10d327dc9f06274bdef5504ed1b9413f2c8c1/housekeeper/cli/init.py#L11-L26
SiLab-Bonn/online_monitor
online_monitor/converter/transceiver.py
Transceiver._setup_frontend
def _setup_frontend(self): ''' Receiver sockets facing clients (DAQ systems) ''' self.frontends = [] self.fe_poller = zmq.Poller() for actual_frontend_address in self.frontend_address: # Subscriber or server socket actual_frontend = (actual_frontend_addres...
python
def _setup_frontend(self): ''' Receiver sockets facing clients (DAQ systems) ''' self.frontends = [] self.fe_poller = zmq.Poller() for actual_frontend_address in self.frontend_address: # Subscriber or server socket actual_frontend = (actual_frontend_addres...
[ "def", "_setup_frontend", "(", "self", ")", ":", "self", ".", "frontends", "=", "[", "]", "self", ".", "fe_poller", "=", "zmq", ".", "Poller", "(", ")", "for", "actual_frontend_address", "in", "self", ".", "frontend_address", ":", "# Subscriber or server socke...
Receiver sockets facing clients (DAQ systems)
[ "Receiver", "sockets", "facing", "clients", "(", "DAQ", "systems", ")" ]
train
https://github.com/SiLab-Bonn/online_monitor/blob/113c7d33e9ea4bc18520cefa329462faa406cc08/online_monitor/converter/transceiver.py#L104-L124
SiLab-Bonn/online_monitor
online_monitor/converter/transceiver.py
Transceiver._setup_backend
def _setup_backend(self): ''' Send sockets facing services (e.g. online monitor, other forwarders) ''' self.backends = [] self.be_poller = zmq.Poller() for actual_backend_address in self.backend_address: # publisher or client socket actual_backend = (actua...
python
def _setup_backend(self): ''' Send sockets facing services (e.g. online monitor, other forwarders) ''' self.backends = [] self.be_poller = zmq.Poller() for actual_backend_address in self.backend_address: # publisher or client socket actual_backend = (actua...
[ "def", "_setup_backend", "(", "self", ")", ":", "self", ".", "backends", "=", "[", "]", "self", ".", "be_poller", "=", "zmq", ".", "Poller", "(", ")", "for", "actual_backend_address", "in", "self", ".", "backend_address", ":", "# publisher or client socket", ...
Send sockets facing services (e.g. online monitor, other forwarders)
[ "Send", "sockets", "facing", "services", "(", "e", ".", "g", ".", "online", "monitor", "other", "forwarders", ")" ]
train
https://github.com/SiLab-Bonn/online_monitor/blob/113c7d33e9ea4bc18520cefa329462faa406cc08/online_monitor/converter/transceiver.py#L126-L143
SiLab-Bonn/online_monitor
online_monitor/converter/transceiver.py
Transceiver.send_data
def send_data(self, data): ''' This function can be overwritten in derived class Std. function is to broadcast all receiver data to all backends ''' for frontend_data in data: serialized_data = self.serialize_data(frontend_data) if sys.version_info >= (3, 0):...
python
def send_data(self, data): ''' This function can be overwritten in derived class Std. function is to broadcast all receiver data to all backends ''' for frontend_data in data: serialized_data = self.serialize_data(frontend_data) if sys.version_info >= (3, 0):...
[ "def", "send_data", "(", "self", ",", "data", ")", ":", "for", "frontend_data", "in", "data", ":", "serialized_data", "=", "self", ".", "serialize_data", "(", "frontend_data", ")", "if", "sys", ".", "version_info", ">=", "(", "3", ",", "0", ")", ":", "...
This function can be overwritten in derived class Std. function is to broadcast all receiver data to all backends
[ "This", "function", "can", "be", "overwritten", "in", "derived", "class" ]
train
https://github.com/SiLab-Bonn/online_monitor/blob/113c7d33e9ea4bc18520cefa329462faa406cc08/online_monitor/converter/transceiver.py#L192-L202
planetlabs/datalake-common
datalake_common/conf.py
load_config
def load_config(config_file, default_config_file, **kwargs): '''load the configuration Configuration variables are delivered to applications exclusively through the environment. They get into the environment either from a specified configuration file, from a default configuration file, from an environm...
python
def load_config(config_file, default_config_file, **kwargs): '''load the configuration Configuration variables are delivered to applications exclusively through the environment. They get into the environment either from a specified configuration file, from a default configuration file, from an environm...
[ "def", "load_config", "(", "config_file", ",", "default_config_file", ",", "*", "*", "kwargs", ")", ":", "if", "config_file", "and", "not", "os", ".", "path", ".", "exists", "(", "config_file", ")", ":", "msg", "=", "'config file {} does not exist'", ".", "f...
load the configuration Configuration variables are delivered to applications exclusively through the environment. They get into the environment either from a specified configuration file, from a default configuration file, from an environment variable, or from a kwarg specified to this function. C...
[ "load", "the", "configuration" ]
train
https://github.com/planetlabs/datalake-common/blob/f0864732ac8cf26df4bea62600aee13b19321a93/datalake_common/conf.py#L20-L70
jelmer/python-fastimport
fastimport/processors/query_processor.py
QueryProcessor.pre_handler
def pre_handler(self, cmd): """Hook for logic before each handler starts.""" if self._finished: return if self.interesting_commit and cmd.name == 'commit': if cmd.mark == self.interesting_commit: print(cmd.to_string()) self._finished = True...
python
def pre_handler(self, cmd): """Hook for logic before each handler starts.""" if self._finished: return if self.interesting_commit and cmd.name == 'commit': if cmd.mark == self.interesting_commit: print(cmd.to_string()) self._finished = True...
[ "def", "pre_handler", "(", "self", ",", "cmd", ")", ":", "if", "self", ".", "_finished", ":", "return", "if", "self", ".", "interesting_commit", "and", "cmd", ".", "name", "==", "'commit'", ":", "if", "cmd", ".", "mark", "==", "self", ".", "interesting...
Hook for logic before each handler starts.
[ "Hook", "for", "logic", "before", "each", "handler", "starts", "." ]
train
https://github.com/jelmer/python-fastimport/blob/5cef9e037b7d7b37f58f522ac9ea4e343e6a1dff/fastimport/processors/query_processor.py#L55-L67
jelmer/python-fastimport
fastimport/processors/query_processor.py
QueryProcessor.feature_handler
def feature_handler(self, cmd): """Process a FeatureCommand.""" feature = cmd.feature_name if feature not in commands.FEATURE_NAMES: self.warning("feature %s is not supported - parsing may fail" % (feature,))
python
def feature_handler(self, cmd): """Process a FeatureCommand.""" feature = cmd.feature_name if feature not in commands.FEATURE_NAMES: self.warning("feature %s is not supported - parsing may fail" % (feature,))
[ "def", "feature_handler", "(", "self", ",", "cmd", ")", ":", "feature", "=", "cmd", ".", "feature_name", "if", "feature", "not", "in", "commands", ".", "FEATURE_NAMES", ":", "self", ".", "warning", "(", "\"feature %s is not supported - parsing may fail\"", "%", ...
Process a FeatureCommand.
[ "Process", "a", "FeatureCommand", "." ]
train
https://github.com/jelmer/python-fastimport/blob/5cef9e037b7d7b37f58f522ac9ea4e343e6a1dff/fastimport/processors/query_processor.py#L93-L98
svven/summary
summary/config.py
from_object
def from_object(updates): "Update same name (or prefixed) settings." import sys config = sys.modules[__name__] prefix = config.__name__.split('.')[0].upper() keys = [k for k in config.__dict__ if \ k != from_object.__name__ and not k.startswith('_')] get_value = lambda c, k: hasattr...
python
def from_object(updates): "Update same name (or prefixed) settings." import sys config = sys.modules[__name__] prefix = config.__name__.split('.')[0].upper() keys = [k for k in config.__dict__ if \ k != from_object.__name__ and not k.startswith('_')] get_value = lambda c, k: hasattr...
[ "def", "from_object", "(", "updates", ")", ":", "import", "sys", "config", "=", "sys", ".", "modules", "[", "__name__", "]", "prefix", "=", "config", ".", "__name__", ".", "split", "(", "'.'", ")", "[", "0", "]", ".", "upper", "(", ")", "keys", "="...
Update same name (or prefixed) settings.
[ "Update", "same", "name", "(", "or", "prefixed", ")", "settings", "." ]
train
https://github.com/svven/summary/blob/3a6c43d2da08a7452f6b76d1813aa70ba36b8a54/summary/config.py#L5-L17
magrathealabs/feito
feito/messages.py
Messages.commit_format
def commit_format(self): """ Formats the analysis into a simpler dictionary with the line, file and message values to be commented on a commit. Returns a list of dictionaries """ formatted_analyses = [] for analyze in self.analysis['messages']: for...
python
def commit_format(self): """ Formats the analysis into a simpler dictionary with the line, file and message values to be commented on a commit. Returns a list of dictionaries """ formatted_analyses = [] for analyze in self.analysis['messages']: for...
[ "def", "commit_format", "(", "self", ")", ":", "formatted_analyses", "=", "[", "]", "for", "analyze", "in", "self", ".", "analysis", "[", "'messages'", "]", ":", "formatted_analyses", ".", "append", "(", "{", "'message'", ":", "f\"{analyze['source']}: {analyze['...
Formats the analysis into a simpler dictionary with the line, file and message values to be commented on a commit. Returns a list of dictionaries
[ "Formats", "the", "analysis", "into", "a", "simpler", "dictionary", "with", "the", "line", "file", "and", "message", "values", "to", "be", "commented", "on", "a", "commit", ".", "Returns", "a", "list", "of", "dictionaries" ]
train
https://github.com/magrathealabs/feito/blob/4179e40233ccf6e5a6c9892e528595690ce9ef43/feito/messages.py#L10-L24
Clinical-Genomics/housekeeper
housekeeper/server/api.py
bundles
def bundles(): """Display bundles.""" per_page = int(request.args.get('per_page', 30)) page = int(request.args.get('page', 1)) query = store.bundles() query_page = query.paginate(page, per_page=per_page) data = [] for bundle_obj in query_page.items: bundle_data = bundle_obj.to_dict(...
python
def bundles(): """Display bundles.""" per_page = int(request.args.get('per_page', 30)) page = int(request.args.get('page', 1)) query = store.bundles() query_page = query.paginate(page, per_page=per_page) data = [] for bundle_obj in query_page.items: bundle_data = bundle_obj.to_dict(...
[ "def", "bundles", "(", ")", ":", "per_page", "=", "int", "(", "request", ".", "args", ".", "get", "(", "'per_page'", ",", "30", ")", ")", "page", "=", "int", "(", "request", ".", "args", ".", "get", "(", "'page'", ",", "1", ")", ")", "query", "...
Display bundles.
[ "Display", "bundles", "." ]
train
https://github.com/Clinical-Genomics/housekeeper/blob/a7d10d327dc9f06274bdef5504ed1b9413f2c8c1/housekeeper/server/api.py#L10-L23
openmicroscopy/omero-marshal
omero_marshal/decode/__init__.py
Decoder.int_to_rgba
def int_to_rgba(cls, rgba_int): """Converts a color Integer into r, g, b, a tuple.""" if rgba_int is None: return None, None, None, None alpha = rgba_int % 256 blue = rgba_int / 256 % 256 green = rgba_int / 256 / 256 % 256 red = rgba_int / 256 / 256 / 256 % 25...
python
def int_to_rgba(cls, rgba_int): """Converts a color Integer into r, g, b, a tuple.""" if rgba_int is None: return None, None, None, None alpha = rgba_int % 256 blue = rgba_int / 256 % 256 green = rgba_int / 256 / 256 % 256 red = rgba_int / 256 / 256 / 256 % 25...
[ "def", "int_to_rgba", "(", "cls", ",", "rgba_int", ")", ":", "if", "rgba_int", "is", "None", ":", "return", "None", ",", "None", ",", "None", ",", "None", "alpha", "=", "rgba_int", "%", "256", "blue", "=", "rgba_int", "/", "256", "%", "256", "green",...
Converts a color Integer into r, g, b, a tuple.
[ "Converts", "a", "color", "Integer", "into", "r", "g", "b", "a", "tuple", "." ]
train
https://github.com/openmicroscopy/omero-marshal/blob/0f427927b471a19f14b434452de88e16d621c487/omero_marshal/decode/__init__.py#L56-L64
isambard-uob/ampal
src/ampal/pseudo_atoms.py
Primitive.radii_of_curvature
def radii_of_curvature(self): """The radius of curvature at each point on the Polymer primitive. Notes ----- Each element of the returned list is the radius of curvature, at a point on the Polymer primitive. Element i is the radius of the circumcircle formed from indices...
python
def radii_of_curvature(self): """The radius of curvature at each point on the Polymer primitive. Notes ----- Each element of the returned list is the radius of curvature, at a point on the Polymer primitive. Element i is the radius of the circumcircle formed from indices...
[ "def", "radii_of_curvature", "(", "self", ")", ":", "rocs", "=", "[", "]", "for", "i", ",", "_", "in", "enumerate", "(", "self", ")", ":", "if", "0", "<", "i", "<", "len", "(", "self", ")", "-", "1", ":", "rocs", ".", "append", "(", "radius_of_...
The radius of curvature at each point on the Polymer primitive. Notes ----- Each element of the returned list is the radius of curvature, at a point on the Polymer primitive. Element i is the radius of the circumcircle formed from indices [i-1, i, i+1] of the primitve. T...
[ "The", "radius", "of", "curvature", "at", "each", "point", "on", "the", "Polymer", "primitive", "." ]
train
https://github.com/isambard-uob/ampal/blob/906e2afacb435ffb129b381f262ff8e7bfb324c5/src/ampal/pseudo_atoms.py#L290-L307
chbrown/viz
viz/text.py
format_float
def format_float(x, max_width): '''format_float will ensure that a number's decimal part is truncated to fit within some bounds, unless the whole part is wider than max_width, which is a problem you need to sort out yourself. ''' # width of (whole part + 1 (to avoid zero)) + 1 because int floors, no...
python
def format_float(x, max_width): '''format_float will ensure that a number's decimal part is truncated to fit within some bounds, unless the whole part is wider than max_width, which is a problem you need to sort out yourself. ''' # width of (whole part + 1 (to avoid zero)) + 1 because int floors, no...
[ "def", "format_float", "(", "x", ",", "max_width", ")", ":", "# width of (whole part + 1 (to avoid zero)) + 1 because int floors, not ceils", "whole_width", "=", "int", "(", "math", ".", "log10", "(", "abs", "(", "x", ")", "+", "1", ")", ")", "+", "1", "# for +/...
format_float will ensure that a number's decimal part is truncated to fit within some bounds, unless the whole part is wider than max_width, which is a problem you need to sort out yourself.
[ "format_float", "will", "ensure", "that", "a", "number", "s", "decimal", "part", "is", "truncated", "to", "fit", "within", "some", "bounds", "unless", "the", "whole", "part", "is", "wider", "than", "max_width", "which", "is", "a", "problem", "you", "need", ...
train
https://github.com/chbrown/viz/blob/683a8f91630582d74250690a0e8ea7743ab94058/viz/text.py#L4-L15
mayfield/syndicate
syndicate/adapters/aio.py
monkey_patch_issue_25593
def monkey_patch_issue_25593(): """ Workaround for http://bugs.python.org/issue25593 """ save = asyncio.selector_events.BaseSelectorEventLoop._sock_connect_cb @functools.wraps(save) def patched(instance, fut, sock, address): if not fut.done(): save(instance, fut, sock, address) ...
python
def monkey_patch_issue_25593(): """ Workaround for http://bugs.python.org/issue25593 """ save = asyncio.selector_events.BaseSelectorEventLoop._sock_connect_cb @functools.wraps(save) def patched(instance, fut, sock, address): if not fut.done(): save(instance, fut, sock, address) ...
[ "def", "monkey_patch_issue_25593", "(", ")", ":", "save", "=", "asyncio", ".", "selector_events", ".", "BaseSelectorEventLoop", ".", "_sock_connect_cb", "@", "functools", ".", "wraps", "(", "save", ")", "def", "patched", "(", "instance", ",", "fut", ",", "sock...
Workaround for http://bugs.python.org/issue25593
[ "Workaround", "for", "http", ":", "//", "bugs", ".", "python", ".", "org", "/", "issue25593" ]
train
https://github.com/mayfield/syndicate/blob/917af976dacb7377bdf0cb616f47e0df5afaff1a/syndicate/adapters/aio.py#L15-L23
sveetch/boussole
boussole/compiler.py
SassCompileHelper.safe_compile
def safe_compile(self, settings, sourcepath, destination): """ Safe compile It won't raise compile error and instead return compile success state as a boolean with a message. It will create needed directory structure first if it contain some directories that does not al...
python
def safe_compile(self, settings, sourcepath, destination): """ Safe compile It won't raise compile error and instead return compile success state as a boolean with a message. It will create needed directory structure first if it contain some directories that does not al...
[ "def", "safe_compile", "(", "self", ",", "settings", ",", "sourcepath", ",", "destination", ")", ":", "source_map_destination", "=", "None", "if", "settings", ".", "SOURCE_MAP", ":", "source_map_destination", "=", "self", ".", "change_extension", "(", "destination...
Safe compile It won't raise compile error and instead return compile success state as a boolean with a message. It will create needed directory structure first if it contain some directories that does not allready exists. Args: settings (boussole.conf.model.Setting...
[ "Safe", "compile" ]
train
https://github.com/sveetch/boussole/blob/22cc644e9d633f41ebfc167d427a71c1726cee21/boussole/compiler.py#L25-L80
sveetch/boussole
boussole/compiler.py
SassCompileHelper.write_content
def write_content(self, content, destination): """ Write given content to destination path. It will create needed directory structure first if it contain some directories that does not allready exists. Args: content (str): Content to write to target file. ...
python
def write_content(self, content, destination): """ Write given content to destination path. It will create needed directory structure first if it contain some directories that does not allready exists. Args: content (str): Content to write to target file. ...
[ "def", "write_content", "(", "self", ",", "content", ",", "destination", ")", ":", "directory", "=", "os", ".", "path", ".", "dirname", "(", "destination", ")", "if", "directory", "and", "not", "os", ".", "path", ".", "exists", "(", "directory", ")", "...
Write given content to destination path. It will create needed directory structure first if it contain some directories that does not allready exists. Args: content (str): Content to write to target file. destination (str): Destination path for target file. Ret...
[ "Write", "given", "content", "to", "destination", "path", "." ]
train
https://github.com/sveetch/boussole/blob/22cc644e9d633f41ebfc167d427a71c1726cee21/boussole/compiler.py#L82-L104
lawlesst/vivo-rdflib-sparqlstore
vstore/graph_utils.py
VIVOUtilsGraph.make_batch
def make_batch(size, graph): """ Split graphs into n sized chunks. See: http://stackoverflow.com/a/1915307/758157 :param size: int :param graph: graph :return: graph """ i = iter(graph) chunk = list(islice(i, size)) while chunk: ...
python
def make_batch(size, graph): """ Split graphs into n sized chunks. See: http://stackoverflow.com/a/1915307/758157 :param size: int :param graph: graph :return: graph """ i = iter(graph) chunk = list(islice(i, size)) while chunk: ...
[ "def", "make_batch", "(", "size", ",", "graph", ")", ":", "i", "=", "iter", "(", "graph", ")", "chunk", "=", "list", "(", "islice", "(", "i", ",", "size", ")", ")", "while", "chunk", ":", "yield", "chunk", "chunk", "=", "list", "(", "islice", "("...
Split graphs into n sized chunks. See: http://stackoverflow.com/a/1915307/758157 :param size: int :param graph: graph :return: graph
[ "Split", "graphs", "into", "n", "sized", "chunks", ".", "See", ":", "http", ":", "//", "stackoverflow", ".", "com", "/", "a", "/", "1915307", "/", "758157" ]
train
https://github.com/lawlesst/vivo-rdflib-sparqlstore/blob/9e3a3d8efb8ab3a247c49cb64af639e2bdc2425b/vstore/graph_utils.py#L17-L30
lawlesst/vivo-rdflib-sparqlstore
vstore/graph_utils.py
VIVOUtilsGraph.nt_yielder
def nt_yielder(self, graph, size): """ Yield n sized ntriples for a given graph. Used in sending chunks of data to the VIVO SPARQL API. """ for grp in self.make_batch(size, graph): tmpg = Graph() # Add statements as list to tmp graph tm...
python
def nt_yielder(self, graph, size): """ Yield n sized ntriples for a given graph. Used in sending chunks of data to the VIVO SPARQL API. """ for grp in self.make_batch(size, graph): tmpg = Graph() # Add statements as list to tmp graph tm...
[ "def", "nt_yielder", "(", "self", ",", "graph", ",", "size", ")", ":", "for", "grp", "in", "self", ".", "make_batch", "(", "size", ",", "graph", ")", ":", "tmpg", "=", "Graph", "(", ")", "# Add statements as list to tmp graph", "tmpg", "+=", "grp", "yiel...
Yield n sized ntriples for a given graph. Used in sending chunks of data to the VIVO SPARQL API.
[ "Yield", "n", "sized", "ntriples", "for", "a", "given", "graph", ".", "Used", "in", "sending", "chunks", "of", "data", "to", "the", "VIVO", "SPARQL", "API", "." ]
train
https://github.com/lawlesst/vivo-rdflib-sparqlstore/blob/9e3a3d8efb8ab3a247c49cb64af639e2bdc2425b/vstore/graph_utils.py#L32-L42
lawlesst/vivo-rdflib-sparqlstore
vstore/graph_utils.py
VIVOUtilsGraph.bulk_update
def bulk_update(self, named_graph, graph, size, is_add=True): """ Bulk adds or deletes. Triples are chunked into n size groups before sending to API. This prevents the API endpoint from timing out. """ context = URIRef(named_graph) total = len(graph) if total > 0:...
python
def bulk_update(self, named_graph, graph, size, is_add=True): """ Bulk adds or deletes. Triples are chunked into n size groups before sending to API. This prevents the API endpoint from timing out. """ context = URIRef(named_graph) total = len(graph) if total > 0:...
[ "def", "bulk_update", "(", "self", ",", "named_graph", ",", "graph", ",", "size", ",", "is_add", "=", "True", ")", ":", "context", "=", "URIRef", "(", "named_graph", ")", "total", "=", "len", "(", "graph", ")", "if", "total", ">", "0", ":", "for", ...
Bulk adds or deletes. Triples are chunked into n size groups before sending to API. This prevents the API endpoint from timing out.
[ "Bulk", "adds", "or", "deletes", ".", "Triples", "are", "chunked", "into", "n", "size", "groups", "before", "sending", "to", "API", ".", "This", "prevents", "the", "API", "endpoint", "from", "timing", "out", "." ]
train
https://github.com/lawlesst/vivo-rdflib-sparqlstore/blob/9e3a3d8efb8ab3a247c49cb64af639e2bdc2425b/vstore/graph_utils.py#L44-L59
lawlesst/vivo-rdflib-sparqlstore
vstore/graph_utils.py
VIVOUtilsGraph.bulk_add
def bulk_add(self, named_graph, add, size=DEFAULT_CHUNK_SIZE): """ Add batches of statements in n-sized chunks. """ return self.bulk_update(named_graph, add, size)
python
def bulk_add(self, named_graph, add, size=DEFAULT_CHUNK_SIZE): """ Add batches of statements in n-sized chunks. """ return self.bulk_update(named_graph, add, size)
[ "def", "bulk_add", "(", "self", ",", "named_graph", ",", "add", ",", "size", "=", "DEFAULT_CHUNK_SIZE", ")", ":", "return", "self", ".", "bulk_update", "(", "named_graph", ",", "add", ",", "size", ")" ]
Add batches of statements in n-sized chunks.
[ "Add", "batches", "of", "statements", "in", "n", "-", "sized", "chunks", "." ]
train
https://github.com/lawlesst/vivo-rdflib-sparqlstore/blob/9e3a3d8efb8ab3a247c49cb64af639e2bdc2425b/vstore/graph_utils.py#L61-L65
lawlesst/vivo-rdflib-sparqlstore
vstore/graph_utils.py
VIVOUtilsGraph.bulk_remove
def bulk_remove(self, named_graph, add, size=DEFAULT_CHUNK_SIZE): """ Remove batches of statements in n-sized chunks. """ return self.bulk_update(named_graph, add, size, is_add=False)
python
def bulk_remove(self, named_graph, add, size=DEFAULT_CHUNK_SIZE): """ Remove batches of statements in n-sized chunks. """ return self.bulk_update(named_graph, add, size, is_add=False)
[ "def", "bulk_remove", "(", "self", ",", "named_graph", ",", "add", ",", "size", "=", "DEFAULT_CHUNK_SIZE", ")", ":", "return", "self", ".", "bulk_update", "(", "named_graph", ",", "add", ",", "size", ",", "is_add", "=", "False", ")" ]
Remove batches of statements in n-sized chunks.
[ "Remove", "batches", "of", "statements", "in", "n", "-", "sized", "chunks", "." ]
train
https://github.com/lawlesst/vivo-rdflib-sparqlstore/blob/9e3a3d8efb8ab3a247c49cb64af639e2bdc2425b/vstore/graph_utils.py#L67-L71
lawlesst/vivo-rdflib-sparqlstore
vstore/graph_utils.py
VIVOUtilsGraph.merge_uris
def merge_uris(self, uri1, uri2, graph=DEFAULT_GRAPH): """ Generate statements to merge two URIS in a specified graph. """ rq = """ CONSTRUCT { ?uri ?p ?o . ?other ?p2 ?uri . } WHERE { GRAPH ?g { { ?uri...
python
def merge_uris(self, uri1, uri2, graph=DEFAULT_GRAPH): """ Generate statements to merge two URIS in a specified graph. """ rq = """ CONSTRUCT { ?uri ?p ?o . ?other ?p2 ?uri . } WHERE { GRAPH ?g { { ?uri...
[ "def", "merge_uris", "(", "self", ",", "uri1", ",", "uri2", ",", "graph", "=", "DEFAULT_GRAPH", ")", ":", "rq", "=", "\"\"\"\n CONSTRUCT {\n ?uri ?p ?o .\n ?other ?p2 ?uri .\n }\n WHERE {\n GRAPH ?g {\n {\n ...
Generate statements to merge two URIS in a specified graph.
[ "Generate", "statements", "to", "merge", "two", "URIS", "in", "a", "specified", "graph", "." ]
train
https://github.com/lawlesst/vivo-rdflib-sparqlstore/blob/9e3a3d8efb8ab3a247c49cb64af639e2bdc2425b/vstore/graph_utils.py#L73-L108
rcarmo/pngcanvas
pngcanvas.py
blend
def blend(c1, c2): """Alpha blends two colors, using the alpha given by c2""" return [c1[i] * (0xFF - c2[3]) + c2[i] * c2[3] >> 8 for i in range(3)]
python
def blend(c1, c2): """Alpha blends two colors, using the alpha given by c2""" return [c1[i] * (0xFF - c2[3]) + c2[i] * c2[3] >> 8 for i in range(3)]
[ "def", "blend", "(", "c1", ",", "c2", ")", ":", "return", "[", "c1", "[", "i", "]", "*", "(", "0xFF", "-", "c2", "[", "3", "]", ")", "+", "c2", "[", "i", "]", "*", "c2", "[", "3", "]", ">>", "8", "for", "i", "in", "range", "(", "3", "...
Alpha blends two colors, using the alpha given by c2
[ "Alpha", "blends", "two", "colors", "using", "the", "alpha", "given", "by", "c2" ]
train
https://github.com/rcarmo/pngcanvas/blob/e2eaa0d5ba353005b3b658f6ee453c1956340670/pngcanvas.py#L36-L38
rcarmo/pngcanvas
pngcanvas.py
gradient_list
def gradient_list(start, end, steps): """Compute gradient colors""" delta = [end[i] - start[i] for i in range(4)] return [bytearray(start[j] + (delta[j] * i) // steps for j in range(4)) for i in range(steps + 1)]
python
def gradient_list(start, end, steps): """Compute gradient colors""" delta = [end[i] - start[i] for i in range(4)] return [bytearray(start[j] + (delta[j] * i) // steps for j in range(4)) for i in range(steps + 1)]
[ "def", "gradient_list", "(", "start", ",", "end", ",", "steps", ")", ":", "delta", "=", "[", "end", "[", "i", "]", "-", "start", "[", "i", "]", "for", "i", "in", "range", "(", "4", ")", "]", "return", "[", "bytearray", "(", "start", "[", "j", ...
Compute gradient colors
[ "Compute", "gradient", "colors" ]
train
https://github.com/rcarmo/pngcanvas/blob/e2eaa0d5ba353005b3b658f6ee453c1956340670/pngcanvas.py#L51-L55
rcarmo/pngcanvas
pngcanvas.py
rgb2rgba
def rgb2rgba(rgb): """Take a row of RGB bytes, and convert to a row of RGBA bytes.""" rgba = [] for i in range(0, len(rgb), 3): rgba += rgb[i:i+3] rgba.append(255) return rgba
python
def rgb2rgba(rgb): """Take a row of RGB bytes, and convert to a row of RGBA bytes.""" rgba = [] for i in range(0, len(rgb), 3): rgba += rgb[i:i+3] rgba.append(255) return rgba
[ "def", "rgb2rgba", "(", "rgb", ")", ":", "rgba", "=", "[", "]", "for", "i", "in", "range", "(", "0", ",", "len", "(", "rgb", ")", ",", "3", ")", ":", "rgba", "+=", "rgb", "[", "i", ":", "i", "+", "3", "]", "rgba", ".", "append", "(", "255...
Take a row of RGB bytes, and convert to a row of RGBA bytes.
[ "Take", "a", "row", "of", "RGB", "bytes", "and", "convert", "to", "a", "row", "of", "RGBA", "bytes", "." ]
train
https://github.com/rcarmo/pngcanvas/blob/e2eaa0d5ba353005b3b658f6ee453c1956340670/pngcanvas.py#L58-L65
rcarmo/pngcanvas
pngcanvas.py
ByteReader.read
def read(self, num_bytes): """Read `num_bytes` from the compressed data chunks. Data is returned as `bytes` of length `num_bytes` Will raise an EOFError if data is unavailable. Note: Will always return `num_bytes` of data (unlike the file read method). """ while len(s...
python
def read(self, num_bytes): """Read `num_bytes` from the compressed data chunks. Data is returned as `bytes` of length `num_bytes` Will raise an EOFError if data is unavailable. Note: Will always return `num_bytes` of data (unlike the file read method). """ while len(s...
[ "def", "read", "(", "self", ",", "num_bytes", ")", ":", "while", "len", "(", "self", ".", "decoded", ")", "<", "num_bytes", ":", "try", ":", "tag", ",", "data", "=", "next", "(", "self", ".", "chunks", ")", "except", "StopIteration", ":", "raise", ...
Read `num_bytes` from the compressed data chunks. Data is returned as `bytes` of length `num_bytes` Will raise an EOFError if data is unavailable. Note: Will always return `num_bytes` of data (unlike the file read method).
[ "Read", "num_bytes", "from", "the", "compressed", "data", "chunks", "." ]
train
https://github.com/rcarmo/pngcanvas/blob/e2eaa0d5ba353005b3b658f6ee453c1956340670/pngcanvas.py#L74-L95
rcarmo/pngcanvas
pngcanvas.py
PNGCanvas._offset
def _offset(self, x, y): """Helper for internal data""" x, y = force_int(x, y) return y * self.width * 4 + x * 4
python
def _offset(self, x, y): """Helper for internal data""" x, y = force_int(x, y) return y * self.width * 4 + x * 4
[ "def", "_offset", "(", "self", ",", "x", ",", "y", ")", ":", "x", ",", "y", "=", "force_int", "(", "x", ",", "y", ")", "return", "y", "*", "self", ".", "width", "*", "4", "+", "x", "*", "4" ]
Helper for internal data
[ "Helper", "for", "internal", "data" ]
train
https://github.com/rcarmo/pngcanvas/blob/e2eaa0d5ba353005b3b658f6ee453c1956340670/pngcanvas.py#L108-L111
rcarmo/pngcanvas
pngcanvas.py
PNGCanvas.point
def point(self, x, y, color=None): """Set a pixel""" if x < 0 or y < 0 or x > self.width - 1 or y > self.height - 1: return if color is None: color = self.color o = self._offset(x, y) self.canvas[o:o + 3] = blend(self.canvas[o:o + 3], bytearray(color))
python
def point(self, x, y, color=None): """Set a pixel""" if x < 0 or y < 0 or x > self.width - 1 or y > self.height - 1: return if color is None: color = self.color o = self._offset(x, y) self.canvas[o:o + 3] = blend(self.canvas[o:o + 3], bytearray(color))
[ "def", "point", "(", "self", ",", "x", ",", "y", ",", "color", "=", "None", ")", ":", "if", "x", "<", "0", "or", "y", "<", "0", "or", "x", ">", "self", ".", "width", "-", "1", "or", "y", ">", "self", ".", "height", "-", "1", ":", "return"...
Set a pixel
[ "Set", "a", "pixel" ]
train
https://github.com/rcarmo/pngcanvas/blob/e2eaa0d5ba353005b3b658f6ee453c1956340670/pngcanvas.py#L113-L121
rcarmo/pngcanvas
pngcanvas.py
PNGCanvas.rect_helper
def rect_helper(x0, y0, x1, y1): """Rectangle helper""" x0, y0, x1, y1 = force_int(x0, y0, x1, y1) if x0 > x1: x0, x1 = x1, x0 if y0 > y1: y0, y1 = y1, y0 return x0, y0, x1, y1
python
def rect_helper(x0, y0, x1, y1): """Rectangle helper""" x0, y0, x1, y1 = force_int(x0, y0, x1, y1) if x0 > x1: x0, x1 = x1, x0 if y0 > y1: y0, y1 = y1, y0 return x0, y0, x1, y1
[ "def", "rect_helper", "(", "x0", ",", "y0", ",", "x1", ",", "y1", ")", ":", "x0", ",", "y0", ",", "x1", ",", "y1", "=", "force_int", "(", "x0", ",", "y0", ",", "x1", ",", "y1", ")", "if", "x0", ">", "x1", ":", "x0", ",", "x1", "=", "x1", ...
Rectangle helper
[ "Rectangle", "helper" ]
train
https://github.com/rcarmo/pngcanvas/blob/e2eaa0d5ba353005b3b658f6ee453c1956340670/pngcanvas.py#L124-L131
rcarmo/pngcanvas
pngcanvas.py
PNGCanvas.vertical_gradient
def vertical_gradient(self, x0, y0, x1, y1, start, end): """Draw a vertical gradient""" x0, y0, x1, y1 = self.rect_helper(x0, y0, x1, y1) grad = gradient_list(start, end, y1 - y0) for x in range(x0, x1 + 1): for y in range(y0, y1 + 1): self.point(x, y, grad[y ...
python
def vertical_gradient(self, x0, y0, x1, y1, start, end): """Draw a vertical gradient""" x0, y0, x1, y1 = self.rect_helper(x0, y0, x1, y1) grad = gradient_list(start, end, y1 - y0) for x in range(x0, x1 + 1): for y in range(y0, y1 + 1): self.point(x, y, grad[y ...
[ "def", "vertical_gradient", "(", "self", ",", "x0", ",", "y0", ",", "x1", ",", "y1", ",", "start", ",", "end", ")", ":", "x0", ",", "y0", ",", "x1", ",", "y1", "=", "self", ".", "rect_helper", "(", "x0", ",", "y0", ",", "x1", ",", "y1", ")", ...
Draw a vertical gradient
[ "Draw", "a", "vertical", "gradient" ]
train
https://github.com/rcarmo/pngcanvas/blob/e2eaa0d5ba353005b3b658f6ee453c1956340670/pngcanvas.py#L133-L139
rcarmo/pngcanvas
pngcanvas.py
PNGCanvas.rectangle
def rectangle(self, x0, y0, x1, y1): """Draw a rectangle""" x0, y0, x1, y1 = self.rect_helper(x0, y0, x1, y1) self.polyline([[x0, y0], [x1, y0], [x1, y1], [x0, y1], [x0, y0]])
python
def rectangle(self, x0, y0, x1, y1): """Draw a rectangle""" x0, y0, x1, y1 = self.rect_helper(x0, y0, x1, y1) self.polyline([[x0, y0], [x1, y0], [x1, y1], [x0, y1], [x0, y0]])
[ "def", "rectangle", "(", "self", ",", "x0", ",", "y0", ",", "x1", ",", "y1", ")", ":", "x0", ",", "y0", ",", "x1", ",", "y1", "=", "self", ".", "rect_helper", "(", "x0", ",", "y0", ",", "x1", ",", "y1", ")", "self", ".", "polyline", "(", "[...
Draw a rectangle
[ "Draw", "a", "rectangle" ]
train
https://github.com/rcarmo/pngcanvas/blob/e2eaa0d5ba353005b3b658f6ee453c1956340670/pngcanvas.py#L141-L144
rcarmo/pngcanvas
pngcanvas.py
PNGCanvas.filled_rectangle
def filled_rectangle(self, x0, y0, x1, y1): """Draw a filled rectangle""" x0, y0, x1, y1 = self.rect_helper(x0, y0, x1, y1) for x in range(x0, x1 + 1): for y in range(y0, y1 + 1): self.point(x, y, self.color)
python
def filled_rectangle(self, x0, y0, x1, y1): """Draw a filled rectangle""" x0, y0, x1, y1 = self.rect_helper(x0, y0, x1, y1) for x in range(x0, x1 + 1): for y in range(y0, y1 + 1): self.point(x, y, self.color)
[ "def", "filled_rectangle", "(", "self", ",", "x0", ",", "y0", ",", "x1", ",", "y1", ")", ":", "x0", ",", "y0", ",", "x1", ",", "y1", "=", "self", ".", "rect_helper", "(", "x0", ",", "y0", ",", "x1", ",", "y1", ")", "for", "x", "in", "range", ...
Draw a filled rectangle
[ "Draw", "a", "filled", "rectangle" ]
train
https://github.com/rcarmo/pngcanvas/blob/e2eaa0d5ba353005b3b658f6ee453c1956340670/pngcanvas.py#L146-L151
rcarmo/pngcanvas
pngcanvas.py
PNGCanvas.copy_rect
def copy_rect(self, x0, y0, x1, y1, dx, dy, destination): """Copy (blit) a rectangle onto another part of the image""" x0, y0, x1, y1 = self.rect_helper(x0, y0, x1, y1) dx, dy = force_int(dx, dy) for x in range(x0, x1 + 1): for y in range(y0, y1 + 1): d = des...
python
def copy_rect(self, x0, y0, x1, y1, dx, dy, destination): """Copy (blit) a rectangle onto another part of the image""" x0, y0, x1, y1 = self.rect_helper(x0, y0, x1, y1) dx, dy = force_int(dx, dy) for x in range(x0, x1 + 1): for y in range(y0, y1 + 1): d = des...
[ "def", "copy_rect", "(", "self", ",", "x0", ",", "y0", ",", "x1", ",", "y1", ",", "dx", ",", "dy", ",", "destination", ")", ":", "x0", ",", "y0", ",", "x1", ",", "y1", "=", "self", ".", "rect_helper", "(", "x0", ",", "y0", ",", "x1", ",", "...
Copy (blit) a rectangle onto another part of the image
[ "Copy", "(", "blit", ")", "a", "rectangle", "onto", "another", "part", "of", "the", "image" ]
train
https://github.com/rcarmo/pngcanvas/blob/e2eaa0d5ba353005b3b658f6ee453c1956340670/pngcanvas.py#L153-L162
rcarmo/pngcanvas
pngcanvas.py
PNGCanvas.blend_rect
def blend_rect(self, x0, y0, x1, y1, dx, dy, destination, alpha=0xff): """Blend a rectangle onto the image""" x0, y0, x1, y1 = self.rect_helper(x0, y0, x1, y1) for x in range(x0, x1 + 1): for y in range(y0, y1 + 1): o = self._offset(x, y) rgba = self.c...
python
def blend_rect(self, x0, y0, x1, y1, dx, dy, destination, alpha=0xff): """Blend a rectangle onto the image""" x0, y0, x1, y1 = self.rect_helper(x0, y0, x1, y1) for x in range(x0, x1 + 1): for y in range(y0, y1 + 1): o = self._offset(x, y) rgba = self.c...
[ "def", "blend_rect", "(", "self", ",", "x0", ",", "y0", ",", "x1", ",", "y1", ",", "dx", ",", "dy", ",", "destination", ",", "alpha", "=", "0xff", ")", ":", "x0", ",", "y0", ",", "x1", ",", "y1", "=", "self", ".", "rect_helper", "(", "x0", ",...
Blend a rectangle onto the image
[ "Blend", "a", "rectangle", "onto", "the", "image" ]
train
https://github.com/rcarmo/pngcanvas/blob/e2eaa0d5ba353005b3b658f6ee453c1956340670/pngcanvas.py#L164-L172
rcarmo/pngcanvas
pngcanvas.py
PNGCanvas.line
def line(self, x0, y0, x1, y1): """Draw a line using Xiaolin Wu's antialiasing technique""" # clean params x0, y0, x1, y1 = int(x0), int(y0), int(x1), int(y1) if y0 > y1: y0, y1, x0, x1 = y1, y0, x1, x0 dx = x1 - x0 if dx < 0: sx = -1 else:...
python
def line(self, x0, y0, x1, y1): """Draw a line using Xiaolin Wu's antialiasing technique""" # clean params x0, y0, x1, y1 = int(x0), int(y0), int(x1), int(y1) if y0 > y1: y0, y1, x0, x1 = y1, y0, x1, x0 dx = x1 - x0 if dx < 0: sx = -1 else:...
[ "def", "line", "(", "self", ",", "x0", ",", "y0", ",", "x1", ",", "y1", ")", ":", "# clean params", "x0", ",", "y0", ",", "x1", ",", "y1", "=", "int", "(", "x0", ")", ",", "int", "(", "y0", ")", ",", "int", "(", "x1", ")", ",", "int", "("...
Draw a line using Xiaolin Wu's antialiasing technique
[ "Draw", "a", "line", "using", "Xiaolin", "Wu", "s", "antialiasing", "technique" ]
train
https://github.com/rcarmo/pngcanvas/blob/e2eaa0d5ba353005b3b658f6ee453c1956340670/pngcanvas.py#L174-L230
rcarmo/pngcanvas
pngcanvas.py
PNGCanvas.polyline
def polyline(self, arr): """Draw a set of lines""" for i in range(0, len(arr) - 1): self.line(arr[i][0], arr[i][1], arr[i + 1][0], arr[i + 1][1])
python
def polyline(self, arr): """Draw a set of lines""" for i in range(0, len(arr) - 1): self.line(arr[i][0], arr[i][1], arr[i + 1][0], arr[i + 1][1])
[ "def", "polyline", "(", "self", ",", "arr", ")", ":", "for", "i", "in", "range", "(", "0", ",", "len", "(", "arr", ")", "-", "1", ")", ":", "self", ".", "line", "(", "arr", "[", "i", "]", "[", "0", "]", ",", "arr", "[", "i", "]", "[", "...
Draw a set of lines
[ "Draw", "a", "set", "of", "lines" ]
train
https://github.com/rcarmo/pngcanvas/blob/e2eaa0d5ba353005b3b658f6ee453c1956340670/pngcanvas.py#L232-L235
rcarmo/pngcanvas
pngcanvas.py
PNGCanvas.dump
def dump(self): """Dump the image data""" scan_lines = bytearray() for y in range(self.height): scan_lines.append(0) # filter type 0 (None) scan_lines.extend( self.canvas[(y * self.width * 4):((y + 1) * self.width * 4)] ) # image repre...
python
def dump(self): """Dump the image data""" scan_lines = bytearray() for y in range(self.height): scan_lines.append(0) # filter type 0 (None) scan_lines.extend( self.canvas[(y * self.width * 4):((y + 1) * self.width * 4)] ) # image repre...
[ "def", "dump", "(", "self", ")", ":", "scan_lines", "=", "bytearray", "(", ")", "for", "y", "in", "range", "(", "self", ".", "height", ")", ":", "scan_lines", ".", "append", "(", "0", ")", "# filter type 0 (None)", "scan_lines", ".", "extend", "(", "se...
Dump the image data
[ "Dump", "the", "image", "data" ]
train
https://github.com/rcarmo/pngcanvas/blob/e2eaa0d5ba353005b3b658f6ee453c1956340670/pngcanvas.py#L237-L251
rcarmo/pngcanvas
pngcanvas.py
PNGCanvas.pack_chunk
def pack_chunk(tag, data): """Pack a PNG chunk for serializing to disk""" to_check = tag + data return (struct.pack(b"!I", len(data)) + to_check + struct.pack(b"!I", zlib.crc32(to_check) & 0xFFFFFFFF))
python
def pack_chunk(tag, data): """Pack a PNG chunk for serializing to disk""" to_check = tag + data return (struct.pack(b"!I", len(data)) + to_check + struct.pack(b"!I", zlib.crc32(to_check) & 0xFFFFFFFF))
[ "def", "pack_chunk", "(", "tag", ",", "data", ")", ":", "to_check", "=", "tag", "+", "data", "return", "(", "struct", ".", "pack", "(", "b\"!I\"", ",", "len", "(", "data", ")", ")", "+", "to_check", "+", "struct", ".", "pack", "(", "b\"!I\"", ",", ...
Pack a PNG chunk for serializing to disk
[ "Pack", "a", "PNG", "chunk", "for", "serializing", "to", "disk" ]
train
https://github.com/rcarmo/pngcanvas/blob/e2eaa0d5ba353005b3b658f6ee453c1956340670/pngcanvas.py#L254-L258
rcarmo/pngcanvas
pngcanvas.py
PNGCanvas.load
def load(self, f): """Load a PNG image""" SUPPORTED_COLOR_TYPES = (COLOR_TYPE_TRUECOLOR, COLOR_TYPE_TRUECOLOR_WITH_ALPHA) SAMPLES_PER_PIXEL = { COLOR_TYPE_TRUECOLOR: 3, COLOR_TYPE_TRUECOLOR_WITH_ALPHA: 4 } assert f.read(8) == SIGNATURE chunks = ite...
python
def load(self, f): """Load a PNG image""" SUPPORTED_COLOR_TYPES = (COLOR_TYPE_TRUECOLOR, COLOR_TYPE_TRUECOLOR_WITH_ALPHA) SAMPLES_PER_PIXEL = { COLOR_TYPE_TRUECOLOR: 3, COLOR_TYPE_TRUECOLOR_WITH_ALPHA: 4 } assert f.read(8) == SIGNATURE chunks = ite...
[ "def", "load", "(", "self", ",", "f", ")", ":", "SUPPORTED_COLOR_TYPES", "=", "(", "COLOR_TYPE_TRUECOLOR", ",", "COLOR_TYPE_TRUECOLOR_WITH_ALPHA", ")", "SAMPLES_PER_PIXEL", "=", "{", "COLOR_TYPE_TRUECOLOR", ":", "3", ",", "COLOR_TYPE_TRUECOLOR_WITH_ALPHA", ":", "4", ...
Load a PNG image
[ "Load", "a", "PNG", "image" ]
train
https://github.com/rcarmo/pngcanvas/blob/e2eaa0d5ba353005b3b658f6ee453c1956340670/pngcanvas.py#L260-L307
rcarmo/pngcanvas
pngcanvas.py
PNGCanvas.defilter
def defilter(cur, prev, filter_type, bpp=4): """Decode a chunk""" if filter_type == 0: # No filter return cur elif filter_type == 1: # Sub xp = 0 for xc in range(bpp, len(cur)): cur[xc] = (cur[xc] + cur[xp]) % 256 xp += 1 ...
python
def defilter(cur, prev, filter_type, bpp=4): """Decode a chunk""" if filter_type == 0: # No filter return cur elif filter_type == 1: # Sub xp = 0 for xc in range(bpp, len(cur)): cur[xc] = (cur[xc] + cur[xp]) % 256 xp += 1 ...
[ "def", "defilter", "(", "cur", ",", "prev", ",", "filter_type", ",", "bpp", "=", "4", ")", ":", "if", "filter_type", "==", "0", ":", "# No filter", "return", "cur", "elif", "filter_type", "==", "1", ":", "# Sub", "xp", "=", "0", "for", "xc", "in", ...
Decode a chunk
[ "Decode", "a", "chunk" ]
train
https://github.com/rcarmo/pngcanvas/blob/e2eaa0d5ba353005b3b658f6ee453c1956340670/pngcanvas.py#L310-L351
rcarmo/pngcanvas
pngcanvas.py
PNGCanvas.chunks
def chunks(f): """Split read PNG image data into chunks""" while 1: try: length = struct.unpack(b"!I", f.read(4))[0] tag = f.read(4) data = f.read(length) crc = struct.unpack(b"!I", f.read(4))[0] except struct.error:...
python
def chunks(f): """Split read PNG image data into chunks""" while 1: try: length = struct.unpack(b"!I", f.read(4))[0] tag = f.read(4) data = f.read(length) crc = struct.unpack(b"!I", f.read(4))[0] except struct.error:...
[ "def", "chunks", "(", "f", ")", ":", "while", "1", ":", "try", ":", "length", "=", "struct", ".", "unpack", "(", "b\"!I\"", ",", "f", ".", "read", "(", "4", ")", ")", "[", "0", "]", "tag", "=", "f", ".", "read", "(", "4", ")", "data", "=", ...
Split read PNG image data into chunks
[ "Split", "read", "PNG", "image", "data", "into", "chunks" ]
train
https://github.com/rcarmo/pngcanvas/blob/e2eaa0d5ba353005b3b658f6ee453c1956340670/pngcanvas.py#L354-L366
welchbj/sublemon
sublemon/runtime.py
Sublemon.start
async def start(self) -> None: """Coroutine to run this server.""" if self._is_running: raise SublemonRuntimeError( 'Attempted to start an already-running `Sublemon` instance') self._poll_task = asyncio.ensure_future(self._poll()) self._is_running = True
python
async def start(self) -> None: """Coroutine to run this server.""" if self._is_running: raise SublemonRuntimeError( 'Attempted to start an already-running `Sublemon` instance') self._poll_task = asyncio.ensure_future(self._poll()) self._is_running = True
[ "async", "def", "start", "(", "self", ")", "->", "None", ":", "if", "self", ".", "_is_running", ":", "raise", "SublemonRuntimeError", "(", "'Attempted to start an already-running `Sublemon` instance'", ")", "self", ".", "_poll_task", "=", "asyncio", ".", "ensure_fut...
Coroutine to run this server.
[ "Coroutine", "to", "run", "this", "server", "." ]
train
https://github.com/welchbj/sublemon/blob/edbfd1ca2a0ce3de9470dfc88f8db1cadf4b6326/sublemon/runtime.py#L52-L59
welchbj/sublemon
sublemon/runtime.py
Sublemon.stop
async def stop(self) -> None: """Coroutine to stop execution of this server.""" if not self._is_running: raise SublemonRuntimeError( 'Attempted to stop an already-stopped `Sublemon` instance') await self.block() self._poll_task.cancel() self._is_runni...
python
async def stop(self) -> None: """Coroutine to stop execution of this server.""" if not self._is_running: raise SublemonRuntimeError( 'Attempted to stop an already-stopped `Sublemon` instance') await self.block() self._poll_task.cancel() self._is_runni...
[ "async", "def", "stop", "(", "self", ")", "->", "None", ":", "if", "not", "self", ".", "_is_running", ":", "raise", "SublemonRuntimeError", "(", "'Attempted to stop an already-stopped `Sublemon` instance'", ")", "await", "self", ".", "block", "(", ")", "self", "...
Coroutine to stop execution of this server.
[ "Coroutine", "to", "stop", "execution", "of", "this", "server", "." ]
train
https://github.com/welchbj/sublemon/blob/edbfd1ca2a0ce3de9470dfc88f8db1cadf4b6326/sublemon/runtime.py#L61-L71
welchbj/sublemon
sublemon/runtime.py
Sublemon._poll
async def _poll(self) -> None: """Coroutine to poll status of running subprocesses.""" while True: await asyncio.sleep(self._poll_delta) for subproc in list(self._running_set): subproc._poll()
python
async def _poll(self) -> None: """Coroutine to poll status of running subprocesses.""" while True: await asyncio.sleep(self._poll_delta) for subproc in list(self._running_set): subproc._poll()
[ "async", "def", "_poll", "(", "self", ")", "->", "None", ":", "while", "True", ":", "await", "asyncio", ".", "sleep", "(", "self", ".", "_poll_delta", ")", "for", "subproc", "in", "list", "(", "self", ".", "_running_set", ")", ":", "subproc", ".", "_...
Coroutine to poll status of running subprocesses.
[ "Coroutine", "to", "poll", "status", "of", "running", "subprocesses", "." ]
train
https://github.com/welchbj/sublemon/blob/edbfd1ca2a0ce3de9470dfc88f8db1cadf4b6326/sublemon/runtime.py#L73-L78
welchbj/sublemon
sublemon/runtime.py
Sublemon.iter_lines
async def iter_lines( self, *cmds: str, stream: str='both') -> AsyncGenerator[str, None]: """Coroutine to spawn commands and yield text lines from stdout.""" sps = self.spawn(*cmds) if stream == 'both': agen = amerge( amerge(*[sp.st...
python
async def iter_lines( self, *cmds: str, stream: str='both') -> AsyncGenerator[str, None]: """Coroutine to spawn commands and yield text lines from stdout.""" sps = self.spawn(*cmds) if stream == 'both': agen = amerge( amerge(*[sp.st...
[ "async", "def", "iter_lines", "(", "self", ",", "*", "cmds", ":", "str", ",", "stream", ":", "str", "=", "'both'", ")", "->", "AsyncGenerator", "[", "str", ",", "None", "]", ":", "sps", "=", "self", ".", "spawn", "(", "*", "cmds", ")", "if", "str...
Coroutine to spawn commands and yield text lines from stdout.
[ "Coroutine", "to", "spawn", "commands", "and", "yield", "text", "lines", "from", "stdout", "." ]
train
https://github.com/welchbj/sublemon/blob/edbfd1ca2a0ce3de9470dfc88f8db1cadf4b6326/sublemon/runtime.py#L80-L98
welchbj/sublemon
sublemon/runtime.py
Sublemon.gather
async def gather(self, *cmds: str) -> Tuple[int]: """Coroutine to spawn subprocesses and block until completion. Note: The same `max_concurrency` restriction that applies to `spawn` also applies here. Returns: The exit codes of the spawned subprocesses, in t...
python
async def gather(self, *cmds: str) -> Tuple[int]: """Coroutine to spawn subprocesses and block until completion. Note: The same `max_concurrency` restriction that applies to `spawn` also applies here. Returns: The exit codes of the spawned subprocesses, in t...
[ "async", "def", "gather", "(", "self", ",", "*", "cmds", ":", "str", ")", "->", "Tuple", "[", "int", "]", ":", "subprocs", "=", "self", ".", "spawn", "(", "*", "cmds", ")", "subproc_wait_coros", "=", "[", "subproc", ".", "wait_done", "(", ")", "for...
Coroutine to spawn subprocesses and block until completion. Note: The same `max_concurrency` restriction that applies to `spawn` also applies here. Returns: The exit codes of the spawned subprocesses, in the order they were passed.
[ "Coroutine", "to", "spawn", "subprocesses", "and", "block", "until", "completion", "." ]
train
https://github.com/welchbj/sublemon/blob/edbfd1ca2a0ce3de9470dfc88f8db1cadf4b6326/sublemon/runtime.py#L100-L114
welchbj/sublemon
sublemon/runtime.py
Sublemon.block
async def block(self) -> None: """Block until all running and pending subprocesses have finished.""" await asyncio.gather( *itertools.chain( (sp.wait_done() for sp in self._running_set), (sp.wait_done() for sp in self._pending_set)))
python
async def block(self) -> None: """Block until all running and pending subprocesses have finished.""" await asyncio.gather( *itertools.chain( (sp.wait_done() for sp in self._running_set), (sp.wait_done() for sp in self._pending_set)))
[ "async", "def", "block", "(", "self", ")", "->", "None", ":", "await", "asyncio", ".", "gather", "(", "*", "itertools", ".", "chain", "(", "(", "sp", ".", "wait_done", "(", ")", "for", "sp", "in", "self", ".", "_running_set", ")", ",", "(", "sp", ...
Block until all running and pending subprocesses have finished.
[ "Block", "until", "all", "running", "and", "pending", "subprocesses", "have", "finished", "." ]
train
https://github.com/welchbj/sublemon/blob/edbfd1ca2a0ce3de9470dfc88f8db1cadf4b6326/sublemon/runtime.py#L116-L121
welchbj/sublemon
sublemon/runtime.py
Sublemon.spawn
def spawn(self, *cmds: str) -> List[SublemonSubprocess]: """Coroutine to spawn shell commands. If `max_concurrency` is reached during the attempt to spawn the specified subprocesses, excess subprocesses will block while attempting to acquire this server's semaphore. """ ...
python
def spawn(self, *cmds: str) -> List[SublemonSubprocess]: """Coroutine to spawn shell commands. If `max_concurrency` is reached during the attempt to spawn the specified subprocesses, excess subprocesses will block while attempting to acquire this server's semaphore. """ ...
[ "def", "spawn", "(", "self", ",", "*", "cmds", ":", "str", ")", "->", "List", "[", "SublemonSubprocess", "]", ":", "if", "not", "self", ".", "_is_running", ":", "raise", "SublemonRuntimeError", "(", "'Attempted to spawn subprocesses from a non-started server'", ")...
Coroutine to spawn shell commands. If `max_concurrency` is reached during the attempt to spawn the specified subprocesses, excess subprocesses will block while attempting to acquire this server's semaphore.
[ "Coroutine", "to", "spawn", "shell", "commands", "." ]
train
https://github.com/welchbj/sublemon/blob/edbfd1ca2a0ce3de9470dfc88f8db1cadf4b6326/sublemon/runtime.py#L123-L138
sveetch/boussole
boussole/conf/base_backend.py
SettingsBackendBase.parse_filepath
def parse_filepath(self, filepath=None): """ Parse given filepath to split possible path directory from filename. * If path directory is empty, will use ``basedir`` attribute as base filepath; * If path directory is absolute, ignore ``basedir`` attribute; * If path dir...
python
def parse_filepath(self, filepath=None): """ Parse given filepath to split possible path directory from filename. * If path directory is empty, will use ``basedir`` attribute as base filepath; * If path directory is absolute, ignore ``basedir`` attribute; * If path dir...
[ "def", "parse_filepath", "(", "self", ",", "filepath", "=", "None", ")", ":", "filepath", "=", "filepath", "or", "self", ".", "_default_filename", "path", ",", "filename", "=", "os", ".", "path", ".", "split", "(", "filepath", ")", "if", "not", "path", ...
Parse given filepath to split possible path directory from filename. * If path directory is empty, will use ``basedir`` attribute as base filepath; * If path directory is absolute, ignore ``basedir`` attribute; * If path directory is relative, join it to ``basedir`` attribute; ...
[ "Parse", "given", "filepath", "to", "split", "possible", "path", "directory", "from", "filename", "." ]
train
https://github.com/sveetch/boussole/blob/22cc644e9d633f41ebfc167d427a71c1726cee21/boussole/conf/base_backend.py#L52-L81
sveetch/boussole
boussole/conf/base_backend.py
SettingsBackendBase.check_filepath
def check_filepath(self, path, filename): """ Check and return the final filepath to settings Args: path (str): Directory path where to search for settings file. filename (str): Filename to use to search for settings file. Raises: boussole.exceptions...
python
def check_filepath(self, path, filename): """ Check and return the final filepath to settings Args: path (str): Directory path where to search for settings file. filename (str): Filename to use to search for settings file. Raises: boussole.exceptions...
[ "def", "check_filepath", "(", "self", ",", "path", ",", "filename", ")", ":", "settings_path", "=", "os", ".", "path", ".", "join", "(", "path", ",", "filename", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "settings_path", ")", "or", "no...
Check and return the final filepath to settings Args: path (str): Directory path where to search for settings file. filename (str): Filename to use to search for settings file. Raises: boussole.exceptions.SettingsBackendError: If determined filepath ...
[ "Check", "and", "return", "the", "final", "filepath", "to", "settings" ]
train
https://github.com/sveetch/boussole/blob/22cc644e9d633f41ebfc167d427a71c1726cee21/boussole/conf/base_backend.py#L83-L106
sveetch/boussole
boussole/conf/base_backend.py
SettingsBackendBase.open
def open(self, filepath): """ Open settings backend to return its content Args: filepath (str): Settings object, depends from backend Returns: string: File content. """ with io.open(filepath, 'r', encoding='utf-8') as fp: content = f...
python
def open(self, filepath): """ Open settings backend to return its content Args: filepath (str): Settings object, depends from backend Returns: string: File content. """ with io.open(filepath, 'r', encoding='utf-8') as fp: content = f...
[ "def", "open", "(", "self", ",", "filepath", ")", ":", "with", "io", ".", "open", "(", "filepath", ",", "'r'", ",", "encoding", "=", "'utf-8'", ")", "as", "fp", ":", "content", "=", "fp", ".", "read", "(", ")", "return", "content" ]
Open settings backend to return its content Args: filepath (str): Settings object, depends from backend Returns: string: File content.
[ "Open", "settings", "backend", "to", "return", "its", "content" ]
train
https://github.com/sveetch/boussole/blob/22cc644e9d633f41ebfc167d427a71c1726cee21/boussole/conf/base_backend.py#L108-L121
sveetch/boussole
boussole/conf/base_backend.py
SettingsBackendBase.load
def load(self, filepath=None): """ Load settings file from given path and optionnal filepath. During path resolving, the ``projectdir`` is updated to the file path directory. Keyword Arguments: filepath (str): Filepath to the settings file. Returns: ...
python
def load(self, filepath=None): """ Load settings file from given path and optionnal filepath. During path resolving, the ``projectdir`` is updated to the file path directory. Keyword Arguments: filepath (str): Filepath to the settings file. Returns: ...
[ "def", "load", "(", "self", ",", "filepath", "=", "None", ")", ":", "self", ".", "projectdir", ",", "filename", "=", "self", ".", "parse_filepath", "(", "filepath", ")", "settings_path", "=", "self", ".", "check_filepath", "(", "self", ".", "projectdir", ...
Load settings file from given path and optionnal filepath. During path resolving, the ``projectdir`` is updated to the file path directory. Keyword Arguments: filepath (str): Filepath to the settings file. Returns: boussole.conf.model.Settings: Settings object ...
[ "Load", "settings", "file", "from", "given", "path", "and", "optionnal", "filepath", "." ]
train
https://github.com/sveetch/boussole/blob/22cc644e9d633f41ebfc167d427a71c1726cee21/boussole/conf/base_backend.py#L171-L193
Robin8Put/pmes
wallet_manager/handlers/withdraw.py
Withdraw.withdraw_bulk
async def withdraw_bulk(self, *args, **kwargs): """ Withdraw funds requests to user wallet Accepts: - coinid [string] (blockchain id (example: BTCTEST, LTCTEST)) - address [string] withdrawal address (in hex for tokens) - amount [int] withdrawal amount multipl...
python
async def withdraw_bulk(self, *args, **kwargs): """ Withdraw funds requests to user wallet Accepts: - coinid [string] (blockchain id (example: BTCTEST, LTCTEST)) - address [string] withdrawal address (in hex for tokens) - amount [int] withdrawal amount multipl...
[ "async", "def", "withdraw_bulk", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "await", "self", ".", "db", ".", "withdraw_requests", ".", "insert_one", "(", "{", "'coinid'", ":", "kwargs", ".", "get", "(", "\"coinid\"", ")", ",", ...
Withdraw funds requests to user wallet Accepts: - coinid [string] (blockchain id (example: BTCTEST, LTCTEST)) - address [string] withdrawal address (in hex for tokens) - amount [int] withdrawal amount multiplied by decimals_k (10**8) Returns dictionary with following ...
[ "Withdraw", "funds", "requests", "to", "user", "wallet" ]
train
https://github.com/Robin8Put/pmes/blob/338bec94162098f05b75bad035417317e1252fd2/wallet_manager/handlers/withdraw.py#L156-L174
Robin8Put/pmes
wallet_manager/handlers/withdraw.py
Withdraw.withdraw
async def withdraw(self, *args, **kwargs): """ Withdraw funds to user wallet Accepts: - coinid [string] (blockchain id (example: BTCTEST, LTCTEST)) - address [string] withdrawal address (in hex for tokens) - amount [int] withdrawal amount multiplied by de...
python
async def withdraw(self, *args, **kwargs): """ Withdraw funds to user wallet Accepts: - coinid [string] (blockchain id (example: BTCTEST, LTCTEST)) - address [string] withdrawal address (in hex for tokens) - amount [int] withdrawal amount multiplied by de...
[ "async", "def", "withdraw", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "super", "(", ")", ".", "reload_connections", "(", ")", "except", "Exception", "as", "e", ":", "return", "WithdrawValidator", ".", "error_500", "(...
Withdraw funds to user wallet Accepts: - coinid [string] (blockchain id (example: BTCTEST, LTCTEST)) - address [string] withdrawal address (in hex for tokens) - amount [int] withdrawal amount multiplied by decimals_k (10**8) Returns dictionary with following fiel...
[ "Withdraw", "funds", "to", "user", "wallet" ]
train
https://github.com/Robin8Put/pmes/blob/338bec94162098f05b75bad035417317e1252fd2/wallet_manager/handlers/withdraw.py#L176-L261
Robin8Put/pmes
wallet_manager/handlers/withdraw.py
Withdraw.withdraw_custom_token
async def withdraw_custom_token(self, *args, **kwargs): """ Withdraw custom token to user wallet Accepts: - address [hex string] (withdrawal address in hex form) - amount [int] withdrawal amount multiplied by decimals_k (10**8) - blockchain [string] token's ...
python
async def withdraw_custom_token(self, *args, **kwargs): """ Withdraw custom token to user wallet Accepts: - address [hex string] (withdrawal address in hex form) - amount [int] withdrawal amount multiplied by decimals_k (10**8) - blockchain [string] token's ...
[ "async", "def", "withdraw_custom_token", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "super", "(", ")", ".", "reload_connections", "(", ")", "except", "Exception", "as", "e", ":", "return", "WithdrawValidator", ".", "err...
Withdraw custom token to user wallet Accepts: - address [hex string] (withdrawal address in hex form) - amount [int] withdrawal amount multiplied by decimals_k (10**8) - blockchain [string] token's blockchain (QTUMTEST, ETH) - contract_address [hex string] token...
[ "Withdraw", "custom", "token", "to", "user", "wallet" ]
train
https://github.com/Robin8Put/pmes/blob/338bec94162098f05b75bad035417317e1252fd2/wallet_manager/handlers/withdraw.py#L263-L324
Clinical-Genomics/housekeeper
housekeeper/store/models.py
Version.relative_root_dir
def relative_root_dir(self): """Build the relative root dir path for the bundle version.""" return Path(self.bundle.name) / str(self.created_at.date())
python
def relative_root_dir(self): """Build the relative root dir path for the bundle version.""" return Path(self.bundle.name) / str(self.created_at.date())
[ "def", "relative_root_dir", "(", "self", ")", ":", "return", "Path", "(", "self", ".", "bundle", ".", "name", ")", "/", "str", "(", "self", ".", "created_at", ".", "date", "(", ")", ")" ]
Build the relative root dir path for the bundle version.
[ "Build", "the", "relative", "root", "dir", "path", "for", "the", "bundle", "version", "." ]
train
https://github.com/Clinical-Genomics/housekeeper/blob/a7d10d327dc9f06274bdef5504ed1b9413f2c8c1/housekeeper/store/models.py#L52-L54
Clinical-Genomics/housekeeper
housekeeper/store/models.py
File.full_path
def full_path(self): """Return the full path to the file.""" if Path(self.path).is_absolute(): return self.path else: return str(self.app_root / self.path)
python
def full_path(self): """Return the full path to the file.""" if Path(self.path).is_absolute(): return self.path else: return str(self.app_root / self.path)
[ "def", "full_path", "(", "self", ")", ":", "if", "Path", "(", "self", ".", "path", ")", ".", "is_absolute", "(", ")", ":", "return", "self", ".", "path", "else", ":", "return", "str", "(", "self", ".", "app_root", "/", "self", ".", "path", ")" ]
Return the full path to the file.
[ "Return", "the", "full", "path", "to", "the", "file", "." ]
train
https://github.com/Clinical-Genomics/housekeeper/blob/a7d10d327dc9f06274bdef5504ed1b9413f2c8c1/housekeeper/store/models.py#L78-L83
dmgass/baseline
baseline/_baseline.py
multiline_repr
def multiline_repr(text, special_chars=('\n', '"')): """Get string representation for triple quoted context. Make string representation as normal except do not transform "special characters" into an escaped representation to support use of the representation in a triple quoted multi-line string con...
python
def multiline_repr(text, special_chars=('\n', '"')): """Get string representation for triple quoted context. Make string representation as normal except do not transform "special characters" into an escaped representation to support use of the representation in a triple quoted multi-line string con...
[ "def", "multiline_repr", "(", "text", ",", "special_chars", "=", "(", "'\\n'", ",", "'\"'", ")", ")", ":", "try", ":", "char", "=", "special_chars", "[", "0", "]", "except", "IndexError", ":", "text", "=", "ascii", "(", "text", ")", "[", "2", "if", ...
Get string representation for triple quoted context. Make string representation as normal except do not transform "special characters" into an escaped representation to support use of the representation in a triple quoted multi-line string context (to avoid escaping newlines and double quotes). P...
[ "Get", "string", "representation", "for", "triple", "quoted", "context", "." ]
train
https://github.com/dmgass/baseline/blob/1f7988e8c9fafa83eb3a1ce73b1601d2afdbb2cd/baseline/_baseline.py#L44-L71
dmgass/baseline
baseline/_baseline.py
Baseline._dedent
def _dedent(text): """Remove common indentation from each line in a text block. When text block is a single line, return text block. Otherwise determine common indentation from last line, strip common indentation from each line, and return text block consisting of inner lines (d...
python
def _dedent(text): """Remove common indentation from each line in a text block. When text block is a single line, return text block. Otherwise determine common indentation from last line, strip common indentation from each line, and return text block consisting of inner lines (d...
[ "def", "_dedent", "(", "text", ")", ":", "lines", "=", "text", ".", "split", "(", "'\\n'", ")", "if", "len", "(", "lines", ")", "==", "1", ":", "indent", "=", "0", "elif", "lines", "[", "0", "]", ".", "strip", "(", ")", ":", "raise", "ValueErro...
Remove common indentation from each line in a text block. When text block is a single line, return text block. Otherwise determine common indentation from last line, strip common indentation from each line, and return text block consisting of inner lines (don't include first and last li...
[ "Remove", "common", "indentation", "from", "each", "line", "in", "a", "text", "block", "." ]
train
https://github.com/dmgass/baseline/blob/1f7988e8c9fafa83eb3a1ce73b1601d2afdbb2cd/baseline/_baseline.py#L102-L138
dmgass/baseline
baseline/_baseline.py
Baseline.z__update
def z__update(self): """Triple quoted baseline representation. Return string with multiple triple quoted baseline strings when baseline had been compared multiple times against varying strings. :returns: source file baseline replacement text :rtype: str """ upd...
python
def z__update(self): """Triple quoted baseline representation. Return string with multiple triple quoted baseline strings when baseline had been compared multiple times against varying strings. :returns: source file baseline replacement text :rtype: str """ upd...
[ "def", "z__update", "(", "self", ")", ":", "updates", "=", "[", "]", "for", "text", "in", "self", ".", "_updates", ":", "if", "self", ".", "_AVOID_RAW_FORM", ":", "text_repr", "=", "multiline_repr", "(", "text", ")", "raw_char", "=", "''", "else", ":",...
Triple quoted baseline representation. Return string with multiple triple quoted baseline strings when baseline had been compared multiple times against varying strings. :returns: source file baseline replacement text :rtype: str
[ "Triple", "quoted", "baseline", "representation", "." ]
train
https://github.com/dmgass/baseline/blob/1f7988e8c9fafa83eb3a1ce73b1601d2afdbb2cd/baseline/_baseline.py#L234-L286
dmgass/baseline
baseline/_baseline.py
Baseline._atexit_callback
def _atexit_callback(cls): """Create Python script copies with updated baselines. For any baseline that had a miscompare, make a copy of the source file which contained the baseline and update the baseline with the new string value. :returns: record of every Python ...
python
def _atexit_callback(cls): """Create Python script copies with updated baselines. For any baseline that had a miscompare, make a copy of the source file which contained the baseline and update the baseline with the new string value. :returns: record of every Python ...
[ "def", "_atexit_callback", "(", "cls", ")", ":", "updated_scripts", "=", "{", "}", "for", "baseline", "in", "cls", ".", "_baselines_to_update", ":", "if", "baseline", ".", "z__path", ".", "endswith", "(", "'<stdin>'", ")", ":", "continue", "try", ":", "scr...
Create Python script copies with updated baselines. For any baseline that had a miscompare, make a copy of the source file which contained the baseline and update the baseline with the new string value. :returns: record of every Python file update (key=path, val...
[ "Create", "Python", "script", "copies", "with", "updated", "baselines", "." ]
train
https://github.com/dmgass/baseline/blob/1f7988e8c9fafa83eb3a1ce73b1601d2afdbb2cd/baseline/_baseline.py#L289-L321
Clinical-Genomics/housekeeper
housekeeper/cli/add.py
bundle
def bundle(context, name): """Add a new bundle.""" if context.obj['db'].bundle(name): click.echo(click.style('bundle name already exists', fg='yellow')) context.abort() new_bundle = context.obj['db'].new_bundle(name) context.obj['db'].add_commit(new_bundle) # add default version ...
python
def bundle(context, name): """Add a new bundle.""" if context.obj['db'].bundle(name): click.echo(click.style('bundle name already exists', fg='yellow')) context.abort() new_bundle = context.obj['db'].new_bundle(name) context.obj['db'].add_commit(new_bundle) # add default version ...
[ "def", "bundle", "(", "context", ",", "name", ")", ":", "if", "context", ".", "obj", "[", "'db'", "]", ".", "bundle", "(", "name", ")", ":", "click", ".", "echo", "(", "click", ".", "style", "(", "'bundle name already exists'", ",", "fg", "=", "'yell...
Add a new bundle.
[ "Add", "a", "new", "bundle", "." ]
train
https://github.com/Clinical-Genomics/housekeeper/blob/a7d10d327dc9f06274bdef5504ed1b9413f2c8c1/housekeeper/cli/add.py#L20-L33