repo
stringlengths
7
54
path
stringlengths
4
192
url
stringlengths
87
284
code
stringlengths
78
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
marrow/mailer
marrow/mailer/validator.py
https://github.com/marrow/mailer/blob/3995ef98a3f7feb75f1aeb652e6afe40a5c94def/marrow/mailer/validator.py#L160-L184
def _apply_common_rules(self, part, maxlength): """This method contains the rules that must be applied to both the domain and the local part of the e-mail address. """ part = part.strip() if self.fix: part = part.strip('.') if not part: ...
[ "def", "_apply_common_rules", "(", "self", ",", "part", ",", "maxlength", ")", ":", "part", "=", "part", ".", "strip", "(", ")", "if", "self", ".", "fix", ":", "part", "=", "part", ".", "strip", "(", "'.'", ")", "if", "not", "part", ":", "return", ...
This method contains the rules that must be applied to both the domain and the local part of the e-mail address.
[ "This", "method", "contains", "the", "rules", "that", "must", "be", "applied", "to", "both", "the", "domain", "and", "the", "local", "part", "of", "the", "e", "-", "mail", "address", "." ]
python
train
viniciuschiele/flask-apscheduler
flask_apscheduler/scheduler.py
https://github.com/viniciuschiele/flask-apscheduler/blob/cc52c39e1948c4e8de5da0d01db45f1779f61997/flask_apscheduler/scheduler.py#L264-L276
def run_job(self, id, jobstore=None): """ Run the given job without scheduling it. :param id: the identifier of the job. :param str jobstore: alias of the job store that contains the job :return: """ job = self._scheduler.get_job(id, jobstore) if not job:...
[ "def", "run_job", "(", "self", ",", "id", ",", "jobstore", "=", "None", ")", ":", "job", "=", "self", ".", "_scheduler", ".", "get_job", "(", "id", ",", "jobstore", ")", "if", "not", "job", ":", "raise", "JobLookupError", "(", "id", ")", "job", "."...
Run the given job without scheduling it. :param id: the identifier of the job. :param str jobstore: alias of the job store that contains the job :return:
[ "Run", "the", "given", "job", "without", "scheduling", "it", ".", ":", "param", "id", ":", "the", "identifier", "of", "the", "job", ".", ":", "param", "str", "jobstore", ":", "alias", "of", "the", "job", "store", "that", "contains", "the", "job", ":", ...
python
train
FPGAwars/apio
apio/commands/uninstall.py
https://github.com/FPGAwars/apio/blob/5c6310f11a061a760764c6b5847bfb431dc3d0bc/apio/commands/uninstall.py#L31-L42
def cli(ctx, packages, all, list, platform): """Uninstall packages.""" if packages: _uninstall(packages, platform) elif all: # pragma: no cover packages = Resources(platform).packages _uninstall(packages, platform) elif list: Resources(platform).list_packages(installed=...
[ "def", "cli", "(", "ctx", ",", "packages", ",", "all", ",", "list", ",", "platform", ")", ":", "if", "packages", ":", "_uninstall", "(", "packages", ",", "platform", ")", "elif", "all", ":", "# pragma: no cover", "packages", "=", "Resources", "(", "platf...
Uninstall packages.
[ "Uninstall", "packages", "." ]
python
train
acorg/dark-matter
dark/proteins.py
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/proteins.py#L147-L164
def lookup(self, pathogenName, sampleName): """ Look up a pathogen name, sample name combination and get its FASTA/FASTQ file name and unique read count. This method should be used instead of C{add} in situations where you want an exception to be raised if a pathogen/sample comb...
[ "def", "lookup", "(", "self", ",", "pathogenName", ",", "sampleName", ")", ":", "pathogenIndex", "=", "self", ".", "_pathogens", "[", "pathogenName", "]", "sampleIndex", "=", "self", ".", "_samples", "[", "sampleName", "]", "return", "self", ".", "_readsFile...
Look up a pathogen name, sample name combination and get its FASTA/FASTQ file name and unique read count. This method should be used instead of C{add} in situations where you want an exception to be raised if a pathogen/sample combination has not already been passed to C{add}. ...
[ "Look", "up", "a", "pathogen", "name", "sample", "name", "combination", "and", "get", "its", "FASTA", "/", "FASTQ", "file", "name", "and", "unique", "read", "count", "." ]
python
train
sys-git/certifiable
certifiable/cli_impl/utils.py
https://github.com/sys-git/certifiable/blob/a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8/certifiable/cli_impl/utils.py#L73-L110
def load_value_from_schema(v): """ Load a value from a schema defined string. """ x = urllib.parse.urlparse(v) if x.scheme.lower() == 'decimal': v = Decimal(x.netloc) elif x.scheme.lower() in ['int', 'integer']: v = int(x.netloc) elif x.scheme.lower() == 'float': v =...
[ "def", "load_value_from_schema", "(", "v", ")", ":", "x", "=", "urllib", ".", "parse", ".", "urlparse", "(", "v", ")", "if", "x", ".", "scheme", ".", "lower", "(", ")", "==", "'decimal'", ":", "v", "=", "Decimal", "(", "x", ".", "netloc", ")", "e...
Load a value from a schema defined string.
[ "Load", "a", "value", "from", "a", "schema", "defined", "string", "." ]
python
train
saltstack/salt
salt/utils/pkg/rpm.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/rpm.py#L46-L60
def get_osarch(): ''' Get the os architecture using rpm --eval ''' if salt.utils.path.which('rpm'): ret = subprocess.Popen( 'rpm --eval "%{_host_cpu}"', shell=True, close_fds=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communi...
[ "def", "get_osarch", "(", ")", ":", "if", "salt", ".", "utils", ".", "path", ".", "which", "(", "'rpm'", ")", ":", "ret", "=", "subprocess", ".", "Popen", "(", "'rpm --eval \"%{_host_cpu}\"'", ",", "shell", "=", "True", ",", "close_fds", "=", "True", "...
Get the os architecture using rpm --eval
[ "Get", "the", "os", "architecture", "using", "rpm", "--", "eval" ]
python
train
hellupline/flask-manager
flask_manager/utils.py
https://github.com/hellupline/flask-manager/blob/70e48309f73aacf55f5c37b43165791ae1cf6861/flask_manager/utils.py#L23-L27
def slugify(value): """Simple Slugify.""" s1 = first_cap_re.sub(r'\1_\2', value) s2 = all_cap_re.sub(r'\1_\2', s1) return s2.lower().replace(' _', '_').replace(' ', '_')
[ "def", "slugify", "(", "value", ")", ":", "s1", "=", "first_cap_re", ".", "sub", "(", "r'\\1_\\2'", ",", "value", ")", "s2", "=", "all_cap_re", ".", "sub", "(", "r'\\1_\\2'", ",", "s1", ")", "return", "s2", ".", "lower", "(", ")", ".", "replace", "...
Simple Slugify.
[ "Simple", "Slugify", "." ]
python
train
Dallinger/Dallinger
dallinger/experiment_server/experiment_server.py
https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/experiment_server/experiment_server.py#L1015-L1065
def node_neighbors(node_id): """Send a GET request to the node table. This calls the neighbours method of the node making the request and returns a list of descriptions of the nodes (even if there is only one). Required arguments: participant_id, node_id Optional arguments: type, connection ...
[ "def", "node_neighbors", "(", "node_id", ")", ":", "exp", "=", "Experiment", "(", "session", ")", "# get the parameters", "node_type", "=", "request_parameter", "(", "parameter", "=", "\"node_type\"", ",", "parameter_type", "=", "\"known_class\"", ",", "default", ...
Send a GET request to the node table. This calls the neighbours method of the node making the request and returns a list of descriptions of the nodes (even if there is only one). Required arguments: participant_id, node_id Optional arguments: type, connection After getting the neighbours it al...
[ "Send", "a", "GET", "request", "to", "the", "node", "table", "." ]
python
train
openstack/networking-cisco
networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L99-L106
def store_dcnm_subnet_dict(self, subnet_dict, direc): """Store the subnet attributes and dict. """ if direc == 'in': self.in_dcnm_subnet_dict = subnet_dict self.in_subnet_dict = self._parse_subnet(subnet_dict) else: self.out_dcnm_subnet_dict = subnet_dict ...
[ "def", "store_dcnm_subnet_dict", "(", "self", ",", "subnet_dict", ",", "direc", ")", ":", "if", "direc", "==", "'in'", ":", "self", ".", "in_dcnm_subnet_dict", "=", "subnet_dict", "self", ".", "in_subnet_dict", "=", "self", ".", "_parse_subnet", "(", "subnet_d...
Store the subnet attributes and dict.
[ "Store", "the", "subnet", "attributes", "and", "dict", "." ]
python
train
mezz64/pyHik
pyhik/hikvision.py
https://github.com/mezz64/pyHik/blob/1e7afca926e2b045257a43cbf8b1236a435493c2/pyhik/hikvision.py#L449-L531
def alert_stream(self, reset_event, kill_event): """Open event stream.""" _LOGGING.debug('Stream Thread Started: %s, %s', self.name, self.cam_id) start_event = False parse_string = "" fail_count = 0 url = '%s/ISAPI/Event/notification/alertStream' % self.root_url ...
[ "def", "alert_stream", "(", "self", ",", "reset_event", ",", "kill_event", ")", ":", "_LOGGING", ".", "debug", "(", "'Stream Thread Started: %s, %s'", ",", "self", ".", "name", ",", "self", ".", "cam_id", ")", "start_event", "=", "False", "parse_string", "=", ...
Open event stream.
[ "Open", "event", "stream", "." ]
python
train
MacHu-GWU/crawl_zillow-project
crawl_zillow/model.py
https://github.com/MacHu-GWU/crawl_zillow-project/blob/c6d7ca8e4c80e7e7e963496433ef73df1413c16e/crawl_zillow/model.py#L50-L63
def key(self): """ Example:: /browse/homes/ca/ -> ca /browse/homes/ca/los-angeles-county/ -> los-angeles-county /browse/homes/ca/los-angeles-county/91001/ -> 91001 /browse/homes/ca/los-angeles-county/91001/tola-ave_5038895/ -> tola-ave_5038895 :r...
[ "def", "key", "(", "self", ")", ":", "return", "[", "part", ".", "strip", "(", ")", "for", "part", "in", "self", ".", "href", ".", "split", "(", "\"/\"", ")", "if", "part", ".", "strip", "(", ")", "]", "[", "-", "1", "]" ]
Example:: /browse/homes/ca/ -> ca /browse/homes/ca/los-angeles-county/ -> los-angeles-county /browse/homes/ca/los-angeles-county/91001/ -> 91001 /browse/homes/ca/los-angeles-county/91001/tola-ave_5038895/ -> tola-ave_5038895 :return:
[ "Example", "::" ]
python
train
zebpalmer/WeatherAlerts
weatheralerts/feed.py
https://github.com/zebpalmer/WeatherAlerts/blob/b99513571571fa0d65b90be883bb3bc000994027/weatheralerts/feed.py#L38-L50
def raw_cap(self, refresh=False): """ Raw xml(cap) of the the feed. If a valid cache is available it is used, else a new copy of the feed is grabbed Note: you can force refresh here, if you do, don't also manually call refresh """ if refresh is True: self._raw...
[ "def", "raw_cap", "(", "self", ",", "refresh", "=", "False", ")", ":", "if", "refresh", "is", "True", ":", "self", ".", "_raw", "=", "self", ".", "refresh", "(", ")", "if", "self", ".", "_raw", "is", "None", ":", "self", ".", "_raw", "=", "self",...
Raw xml(cap) of the the feed. If a valid cache is available it is used, else a new copy of the feed is grabbed Note: you can force refresh here, if you do, don't also manually call refresh
[ "Raw", "xml", "(", "cap", ")", "of", "the", "the", "feed", ".", "If", "a", "valid", "cache", "is", "available", "it", "is", "used", "else", "a", "new", "copy", "of", "the", "feed", "is", "grabbed", "Note", ":", "you", "can", "force", "refresh", "he...
python
train
wq/html-json-forms
html_json_forms/utils.py
https://github.com/wq/html-json-forms/blob/4dfbfabeee924ba832a7a387ab3b02b6d51d9701/html_json_forms/utils.py#L50-L142
def parse_json_path(path): """ Parse a string as a JSON path An implementation of "steps to parse a JSON encoding path" http://www.w3.org/TR/html-json-forms/#dfn-steps-to-parse-a-json-encoding-path """ # Steps 1, 2, 3 original_path = path steps = [] # Step 11 (Failure) failed =...
[ "def", "parse_json_path", "(", "path", ")", ":", "# Steps 1, 2, 3", "original_path", "=", "path", "steps", "=", "[", "]", "# Step 11 (Failure)", "failed", "=", "[", "JsonStep", "(", "type", "=", "\"object\"", ",", "key", "=", "original_path", ",", "last", "=...
Parse a string as a JSON path An implementation of "steps to parse a JSON encoding path" http://www.w3.org/TR/html-json-forms/#dfn-steps-to-parse-a-json-encoding-path
[ "Parse", "a", "string", "as", "a", "JSON", "path", "An", "implementation", "of", "steps", "to", "parse", "a", "JSON", "encoding", "path", "http", ":", "//", "www", ".", "w3", ".", "org", "/", "TR", "/", "html", "-", "json", "-", "forms", "/", "#dfn...
python
valid
axltxl/m2bk
m2bk/drivers/s3.py
https://github.com/axltxl/m2bk/blob/980083dfd17e6e783753a946e9aa809714551141/m2bk/drivers/s3.py#L37-L91
def load(*, aws_access_key_id=None, aws_secret_access_key=None, s3_bucket=AWS_S3_DEFAULT_BUCKET_NAME, dry_run=False, **kwargs): """ Load this driver Note that if either aws_access_key_id or aws_secret_access_key are not specified, they will not be taken into...
[ "def", "load", "(", "*", ",", "aws_access_key_id", "=", "None", ",", "aws_secret_access_key", "=", "None", ",", "s3_bucket", "=", "AWS_S3_DEFAULT_BUCKET_NAME", ",", "dry_run", "=", "False", ",", "*", "*", "kwargs", ")", ":", "global", "_dry_run", ",", "_has_...
Load this driver Note that if either aws_access_key_id or aws_secret_access_key are not specified, they will not be taken into account and instead authentication towards AWS will solely rely on boto config :param aws_access_key_id(str, optional): Access key ID :param aws_secret_access_key(str, opt...
[ "Load", "this", "driver" ]
python
train
hitchtest/hitchserve
hitchserve/hitch_service.py
https://github.com/hitchtest/hitchserve/blob/a2def19979264186d283e76f7f0c88f3ed97f2e0/hitchserve/hitch_service.py#L237-L247
def subcommand(self, *args): """Get subcommand acting on a service. Subcommand will run in service directory and with the environment variables used to run the service itself. Args: *args: Arguments to run command (e.g. "redis-cli", "-n", "1") Returns: Subcom...
[ "def", "subcommand", "(", "self", ",", "*", "args", ")", ":", "return", "Subcommand", "(", "*", "args", ",", "directory", "=", "self", ".", "directory", ",", "env_vars", "=", "self", ".", "env_vars", ")" ]
Get subcommand acting on a service. Subcommand will run in service directory and with the environment variables used to run the service itself. Args: *args: Arguments to run command (e.g. "redis-cli", "-n", "1") Returns: Subcommand object.
[ "Get", "subcommand", "acting", "on", "a", "service", ".", "Subcommand", "will", "run", "in", "service", "directory", "and", "with", "the", "environment", "variables", "used", "to", "run", "the", "service", "itself", "." ]
python
train
pytroll/satpy
satpy/readers/seviri_l1b_hrit.py
https://github.com/pytroll/satpy/blob/1f21d20ac686b745fb0da9b4030d139893e066dd/satpy/readers/seviri_l1b_hrit.py#L398-L439
def get_area_extent(self, size, offsets, factors, platform_height): """Get the area extent of the file. Until December 2017, the data is shifted by 1.5km SSP North and West against the nominal GEOS projection. Since December 2017 this offset has been corrected. A flag in the data indicates if t...
[ "def", "get_area_extent", "(", "self", ",", "size", ",", "offsets", ",", "factors", ",", "platform_height", ")", ":", "nlines", ",", "ncols", "=", "size", "h", "=", "platform_height", "loff", ",", "coff", "=", "offsets", "loff", "-=", "nlines", "offsets", ...
Get the area extent of the file. Until December 2017, the data is shifted by 1.5km SSP North and West against the nominal GEOS projection. Since December 2017 this offset has been corrected. A flag in the data indicates if the correction has been applied. If no correction was applied, adjust th...
[ "Get", "the", "area", "extent", "of", "the", "file", "." ]
python
train
klen/pylama
pylama/hook.py
https://github.com/klen/pylama/blob/f436ccc6b55b33381a295ded753e467953cf4379/pylama/hook.py#L64-L75
def install_git(path): """Install hook in Git repository.""" hook = op.join(path, 'pre-commit') with open(hook, 'w') as fd: fd.write("""#!/usr/bin/env python import sys from pylama.hook import git_hook if __name__ == '__main__': sys.exit(git_hook()) """) chmod(hook, 484)
[ "def", "install_git", "(", "path", ")", ":", "hook", "=", "op", ".", "join", "(", "path", ",", "'pre-commit'", ")", "with", "open", "(", "hook", ",", "'w'", ")", "as", "fd", ":", "fd", ".", "write", "(", "\"\"\"#!/usr/bin/env python\nimport sys\nfrom pylam...
Install hook in Git repository.
[ "Install", "hook", "in", "Git", "repository", "." ]
python
train
tradenity/python-sdk
tradenity/resources/free_shipping_promotion.py
https://github.com/tradenity/python-sdk/blob/d13fbe23f4d6ff22554c6d8d2deaf209371adaf1/tradenity/resources/free_shipping_promotion.py#L527-L547
def get_free_shipping_promotion_by_id(cls, free_shipping_promotion_id, **kwargs): """Find FreeShippingPromotion Return single instance of FreeShippingPromotion by its ID. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=Tru...
[ "def", "get_free_shipping_promotion_by_id", "(", "cls", ",", "free_shipping_promotion_id", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async'", ")", ":", "return", "cls", "....
Find FreeShippingPromotion Return single instance of FreeShippingPromotion by its ID. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.get_free_shipping_promotion_by_id(free_shipping_promotion_id, asyn...
[ "Find", "FreeShippingPromotion" ]
python
train
RudolfCardinal/pythonlib
cardinal_pythonlib/rnc_web.py
https://github.com/RudolfCardinal/pythonlib/blob/0b84cb35f38bd7d8723958dae51b480a829b7227/cardinal_pythonlib/rnc_web.py#L191-L196
def get_cgi_parameter_bool(form: cgi.FieldStorage, key: str) -> bool: """ Extracts a boolean parameter from a CGI form, on the assumption that ``"1"`` is ``True`` and everything else is ``False``. """ return is_1(get_cgi_parameter_str(form, key))
[ "def", "get_cgi_parameter_bool", "(", "form", ":", "cgi", ".", "FieldStorage", ",", "key", ":", "str", ")", "->", "bool", ":", "return", "is_1", "(", "get_cgi_parameter_str", "(", "form", ",", "key", ")", ")" ]
Extracts a boolean parameter from a CGI form, on the assumption that ``"1"`` is ``True`` and everything else is ``False``.
[ "Extracts", "a", "boolean", "parameter", "from", "a", "CGI", "form", "on", "the", "assumption", "that", "1", "is", "True", "and", "everything", "else", "is", "False", "." ]
python
train
robertpeteuil/aws-shortcuts
awss/core.py
https://github.com/robertpeteuil/aws-shortcuts/blob/cf453ca996978a4d88015d1cf6125bce8ca4873b/awss/core.py#L458-L489
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", "." ]
python
train
PyCQA/astroid
astroid/raw_building.py
https://github.com/PyCQA/astroid/blob/e0a298df55b15abcb77c2a93253f5ab7be52d0fb/astroid/raw_building.py#L167-L170
def object_build_class(node, member, localname): """create astroid for a living class object""" basenames = [base.__name__ for base in member.__bases__] return _base_class_object_build(node, member, basenames, localname=localname)
[ "def", "object_build_class", "(", "node", ",", "member", ",", "localname", ")", ":", "basenames", "=", "[", "base", ".", "__name__", "for", "base", "in", "member", ".", "__bases__", "]", "return", "_base_class_object_build", "(", "node", ",", "member", ",", ...
create astroid for a living class object
[ "create", "astroid", "for", "a", "living", "class", "object" ]
python
train
mitsei/dlkit
dlkit/json_/grading/managers.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/grading/managers.py#L1183-L1206
def get_grade_system_lookup_session_for_gradebook(self, gradebook_id, proxy): """Gets the ``OsidSession`` associated with the grade system lookup service for the given gradebook. arg: gradebook_id (osid.id.Id): the ``Id`` of the gradebook arg: proxy (osid.proxy.Proxy): a proxy ret...
[ "def", "get_grade_system_lookup_session_for_gradebook", "(", "self", ",", "gradebook_id", ",", "proxy", ")", ":", "if", "not", "self", ".", "supports_grade_system_lookup", "(", ")", ":", "raise", "errors", ".", "Unimplemented", "(", ")", "##", "# Also include check ...
Gets the ``OsidSession`` associated with the grade system lookup service for the given gradebook. arg: gradebook_id (osid.id.Id): the ``Id`` of the gradebook arg: proxy (osid.proxy.Proxy): a proxy return: (osid.grading.GradeSystemLookupSession) - ``a GradeSystemLookupSessi...
[ "Gets", "the", "OsidSession", "associated", "with", "the", "grade", "system", "lookup", "service", "for", "the", "given", "gradebook", "." ]
python
train
pypa/pipenv
pipenv/vendor/jinja2/compiler.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/compiler.py#L582-L591
def macro_def(self, macro_ref, frame): """Dump the macro definition for the def created by macro_body.""" arg_tuple = ', '.join(repr(x.name) for x in macro_ref.node.args) name = getattr(macro_ref.node, 'name', None) if len(macro_ref.node.args) == 1: arg_tuple += ',' s...
[ "def", "macro_def", "(", "self", ",", "macro_ref", ",", "frame", ")", ":", "arg_tuple", "=", "', '", ".", "join", "(", "repr", "(", "x", ".", "name", ")", "for", "x", "in", "macro_ref", ".", "node", ".", "args", ")", "name", "=", "getattr", "(", ...
Dump the macro definition for the def created by macro_body.
[ "Dump", "the", "macro", "definition", "for", "the", "def", "created", "by", "macro_body", "." ]
python
train
openstack/monasca-common
monasca_common/rest/utils.py
https://github.com/openstack/monasca-common/blob/61e2e00454734e2881611abec8df0d85bf7655ac/monasca_common/rest/utils.py#L39-L55
def as_json(data, **kwargs): """Writes data as json. :param dict data: data to convert to json :param kwargs kwargs: kwargs for json dumps :return: json string :rtype: str """ if 'sort_keys' not in kwargs: kwargs['sort_keys'] = False if 'ensure_ascii' not in kwargs: kwa...
[ "def", "as_json", "(", "data", ",", "*", "*", "kwargs", ")", ":", "if", "'sort_keys'", "not", "in", "kwargs", ":", "kwargs", "[", "'sort_keys'", "]", "=", "False", "if", "'ensure_ascii'", "not", "in", "kwargs", ":", "kwargs", "[", "'ensure_ascii'", "]", ...
Writes data as json. :param dict data: data to convert to json :param kwargs kwargs: kwargs for json dumps :return: json string :rtype: str
[ "Writes", "data", "as", "json", "." ]
python
train
androguard/androguard
androguard/gui/treewindow.py
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/gui/treewindow.py#L33-L72
def fill(self): """Parse all the paths (['Lcom/example/myclass/MyActivity$1;', ...]) and build a tree using the QTreeWidgetItem insertion method.""" log.debug("Fill classes tree") for idx, filename, digest, classes in self.session.get_classes(): for c in sorted(classes, k...
[ "def", "fill", "(", "self", ")", ":", "log", ".", "debug", "(", "\"Fill classes tree\"", ")", "for", "idx", ",", "filename", ",", "digest", ",", "classes", "in", "self", ".", "session", ".", "get_classes", "(", ")", ":", "for", "c", "in", "sorted", "...
Parse all the paths (['Lcom/example/myclass/MyActivity$1;', ...]) and build a tree using the QTreeWidgetItem insertion method.
[ "Parse", "all", "the", "paths", "(", "[", "Lcom", "/", "example", "/", "myclass", "/", "MyActivity$1", ";", "...", "]", ")", "and", "build", "a", "tree", "using", "the", "QTreeWidgetItem", "insertion", "method", "." ]
python
train
hydpy-dev/hydpy
hydpy/auxs/anntools.py
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/auxs/anntools.py#L565-L577
def nmb_weights_hidden(self) -> int: """Number of hidden weights. >>> from hydpy import ANN >>> ann = ANN(None) >>> ann(nmb_inputs=2, nmb_neurons=(4, 3, 2), nmb_outputs=3) >>> ann.nmb_weights_hidden 18 """ nmb = 0 for idx_layer in range(self.nmb_l...
[ "def", "nmb_weights_hidden", "(", "self", ")", "->", "int", ":", "nmb", "=", "0", "for", "idx_layer", "in", "range", "(", "self", ".", "nmb_layers", "-", "1", ")", ":", "nmb", "+=", "self", ".", "nmb_neurons", "[", "idx_layer", "]", "*", "self", ".",...
Number of hidden weights. >>> from hydpy import ANN >>> ann = ANN(None) >>> ann(nmb_inputs=2, nmb_neurons=(4, 3, 2), nmb_outputs=3) >>> ann.nmb_weights_hidden 18
[ "Number", "of", "hidden", "weights", "." ]
python
train
globocom/GloboNetworkAPI-client-python
networkapiclient/ApiNetworkIPv6.py
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiNetworkIPv6.py#L60-L69
def undeploy(self, id_networkv6): """Remove deployment of network in equipments and set column 'active = 0' in tables redeipv6 ] :param id_networkv6: ID for NetworkIPv6 :return: Equipments configuration output """ uri = 'api/networkv6/%s/equipments/' % id_networkv6 ret...
[ "def", "undeploy", "(", "self", ",", "id_networkv6", ")", ":", "uri", "=", "'api/networkv6/%s/equipments/'", "%", "id_networkv6", "return", "super", "(", "ApiNetworkIPv6", ",", "self", ")", ".", "delete", "(", "uri", ")" ]
Remove deployment of network in equipments and set column 'active = 0' in tables redeipv6 ] :param id_networkv6: ID for NetworkIPv6 :return: Equipments configuration output
[ "Remove", "deployment", "of", "network", "in", "equipments", "and", "set", "column", "active", "=", "0", "in", "tables", "redeipv6", "]" ]
python
train
liminspace/dju-common
dju_common/templatetags/dju_common.py
https://github.com/liminspace/dju-common/blob/c68860bb84d454a35e66275841c20f38375c2135/dju_common/templatetags/dju_common.py#L170-L196
def recurse(parser, token): """ Iterate recurse data structure. <ul> {% recurse items %} <li> {{ item.name }} {% if item.children %} <ul> {{ subitems }} </ul> {% endif %} ...
[ "def", "recurse", "(", "parser", ",", "token", ")", ":", "params", "=", "token", ".", "contents", ".", "split", "(", ")", "if", "not", "2", "<=", "len", "(", "params", ")", "<=", "3", ":", "raise", "template", ".", "TemplateSyntaxError", "(", "'%s pa...
Iterate recurse data structure. <ul> {% recurse items %} <li> {{ item.name }} {% if item.children %} <ul> {{ subitems }} </ul> {% endif %} </li> {% endrecurse %} ...
[ "Iterate", "recurse", "data", "structure", ".", "<ul", ">", "{", "%", "recurse", "items", "%", "}", "<li", ">", "{{", "item", ".", "name", "}}", "{", "%", "if", "item", ".", "children", "%", "}", "<ul", ">", "{{", "subitems", "}}", "<", "/", "ul"...
python
train
juju/charm-helpers
charmhelpers/contrib/amulet/utils.py
https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/amulet/utils.py#L171-L180
def _get_config(self, unit, filename): """Get a ConfigParser object for parsing a unit's config file.""" file_contents = unit.file_contents(filename) # NOTE(beisner): by default, ConfigParser does not handle options # with no value, such as the flags used in the mysql my.cnf file. ...
[ "def", "_get_config", "(", "self", ",", "unit", ",", "filename", ")", ":", "file_contents", "=", "unit", ".", "file_contents", "(", "filename", ")", "# NOTE(beisner): by default, ConfigParser does not handle options", "# with no value, such as the flags used in the mysql my.cn...
Get a ConfigParser object for parsing a unit's config file.
[ "Get", "a", "ConfigParser", "object", "for", "parsing", "a", "unit", "s", "config", "file", "." ]
python
train
OzymandiasTheGreat/python-libinput
libinput/__init__.py
https://github.com/OzymandiasTheGreat/python-libinput/blob/1f477ee9f1d56b284b20e0317ea8967c64ef1218/libinput/__init__.py#L221-L236
def next_event_type(self): """Return the type of the next event in the internal queue. This method does not pop the event off the queue and the next call to :attr:`events` returns that event. Returns: ~libinput.constant.EventType: The event type of the next available event or :obj:`None` if no event is ...
[ "def", "next_event_type", "(", "self", ")", ":", "type_", "=", "self", ".", "_libinput", ".", "libinput_next_event_type", "(", "self", ".", "_li", ")", "if", "type_", "==", "0", ":", "return", "None", "else", ":", "return", "EventType", "(", "type_", ")"...
Return the type of the next event in the internal queue. This method does not pop the event off the queue and the next call to :attr:`events` returns that event. Returns: ~libinput.constant.EventType: The event type of the next available event or :obj:`None` if no event is available.
[ "Return", "the", "type", "of", "the", "next", "event", "in", "the", "internal", "queue", "." ]
python
train
timstaley/voevent-parse
src/voeventparse/voevent.py
https://github.com/timstaley/voevent-parse/blob/58fc1eb3af5eca23d9e819c727204950615402a7/src/voeventparse/voevent.py#L110-L130
def load(file, check_version=True): """Load VOEvent from file object. A simple wrapper to read a file before passing the contents to :py:func:`.loads`. Use with an open file object, e.g.:: with open('/path/to/voevent.xml', 'rb') as f: v = vp.load(f) Args: file (io.IOBase):...
[ "def", "load", "(", "file", ",", "check_version", "=", "True", ")", ":", "s", "=", "file", ".", "read", "(", ")", "return", "loads", "(", "s", ",", "check_version", ")" ]
Load VOEvent from file object. A simple wrapper to read a file before passing the contents to :py:func:`.loads`. Use with an open file object, e.g.:: with open('/path/to/voevent.xml', 'rb') as f: v = vp.load(f) Args: file (io.IOBase): An open file object (binary mode preferred...
[ "Load", "VOEvent", "from", "file", "object", "." ]
python
train
saltstack/salt
salt/states/aws_sqs.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/aws_sqs.py#L73-L112
def absent( name, region, user=None, opts=False): ''' Remove the named SQS queue if it exists. name Name of the SQS queue. region Region to remove the queue from user Name of the user performing the SQS operations opts Include a...
[ "def", "absent", "(", "name", ",", "region", ",", "user", "=", "None", ",", "opts", "=", "False", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", ",", "'changes'", ":", "{", "}", "}", ...
Remove the named SQS queue if it exists. name Name of the SQS queue. region Region to remove the queue from user Name of the user performing the SQS operations opts Include additional arguments and options to the aws command line
[ "Remove", "the", "named", "SQS", "queue", "if", "it", "exists", "." ]
python
train
idlesign/django-sitecats
sitecats/models.py
https://github.com/idlesign/django-sitecats/blob/9b45e91fc0dcb63a0011780437fe28145e3ecce9/sitecats/models.py#L334-L343
def get_from_category_qs(cls, category): """Returns a QuerySet of objects of this type associated with the given category. :param Category category: :rtype: list :return: """ ids = cls.get_ties_for_categories_qs(category).values_list('object_id').distinct() filte...
[ "def", "get_from_category_qs", "(", "cls", ",", "category", ")", ":", "ids", "=", "cls", ".", "get_ties_for_categories_qs", "(", "category", ")", ".", "values_list", "(", "'object_id'", ")", ".", "distinct", "(", ")", "filter_kwargs", "=", "{", "'id__in'", "...
Returns a QuerySet of objects of this type associated with the given category. :param Category category: :rtype: list :return:
[ "Returns", "a", "QuerySet", "of", "objects", "of", "this", "type", "associated", "with", "the", "given", "category", "." ]
python
train
mbi/django-simple-captcha
captcha/helpers.py
https://github.com/mbi/django-simple-captcha/blob/e96cd8f63e41e658d103d12d6486b34195aee555/captcha/helpers.py#L49-L62
def huge_words_and_punctuation_challenge(): "Yay, undocumneted. Mostly used to test Issue 39 - http://code.google.com/p/django-simple-captcha/issues/detail?id=39" fd = open(settings.CAPTCHA_WORDS_DICTIONARY, 'rb') l = fd.readlines() fd.close() word = '' while True: word1 = random.choice(...
[ "def", "huge_words_and_punctuation_challenge", "(", ")", ":", "fd", "=", "open", "(", "settings", ".", "CAPTCHA_WORDS_DICTIONARY", ",", "'rb'", ")", "l", "=", "fd", ".", "readlines", "(", ")", "fd", ".", "close", "(", ")", "word", "=", "''", "while", "Tr...
Yay, undocumneted. Mostly used to test Issue 39 - http://code.google.com/p/django-simple-captcha/issues/detail?id=39
[ "Yay", "undocumneted", ".", "Mostly", "used", "to", "test", "Issue", "39", "-", "http", ":", "//", "code", ".", "google", ".", "com", "/", "p", "/", "django", "-", "simple", "-", "captcha", "/", "issues", "/", "detail?id", "=", "39" ]
python
train
materialsproject/pymatgen
pymatgen/analysis/pourbaix_diagram.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/pourbaix_diagram.py#L782-L794
def show(self, *args, **kwargs): """ Shows the pourbaix plot Args: *args: args to get_pourbaix_plot **kwargs: kwargs to get_pourbaix_plot Returns: None """ plt = self.get_pourbaix_plot(*args, **kwargs) plt.show()
[ "def", "show", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "plt", "=", "self", ".", "get_pourbaix_plot", "(", "*", "args", ",", "*", "*", "kwargs", ")", "plt", ".", "show", "(", ")" ]
Shows the pourbaix plot Args: *args: args to get_pourbaix_plot **kwargs: kwargs to get_pourbaix_plot Returns: None
[ "Shows", "the", "pourbaix", "plot" ]
python
train
sdispater/poetry
poetry/mixology/incompatibility.py
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/mixology/incompatibility.py#L88-L101
def external_incompatibilities(self): # type: () -> Generator[Incompatibility] """ Returns all external incompatibilities in this incompatibility's derivation graph. """ if isinstance(self._cause, ConflictCause): cause = self._cause # type: ConflictCause ...
[ "def", "external_incompatibilities", "(", "self", ")", ":", "# type: () -> Generator[Incompatibility]", "if", "isinstance", "(", "self", ".", "_cause", ",", "ConflictCause", ")", ":", "cause", "=", "self", ".", "_cause", "# type: ConflictCause", "for", "incompatibilit...
Returns all external incompatibilities in this incompatibility's derivation graph.
[ "Returns", "all", "external", "incompatibilities", "in", "this", "incompatibility", "s", "derivation", "graph", "." ]
python
train
chimera0/accel-brain-code
Generative-Adversarial-Networks/pygan/truesampler/conditionaltruesampler/conditional_image_true_sampler.py
https://github.com/chimera0/accel-brain-code/blob/03661f6f544bed656269fcd4b3c23c9061629daa/Generative-Adversarial-Networks/pygan/truesampler/conditionaltruesampler/conditional_image_true_sampler.py#L23-L32
def draw(self): ''' Draws samples from the `true` distribution. Returns: `np.ndarray` of samples. ''' observed_arr = self.__image_true_sampler.draw() observed_arr = self.add_condition(observed_arr) return observed_arr
[ "def", "draw", "(", "self", ")", ":", "observed_arr", "=", "self", ".", "__image_true_sampler", ".", "draw", "(", ")", "observed_arr", "=", "self", ".", "add_condition", "(", "observed_arr", ")", "return", "observed_arr" ]
Draws samples from the `true` distribution. Returns: `np.ndarray` of samples.
[ "Draws", "samples", "from", "the", "true", "distribution", ".", "Returns", ":", "np", ".", "ndarray", "of", "samples", "." ]
python
train
Duke-GCB/DukeDSClient
ddsc/core/d4s2.py
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/d4s2.py#L381-L388
def _is_current_user(self, some_user): """ Is the specified user the current user? :param some_user: RemoteUser user we want to check against the current user :return: boolean: True if the current user is the passed in user """ current_user = self.remote_store.get_current...
[ "def", "_is_current_user", "(", "self", ",", "some_user", ")", ":", "current_user", "=", "self", ".", "remote_store", ".", "get_current_user", "(", ")", "return", "current_user", ".", "id", "==", "some_user", ".", "id" ]
Is the specified user the current user? :param some_user: RemoteUser user we want to check against the current user :return: boolean: True if the current user is the passed in user
[ "Is", "the", "specified", "user", "the", "current", "user?", ":", "param", "some_user", ":", "RemoteUser", "user", "we", "want", "to", "check", "against", "the", "current", "user", ":", "return", ":", "boolean", ":", "True", "if", "the", "current", "user",...
python
train
PaulHancock/Aegean
AegeanTools/source_finder.py
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/source_finder.py#L744-L822
def save_background_files(self, image_filename, hdu_index=0, bkgin=None, rmsin=None, beam=None, rms=None, bkg=None, cores=1, outbase=None): """ Generate and save the background and RMS maps as FITS files. They are saved in the current directly as aegean-background.f...
[ "def", "save_background_files", "(", "self", ",", "image_filename", ",", "hdu_index", "=", "0", ",", "bkgin", "=", "None", ",", "rmsin", "=", "None", ",", "beam", "=", "None", ",", "rms", "=", "None", ",", "bkg", "=", "None", ",", "cores", "=", "1", ...
Generate and save the background and RMS maps as FITS files. They are saved in the current directly as aegean-background.fits and aegean-rms.fits. Parameters ---------- image_filename : str or HDUList Input image. hdu_index : int If fits file has more th...
[ "Generate", "and", "save", "the", "background", "and", "RMS", "maps", "as", "FITS", "files", ".", "They", "are", "saved", "in", "the", "current", "directly", "as", "aegean", "-", "background", ".", "fits", "and", "aegean", "-", "rms", ".", "fits", "." ]
python
train
tylertreat/BigQuery-Python
bigquery/client.py
https://github.com/tylertreat/BigQuery-Python/blob/88d99de42d954d49fc281460068f0e95003da098/bigquery/client.py#L1057-L1151
def export_data_to_uris( self, destination_uris, dataset, table, job=None, compression=None, destination_format=None, print_header=None, field_delimiter=None, project_id=None, ): ...
[ "def", "export_data_to_uris", "(", "self", ",", "destination_uris", ",", "dataset", ",", "table", ",", "job", "=", "None", ",", "compression", "=", "None", ",", "destination_format", "=", "None", ",", "print_header", "=", "None", ",", "field_delimiter", "=", ...
Export data from a BigQuery table to cloud storage. Optional arguments that are not specified are determined by BigQuery as described: https://developers.google.com/bigquery/docs/reference/v2/jobs Parameters ---------- destination_uris : Union[str, list] ``str`` or `...
[ "Export", "data", "from", "a", "BigQuery", "table", "to", "cloud", "storage", ".", "Optional", "arguments", "that", "are", "not", "specified", "are", "determined", "by", "BigQuery", "as", "described", ":", "https", ":", "//", "developers", ".", "google", "."...
python
train
aio-libs/aiohttp
aiohttp/web_response.py
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/web_response.py#L179-L221
def set_cookie(self, name: str, value: str, *, expires: Optional[str]=None, domain: Optional[str]=None, max_age: Optional[Union[int, str]]=None, path: str='/', secure: Optional[str]=None, httponly: Optional...
[ "def", "set_cookie", "(", "self", ",", "name", ":", "str", ",", "value", ":", "str", ",", "*", ",", "expires", ":", "Optional", "[", "str", "]", "=", "None", ",", "domain", ":", "Optional", "[", "str", "]", "=", "None", ",", "max_age", ":", "Opti...
Set or update response cookie. Sets new cookie or updates existent with new value. Also updates only those params which are not None.
[ "Set", "or", "update", "response", "cookie", "." ]
python
train
pyviz/holoviews
holoviews/core/layout.py
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/layout.py#L168-L183
def relabel(self, label=None, group=None, depth=1): """Clone object and apply new group and/or label. Applies relabeling to child up to the supplied depth. Args: label (str, optional): New label to apply to returned object group (str, optional): New group to apply to re...
[ "def", "relabel", "(", "self", ",", "label", "=", "None", ",", "group", "=", "None", ",", "depth", "=", "1", ")", ":", "return", "super", "(", "AdjointLayout", ",", "self", ")", ".", "relabel", "(", "label", "=", "label", ",", "group", "=", "group"...
Clone object and apply new group and/or label. Applies relabeling to child up to the supplied depth. Args: label (str, optional): New label to apply to returned object group (str, optional): New group to apply to returned object depth (int, optional): Depth to which...
[ "Clone", "object", "and", "apply", "new", "group", "and", "/", "or", "label", "." ]
python
train
twilio/twilio-python
twilio/rest/autopilot/v1/assistant/query.py
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/autopilot/v1/assistant/query.py#L98-L130
def page(self, language=values.unset, model_build=values.unset, status=values.unset, page_token=values.unset, page_number=values.unset, page_size=values.unset): """ Retrieve a single page of QueryInstance records from the API. Request is executed immediately :p...
[ "def", "page", "(", "self", ",", "language", "=", "values", ".", "unset", ",", "model_build", "=", "values", ".", "unset", ",", "status", "=", "values", ".", "unset", ",", "page_token", "=", "values", ".", "unset", ",", "page_number", "=", "values", "....
Retrieve a single page of QueryInstance records from the API. Request is executed immediately :param unicode language: The ISO language-country string that specifies the language used by the Query resources to read :param unicode model_build: The SID or unique name of the Model Build to be quer...
[ "Retrieve", "a", "single", "page", "of", "QueryInstance", "records", "from", "the", "API", ".", "Request", "is", "executed", "immediately" ]
python
train
pgmpy/pgmpy
pgmpy/inference/ExactInference.py
https://github.com/pgmpy/pgmpy/blob/9381a66aba3c3871d3ccd00672b148d17d63239e/pgmpy/inference/ExactInference.py#L533-L627
def _query(self, variables, operation, evidence=None, joint=True): """ This is a generalized query method that can be used for both query and map query. Parameters ---------- variables: list list of variables for which you want to compute the probability oper...
[ "def", "_query", "(", "self", ",", "variables", ",", "operation", ",", "evidence", "=", "None", ",", "joint", "=", "True", ")", ":", "is_calibrated", "=", "self", ".", "_is_converged", "(", "operation", "=", "operation", ")", "# Calibrate the junction tree if ...
This is a generalized query method that can be used for both query and map query. Parameters ---------- variables: list list of variables for which you want to compute the probability operation: str ('marginalize' | 'maximize') The operation to do for passing mes...
[ "This", "is", "a", "generalized", "query", "method", "that", "can", "be", "used", "for", "both", "query", "and", "map", "query", "." ]
python
train
jazzband/django-ddp
dddp/accounts/ddp.py
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/accounts/ddp.py#L255-L301
def update_subs(new_user_id): """Update subs to send added/removed for collections with user_rel.""" for sub in Subscription.objects.filter(connection=this.ws.connection): params = loads(sub.params_ejson) pub = API.get_pub_by_name(sub.publication) # calculate the que...
[ "def", "update_subs", "(", "new_user_id", ")", ":", "for", "sub", "in", "Subscription", ".", "objects", ".", "filter", "(", "connection", "=", "this", ".", "ws", ".", "connection", ")", ":", "params", "=", "loads", "(", "sub", ".", "params_ejson", ")", ...
Update subs to send added/removed for collections with user_rel.
[ "Update", "subs", "to", "send", "added", "/", "removed", "for", "collections", "with", "user_rel", "." ]
python
test
librosa/librosa
examples/beat_tracker.py
https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/examples/beat_tracker.py#L16-L45
def beat_track(input_file, output_csv): '''Beat tracking function :parameters: - input_file : str Path to input audio file (wav, mp3, m4a, flac, etc.) - output_file : str Path to save beat event timestamps as a CSV file ''' print('Loading ', input_file) y, sr = lib...
[ "def", "beat_track", "(", "input_file", ",", "output_csv", ")", ":", "print", "(", "'Loading '", ",", "input_file", ")", "y", ",", "sr", "=", "librosa", ".", "load", "(", "input_file", ",", "sr", "=", "22050", ")", "# Use a default hop size of 512 samples @ 22...
Beat tracking function :parameters: - input_file : str Path to input audio file (wav, mp3, m4a, flac, etc.) - output_file : str Path to save beat event timestamps as a CSV file
[ "Beat", "tracking", "function" ]
python
test
ThreatConnect-Inc/tcex
tcex/tcex_resources.py
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_resources.py#L949-L974
def task_pivot(self, task_resource): """Pivot point on Tasks for this resource. This method will return all *resources* (group, indicators, victims, etc) for this resource that are associated with the provided task id. **Example Endpoints URI's** +--------------+--------------...
[ "def", "task_pivot", "(", "self", ",", "task_resource", ")", ":", "resource", "=", "self", ".", "copy", "(", ")", "resource", ".", "_request_uri", "=", "'{}/{}'", ".", "format", "(", "task_resource", ".", "request_uri", ",", "resource", ".", "_request_uri", ...
Pivot point on Tasks for this resource. This method will return all *resources* (group, indicators, victims, etc) for this resource that are associated with the provided task id. **Example Endpoints URI's** +--------------+-------------------------------------------------------------+...
[ "Pivot", "point", "on", "Tasks", "for", "this", "resource", "." ]
python
train
senaite/senaite.core
bika/lims/content/worksheet.py
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/content/worksheet.py#L241-L263
def addToLayout(self, analysis, position=None): """ Adds the analysis passed in to the worksheet's layout """ # TODO Redux layout = self.getLayout() container_uid = self.get_container_for(analysis) if IRequestAnalysis.providedBy(analysis) and \ not IDuplic...
[ "def", "addToLayout", "(", "self", ",", "analysis", ",", "position", "=", "None", ")", ":", "# TODO Redux", "layout", "=", "self", ".", "getLayout", "(", ")", "container_uid", "=", "self", ".", "get_container_for", "(", "analysis", ")", "if", "IRequestAnalys...
Adds the analysis passed in to the worksheet's layout
[ "Adds", "the", "analysis", "passed", "in", "to", "the", "worksheet", "s", "layout" ]
python
train
spacetelescope/drizzlepac
drizzlepac/outputimage.py
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/outputimage.py#L680-L694
def getTemplates(fnames, blend=True): """ Process all headers to produce a set of combined headers that follows the rules defined by each instrument. """ if not blend: newhdrs = blendheaders.getSingleTemplate(fnames[0]) newtab = None else: # apply rules to create final ...
[ "def", "getTemplates", "(", "fnames", ",", "blend", "=", "True", ")", ":", "if", "not", "blend", ":", "newhdrs", "=", "blendheaders", ".", "getSingleTemplate", "(", "fnames", "[", "0", "]", ")", "newtab", "=", "None", "else", ":", "# apply rules to create ...
Process all headers to produce a set of combined headers that follows the rules defined by each instrument.
[ "Process", "all", "headers", "to", "produce", "a", "set", "of", "combined", "headers", "that", "follows", "the", "rules", "defined", "by", "each", "instrument", "." ]
python
train
sdispater/orator
orator/query/builder.py
https://github.com/sdispater/orator/blob/bd90bf198ee897751848f9a92e49d18e60a74136/orator/query/builder.py#L1229-L1242
def exists(self): """ Determine if any rows exist for the current query. :return: Whether the rows exist or not :rtype: bool """ limit = self.limit_ result = self.limit(1).count() > 0 self.limit(limit) return result
[ "def", "exists", "(", "self", ")", ":", "limit", "=", "self", ".", "limit_", "result", "=", "self", ".", "limit", "(", "1", ")", ".", "count", "(", ")", ">", "0", "self", ".", "limit", "(", "limit", ")", "return", "result" ]
Determine if any rows exist for the current query. :return: Whether the rows exist or not :rtype: bool
[ "Determine", "if", "any", "rows", "exist", "for", "the", "current", "query", "." ]
python
train
proycon/pynlpl
pynlpl/search.py
https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/search.py#L263-L268
def searchtop(self,n=10): """Return the top n best resulta (or possibly less if not enough is found)""" solutions = PriorityQueue([], lambda x: x.score, self.minimize, length=n, blockworse=False, blockequal=False,duplicates=False) for solution in self: solutions.append(so...
[ "def", "searchtop", "(", "self", ",", "n", "=", "10", ")", ":", "solutions", "=", "PriorityQueue", "(", "[", "]", ",", "lambda", "x", ":", "x", ".", "score", ",", "self", ".", "minimize", ",", "length", "=", "n", ",", "blockworse", "=", "False", ...
Return the top n best resulta (or possibly less if not enough is found)
[ "Return", "the", "top", "n", "best", "resulta", "(", "or", "possibly", "less", "if", "not", "enough", "is", "found", ")" ]
python
train
YeoLab/anchor
anchor/infotheory.py
https://github.com/YeoLab/anchor/blob/1f9c9d6d30235b1e77b945e6ef01db5a0e55d53a/anchor/infotheory.py#L46-L77
def binify(data, bins): """Makes a histogram of each column the provided binsize Parameters ---------- data : pandas.DataFrame A samples x features dataframe. Each feature (column) will be binned into the provided bins bins : iterable Bins you would like to use for this data...
[ "def", "binify", "(", "data", ",", "bins", ")", ":", "if", "bins", "is", "None", ":", "raise", "ValueError", "(", "'Must specify \"bins\"'", ")", "if", "isinstance", "(", "data", ",", "pd", ".", "DataFrame", ")", ":", "binned", "=", "data", ".", "apply...
Makes a histogram of each column the provided binsize Parameters ---------- data : pandas.DataFrame A samples x features dataframe. Each feature (column) will be binned into the provided bins bins : iterable Bins you would like to use for this data. Must include the final bin ...
[ "Makes", "a", "histogram", "of", "each", "column", "the", "provided", "binsize" ]
python
train
blockstack/virtualchain
virtualchain/lib/blockchain/bitcoin_blockchain/spv.py
https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/blockchain/bitcoin_blockchain/spv.py#L699-L729
def verify_header_chain(cls, path, chain=None): """ Verify that a given chain of block headers has sufficient proof of work. """ if chain is None: chain = SPVClient.load_header_chain( path ) prev_header = chain[0] for i in xrange(1, len(chain...
[ "def", "verify_header_chain", "(", "cls", ",", "path", ",", "chain", "=", "None", ")", ":", "if", "chain", "is", "None", ":", "chain", "=", "SPVClient", ".", "load_header_chain", "(", "path", ")", "prev_header", "=", "chain", "[", "0", "]", "for", "i",...
Verify that a given chain of block headers has sufficient proof of work.
[ "Verify", "that", "a", "given", "chain", "of", "block", "headers", "has", "sufficient", "proof", "of", "work", "." ]
python
train
IBMStreams/pypi.streamsx
streamsx/scripts/extract.py
https://github.com/IBMStreams/pypi.streamsx/blob/abd67b4757120f6f805787fba390f53e9df9cdd8/streamsx/scripts/extract.py#L219-L246
def _copy_globalization_resources(self): '''Copy the language resource files for python api functions This function copies the TopologySplpy Resource files from Topology toolkit directory into the impl/nl folder of the project. Returns: the list with the copied locale strings''' ...
[ "def", "_copy_globalization_resources", "(", "self", ")", ":", "rootDir", "=", "os", ".", "path", ".", "join", "(", "_topology_tk_dir", "(", ")", ",", "\"impl\"", ",", "\"nl\"", ")", "languageList", "=", "[", "]", "for", "dirName", "in", "os", ".", "list...
Copy the language resource files for python api functions This function copies the TopologySplpy Resource files from Topology toolkit directory into the impl/nl folder of the project. Returns: the list with the copied locale strings
[ "Copy", "the", "language", "resource", "files", "for", "python", "api", "functions", "This", "function", "copies", "the", "TopologySplpy", "Resource", "files", "from", "Topology", "toolkit", "directory", "into", "the", "impl", "/", "nl", "folder", "of", "the", ...
python
train
knipknap/SpiffWorkflow
SpiffWorkflow/task.py
https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/task.py#L405-L419
def _is_descendant_of(self, parent): """ Returns True if parent is in the list of ancestors, returns False otherwise. :type parent: Task :param parent: The parent that is searched in the ancestors. :rtype: bool :returns: Whether the parent was found. ""...
[ "def", "_is_descendant_of", "(", "self", ",", "parent", ")", ":", "if", "self", ".", "parent", "is", "None", ":", "return", "False", "if", "self", ".", "parent", "==", "parent", ":", "return", "True", "return", "self", ".", "parent", ".", "_is_descendant...
Returns True if parent is in the list of ancestors, returns False otherwise. :type parent: Task :param parent: The parent that is searched in the ancestors. :rtype: bool :returns: Whether the parent was found.
[ "Returns", "True", "if", "parent", "is", "in", "the", "list", "of", "ancestors", "returns", "False", "otherwise", "." ]
python
valid
phoebe-project/phoebe2
phoebe/frontend/bundle.py
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/bundle.py#L382-L394
def from_legacy(cls, filename, add_compute_legacy=True, add_compute_phoebe=True): """Load a bundle from a PHOEBE 1.0 Legacy file. This is a constructor so should be called as: >>> b = Bundle.from_legacy('myfile.phoebe') :parameter str filename: relative or full path to the file ...
[ "def", "from_legacy", "(", "cls", ",", "filename", ",", "add_compute_legacy", "=", "True", ",", "add_compute_phoebe", "=", "True", ")", ":", "logger", ".", "warning", "(", "\"importing from legacy is experimental until official 1.0 release\"", ")", "filename", "=", "o...
Load a bundle from a PHOEBE 1.0 Legacy file. This is a constructor so should be called as: >>> b = Bundle.from_legacy('myfile.phoebe') :parameter str filename: relative or full path to the file :return: instantiated :class:`Bundle` object
[ "Load", "a", "bundle", "from", "a", "PHOEBE", "1", ".", "0", "Legacy", "file", "." ]
python
train
CellProfiler/centrosome
centrosome/threshold.py
https://github.com/CellProfiler/centrosome/blob/7bd9350a2d4ae1b215b81eabcecfe560bbb1f32a/centrosome/threshold.py#L436-L468
def get_background_threshold(image, mask = None): """Get threshold based on the mode of the image The threshold is calculated by calculating the mode and multiplying by 2 (an arbitrary empirical factor). The user will presumably adjust the multiplication factor as needed.""" cropped_image = np.array...
[ "def", "get_background_threshold", "(", "image", ",", "mask", "=", "None", ")", ":", "cropped_image", "=", "np", ".", "array", "(", "image", ".", "flat", ")", "if", "mask", "is", "None", "else", "image", "[", "mask", "]", "if", "np", ".", "product", ...
Get threshold based on the mode of the image The threshold is calculated by calculating the mode and multiplying by 2 (an arbitrary empirical factor). The user will presumably adjust the multiplication factor as needed.
[ "Get", "threshold", "based", "on", "the", "mode", "of", "the", "image", "The", "threshold", "is", "calculated", "by", "calculating", "the", "mode", "and", "multiplying", "by", "2", "(", "an", "arbitrary", "empirical", "factor", ")", ".", "The", "user", "wi...
python
train
dcos/shakedown
shakedown/dcos/package.py
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/package.py#L352-L383
def add_package_repo( repo_name, repo_url, index=None, wait_for_package=None, expect_prev_version=None): """ Add a repository to the list of package sources :param repo_name: name of the repository to add :type repo_name: str :param repo_url: location...
[ "def", "add_package_repo", "(", "repo_name", ",", "repo_url", ",", "index", "=", "None", ",", "wait_for_package", "=", "None", ",", "expect_prev_version", "=", "None", ")", ":", "package_manager", "=", "_get_package_manager", "(", ")", "if", "wait_for_package", ...
Add a repository to the list of package sources :param repo_name: name of the repository to add :type repo_name: str :param repo_url: location of the repository to add :type repo_url: str :param index: index (precedence) for this repository :type index: int :para...
[ "Add", "a", "repository", "to", "the", "list", "of", "package", "sources" ]
python
train
nyergler/hieroglyph
src/hieroglyph/directives.py
https://github.com/nyergler/hieroglyph/blob/1ef062fad5060006566f8d6bd3b5a231ac7e0488/src/hieroglyph/directives.py#L217-L224
def apply(self, builder): """Apply the Slide Configuration to a Builder.""" if 'theme' in self.attributes: builder.apply_theme( self.attributes['theme'], builder.theme_options, )
[ "def", "apply", "(", "self", ",", "builder", ")", ":", "if", "'theme'", "in", "self", ".", "attributes", ":", "builder", ".", "apply_theme", "(", "self", ".", "attributes", "[", "'theme'", "]", ",", "builder", ".", "theme_options", ",", ")" ]
Apply the Slide Configuration to a Builder.
[ "Apply", "the", "Slide", "Configuration", "to", "a", "Builder", "." ]
python
train
pycontribs/pyrax
pyrax/clouddatabases.py
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L446-L453
def delete_database(self, name_or_obj): """ Deletes the specified database. If no database by that name exists, no exception will be raised; instead, nothing at all is done. """ name = utils.get_name(name_or_obj) self._database_manager.delete(name)
[ "def", "delete_database", "(", "self", ",", "name_or_obj", ")", ":", "name", "=", "utils", ".", "get_name", "(", "name_or_obj", ")", "self", ".", "_database_manager", ".", "delete", "(", "name", ")" ]
Deletes the specified database. If no database by that name exists, no exception will be raised; instead, nothing at all is done.
[ "Deletes", "the", "specified", "database", ".", "If", "no", "database", "by", "that", "name", "exists", "no", "exception", "will", "be", "raised", ";", "instead", "nothing", "at", "all", "is", "done", "." ]
python
train
estnltk/estnltk
estnltk/converters/gt_conversion.py
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/converters/gt_conversion.py#L613-L669
def get_original_vs_converted_diff( original ,converted ): ''' Compares the *original* text to *converted* text, and detects changes/differences in morphological annotations. The method constructs line-by-line comparison string, where lines are separated by newline, and '***' at the beg...
[ "def", "get_original_vs_converted_diff", "(", "original", ",", "converted", ")", ":", "from", "estnltk", ".", "syntax", ".", "syntax_preprocessing", "import", "convert_Text_to_mrf", "old_layer_mrf", "=", "convert_Text_to_mrf", "(", "original", ")", "new_layer_mrf", "=",...
Compares the *original* text to *converted* text, and detects changes/differences in morphological annotations. The method constructs line-by-line comparison string, where lines are separated by newline, and '***' at the beginning of the line indicates the difference. Returns a pair...
[ "Compares", "the", "*", "original", "*", "text", "to", "*", "converted", "*", "text", "and", "detects", "changes", "/", "differences", "in", "morphological", "annotations", "." ]
python
train
ska-sa/purr
Purr/Plugins/local_pychart/basecanvas.py
https://github.com/ska-sa/purr/blob/4c848768d0485d0f88b30850d0d5372221b21b66/Purr/Plugins/local_pychart/basecanvas.py#L155-L167
def _path_polygon(self, points): "Low-level polygon-drawing routine." (xmin, ymin, xmax, ymax) = _compute_bounding_box(points) if invisible_p(xmax, ymax): return self.setbb(xmin, ymin) self.setbb(xmax, ymax) self.newpath() self.moveto(xscale(points[0]...
[ "def", "_path_polygon", "(", "self", ",", "points", ")", ":", "(", "xmin", ",", "ymin", ",", "xmax", ",", "ymax", ")", "=", "_compute_bounding_box", "(", "points", ")", "if", "invisible_p", "(", "xmax", ",", "ymax", ")", ":", "return", "self", ".", "...
Low-level polygon-drawing routine.
[ "Low", "-", "level", "polygon", "-", "drawing", "routine", "." ]
python
train
Toilal/rebulk
rebulk/rebulk.py
https://github.com/Toilal/rebulk/blob/7511a4671f2fd9493e3df1e5177b7656789069e8/rebulk/rebulk.py#L307-L319
def _execute_rules(self, matches, context): """ Execute rules for this rebulk and children. :param matches: :type matches: :param context: :type context: :return: :rtype: """ if not self.disabled(context): rules = self.effective...
[ "def", "_execute_rules", "(", "self", ",", "matches", ",", "context", ")", ":", "if", "not", "self", ".", "disabled", "(", "context", ")", ":", "rules", "=", "self", ".", "effective_rules", "(", "context", ")", "rules", ".", "execute_all_rules", "(", "ma...
Execute rules for this rebulk and children. :param matches: :type matches: :param context: :type context: :return: :rtype:
[ "Execute", "rules", "for", "this", "rebulk", "and", "children", ".", ":", "param", "matches", ":", ":", "type", "matches", ":", ":", "param", "context", ":", ":", "type", "context", ":", ":", "return", ":", ":", "rtype", ":" ]
python
train
Loudr/asana-hub
asana_hub/actions/sync.py
https://github.com/Loudr/asana-hub/blob/af996ce890ed23d8ede5bf68dcd318e3438829cb/asana_hub/actions/sync.py#L54-L65
def apply_tasks_to_issue(self, issue, tasks, issue_body=None): """Applies task numbers to an issue.""" issue_body = issue_body or issue.body task_numbers = transport.format_task_numbers_with_links(tasks) if task_numbers: new_body = transport.ASANA_SECTION_RE.sub('', issue_bod...
[ "def", "apply_tasks_to_issue", "(", "self", ",", "issue", ",", "tasks", ",", "issue_body", "=", "None", ")", ":", "issue_body", "=", "issue_body", "or", "issue", ".", "body", "task_numbers", "=", "transport", ".", "format_task_numbers_with_links", "(", "tasks", ...
Applies task numbers to an issue.
[ "Applies", "task", "numbers", "to", "an", "issue", "." ]
python
test
loli/medpy
doc/numpydoc/numpydoc/compiler_unparse.py
https://github.com/loli/medpy/blob/95216b9e22e7ce301f0edf953ee2a2f1b6c6aee5/doc/numpydoc/numpydoc/compiler_unparse.py#L244-L256
def _From(self, t): """ Handle "from xyz import foo, bar as baz". """ # fixme: Are From and ImportFrom handled differently? self._fill("from ") self._write(t.modname) self._write(" import ") for i, (name,asname) in enumerate(t.names): if i != 0: ...
[ "def", "_From", "(", "self", ",", "t", ")", ":", "# fixme: Are From and ImportFrom handled differently?", "self", ".", "_fill", "(", "\"from \"", ")", "self", ".", "_write", "(", "t", ".", "modname", ")", "self", ".", "_write", "(", "\" import \"", ")", "for...
Handle "from xyz import foo, bar as baz".
[ "Handle", "from", "xyz", "import", "foo", "bar", "as", "baz", "." ]
python
train
radjkarl/imgProcessor
imgProcessor/camera/PerspectiveCorrection.py
https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/camera/PerspectiveCorrection.py#L281-L372
def correctGrid(self, img, grid): ''' grid -> array of polylines=((p0x,p0y),(p1x,p1y),,,) ''' self.img = imread(img) h = self.homography # TODO: cleanup only needed to get newBorder attr. if self.opts['do_correctIntensity']: self.img = self.img / s...
[ "def", "correctGrid", "(", "self", ",", "img", ",", "grid", ")", ":", "self", ".", "img", "=", "imread", "(", "img", ")", "h", "=", "self", ".", "homography", "# TODO: cleanup only needed to get newBorder attr.\r", "if", "self", ".", "opts", "[", "'do_correc...
grid -> array of polylines=((p0x,p0y),(p1x,p1y),,,)
[ "grid", "-", ">", "array", "of", "polylines", "=", "((", "p0x", "p0y", ")", "(", "p1x", "p1y", ")", ")" ]
python
train
pauleveritt/kaybee
kaybee/plugins/widgets/handlers.py
https://github.com/pauleveritt/kaybee/blob/a00a718aaaa23b2d12db30dfacb6b2b6ec84459c/kaybee/plugins/widgets/handlers.py#L63-L84
def render_widgets(kb_app: kb, sphinx_app: Sphinx, doctree: doctree, fromdocname: str, ): """ Go through docs and replace widget directive with rendering """ builder: StandaloneHTMLBuilder = sphinx_app.builder for node in doctree....
[ "def", "render_widgets", "(", "kb_app", ":", "kb", ",", "sphinx_app", ":", "Sphinx", ",", "doctree", ":", "doctree", ",", "fromdocname", ":", "str", ",", ")", ":", "builder", ":", "StandaloneHTMLBuilder", "=", "sphinx_app", ".", "builder", "for", "node", "...
Go through docs and replace widget directive with rendering
[ "Go", "through", "docs", "and", "replace", "widget", "directive", "with", "rendering" ]
python
train
brunobord/tdaemon
tdaemon.py
https://github.com/brunobord/tdaemon/blob/733b5bddb4b12bc3db326a192ce5606f28768307/tdaemon.py#L167-L176
def include(self, path): """Returns `True` if the file is not ignored""" for extension in IGNORE_EXTENSIONS: if path.endswith(extension): return False parts = path.split(os.path.sep) for part in parts: if part in self.ignore_dirs: r...
[ "def", "include", "(", "self", ",", "path", ")", ":", "for", "extension", "in", "IGNORE_EXTENSIONS", ":", "if", "path", ".", "endswith", "(", "extension", ")", ":", "return", "False", "parts", "=", "path", ".", "split", "(", "os", ".", "path", ".", "...
Returns `True` if the file is not ignored
[ "Returns", "True", "if", "the", "file", "is", "not", "ignored" ]
python
train
dodger487/dplython
dplython/dplython.py
https://github.com/dodger487/dplython/blob/09c2a5f4ca67221b2a59928366ca8274357f7234/dplython/dplython.py#L504-L517
def get_join_cols(by_entry): """ helper function used for joins builds left and right join list for join function """ left_cols = [] right_cols = [] for col in by_entry: if isinstance(col, str): left_cols.append(col) right_cols.append(col) else: left_cols.append(col[0]) right...
[ "def", "get_join_cols", "(", "by_entry", ")", ":", "left_cols", "=", "[", "]", "right_cols", "=", "[", "]", "for", "col", "in", "by_entry", ":", "if", "isinstance", "(", "col", ",", "str", ")", ":", "left_cols", ".", "append", "(", "col", ")", "right...
helper function used for joins builds left and right join list for join function
[ "helper", "function", "used", "for", "joins", "builds", "left", "and", "right", "join", "list", "for", "join", "function" ]
python
train
hyperledger/indy-sdk
wrappers/python/indy/non_secrets.py
https://github.com/hyperledger/indy-sdk/blob/55240dc170308d7883c48f03f308130a6d077be6/wrappers/python/indy/non_secrets.py#L326-L380
async def open_wallet_search(wallet_handle: int, type_: str, query_json: str, options_json: str) -> int: """ Search for wallet records :param wallet_handle: wallet handler (created by open_wallet). :param type_: allo...
[ "async", "def", "open_wallet_search", "(", "wallet_handle", ":", "int", ",", "type_", ":", "str", ",", "query_json", ":", "str", ",", "options_json", ":", "str", ")", "->", "int", ":", "logger", "=", "logging", ".", "getLogger", "(", "__name__", ")", "lo...
Search for wallet records :param wallet_handle: wallet handler (created by open_wallet). :param type_: allows to separate different record types collections :param query_json: MongoDB style query to wallet record tags: { "tagName": "tagValue", $or: { "tagName2": { $regex: 'p...
[ "Search", "for", "wallet", "records" ]
python
train
mitsei/dlkit
dlkit/handcar/learning/sessions.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/handcar/learning/sessions.py#L1861-L1877
def can_lookup_objective_prerequisites(self): """Tests if this user can perform Objective lookups. A return of true does not guarantee successful authorization. A return of false indicates that it is known all methods in this session will result in a PermissionDenied. This is intended a...
[ "def", "can_lookup_objective_prerequisites", "(", "self", ")", ":", "url_path", "=", "construct_url", "(", "'authorization'", ",", "bank_id", "=", "self", ".", "_catalog_idstr", ")", "return", "self", ".", "_get_request", "(", "url_path", ")", "[", "'objectiveRequ...
Tests if this user can perform Objective lookups. A return of true does not guarantee successful authorization. A return of false indicates that it is known all methods in this session will result in a PermissionDenied. This is intended as a hint to an application that may opt not to of...
[ "Tests", "if", "this", "user", "can", "perform", "Objective", "lookups", "." ]
python
train
pikepdf/pikepdf
src/pikepdf/models/metadata.py
https://github.com/pikepdf/pikepdf/blob/07154f4dec007e2e9c0c6a8c07b964fd06bc5f77/src/pikepdf/models/metadata.py#L127-L148
def decode_pdf_date(s: str) -> datetime: """Decode a pdfmark date to a Python datetime object A pdfmark date is a string in a paritcular format. See the pdfmark Reference for the specification. """ if isinstance(s, String): s = str(s) if s.startswith('D:'): s = s[2:] # Lite...
[ "def", "decode_pdf_date", "(", "s", ":", "str", ")", "->", "datetime", ":", "if", "isinstance", "(", "s", ",", "String", ")", ":", "s", "=", "str", "(", "s", ")", "if", "s", ".", "startswith", "(", "'D:'", ")", ":", "s", "=", "s", "[", "2", "...
Decode a pdfmark date to a Python datetime object A pdfmark date is a string in a paritcular format. See the pdfmark Reference for the specification.
[ "Decode", "a", "pdfmark", "date", "to", "a", "Python", "datetime", "object" ]
python
train
kytos/kytos-utils
kytos/cli/commands/napps/api.py
https://github.com/kytos/kytos-utils/blob/b4750c618d15cff75970ea6124bda4d2b9a33578/kytos/cli/commands/napps/api.py#L213-L233
def list(cls, args): # pylint: disable=unused-argument """List all installed NApps and inform whether they are enabled.""" mgr = NAppsManager() # Add status napps = [napp + ('[ie]',) for napp in mgr.get_enabled()] napps += [napp + ('[i-]',) for napp in mgr.get_disabled()] ...
[ "def", "list", "(", "cls", ",", "args", ")", ":", "# pylint: disable=unused-argument", "mgr", "=", "NAppsManager", "(", ")", "# Add status", "napps", "=", "[", "napp", "+", "(", "'[ie]'", ",", ")", "for", "napp", "in", "mgr", ".", "get_enabled", "(", ")"...
List all installed NApps and inform whether they are enabled.
[ "List", "all", "installed", "NApps", "and", "inform", "whether", "they", "are", "enabled", "." ]
python
train
apple/turicreate
deps/src/libxml2-2.9.1/python/libxml2.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/libxml2-2.9.1/python/libxml2.py#L7116-L7125
def validateDocumentFinal(self, doc): """Does the final step for the document validation once all the incremental validation steps have been completed basically it does the following checks described by the XML Rec Check all the IDREF/IDREFS attributes definition for va...
[ "def", "validateDocumentFinal", "(", "self", ",", "doc", ")", ":", "if", "doc", "is", "None", ":", "doc__o", "=", "None", "else", ":", "doc__o", "=", "doc", ".", "_o", "ret", "=", "libxml2mod", ".", "xmlValidateDocumentFinal", "(", "self", ".", "_o", "...
Does the final step for the document validation once all the incremental validation steps have been completed basically it does the following checks described by the XML Rec Check all the IDREF/IDREFS attributes definition for validity
[ "Does", "the", "final", "step", "for", "the", "document", "validation", "once", "all", "the", "incremental", "validation", "steps", "have", "been", "completed", "basically", "it", "does", "the", "following", "checks", "described", "by", "the", "XML", "Rec", "C...
python
train
boppreh/keyboard
keyboard/_darwinkeyboard.py
https://github.com/boppreh/keyboard/blob/dbb73dfff484f733d5fed8dbc53301af5b6c7f50/keyboard/_darwinkeyboard.py#L187-L199
def vk_to_character(self, vk, modifiers=[]): """ Returns a character corresponding to the specified scan code (with given modifiers applied) """ if vk in self.non_layout_keys: # Not a character return self.non_layout_keys[vk] elif vk in self.layout_specific_keys: ...
[ "def", "vk_to_character", "(", "self", ",", "vk", ",", "modifiers", "=", "[", "]", ")", ":", "if", "vk", "in", "self", ".", "non_layout_keys", ":", "# Not a character", "return", "self", ".", "non_layout_keys", "[", "vk", "]", "elif", "vk", "in", "self",...
Returns a character corresponding to the specified scan code (with given modifiers applied)
[ "Returns", "a", "character", "corresponding", "to", "the", "specified", "scan", "code", "(", "with", "given", "modifiers", "applied", ")" ]
python
train
23andMe/Yamale
yamale/command_line.py
https://github.com/23andMe/Yamale/blob/0a75b4205624d9bccc52bda03efaf0d58c143c76/yamale/command_line.py#L51-L60
def _find_schema(data_path, schema_name): """ Checks if `schema_name` is a valid file, if not searches in `data_path` for it. """ path = glob.glob(schema_name) for p in path: if os.path.isfile(p): return p return _find_data_path_schema(data_path, schema_name)
[ "def", "_find_schema", "(", "data_path", ",", "schema_name", ")", ":", "path", "=", "glob", ".", "glob", "(", "schema_name", ")", "for", "p", "in", "path", ":", "if", "os", ".", "path", ".", "isfile", "(", "p", ")", ":", "return", "p", "return", "_...
Checks if `schema_name` is a valid file, if not searches in `data_path` for it.
[ "Checks", "if", "schema_name", "is", "a", "valid", "file", "if", "not", "searches", "in", "data_path", "for", "it", "." ]
python
train
google/transitfeed
gtfsscheduleviewer/marey_graph.py
https://github.com/google/transitfeed/blob/eb2991a3747ba541b2cb66502b305b6304a1f85f/gtfsscheduleviewer/marey_graph.py#L196-L213
def _BuildStations(self, stoplist): """Dispatches the best algorithm for calculating station line position. Args: # Class Stop is defined in transitfeed.py stoplist: [Stop, Stop, ...] # Class Trip is defined in transitfeed.py triplist: [Trip, Trip, ...] Returns: # One integer...
[ "def", "_BuildStations", "(", "self", ",", "stoplist", ")", ":", "stations", "=", "[", "]", "dists", "=", "self", ".", "_EuclidianDistances", "(", "stoplist", ")", "stations", "=", "self", ".", "_CalculateYLines", "(", "dists", ")", "return", "stations" ]
Dispatches the best algorithm for calculating station line position. Args: # Class Stop is defined in transitfeed.py stoplist: [Stop, Stop, ...] # Class Trip is defined in transitfeed.py triplist: [Trip, Trip, ...] Returns: # One integer y-coordinate for each station normalized b...
[ "Dispatches", "the", "best", "algorithm", "for", "calculating", "station", "line", "position", "." ]
python
train
boto/s3transfer
s3transfer/futures.py
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/futures.py#L301-L326
def submit(self, executor, task, tag=None): """Submits a task to a provided executor :type executor: s3transfer.futures.BoundedExecutor :param executor: The executor to submit the callable to :type task: s3transfer.tasks.Task :param task: The task to submit to the executor ...
[ "def", "submit", "(", "self", ",", "executor", ",", "task", ",", "tag", "=", "None", ")", ":", "logger", ".", "debug", "(", "\"Submitting task %s to executor %s for transfer request: %s.\"", "%", "(", "task", ",", "executor", ",", "self", ".", "transfer_id", "...
Submits a task to a provided executor :type executor: s3transfer.futures.BoundedExecutor :param executor: The executor to submit the callable to :type task: s3transfer.tasks.Task :param task: The task to submit to the executor :type tag: s3transfer.futures.TaskTag :par...
[ "Submits", "a", "task", "to", "a", "provided", "executor" ]
python
test
google/grr
grr/server/grr_response_server/gui/api_plugins/vfs.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_plugins/vfs.py#L117-L167
def InitFromAff4Object(self, aff4_obj, aff4_cls, attr_blacklist): """Initializes the current instance from an Aff4Object. Iterates over all attributes of the Aff4Object defined by a given class and adds a representation of them to the current instance. Args: aff4_obj: An Aff4Object to take the a...
[ "def", "InitFromAff4Object", "(", "self", ",", "aff4_obj", ",", "aff4_cls", ",", "attr_blacklist", ")", ":", "self", ".", "name", "=", "str", "(", "aff4_cls", ".", "__name__", ")", "self", ".", "attributes", "=", "[", "]", "schema", "=", "aff4_cls", ".",...
Initializes the current instance from an Aff4Object. Iterates over all attributes of the Aff4Object defined by a given class and adds a representation of them to the current instance. Args: aff4_obj: An Aff4Object to take the attributes from. aff4_cls: A class in the inheritance hierarchy of t...
[ "Initializes", "the", "current", "instance", "from", "an", "Aff4Object", "." ]
python
train
CellProfiler/centrosome
centrosome/cpmorphology.py
https://github.com/CellProfiler/centrosome/blob/7bd9350a2d4ae1b215b81eabcecfe560bbb1f32a/centrosome/cpmorphology.py#L2063-L2081
def distance2_to_line(pt, l0, l1): '''The perpendicular distance squared from a point to a line pt - point in question l0 - one point on the line l1 - another point on the line ''' pt = np.atleast_1d(pt) l0 = np.atleast_1d(l0) l1 = np.atleast_1d(l1) reshape = pt.ndim == 1 if...
[ "def", "distance2_to_line", "(", "pt", ",", "l0", ",", "l1", ")", ":", "pt", "=", "np", ".", "atleast_1d", "(", "pt", ")", "l0", "=", "np", ".", "atleast_1d", "(", "l0", ")", "l1", "=", "np", ".", "atleast_1d", "(", "l1", ")", "reshape", "=", "...
The perpendicular distance squared from a point to a line pt - point in question l0 - one point on the line l1 - another point on the line
[ "The", "perpendicular", "distance", "squared", "from", "a", "point", "to", "a", "line", "pt", "-", "point", "in", "question", "l0", "-", "one", "point", "on", "the", "line", "l1", "-", "another", "point", "on", "the", "line" ]
python
train
junzis/pyModeS
pyModeS/extra/aero.py
https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/extra/aero.py#L85-L109
def distance(lat1, lon1, lat2, lon2, H=0): """ Compute spherical distance from spherical coordinates. For two locations in spherical coordinates (1, theta, phi) and (1, theta', phi') cosine( arc length ) = sin phi sin phi' cos(theta-theta') + cos phi cos phi' distance = rho * arc length ...
[ "def", "distance", "(", "lat1", ",", "lon1", ",", "lat2", ",", "lon2", ",", "H", "=", "0", ")", ":", "# phi = 90 - latitude", "phi1", "=", "np", ".", "radians", "(", "90.0", "-", "lat1", ")", "phi2", "=", "np", ".", "radians", "(", "90.0", "-", "...
Compute spherical distance from spherical coordinates. For two locations in spherical coordinates (1, theta, phi) and (1, theta', phi') cosine( arc length ) = sin phi sin phi' cos(theta-theta') + cos phi cos phi' distance = rho * arc length
[ "Compute", "spherical", "distance", "from", "spherical", "coordinates", "." ]
python
train
wright-group/WrightTools
WrightTools/data/_data.py
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_data.py#L1460-L1529
def rename_variables(self, *, implied=True, verbose=True, **kwargs): """Rename a set of variables. Parameters ---------- kwargs Keyword arguments of the form current:'new'. implied : boolean (optional) Toggle inclusion of other variables that start with t...
[ "def", "rename_variables", "(", "self", ",", "*", ",", "implied", "=", "True", ",", "verbose", "=", "True", ",", "*", "*", "kwargs", ")", ":", "# find all of the implied variables", "kwargs", "=", "collections", ".", "OrderedDict", "(", "kwargs", ")", "if", ...
Rename a set of variables. Parameters ---------- kwargs Keyword arguments of the form current:'new'. implied : boolean (optional) Toggle inclusion of other variables that start with the same name. Default is True. verbose : boolean (optional) ...
[ "Rename", "a", "set", "of", "variables", "." ]
python
train
numenta/nupic
src/nupic/frameworks/opf/prediction_metrics_manager.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/prediction_metrics_manager.py#L159-L174
def getMetrics(self): """ Gets the current metric values :returns: (dict) where each key is the metric-name, and the values are it scalar value. Same as the output of :meth:`~nupic.frameworks.opf.prediction_metrics_manager.MetricsManager.update` """ result = {} f...
[ "def", "getMetrics", "(", "self", ")", ":", "result", "=", "{", "}", "for", "metricObj", ",", "label", "in", "zip", "(", "self", ".", "__metrics", ",", "self", ".", "__metricLabels", ")", ":", "value", "=", "metricObj", ".", "getMetric", "(", ")", "r...
Gets the current metric values :returns: (dict) where each key is the metric-name, and the values are it scalar value. Same as the output of :meth:`~nupic.frameworks.opf.prediction_metrics_manager.MetricsManager.update`
[ "Gets", "the", "current", "metric", "values" ]
python
valid
cjdrake/pyeda
pyeda/boolalg/expr.py
https://github.com/cjdrake/pyeda/blob/554ee53aa678f4b61bcd7e07ba2c74ddc749d665/pyeda/boolalg/expr.py#L422-L431
def Xnor(*xs, simplify=True): """Expression exclusive nor (XNOR) operator If *simplify* is ``True``, return a simplified expression. """ xs = [Expression.box(x).node for x in xs] y = exprnode.not_(exprnode.xor(*xs)) if simplify: y = y.simplify() return _expr(y)
[ "def", "Xnor", "(", "*", "xs", ",", "simplify", "=", "True", ")", ":", "xs", "=", "[", "Expression", ".", "box", "(", "x", ")", ".", "node", "for", "x", "in", "xs", "]", "y", "=", "exprnode", ".", "not_", "(", "exprnode", ".", "xor", "(", "*"...
Expression exclusive nor (XNOR) operator If *simplify* is ``True``, return a simplified expression.
[ "Expression", "exclusive", "nor", "(", "XNOR", ")", "operator" ]
python
train
h2oai/h2o-3
h2o-py/h2o/backend/cluster.py
https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/backend/cluster.py#L34-L48
def from_kvs(keyvals): """ Create H2OCluster object from a list of key-value pairs. TODO: This method should be moved into the base H2OResponse class. """ obj = H2OCluster() obj._retrieved_at = time.time() for k, v in keyvals: if k in {"__meta", "_exc...
[ "def", "from_kvs", "(", "keyvals", ")", ":", "obj", "=", "H2OCluster", "(", ")", "obj", ".", "_retrieved_at", "=", "time", ".", "time", "(", ")", "for", "k", ",", "v", "in", "keyvals", ":", "if", "k", "in", "{", "\"__meta\"", ",", "\"_exclude_fields\...
Create H2OCluster object from a list of key-value pairs. TODO: This method should be moved into the base H2OResponse class.
[ "Create", "H2OCluster", "object", "from", "a", "list", "of", "key", "-", "value", "pairs", "." ]
python
test
fudge-py/fudge
fudge/patcher.py
https://github.com/fudge-py/fudge/blob/b283fbc1a41900f3f5845b10b8c2ef9136a67ebc/fudge/patcher.py#L328-L341
def restore(self): """Restore the saved value for the attribute of the object.""" if self.proxy_object is None: if self.getter: setattr(self.getter_class, self.attr_name, self.getter) elif self.is_local: setattr(self.orig_object, self.attr_name, se...
[ "def", "restore", "(", "self", ")", ":", "if", "self", ".", "proxy_object", "is", "None", ":", "if", "self", ".", "getter", ":", "setattr", "(", "self", ".", "getter_class", ",", "self", ".", "attr_name", ",", "self", ".", "getter", ")", "elif", "sel...
Restore the saved value for the attribute of the object.
[ "Restore", "the", "saved", "value", "for", "the", "attribute", "of", "the", "object", "." ]
python
train
jspricke/python-remind
remind.py
https://github.com/jspricke/python-remind/blob/dda2aa8fc20b87b9c9fcbca2b67bce73911d05d1/remind.py#L388-L418
def _gen_msg(vevent, label, tail, sep): """Generate a Remind MSG from the given vevent. Opposite of _gen_description() """ rem = ['MSG'] msg = [] if label: msg.append(label) if hasattr(vevent, 'summary') and vevent.summary.value: msg.appen...
[ "def", "_gen_msg", "(", "vevent", ",", "label", ",", "tail", ",", "sep", ")", ":", "rem", "=", "[", "'MSG'", "]", "msg", "=", "[", "]", "if", "label", ":", "msg", ".", "append", "(", "label", ")", "if", "hasattr", "(", "vevent", ",", "'summary'",...
Generate a Remind MSG from the given vevent. Opposite of _gen_description()
[ "Generate", "a", "Remind", "MSG", "from", "the", "given", "vevent", ".", "Opposite", "of", "_gen_description", "()" ]
python
train
PyHDI/Pyverilog
pyverilog/vparser/parser.py
https://github.com/PyHDI/Pyverilog/blob/b852cc5ed6a7a2712e33639f9d9782d0d1587a53/pyverilog/vparser/parser.py#L932-L935
def p_expression_unot(self, p): 'expression : NOT expression %prec UNOT' p[0] = Unot(p[2], lineno=p.lineno(1)) p.set_lineno(0, p.lineno(1))
[ "def", "p_expression_unot", "(", "self", ",", "p", ")", ":", "p", "[", "0", "]", "=", "Unot", "(", "p", "[", "2", "]", ",", "lineno", "=", "p", ".", "lineno", "(", "1", ")", ")", "p", ".", "set_lineno", "(", "0", ",", "p", ".", "lineno", "(...
expression : NOT expression %prec UNOT
[ "expression", ":", "NOT", "expression", "%prec", "UNOT" ]
python
train
GemHQ/round-py
round/applications.py
https://github.com/GemHQ/round-py/blob/d0838f849cd260b1eb5df67ed3c6f2fe56c91c21/round/applications.py#L107-L111
def get_wallets(self, fetch=False): """Return this Applications's wallets object, populating it if fetch is True.""" return Wallets( self.resource.wallets, self.client, populate=fetch, application=self)
[ "def", "get_wallets", "(", "self", ",", "fetch", "=", "False", ")", ":", "return", "Wallets", "(", "self", ".", "resource", ".", "wallets", ",", "self", ".", "client", ",", "populate", "=", "fetch", ",", "application", "=", "self", ")" ]
Return this Applications's wallets object, populating it if fetch is True.
[ "Return", "this", "Applications", "s", "wallets", "object", "populating", "it", "if", "fetch", "is", "True", "." ]
python
train
jay-johnson/spylunking
spylunking/splunk_publisher.py
https://github.com/jay-johnson/spylunking/blob/95cc86776f04ec5935cf04e291cf18798345d6cb/spylunking/splunk_publisher.py#L736-L742
def close( self): """close""" self.debug_log('close - start') self.shutdown() logging.Handler.close(self) self.debug_log('close - done')
[ "def", "close", "(", "self", ")", ":", "self", ".", "debug_log", "(", "'close - start'", ")", "self", ".", "shutdown", "(", ")", "logging", ".", "Handler", ".", "close", "(", "self", ")", "self", ".", "debug_log", "(", "'close - done'", ")" ]
close
[ "close" ]
python
train
kgori/treeCl
treeCl/partition.py
https://github.com/kgori/treeCl/blob/fed624b3db1c19cc07175ca04e3eda6905a8d305/treeCl/partition.py#L133-L152
def random(cls, alpha, size): """ Generate a random start using expected proportions, alpha. These are used to parameterise a random draw from a Dirichlet distribution. An example, to split a dataset of 20 items into 3 groups of [10, 6, 4] items: - alpha = [10, 6...
[ "def", "random", "(", "cls", ",", "alpha", ",", "size", ")", ":", "props", "=", "np", ".", "concatenate", "(", "[", "[", "0", "]", ",", "(", "scipy", ".", "stats", ".", "dirichlet", ".", "rvs", "(", "alpha", ")", "*", "size", ")", ".", "cumsum"...
Generate a random start using expected proportions, alpha. These are used to parameterise a random draw from a Dirichlet distribution. An example, to split a dataset of 20 items into 3 groups of [10, 6, 4] items: - alpha = [10, 6, 4], - alpha = [100, 60, 40], -...
[ "Generate", "a", "random", "start", "using", "expected", "proportions", "alpha", ".", "These", "are", "used", "to", "parameterise", "a", "random", "draw", "from", "a", "Dirichlet", "distribution", ".", "An", "example", "to", "split", "a", "dataset", "of", "2...
python
train
PolyJIT/benchbuild
benchbuild/utils/run.py
https://github.com/PolyJIT/benchbuild/blob/9ad2ec54d96e97b642b1f06eddcbad9ba7aeaf58/benchbuild/utils/run.py#L338-L365
def in_builddir(sub='.'): """ Decorate a project phase with a local working directory change. Args: sub: An optional subdirectory to change into. """ from functools import wraps def wrap_in_builddir(func): """Wrap the function for the new build directory.""" @wraps(fun...
[ "def", "in_builddir", "(", "sub", "=", "'.'", ")", ":", "from", "functools", "import", "wraps", "def", "wrap_in_builddir", "(", "func", ")", ":", "\"\"\"Wrap the function for the new build directory.\"\"\"", "@", "wraps", "(", "func", ")", "def", "wrap_in_builddir_f...
Decorate a project phase with a local working directory change. Args: sub: An optional subdirectory to change into.
[ "Decorate", "a", "project", "phase", "with", "a", "local", "working", "directory", "change", "." ]
python
train
numenta/nupic
src/nupic/frameworks/opf/opf_task_driver.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/opf_task_driver.py#L428-L441
def advance(self): """ Advances the iteration; Returns: True if more iterations remain; False if this is the final iteration. """ hasMore = True try: self.__iter.next() except StopIteration: self.__iter = None hasMore = False return hasMore
[ "def", "advance", "(", "self", ")", ":", "hasMore", "=", "True", "try", ":", "self", ".", "__iter", ".", "next", "(", ")", "except", "StopIteration", ":", "self", ".", "__iter", "=", "None", "hasMore", "=", "False", "return", "hasMore" ]
Advances the iteration; Returns: True if more iterations remain; False if this is the final iteration.
[ "Advances", "the", "iteration", ";" ]
python
valid
markchil/gptools
gptools/utils.py
https://github.com/markchil/gptools/blob/225db52bfe6baef1516529ad22177aa2cf7b71e4/gptools/utils.py#L2616-L2752
def plot_sampler_cov( sampler, method='corr', weights=None, cutoff_weight=None, labels=None, burn=0, chain_mask=None, temp_idx=0, cbar_label=None, title='', rot_x_labels=False, figsize=None, xlabel_on_top=True ): """Make a plot of the sampler's correlation or covariance matrix. ...
[ "def", "plot_sampler_cov", "(", "sampler", ",", "method", "=", "'corr'", ",", "weights", "=", "None", ",", "cutoff_weight", "=", "None", ",", "labels", "=", "None", ",", "burn", "=", "0", ",", "chain_mask", "=", "None", ",", "temp_idx", "=", "0", ",", ...
Make a plot of the sampler's correlation or covariance matrix. Returns the figure and axis created. Parameters ---------- sampler : :py:class:`emcee.Sampler` instance or array, (`n_temps`, `n_chains`, `n_samp`, `n_dim`), (`n_chains`, `n_samp`, `n_dim`) or (`n_samp`, `n_dim`) The sample...
[ "Make", "a", "plot", "of", "the", "sampler", "s", "correlation", "or", "covariance", "matrix", ".", "Returns", "the", "figure", "and", "axis", "created", ".", "Parameters", "----------", "sampler", ":", ":", "py", ":", "class", ":", "emcee", ".", "Sampler"...
python
train
DinoTools/python-overpy
overpy/__init__.py
https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L1584-L1589
def _handle_end_relation(self): """ Handle closing relation element """ self._result.append(Relation(result=self._result, **self._curr)) self._curr = {}
[ "def", "_handle_end_relation", "(", "self", ")", ":", "self", ".", "_result", ".", "append", "(", "Relation", "(", "result", "=", "self", ".", "_result", ",", "*", "*", "self", ".", "_curr", ")", ")", "self", ".", "_curr", "=", "{", "}" ]
Handle closing relation element
[ "Handle", "closing", "relation", "element" ]
python
train
scikit-tda/kepler-mapper
kmapper/jupyter.py
https://github.com/scikit-tda/kepler-mapper/blob/d4ed39f6392b0a134dd573d7d9c4aa65fbef3a7d/kmapper/jupyter.py#L11-L61
def display(path_html="mapper_visualization_output.html"): """ Displays a html file inside a Jupyter Notebook output cell. .. note:: Must run ``KeplerMapper.visualize`` first to generate html. This function will then render that output from a file saved to disk. .....
[ "def", "display", "(", "path_html", "=", "\"mapper_visualization_output.html\"", ")", ":", "iframe", "=", "(", "\"<iframe src=\"", "+", "path_html", "+", "' width=100%% height=800 frameBorder=\"0\"></iframe>'", ")", "IPython", ".", "core", ".", "display", ".", "display"...
Displays a html file inside a Jupyter Notebook output cell. .. note:: Must run ``KeplerMapper.visualize`` first to generate html. This function will then render that output from a file saved to disk. .. note:: Thanks to `smartinsightsfromdata <https://gith...
[ "Displays", "a", "html", "file", "inside", "a", "Jupyter", "Notebook", "output", "cell", ".", "..", "note", "::", "Must", "run", "KeplerMapper", ".", "visualize", "first", "to", "generate", "html", ".", "This", "function", "will", "then", "render", "that", ...
python
train
bitpay/bitpay-python
bitpay/client.py
https://github.com/bitpay/bitpay-python/blob/3f456118bef1c460adf5d4d5546f38dac1e2a5cc/bitpay/client.py#L85-L94
def verify_invoice_params(self, price, currency): """ Deprecated, will be made private in 2.4 """ if re.match("^[A-Z]{3,3}$", currency) is None: raise BitPayArgumentError("Currency is invalid.") try: float(price) except: raise BitPayArgumentError("Price must be formatted as a ...
[ "def", "verify_invoice_params", "(", "self", ",", "price", ",", "currency", ")", ":", "if", "re", ".", "match", "(", "\"^[A-Z]{3,3}$\"", ",", "currency", ")", "is", "None", ":", "raise", "BitPayArgumentError", "(", "\"Currency is invalid.\"", ")", "try", ":", ...
Deprecated, will be made private in 2.4
[ "Deprecated", "will", "be", "made", "private", "in", "2", ".", "4" ]
python
train
klmitch/aversion
aversion.py
https://github.com/klmitch/aversion/blob/90ca68e7d6426a77db8a926171f8d3bbeb00ee4c/aversion.py#L696-L734
def _proc_ctype_header(self, request, result): """ Process the Content-Type header rules for the request. Only the desired API version can be determined from those rules. :param request: The Request object provided by WebOb. :param result: The Result object to store the results...
[ "def", "_proc_ctype_header", "(", "self", ",", "request", ",", "result", ")", ":", "if", "result", ":", "# Result has already been fully determined", "return", "try", ":", "ctype", "=", "request", ".", "headers", "[", "'content-type'", "]", "except", "KeyError", ...
Process the Content-Type header rules for the request. Only the desired API version can be determined from those rules. :param request: The Request object provided by WebOb. :param result: The Result object to store the results in.
[ "Process", "the", "Content", "-", "Type", "header", "rules", "for", "the", "request", ".", "Only", "the", "desired", "API", "version", "can", "be", "determined", "from", "those", "rules", "." ]
python
train
SBRG/ssbio
ssbio/utils.py
https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/utils.py#L889-L926
def remap( x, oMin, oMax, nMin, nMax ): """Map to a 0 to 1 scale http://stackoverflow.com/questions/929103/convert-a-number-range-to-another-range-maintaining-ratio """ #range check if oMin == oMax: log.warning("Zero input range, unable to rescale") return x if nMin == nMa...
[ "def", "remap", "(", "x", ",", "oMin", ",", "oMax", ",", "nMin", ",", "nMax", ")", ":", "#range check", "if", "oMin", "==", "oMax", ":", "log", ".", "warning", "(", "\"Zero input range, unable to rescale\"", ")", "return", "x", "if", "nMin", "==", "nMax"...
Map to a 0 to 1 scale http://stackoverflow.com/questions/929103/convert-a-number-range-to-another-range-maintaining-ratio
[ "Map", "to", "a", "0", "to", "1", "scale", "http", ":", "//", "stackoverflow", ".", "com", "/", "questions", "/", "929103", "/", "convert", "-", "a", "-", "number", "-", "range", "-", "to", "-", "another", "-", "range", "-", "maintaining", "-", "ra...
python
train
sethmlarson/virtualbox-python
virtualbox/library.py
https://github.com/sethmlarson/virtualbox-python/blob/706c8e3f6e3aee17eb06458e73cbb4bc2d37878b/virtualbox/library.py#L28530-L28540
def on_cpu_execution_cap_change(self, execution_cap): """Notification when the CPU execution cap changes. in execution_cap of type int The new CPU execution cap value. (1-100) """ if not isinstance(execution_cap, baseinteger): raise TypeError("execution_cap can ...
[ "def", "on_cpu_execution_cap_change", "(", "self", ",", "execution_cap", ")", ":", "if", "not", "isinstance", "(", "execution_cap", ",", "baseinteger", ")", ":", "raise", "TypeError", "(", "\"execution_cap can only be an instance of type baseinteger\"", ")", "self", "."...
Notification when the CPU execution cap changes. in execution_cap of type int The new CPU execution cap value. (1-100)
[ "Notification", "when", "the", "CPU", "execution", "cap", "changes", "." ]
python
train