repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
cga-harvard/Hypermap-Registry
hypermap/aggregator/models.py
service_post_save
def service_post_save(instance, *args, **kwargs): """ Used to do a service full check when saving it. """ # check service if instance.is_monitored and settings.REGISTRY_SKIP_CELERY: check_service(instance.id) elif instance.is_monitored: check_service.delay(instance.id)
python
def service_post_save(instance, *args, **kwargs): """ Used to do a service full check when saving it. """ # check service if instance.is_monitored and settings.REGISTRY_SKIP_CELERY: check_service(instance.id) elif instance.is_monitored: check_service.delay(instance.id)
[ "def", "service_post_save", "(", "instance", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# check service", "if", "instance", ".", "is_monitored", "and", "settings", ".", "REGISTRY_SKIP_CELERY", ":", "check_service", "(", "instance", ".", "id", ")", ...
Used to do a service full check when saving it.
[ "Used", "to", "do", "a", "service", "full", "check", "when", "saving", "it", "." ]
899a5385b15af7fba190ab4fae1d41e47d155a1b
https://github.com/cga-harvard/Hypermap-Registry/blob/899a5385b15af7fba190ab4fae1d41e47d155a1b/hypermap/aggregator/models.py#L1871-L1880
train
cga-harvard/Hypermap-Registry
hypermap/aggregator/models.py
layer_pre_save
def layer_pre_save(instance, *args, **kwargs): """ Used to check layer validity. """ is_valid = True # we do not need to check validity for WM layers if not instance.service.type == 'Hypermap:WorldMap': # 0. a layer is invalid if its service its invalid as well if not instance...
python
def layer_pre_save(instance, *args, **kwargs): """ Used to check layer validity. """ is_valid = True # we do not need to check validity for WM layers if not instance.service.type == 'Hypermap:WorldMap': # 0. a layer is invalid if its service its invalid as well if not instance...
[ "def", "layer_pre_save", "(", "instance", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "is_valid", "=", "True", "# we do not need to check validity for WM layers", "if", "not", "instance", ".", "service", ".", "type", "==", "'Hypermap:WorldMap'", ":", "#...
Used to check layer validity.
[ "Used", "to", "check", "layer", "validity", "." ]
899a5385b15af7fba190ab4fae1d41e47d155a1b
https://github.com/cga-harvard/Hypermap-Registry/blob/899a5385b15af7fba190ab4fae1d41e47d155a1b/hypermap/aggregator/models.py#L1883-L1905
train
cga-harvard/Hypermap-Registry
hypermap/aggregator/models.py
layer_post_save
def layer_post_save(instance, *args, **kwargs): """ Used to do a layer full check when saving it. """ if instance.is_monitored and instance.service.is_monitored: # index and monitor if not settings.REGISTRY_SKIP_CELERY: check_layer.delay(instance.id) else: check_...
python
def layer_post_save(instance, *args, **kwargs): """ Used to do a layer full check when saving it. """ if instance.is_monitored and instance.service.is_monitored: # index and monitor if not settings.REGISTRY_SKIP_CELERY: check_layer.delay(instance.id) else: check_...
[ "def", "layer_post_save", "(", "instance", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "instance", ".", "is_monitored", "and", "instance", ".", "service", ".", "is_monitored", ":", "# index and monitor", "if", "not", "settings", ".", "REGISTRY...
Used to do a layer full check when saving it.
[ "Used", "to", "do", "a", "layer", "full", "check", "when", "saving", "it", "." ]
899a5385b15af7fba190ab4fae1d41e47d155a1b
https://github.com/cga-harvard/Hypermap-Registry/blob/899a5385b15af7fba190ab4fae1d41e47d155a1b/hypermap/aggregator/models.py#L1908-L1918
train
cga-harvard/Hypermap-Registry
hypermap/aggregator/models.py
issue_post_delete
def issue_post_delete(instance, *args, **kwargs): """ Used to do reindex layers/services when a issue is removed form them. """ LOGGER.debug('Re-adding layer/service to search engine index') if isinstance(instance.content_object, Service): if not settings.REGISTRY_SKIP_CELERY: in...
python
def issue_post_delete(instance, *args, **kwargs): """ Used to do reindex layers/services when a issue is removed form them. """ LOGGER.debug('Re-adding layer/service to search engine index') if isinstance(instance.content_object, Service): if not settings.REGISTRY_SKIP_CELERY: in...
[ "def", "issue_post_delete", "(", "instance", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "LOGGER", ".", "debug", "(", "'Re-adding layer/service to search engine index'", ")", "if", "isinstance", "(", "instance", ".", "content_object", ",", "Service", ")...
Used to do reindex layers/services when a issue is removed form them.
[ "Used", "to", "do", "reindex", "layers", "/", "services", "when", "a", "issue", "is", "removed", "form", "them", "." ]
899a5385b15af7fba190ab4fae1d41e47d155a1b
https://github.com/cga-harvard/Hypermap-Registry/blob/899a5385b15af7fba190ab4fae1d41e47d155a1b/hypermap/aggregator/models.py#L1921-L1935
train
cga-harvard/Hypermap-Registry
hypermap/aggregator/models.py
Resource.get_checks_admin_reliability_warning_url
def get_checks_admin_reliability_warning_url(self): """ When service Realiability is going down users should go to the the check history to find problem causes. :return: admin url with check list for this instance """ # TODO: cache this. path = self.get_checks_adm...
python
def get_checks_admin_reliability_warning_url(self): """ When service Realiability is going down users should go to the the check history to find problem causes. :return: admin url with check list for this instance """ # TODO: cache this. path = self.get_checks_adm...
[ "def", "get_checks_admin_reliability_warning_url", "(", "self", ")", ":", "# TODO: cache this.", "path", "=", "self", ".", "get_checks_admin_url", "(", ")", "content_type", "=", "ContentType", ".", "objects", ".", "get_for_model", "(", "self", ")", "params", "=", ...
When service Realiability is going down users should go to the the check history to find problem causes. :return: admin url with check list for this instance
[ "When", "service", "Realiability", "is", "going", "down", "users", "should", "go", "to", "the", "the", "check", "history", "to", "find", "problem", "causes", ".", ":", "return", ":", "admin", "url", "with", "check", "list", "for", "this", "instance" ]
899a5385b15af7fba190ab4fae1d41e47d155a1b
https://github.com/cga-harvard/Hypermap-Registry/blob/899a5385b15af7fba190ab4fae1d41e47d155a1b/hypermap/aggregator/models.py#L261-L275
train
cga-harvard/Hypermap-Registry
hypermap/aggregator/models.py
Service.update_layers
def update_layers(self): """ Update layers for a service. """ signals.post_save.disconnect(layer_post_save, sender=Layer) try: LOGGER.debug('Updating layers for service id %s' % self.id) if self.type == 'OGC:WMS': update_layers_wms(self) ...
python
def update_layers(self): """ Update layers for a service. """ signals.post_save.disconnect(layer_post_save, sender=Layer) try: LOGGER.debug('Updating layers for service id %s' % self.id) if self.type == 'OGC:WMS': update_layers_wms(self) ...
[ "def", "update_layers", "(", "self", ")", ":", "signals", ".", "post_save", ".", "disconnect", "(", "layer_post_save", ",", "sender", "=", "Layer", ")", "try", ":", "LOGGER", ".", "debug", "(", "'Updating layers for service id %s'", "%", "self", ".", "id", "...
Update layers for a service.
[ "Update", "layers", "for", "a", "service", "." ]
899a5385b15af7fba190ab4fae1d41e47d155a1b
https://github.com/cga-harvard/Hypermap-Registry/blob/899a5385b15af7fba190ab4fae1d41e47d155a1b/hypermap/aggregator/models.py#L309-L336
train
cga-harvard/Hypermap-Registry
hypermap/aggregator/models.py
Service.check_available
def check_available(self): """ Check for availability of a service and provide run metrics. """ success = True start_time = datetime.datetime.utcnow() message = '' LOGGER.debug('Checking service id %s' % self.id) try: title = None ...
python
def check_available(self): """ Check for availability of a service and provide run metrics. """ success = True start_time = datetime.datetime.utcnow() message = '' LOGGER.debug('Checking service id %s' % self.id) try: title = None ...
[ "def", "check_available", "(", "self", ")", ":", "success", "=", "True", "start_time", "=", "datetime", ".", "datetime", ".", "utcnow", "(", ")", "message", "=", "''", "LOGGER", ".", "debug", "(", "'Checking service id %s'", "%", "self", ".", "id", ")", ...
Check for availability of a service and provide run metrics.
[ "Check", "for", "availability", "of", "a", "service", "and", "provide", "run", "metrics", "." ]
899a5385b15af7fba190ab4fae1d41e47d155a1b
https://github.com/cga-harvard/Hypermap-Registry/blob/899a5385b15af7fba190ab4fae1d41e47d155a1b/hypermap/aggregator/models.py#L338-L453
train
cga-harvard/Hypermap-Registry
hypermap/aggregator/models.py
Service.update_validity
def update_validity(self): """ Update validity of a service. """ # WM is always valid if self.type == 'Hypermap:WorldMap': return signals.post_save.disconnect(service_post_save, sender=Service) try: # some service now must be considered...
python
def update_validity(self): """ Update validity of a service. """ # WM is always valid if self.type == 'Hypermap:WorldMap': return signals.post_save.disconnect(service_post_save, sender=Service) try: # some service now must be considered...
[ "def", "update_validity", "(", "self", ")", ":", "# WM is always valid", "if", "self", ".", "type", "==", "'Hypermap:WorldMap'", ":", "return", "signals", ".", "post_save", ".", "disconnect", "(", "service_post_save", ",", "sender", "=", "Service", ")", "try", ...
Update validity of a service.
[ "Update", "validity", "of", "a", "service", "." ]
899a5385b15af7fba190ab4fae1d41e47d155a1b
https://github.com/cga-harvard/Hypermap-Registry/blob/899a5385b15af7fba190ab4fae1d41e47d155a1b/hypermap/aggregator/models.py#L455-L497
train
cga-harvard/Hypermap-Registry
hypermap/aggregator/models.py
Catalog.get_search_url
def get_search_url(self): """ resolve the search url no matter if local or remote. :return: url or exception """ if self.is_remote: return self.url return reverse('search_api', args=[self.slug])
python
def get_search_url(self): """ resolve the search url no matter if local or remote. :return: url or exception """ if self.is_remote: return self.url return reverse('search_api', args=[self.slug])
[ "def", "get_search_url", "(", "self", ")", ":", "if", "self", ".", "is_remote", ":", "return", "self", ".", "url", "return", "reverse", "(", "'search_api'", ",", "args", "=", "[", "self", ".", "slug", "]", ")" ]
resolve the search url no matter if local or remote. :return: url or exception
[ "resolve", "the", "search", "url", "no", "matter", "if", "local", "or", "remote", ".", ":", "return", ":", "url", "or", "exception" ]
899a5385b15af7fba190ab4fae1d41e47d155a1b
https://github.com/cga-harvard/Hypermap-Registry/blob/899a5385b15af7fba190ab4fae1d41e47d155a1b/hypermap/aggregator/models.py#L525-L534
train
cga-harvard/Hypermap-Registry
hypermap/aggregator/models.py
Layer.get_url_endpoint
def get_url_endpoint(self): """ Returns the Hypermap endpoint for a layer. This endpoint will be the WMTS MapProxy endpoint, only for WM we use the original endpoint. """ endpoint = self.url if self.type not in ('Hypermap:WorldMap',): endpoint = 'registry/%s/l...
python
def get_url_endpoint(self): """ Returns the Hypermap endpoint for a layer. This endpoint will be the WMTS MapProxy endpoint, only for WM we use the original endpoint. """ endpoint = self.url if self.type not in ('Hypermap:WorldMap',): endpoint = 'registry/%s/l...
[ "def", "get_url_endpoint", "(", "self", ")", ":", "endpoint", "=", "self", ".", "url", "if", "self", ".", "type", "not", "in", "(", "'Hypermap:WorldMap'", ",", ")", ":", "endpoint", "=", "'registry/%s/layer/%s/map/wmts/1.0.0/WMTSCapabilities.xml'", "%", "(", "se...
Returns the Hypermap endpoint for a layer. This endpoint will be the WMTS MapProxy endpoint, only for WM we use the original endpoint.
[ "Returns", "the", "Hypermap", "endpoint", "for", "a", "layer", ".", "This", "endpoint", "will", "be", "the", "WMTS", "MapProxy", "endpoint", "only", "for", "WM", "we", "use", "the", "original", "endpoint", "." ]
899a5385b15af7fba190ab4fae1d41e47d155a1b
https://github.com/cga-harvard/Hypermap-Registry/blob/899a5385b15af7fba190ab4fae1d41e47d155a1b/hypermap/aggregator/models.py#L573-L584
train
cga-harvard/Hypermap-Registry
hypermap/aggregator/models.py
Layer.check_available
def check_available(self): """ Check for availability of a layer and provide run metrics. """ success = True start_time = datetime.datetime.utcnow() message = '' LOGGER.debug('Checking layer id %s' % self.id) signals.post_save.disconnect(layer_post_save, ...
python
def check_available(self): """ Check for availability of a layer and provide run metrics. """ success = True start_time = datetime.datetime.utcnow() message = '' LOGGER.debug('Checking layer id %s' % self.id) signals.post_save.disconnect(layer_post_save, ...
[ "def", "check_available", "(", "self", ")", ":", "success", "=", "True", "start_time", "=", "datetime", ".", "datetime", ".", "utcnow", "(", ")", "message", "=", "''", "LOGGER", ".", "debug", "(", "'Checking layer id %s'", "%", "self", ".", "id", ")", "s...
Check for availability of a layer and provide run metrics.
[ "Check", "for", "availability", "of", "a", "layer", "and", "provide", "run", "metrics", "." ]
899a5385b15af7fba190ab4fae1d41e47d155a1b
https://github.com/cga-harvard/Hypermap-Registry/blob/899a5385b15af7fba190ab4fae1d41e47d155a1b/hypermap/aggregator/models.py#L800-L837
train
cga-harvard/Hypermap-Registry
hypermap/aggregator/models.py
Layer.registry_tags
def registry_tags(self, query_string='{http://gis.harvard.edu/HHypermap/registry/0.1}property'): """ Get extra metadata tagged with a registry keyword. For example: <registry:property name="nomination/serviceOwner" value="True"/> <registry:property name="nominator/name" v...
python
def registry_tags(self, query_string='{http://gis.harvard.edu/HHypermap/registry/0.1}property'): """ Get extra metadata tagged with a registry keyword. For example: <registry:property name="nomination/serviceOwner" value="True"/> <registry:property name="nominator/name" v...
[ "def", "registry_tags", "(", "self", ",", "query_string", "=", "'{http://gis.harvard.edu/HHypermap/registry/0.1}property'", ")", ":", "from", "pycsw", ".", "core", ".", "etree", "import", "etree", "parsed", "=", "etree", ".", "fromstring", "(", "self", ".", "xml",...
Get extra metadata tagged with a registry keyword. For example: <registry:property name="nomination/serviceOwner" value="True"/> <registry:property name="nominator/name" value="Random Person"/> <registry:property name="nominator/email" value="contact@example.com"/> ...
[ "Get", "extra", "metadata", "tagged", "with", "a", "registry", "keyword", ".", "For", "example", ":", "<registry", ":", "property", "name", "=", "nomination", "/", "serviceOwner", "value", "=", "True", "/", ">", "<registry", ":", "property", "name", "=", "...
899a5385b15af7fba190ab4fae1d41e47d155a1b
https://github.com/cga-harvard/Hypermap-Registry/blob/899a5385b15af7fba190ab4fae1d41e47d155a1b/hypermap/aggregator/models.py#L839-L879
train
sethmlarson/trytravis
trytravis.py
_input_github_repo
def _input_github_repo(url=None): """ Grabs input from the user and saves it as their trytravis target repo """ if url is None: url = user_input('Input the URL of the GitHub repository ' 'to use as a `trytravis` repository: ') url = url.strip() http_match = _HTTPS_RE...
python
def _input_github_repo(url=None): """ Grabs input from the user and saves it as their trytravis target repo """ if url is None: url = user_input('Input the URL of the GitHub repository ' 'to use as a `trytravis` repository: ') url = url.strip() http_match = _HTTPS_RE...
[ "def", "_input_github_repo", "(", "url", "=", "None", ")", ":", "if", "url", "is", "None", ":", "url", "=", "user_input", "(", "'Input the URL of the GitHub repository '", "'to use as a `trytravis` repository: '", ")", "url", "=", "url", ".", "strip", "(", ")", ...
Grabs input from the user and saves it as their trytravis target repo
[ "Grabs", "input", "from", "the", "user", "and", "saves", "it", "as", "their", "trytravis", "target", "repo" ]
d92ed708fe71d8db93a6df8077d23ee39ec0364e
https://github.com/sethmlarson/trytravis/blob/d92ed708fe71d8db93a6df8077d23ee39ec0364e/trytravis.py#L86-L125
train
sethmlarson/trytravis
trytravis.py
_load_github_repo
def _load_github_repo(): """ Loads the GitHub repository from the users config. """ if 'TRAVIS' in os.environ: raise RuntimeError('Detected that we are running in Travis. ' 'Stopping to prevent infinite loops.') try: with open(os.path.join(config_dir, 'repo'), 'r')...
python
def _load_github_repo(): """ Loads the GitHub repository from the users config. """ if 'TRAVIS' in os.environ: raise RuntimeError('Detected that we are running in Travis. ' 'Stopping to prevent infinite loops.') try: with open(os.path.join(config_dir, 'repo'), 'r')...
[ "def", "_load_github_repo", "(", ")", ":", "if", "'TRAVIS'", "in", "os", ".", "environ", ":", "raise", "RuntimeError", "(", "'Detected that we are running in Travis. '", "'Stopping to prevent infinite loops.'", ")", "try", ":", "with", "open", "(", "os", ".", "path"...
Loads the GitHub repository from the users config.
[ "Loads", "the", "GitHub", "repository", "from", "the", "users", "config", "." ]
d92ed708fe71d8db93a6df8077d23ee39ec0364e
https://github.com/sethmlarson/trytravis/blob/d92ed708fe71d8db93a6df8077d23ee39ec0364e/trytravis.py#L128-L138
train
sethmlarson/trytravis
trytravis.py
_submit_changes_to_github_repo
def _submit_changes_to_github_repo(path, url): """ Temporarily commits local changes and submits them to the GitHub repository that the user has specified. Then reverts the changes to the git repository if a commit was necessary. """ try: repo = git.Repo(path) except Exception: r...
python
def _submit_changes_to_github_repo(path, url): """ Temporarily commits local changes and submits them to the GitHub repository that the user has specified. Then reverts the changes to the git repository if a commit was necessary. """ try: repo = git.Repo(path) except Exception: r...
[ "def", "_submit_changes_to_github_repo", "(", "path", ",", "url", ")", ":", "try", ":", "repo", "=", "git", ".", "Repo", "(", "path", ")", "except", "Exception", ":", "raise", "RuntimeError", "(", "'Couldn\\'t locate a repository at `%s`.'", "%", "path", ")", ...
Temporarily commits local changes and submits them to the GitHub repository that the user has specified. Then reverts the changes to the git repository if a commit was necessary.
[ "Temporarily", "commits", "local", "changes", "and", "submits", "them", "to", "the", "GitHub", "repository", "that", "the", "user", "has", "specified", ".", "Then", "reverts", "the", "changes", "to", "the", "git", "repository", "if", "a", "commit", "was", "n...
d92ed708fe71d8db93a6df8077d23ee39ec0364e
https://github.com/sethmlarson/trytravis/blob/d92ed708fe71d8db93a6df8077d23ee39ec0364e/trytravis.py#L141-L185
train
sethmlarson/trytravis
trytravis.py
_wait_for_travis_build
def _wait_for_travis_build(url, commit, committed_at): """ Waits for a Travis build to appear with the given commit SHA """ print('Waiting for a Travis build to appear ' 'for `%s` after `%s`...' % (commit, committed_at)) import requests slug = _slug_from_url(url) start_time = time.time() ...
python
def _wait_for_travis_build(url, commit, committed_at): """ Waits for a Travis build to appear with the given commit SHA """ print('Waiting for a Travis build to appear ' 'for `%s` after `%s`...' % (commit, committed_at)) import requests slug = _slug_from_url(url) start_time = time.time() ...
[ "def", "_wait_for_travis_build", "(", "url", ",", "commit", ",", "committed_at", ")", ":", "print", "(", "'Waiting for a Travis build to appear '", "'for `%s` after `%s`...'", "%", "(", "commit", ",", "committed_at", ")", ")", "import", "requests", "slug", "=", "_sl...
Waits for a Travis build to appear with the given commit SHA
[ "Waits", "for", "a", "Travis", "build", "to", "appear", "with", "the", "given", "commit", "SHA" ]
d92ed708fe71d8db93a6df8077d23ee39ec0364e
https://github.com/sethmlarson/trytravis/blob/d92ed708fe71d8db93a6df8077d23ee39ec0364e/trytravis.py#L188-L234
train
sethmlarson/trytravis
trytravis.py
_watch_travis_build
def _watch_travis_build(build_id): """ Watches and progressively outputs information about a given Travis build """ import requests try: build_size = None # type: int running = True while running: with requests.get('https://api.travis-ci.org/builds/%d' % build_id, ...
python
def _watch_travis_build(build_id): """ Watches and progressively outputs information about a given Travis build """ import requests try: build_size = None # type: int running = True while running: with requests.get('https://api.travis-ci.org/builds/%d' % build_id, ...
[ "def", "_watch_travis_build", "(", "build_id", ")", ":", "import", "requests", "try", ":", "build_size", "=", "None", "# type: int", "running", "=", "True", "while", "running", ":", "with", "requests", ".", "get", "(", "'https://api.travis-ci.org/builds/%d'", "%",...
Watches and progressively outputs information about a given Travis build
[ "Watches", "and", "progressively", "outputs", "information", "about", "a", "given", "Travis", "build" ]
d92ed708fe71d8db93a6df8077d23ee39ec0364e
https://github.com/sethmlarson/trytravis/blob/d92ed708fe71d8db93a6df8077d23ee39ec0364e/trytravis.py#L237-L286
train
sethmlarson/trytravis
trytravis.py
_travis_job_state
def _travis_job_state(state): """ Converts a Travis state into a state character, color, and whether it's still running or a stopped state. """ if state in [None, 'queued', 'created', 'received']: return colorama.Fore.YELLOW, '*', True elif state in ['started', 'running']: return coloram...
python
def _travis_job_state(state): """ Converts a Travis state into a state character, color, and whether it's still running or a stopped state. """ if state in [None, 'queued', 'created', 'received']: return colorama.Fore.YELLOW, '*', True elif state in ['started', 'running']: return coloram...
[ "def", "_travis_job_state", "(", "state", ")", ":", "if", "state", "in", "[", "None", ",", "'queued'", ",", "'created'", ",", "'received'", "]", ":", "return", "colorama", ".", "Fore", ".", "YELLOW", ",", "'*'", ",", "True", "elif", "state", "in", "[",...
Converts a Travis state into a state character, color, and whether it's still running or a stopped state.
[ "Converts", "a", "Travis", "state", "into", "a", "state", "character", "color", "and", "whether", "it", "s", "still", "running", "or", "a", "stopped", "state", "." ]
d92ed708fe71d8db93a6df8077d23ee39ec0364e
https://github.com/sethmlarson/trytravis/blob/d92ed708fe71d8db93a6df8077d23ee39ec0364e/trytravis.py#L289-L305
train
sethmlarson/trytravis
trytravis.py
_slug_from_url
def _slug_from_url(url): """ Parses a project slug out of either an HTTPS or SSH URL. """ http_match = _HTTPS_REGEX.match(url) ssh_match = _SSH_REGEX.match(url) if not http_match and not ssh_match: raise RuntimeError('Could not parse the URL (`%s`) ' 'for your reposito...
python
def _slug_from_url(url): """ Parses a project slug out of either an HTTPS or SSH URL. """ http_match = _HTTPS_REGEX.match(url) ssh_match = _SSH_REGEX.match(url) if not http_match and not ssh_match: raise RuntimeError('Could not parse the URL (`%s`) ' 'for your reposito...
[ "def", "_slug_from_url", "(", "url", ")", ":", "http_match", "=", "_HTTPS_REGEX", ".", "match", "(", "url", ")", "ssh_match", "=", "_SSH_REGEX", ".", "match", "(", "url", ")", "if", "not", "http_match", "and", "not", "ssh_match", ":", "raise", "RuntimeErro...
Parses a project slug out of either an HTTPS or SSH URL.
[ "Parses", "a", "project", "slug", "out", "of", "either", "an", "HTTPS", "or", "SSH", "URL", "." ]
d92ed708fe71d8db93a6df8077d23ee39ec0364e
https://github.com/sethmlarson/trytravis/blob/d92ed708fe71d8db93a6df8077d23ee39ec0364e/trytravis.py#L308-L318
train
sethmlarson/trytravis
trytravis.py
_version_string
def _version_string(): """ Gets the output for `trytravis --version`. """ platform_system = platform.system() if platform_system == 'Linux': os_name, os_version, _ = platform.dist() else: os_name = platform_system os_version = platform.version() python_version = platform.pyth...
python
def _version_string(): """ Gets the output for `trytravis --version`. """ platform_system = platform.system() if platform_system == 'Linux': os_name, os_version, _ = platform.dist() else: os_name = platform_system os_version = platform.version() python_version = platform.pyth...
[ "def", "_version_string", "(", ")", ":", "platform_system", "=", "platform", ".", "system", "(", ")", "if", "platform_system", "==", "'Linux'", ":", "os_name", ",", "os_version", ",", "_", "=", "platform", ".", "dist", "(", ")", "else", ":", "os_name", "...
Gets the output for `trytravis --version`.
[ "Gets", "the", "output", "for", "trytravis", "--", "version", "." ]
d92ed708fe71d8db93a6df8077d23ee39ec0364e
https://github.com/sethmlarson/trytravis/blob/d92ed708fe71d8db93a6df8077d23ee39ec0364e/trytravis.py#L321-L333
train
sethmlarson/trytravis
trytravis.py
_main
def _main(argv): """ Function that acts just like main() except doesn't catch exceptions. """ repo_input_argv = len(argv) == 2 and argv[0] in ['--repo', '-r', '-R'] # We only support a single argv parameter. if len(argv) > 1 and not repo_input_argv: _main(['--help']) # Parse the comman...
python
def _main(argv): """ Function that acts just like main() except doesn't catch exceptions. """ repo_input_argv = len(argv) == 2 and argv[0] in ['--repo', '-r', '-R'] # We only support a single argv parameter. if len(argv) > 1 and not repo_input_argv: _main(['--help']) # Parse the comman...
[ "def", "_main", "(", "argv", ")", ":", "repo_input_argv", "=", "len", "(", "argv", ")", "==", "2", "and", "argv", "[", "0", "]", "in", "[", "'--repo'", ",", "'-r'", ",", "'-R'", "]", "# We only support a single argv parameter.", "if", "len", "(", "argv",...
Function that acts just like main() except doesn't catch exceptions.
[ "Function", "that", "acts", "just", "like", "main", "()", "except", "doesn", "t", "catch", "exceptions", "." ]
d92ed708fe71d8db93a6df8077d23ee39ec0364e
https://github.com/sethmlarson/trytravis/blob/d92ed708fe71d8db93a6df8077d23ee39ec0364e/trytravis.py#L343-L388
train
sethmlarson/trytravis
trytravis.py
main
def main(argv=None): # pragma: no coverage """ Main entry point when the user runs the `trytravis` command. """ try: colorama.init() if argv is None: argv = sys.argv[1:] _main(argv) except RuntimeError as e: print(colorama.Fore.RED + 'ERROR: ' + str...
python
def main(argv=None): # pragma: no coverage """ Main entry point when the user runs the `trytravis` command. """ try: colorama.init() if argv is None: argv = sys.argv[1:] _main(argv) except RuntimeError as e: print(colorama.Fore.RED + 'ERROR: ' + str...
[ "def", "main", "(", "argv", "=", "None", ")", ":", "# pragma: no coverage", "try", ":", "colorama", ".", "init", "(", ")", "if", "argv", "is", "None", ":", "argv", "=", "sys", ".", "argv", "[", "1", ":", "]", "_main", "(", "argv", ")", "except", ...
Main entry point when the user runs the `trytravis` command.
[ "Main", "entry", "point", "when", "the", "user", "runs", "the", "trytravis", "command", "." ]
d92ed708fe71d8db93a6df8077d23ee39ec0364e
https://github.com/sethmlarson/trytravis/blob/d92ed708fe71d8db93a6df8077d23ee39ec0364e/trytravis.py#L391-L403
train
cga-harvard/Hypermap-Registry
hypermap/search/views.py
csw_global_dispatch
def csw_global_dispatch(request, url=None, catalog_id=None): """pycsw wrapper""" if request.user.is_authenticated(): # turn on CSW-T settings.REGISTRY_PYCSW['manager']['transactions'] = 'true' env = request.META.copy() # TODO: remove this workaround # HH should be able to pass env['wsgi....
python
def csw_global_dispatch(request, url=None, catalog_id=None): """pycsw wrapper""" if request.user.is_authenticated(): # turn on CSW-T settings.REGISTRY_PYCSW['manager']['transactions'] = 'true' env = request.META.copy() # TODO: remove this workaround # HH should be able to pass env['wsgi....
[ "def", "csw_global_dispatch", "(", "request", ",", "url", "=", "None", ",", "catalog_id", "=", "None", ")", ":", "if", "request", ".", "user", ".", "is_authenticated", "(", ")", ":", "# turn on CSW-T", "settings", ".", "REGISTRY_PYCSW", "[", "'manager'", "]"...
pycsw wrapper
[ "pycsw", "wrapper" ]
899a5385b15af7fba190ab4fae1d41e47d155a1b
https://github.com/cga-harvard/Hypermap-Registry/blob/899a5385b15af7fba190ab4fae1d41e47d155a1b/hypermap/search/views.py#L19-L59
train
cga-harvard/Hypermap-Registry
hypermap/search/views.py
csw_global_dispatch_by_catalog
def csw_global_dispatch_by_catalog(request, catalog_slug): """pycsw wrapper for catalogs""" catalog = get_object_or_404(Catalog, slug=catalog_slug) if catalog: # define catalog specific settings url = settings.SITE_URL.rstrip('/') + request.path.rstrip('/') return csw_global_dispatch(requ...
python
def csw_global_dispatch_by_catalog(request, catalog_slug): """pycsw wrapper for catalogs""" catalog = get_object_or_404(Catalog, slug=catalog_slug) if catalog: # define catalog specific settings url = settings.SITE_URL.rstrip('/') + request.path.rstrip('/') return csw_global_dispatch(requ...
[ "def", "csw_global_dispatch_by_catalog", "(", "request", ",", "catalog_slug", ")", ":", "catalog", "=", "get_object_or_404", "(", "Catalog", ",", "slug", "=", "catalog_slug", ")", "if", "catalog", ":", "# define catalog specific settings", "url", "=", "settings", "....
pycsw wrapper for catalogs
[ "pycsw", "wrapper", "for", "catalogs" ]
899a5385b15af7fba190ab4fae1d41e47d155a1b
https://github.com/cga-harvard/Hypermap-Registry/blob/899a5385b15af7fba190ab4fae1d41e47d155a1b/hypermap/search/views.py#L63-L70
train
cga-harvard/Hypermap-Registry
hypermap/search/views.py
opensearch_dispatch
def opensearch_dispatch(request): """OpenSearch wrapper""" ctx = { 'shortname': settings.REGISTRY_PYCSW['metadata:main']['identification_title'], 'description': settings.REGISTRY_PYCSW['metadata:main']['identification_abstract'], 'developer': settings.REGISTRY_PYCSW['metadata:main']['co...
python
def opensearch_dispatch(request): """OpenSearch wrapper""" ctx = { 'shortname': settings.REGISTRY_PYCSW['metadata:main']['identification_title'], 'description': settings.REGISTRY_PYCSW['metadata:main']['identification_abstract'], 'developer': settings.REGISTRY_PYCSW['metadata:main']['co...
[ "def", "opensearch_dispatch", "(", "request", ")", ":", "ctx", "=", "{", "'shortname'", ":", "settings", ".", "REGISTRY_PYCSW", "[", "'metadata:main'", "]", "[", "'identification_title'", "]", ",", "'description'", ":", "settings", ".", "REGISTRY_PYCSW", "[", "'...
OpenSearch wrapper
[ "OpenSearch", "wrapper" ]
899a5385b15af7fba190ab4fae1d41e47d155a1b
https://github.com/cga-harvard/Hypermap-Registry/blob/899a5385b15af7fba190ab4fae1d41e47d155a1b/hypermap/search/views.py#L73-L87
train
cga-harvard/Hypermap-Registry
hypermap/aggregator/elasticsearch_client.py
ESHypermap.good_coords
def good_coords(coords): """ passed a string array """ if (len(coords) != 4): return False for coord in coords[0:3]: try: num = float(coord) if (math.isnan(num)): return False if (math.isinf(num)): ...
python
def good_coords(coords): """ passed a string array """ if (len(coords) != 4): return False for coord in coords[0:3]: try: num = float(coord) if (math.isnan(num)): return False if (math.isinf(num)): ...
[ "def", "good_coords", "(", "coords", ")", ":", "if", "(", "len", "(", "coords", ")", "!=", "4", ")", ":", "return", "False", "for", "coord", "in", "coords", "[", "0", ":", "3", "]", ":", "try", ":", "num", "=", "float", "(", "coord", ")", "if",...
passed a string array
[ "passed", "a", "string", "array" ]
899a5385b15af7fba190ab4fae1d41e47d155a1b
https://github.com/cga-harvard/Hypermap-Registry/blob/899a5385b15af7fba190ab4fae1d41e47d155a1b/hypermap/aggregator/elasticsearch_client.py#L36-L49
train
cga-harvard/Hypermap-Registry
hypermap/aggregator/elasticsearch_client.py
ESHypermap.clear_es
def clear_es(): """Clear all indexes in the es core""" # TODO: should receive a catalog slug. ESHypermap.es.indices.delete(ESHypermap.index_name, ignore=[400, 404]) LOGGER.debug('Elasticsearch: Index cleared')
python
def clear_es(): """Clear all indexes in the es core""" # TODO: should receive a catalog slug. ESHypermap.es.indices.delete(ESHypermap.index_name, ignore=[400, 404]) LOGGER.debug('Elasticsearch: Index cleared')
[ "def", "clear_es", "(", ")", ":", "# TODO: should receive a catalog slug.", "ESHypermap", ".", "es", ".", "indices", ".", "delete", "(", "ESHypermap", ".", "index_name", ",", "ignore", "=", "[", "400", ",", "404", "]", ")", "LOGGER", ".", "debug", "(", "'E...
Clear all indexes in the es core
[ "Clear", "all", "indexes", "in", "the", "es", "core" ]
899a5385b15af7fba190ab4fae1d41e47d155a1b
https://github.com/cga-harvard/Hypermap-Registry/blob/899a5385b15af7fba190ab4fae1d41e47d155a1b/hypermap/aggregator/elasticsearch_client.py#L221-L225
train
cga-harvard/Hypermap-Registry
hypermap/aggregator/elasticsearch_client.py
ESHypermap.create_indices
def create_indices(catalog_slug): """Create ES core indices """ # TODO: enable auto_create_index in the ES nodes to make this implicit. # https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html#index-creation # http://support.searchly.com/customer/en/portal/quest...
python
def create_indices(catalog_slug): """Create ES core indices """ # TODO: enable auto_create_index in the ES nodes to make this implicit. # https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html#index-creation # http://support.searchly.com/customer/en/portal/quest...
[ "def", "create_indices", "(", "catalog_slug", ")", ":", "# TODO: enable auto_create_index in the ES nodes to make this implicit.", "# https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html#index-creation", "# http://support.searchly.com/customer/en/portal/questions/", "# ...
Create ES core indices
[ "Create", "ES", "core", "indices" ]
899a5385b15af7fba190ab4fae1d41e47d155a1b
https://github.com/cga-harvard/Hypermap-Registry/blob/899a5385b15af7fba190ab4fae1d41e47d155a1b/hypermap/aggregator/elasticsearch_client.py#L228-L247
train
cga-harvard/Hypermap-Registry
pavement.py
kill_process
def kill_process(procname, scriptname): """kill WSGI processes that may be running in development""" # from http://stackoverflow.com/a/2940878 import signal import subprocess p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE) out, err = p.communicate() for line in out.decode().sp...
python
def kill_process(procname, scriptname): """kill WSGI processes that may be running in development""" # from http://stackoverflow.com/a/2940878 import signal import subprocess p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE) out, err = p.communicate() for line in out.decode().sp...
[ "def", "kill_process", "(", "procname", ",", "scriptname", ")", ":", "# from http://stackoverflow.com/a/2940878", "import", "signal", "import", "subprocess", "p", "=", "subprocess", ".", "Popen", "(", "[", "'ps'", ",", "'aux'", "]", ",", "stdout", "=", "subproce...
kill WSGI processes that may be running in development
[ "kill", "WSGI", "processes", "that", "may", "be", "running", "in", "development" ]
899a5385b15af7fba190ab4fae1d41e47d155a1b
https://github.com/cga-harvard/Hypermap-Registry/blob/899a5385b15af7fba190ab4fae1d41e47d155a1b/pavement.py#L50-L64
train
cga-harvard/Hypermap-Registry
hypermap/aggregator/populate_database.py
populate_initial_services
def populate_initial_services(): """ Populate a fresh installed Hypermap instances with basic services. """ services_list = ( ( 'Harvard WorldMap', 'Harvard WorldMap open source web geospatial platform', 'Hypermap:WorldMap', 'http://worldmap.harvar...
python
def populate_initial_services(): """ Populate a fresh installed Hypermap instances with basic services. """ services_list = ( ( 'Harvard WorldMap', 'Harvard WorldMap open source web geospatial platform', 'Hypermap:WorldMap', 'http://worldmap.harvar...
[ "def", "populate_initial_services", "(", ")", ":", "services_list", "=", "(", "(", "'Harvard WorldMap'", ",", "'Harvard WorldMap open source web geospatial platform'", ",", "'Hypermap:WorldMap'", ",", "'http://worldmap.harvard.edu'", ")", ",", "(", "'NYPL MapWarper'", ",", ...
Populate a fresh installed Hypermap instances with basic services.
[ "Populate", "a", "fresh", "installed", "Hypermap", "instances", "with", "basic", "services", "." ]
899a5385b15af7fba190ab4fae1d41e47d155a1b
https://github.com/cga-harvard/Hypermap-Registry/blob/899a5385b15af7fba190ab4fae1d41e47d155a1b/hypermap/aggregator/populate_database.py#L10-L65
train
cga-harvard/Hypermap-Registry
hypermap/search_api/views.py
elasticsearch
def elasticsearch(serializer, catalog): """ https://www.elastic.co/guide/en/elasticsearch/reference/current/_the_search_api.html :param serializer: :return: """ search_engine_endpoint = "{0}/{1}/_search".format(SEARCH_URL, catalog.slug) q_text = serializer.validated_data.get("q_text") ...
python
def elasticsearch(serializer, catalog): """ https://www.elastic.co/guide/en/elasticsearch/reference/current/_the_search_api.html :param serializer: :return: """ search_engine_endpoint = "{0}/{1}/_search".format(SEARCH_URL, catalog.slug) q_text = serializer.validated_data.get("q_text") ...
[ "def", "elasticsearch", "(", "serializer", ",", "catalog", ")", ":", "search_engine_endpoint", "=", "\"{0}/{1}/_search\"", ".", "format", "(", "SEARCH_URL", ",", "catalog", ".", "slug", ")", "q_text", "=", "serializer", ".", "validated_data", ".", "get", "(", ...
https://www.elastic.co/guide/en/elasticsearch/reference/current/_the_search_api.html :param serializer: :return:
[ "https", ":", "//", "www", ".", "elastic", ".", "co", "/", "guide", "/", "en", "/", "elasticsearch", "/", "reference", "/", "current", "/", "_the_search_api", ".", "html", ":", "param", "serializer", ":", ":", "return", ":" ]
899a5385b15af7fba190ab4fae1d41e47d155a1b
https://github.com/cga-harvard/Hypermap-Registry/blob/899a5385b15af7fba190ab4fae1d41e47d155a1b/hypermap/search_api/views.py#L32-L361
train
cga-harvard/Hypermap-Registry
hypermap/search_api/views.py
solr
def solr(serializer): """ Search on solr endpoint :param serializer: :return: """ search_engine_endpoint = serializer.validated_data.get("search_engine_endpoint") q_time = serializer.validated_data.get("q_time") q_geo = serializer.validated_data.get("q_geo") q_text = serializer.valid...
python
def solr(serializer): """ Search on solr endpoint :param serializer: :return: """ search_engine_endpoint = serializer.validated_data.get("search_engine_endpoint") q_time = serializer.validated_data.get("q_time") q_geo = serializer.validated_data.get("q_geo") q_text = serializer.valid...
[ "def", "solr", "(", "serializer", ")", ":", "search_engine_endpoint", "=", "serializer", ".", "validated_data", ".", "get", "(", "\"search_engine_endpoint\"", ")", "q_time", "=", "serializer", ".", "validated_data", ".", "get", "(", "\"q_time\"", ")", "q_geo", "...
Search on solr endpoint :param serializer: :return:
[ "Search", "on", "solr", "endpoint", ":", "param", "serializer", ":", ":", "return", ":" ]
899a5385b15af7fba190ab4fae1d41e47d155a1b
https://github.com/cga-harvard/Hypermap-Registry/blob/899a5385b15af7fba190ab4fae1d41e47d155a1b/hypermap/search_api/views.py#L364-L573
train
cga-harvard/Hypermap-Registry
hypermap/search_api/views.py
parse_get_params
def parse_get_params(request): """ parse all url get params that contains dots in a representation of serializer field names, for example: d.docs.limit to d_docs_limit. that makes compatible an actual API client with django-rest-framework serializers. :param request: :return: QueryDict with ...
python
def parse_get_params(request): """ parse all url get params that contains dots in a representation of serializer field names, for example: d.docs.limit to d_docs_limit. that makes compatible an actual API client with django-rest-framework serializers. :param request: :return: QueryDict with ...
[ "def", "parse_get_params", "(", "request", ")", ":", "get", "=", "request", ".", "GET", ".", "copy", "(", ")", "new_get", "=", "request", ".", "GET", ".", "copy", "(", ")", "for", "key", "in", "get", ".", "iterkeys", "(", ")", ":", "if", "key", "...
parse all url get params that contains dots in a representation of serializer field names, for example: d.docs.limit to d_docs_limit. that makes compatible an actual API client with django-rest-framework serializers. :param request: :return: QueryDict with parsed get params.
[ "parse", "all", "url", "get", "params", "that", "contains", "dots", "in", "a", "representation", "of", "serializer", "field", "names", "for", "example", ":", "d", ".", "docs", ".", "limit", "to", "d_docs_limit", ".", "that", "makes", "compatible", "an", "a...
899a5385b15af7fba190ab4fae1d41e47d155a1b
https://github.com/cga-harvard/Hypermap-Registry/blob/899a5385b15af7fba190ab4fae1d41e47d155a1b/hypermap/search_api/views.py#L576-L594
train
konikvranik/pyCEC
pycec/tcp.py
main
def main(): """For testing purpose""" tcp_adapter = TcpAdapter("192.168.1.3", name="HASS", activate_source=False) hdmi_network = HDMINetwork(tcp_adapter) hdmi_network.start() while True: for d in hdmi_network.devices: _LOGGER.info("Device: %s", d) time.sleep(7)
python
def main(): """For testing purpose""" tcp_adapter = TcpAdapter("192.168.1.3", name="HASS", activate_source=False) hdmi_network = HDMINetwork(tcp_adapter) hdmi_network.start() while True: for d in hdmi_network.devices: _LOGGER.info("Device: %s", d) time.sleep(7)
[ "def", "main", "(", ")", ":", "tcp_adapter", "=", "TcpAdapter", "(", "\"192.168.1.3\"", ",", "name", "=", "\"HASS\"", ",", "activate_source", "=", "False", ")", "hdmi_network", "=", "HDMINetwork", "(", "tcp_adapter", ")", "hdmi_network", ".", "start", "(", "...
For testing purpose
[ "For", "testing", "purpose" ]
acf42a842d8a912ed68d63d8d6b653e6c405b29b
https://github.com/konikvranik/pyCEC/blob/acf42a842d8a912ed68d63d8d6b653e6c405b29b/pycec/tcp.py#L143-L152
train
diffeo/py-nilsimsa
nilsimsa/deprecated/_deprecated_nilsimsa.py
compare_hexdigests
def compare_hexdigests( digest1, digest2 ): """Compute difference in bits between digest1 and digest2 returns -127 to 128; 128 is the same, -127 is different""" # convert to 32-tuple of unsighed two-byte INTs digest1 = tuple([int(digest1[i:i+2],16) for i in range(0,63,2)]) digest2 = tuple([int(di...
python
def compare_hexdigests( digest1, digest2 ): """Compute difference in bits between digest1 and digest2 returns -127 to 128; 128 is the same, -127 is different""" # convert to 32-tuple of unsighed two-byte INTs digest1 = tuple([int(digest1[i:i+2],16) for i in range(0,63,2)]) digest2 = tuple([int(di...
[ "def", "compare_hexdigests", "(", "digest1", ",", "digest2", ")", ":", "# convert to 32-tuple of unsighed two-byte INTs", "digest1", "=", "tuple", "(", "[", "int", "(", "digest1", "[", "i", ":", "i", "+", "2", "]", ",", "16", ")", "for", "i", "in", "range"...
Compute difference in bits between digest1 and digest2 returns -127 to 128; 128 is the same, -127 is different
[ "Compute", "difference", "in", "bits", "between", "digest1", "and", "digest2", "returns", "-", "127", "to", "128", ";", "128", "is", "the", "same", "-", "127", "is", "different" ]
c652f4bbfd836f7aebf292dcea676cc925ec315a
https://github.com/diffeo/py-nilsimsa/blob/c652f4bbfd836f7aebf292dcea676cc925ec315a/nilsimsa/deprecated/_deprecated_nilsimsa.py#L196-L205
train
diffeo/py-nilsimsa
nilsimsa/deprecated/_deprecated_nilsimsa.py
Nilsimsa.tran3
def tran3(self, a, b, c, n): """Get accumulator for a transition n between chars a, b, c.""" return (((TRAN[(a+n)&255]^TRAN[b]*(n+n+1))+TRAN[(c)^TRAN[n]])&255)
python
def tran3(self, a, b, c, n): """Get accumulator for a transition n between chars a, b, c.""" return (((TRAN[(a+n)&255]^TRAN[b]*(n+n+1))+TRAN[(c)^TRAN[n]])&255)
[ "def", "tran3", "(", "self", ",", "a", ",", "b", ",", "c", ",", "n", ")", ":", "return", "(", "(", "(", "TRAN", "[", "(", "a", "+", "n", ")", "&", "255", "]", "^", "TRAN", "[", "b", "]", "*", "(", "n", "+", "n", "+", "1", ")", ")", ...
Get accumulator for a transition n between chars a, b, c.
[ "Get", "accumulator", "for", "a", "transition", "n", "between", "chars", "a", "b", "c", "." ]
c652f4bbfd836f7aebf292dcea676cc925ec315a
https://github.com/diffeo/py-nilsimsa/blob/c652f4bbfd836f7aebf292dcea676cc925ec315a/nilsimsa/deprecated/_deprecated_nilsimsa.py#L117-L119
train
diffeo/py-nilsimsa
nilsimsa/deprecated/_deprecated_nilsimsa.py
Nilsimsa.update
def update(self, data): """Add data to running digest, increasing the accumulators for 0-8 triplets formed by this char and the previous 0-3 chars.""" for character in data: if PY3: ch = character else: ch = ord(character) se...
python
def update(self, data): """Add data to running digest, increasing the accumulators for 0-8 triplets formed by this char and the previous 0-3 chars.""" for character in data: if PY3: ch = character else: ch = ord(character) se...
[ "def", "update", "(", "self", ",", "data", ")", ":", "for", "character", "in", "data", ":", "if", "PY3", ":", "ch", "=", "character", "else", ":", "ch", "=", "ord", "(", "character", ")", "self", ".", "count", "+=", "1", "# incr accumulators for triple...
Add data to running digest, increasing the accumulators for 0-8 triplets formed by this char and the previous 0-3 chars.
[ "Add", "data", "to", "running", "digest", "increasing", "the", "accumulators", "for", "0", "-", "8", "triplets", "formed", "by", "this", "char", "and", "the", "previous", "0", "-", "3", "chars", "." ]
c652f4bbfd836f7aebf292dcea676cc925ec315a
https://github.com/diffeo/py-nilsimsa/blob/c652f4bbfd836f7aebf292dcea676cc925ec315a/nilsimsa/deprecated/_deprecated_nilsimsa.py#L121-L145
train
diffeo/py-nilsimsa
nilsimsa/deprecated/_deprecated_nilsimsa.py
Nilsimsa.digest
def digest(self): """Get digest of data seen thus far as a list of bytes.""" total = 0 # number of triplets seen if self.count == 3: # 3 chars = 1 triplet total = 1 elif self.count == 4: # 4 chars = 4 triplets ...
python
def digest(self): """Get digest of data seen thus far as a list of bytes.""" total = 0 # number of triplets seen if self.count == 3: # 3 chars = 1 triplet total = 1 elif self.count == 4: # 4 chars = 4 triplets ...
[ "def", "digest", "(", "self", ")", ":", "total", "=", "0", "# number of triplets seen", "if", "self", ".", "count", "==", "3", ":", "# 3 chars = 1 triplet", "total", "=", "1", "elif", "self", ".", "count", "==", "4", ":", "# 4 chars = 4 triplets", "total", ...
Get digest of data seen thus far as a list of bytes.
[ "Get", "digest", "of", "data", "seen", "thus", "far", "as", "a", "list", "of", "bytes", "." ]
c652f4bbfd836f7aebf292dcea676cc925ec315a
https://github.com/diffeo/py-nilsimsa/blob/c652f4bbfd836f7aebf292dcea676cc925ec315a/nilsimsa/deprecated/_deprecated_nilsimsa.py#L147-L164
train
diffeo/py-nilsimsa
nilsimsa/deprecated/_deprecated_nilsimsa.py
Nilsimsa.from_file
def from_file(self, filename): """Update running digest with content of named file.""" f = open(filename, 'rb') while True: data = f.read(10480) if not data: break self.update(data) f.close()
python
def from_file(self, filename): """Update running digest with content of named file.""" f = open(filename, 'rb') while True: data = f.read(10480) if not data: break self.update(data) f.close()
[ "def", "from_file", "(", "self", ",", "filename", ")", ":", "f", "=", "open", "(", "filename", ",", "'rb'", ")", "while", "True", ":", "data", "=", "f", ".", "read", "(", "10480", ")", "if", "not", "data", ":", "break", "self", ".", "update", "("...
Update running digest with content of named file.
[ "Update", "running", "digest", "with", "content", "of", "named", "file", "." ]
c652f4bbfd836f7aebf292dcea676cc925ec315a
https://github.com/diffeo/py-nilsimsa/blob/c652f4bbfd836f7aebf292dcea676cc925ec315a/nilsimsa/deprecated/_deprecated_nilsimsa.py#L174-L182
train
diffeo/py-nilsimsa
nilsimsa/deprecated/_deprecated_nilsimsa.py
Nilsimsa.compare
def compare(self, otherdigest, ishex=False): """Compute difference in bits between own digest and another. returns -127 to 128; 128 is the same, -127 is different""" bits = 0 myd = self.digest() if ishex: # convert to 32-tuple of unsighed two-byte INTs ...
python
def compare(self, otherdigest, ishex=False): """Compute difference in bits between own digest and another. returns -127 to 128; 128 is the same, -127 is different""" bits = 0 myd = self.digest() if ishex: # convert to 32-tuple of unsighed two-byte INTs ...
[ "def", "compare", "(", "self", ",", "otherdigest", ",", "ishex", "=", "False", ")", ":", "bits", "=", "0", "myd", "=", "self", ".", "digest", "(", ")", "if", "ishex", ":", "# convert to 32-tuple of unsighed two-byte INTs", "otherdigest", "=", "tuple", "(", ...
Compute difference in bits between own digest and another. returns -127 to 128; 128 is the same, -127 is different
[ "Compute", "difference", "in", "bits", "between", "own", "digest", "and", "another", ".", "returns", "-", "127", "to", "128", ";", "128", "is", "the", "same", "-", "127", "is", "different" ]
c652f4bbfd836f7aebf292dcea676cc925ec315a
https://github.com/diffeo/py-nilsimsa/blob/c652f4bbfd836f7aebf292dcea676cc925ec315a/nilsimsa/deprecated/_deprecated_nilsimsa.py#L184-L194
train
CloudGenix/sdk-python
cloudgenix/__init__.py
jdout
def jdout(api_response): """ JD Output function. Does quick pretty printing of a CloudGenix Response body. This function returns a string instead of directly printing content. **Parameters:** - **api_response:** A CloudGenix-attribute extended `requests.Response` object **Returns:** Prett...
python
def jdout(api_response): """ JD Output function. Does quick pretty printing of a CloudGenix Response body. This function returns a string instead of directly printing content. **Parameters:** - **api_response:** A CloudGenix-attribute extended `requests.Response` object **Returns:** Prett...
[ "def", "jdout", "(", "api_response", ")", ":", "try", ":", "# attempt to output the cgx_content. should always be a Dict if it exists.", "output", "=", "json", ".", "dumps", "(", "api_response", ".", "cgx_content", ",", "indent", "=", "4", ")", "except", "(", "TypeE...
JD Output function. Does quick pretty printing of a CloudGenix Response body. This function returns a string instead of directly printing content. **Parameters:** - **api_response:** A CloudGenix-attribute extended `requests.Response` object **Returns:** Pretty-formatted text of the Response body
[ "JD", "Output", "function", ".", "Does", "quick", "pretty", "printing", "of", "a", "CloudGenix", "Response", "body", ".", "This", "function", "returns", "a", "string", "instead", "of", "directly", "printing", "content", "." ]
1b2f92582b6a19769134914793bfd00e4caa074b
https://github.com/CloudGenix/sdk-python/blob/1b2f92582b6a19769134914793bfd00e4caa074b/cloudgenix/__init__.py#L159-L180
train
CloudGenix/sdk-python
cloudgenix/__init__.py
jdout_detailed
def jdout_detailed(api_response, sensitive=False): """ JD Output Detailed function. Meant for quick DETAILED pretty-printing of CloudGenix Request and Response objects for troubleshooting. This function returns a string instead of directly printing content. **Parameters:** - **api_response:** ...
python
def jdout_detailed(api_response, sensitive=False): """ JD Output Detailed function. Meant for quick DETAILED pretty-printing of CloudGenix Request and Response objects for troubleshooting. This function returns a string instead of directly printing content. **Parameters:** - **api_response:** ...
[ "def", "jdout_detailed", "(", "api_response", ",", "sensitive", "=", "False", ")", ":", "try", ":", "# try to be super verbose.", "output", "=", "\"REQUEST: {0} {1}\\n\"", ".", "format", "(", "api_response", ".", "request", ".", "method", ",", "api_response", ".",...
JD Output Detailed function. Meant for quick DETAILED pretty-printing of CloudGenix Request and Response objects for troubleshooting. This function returns a string instead of directly printing content. **Parameters:** - **api_response:** A CloudGenix-attribute extended `requests.Response` object ...
[ "JD", "Output", "Detailed", "function", ".", "Meant", "for", "quick", "DETAILED", "pretty", "-", "printing", "of", "CloudGenix", "Request", "and", "Response", "objects", "for", "troubleshooting", ".", "This", "function", "returns", "a", "string", "instead", "of"...
1b2f92582b6a19769134914793bfd00e4caa074b
https://github.com/CloudGenix/sdk-python/blob/1b2f92582b6a19769134914793bfd00e4caa074b/cloudgenix/__init__.py#L201-L266
train
CloudGenix/sdk-python
cloudgenix/__init__.py
API.notify_for_new_version
def notify_for_new_version(self): """ Check for a new version of the SDK on API constructor instantiation. If new version found, print Notification to STDERR. On failure of this check, fail silently. **Returns:** No item returned, directly prints notification to `sys.stderr`. ...
python
def notify_for_new_version(self): """ Check for a new version of the SDK on API constructor instantiation. If new version found, print Notification to STDERR. On failure of this check, fail silently. **Returns:** No item returned, directly prints notification to `sys.stderr`. ...
[ "def", "notify_for_new_version", "(", "self", ")", ":", "# broad exception clause, if this fails for any reason just return.", "try", ":", "recommend_update", "=", "False", "update_check_resp", "=", "requests", ".", "get", "(", "self", ".", "update_info_url", ",", "timeou...
Check for a new version of the SDK on API constructor instantiation. If new version found, print Notification to STDERR. On failure of this check, fail silently. **Returns:** No item returned, directly prints notification to `sys.stderr`.
[ "Check", "for", "a", "new", "version", "of", "the", "SDK", "on", "API", "constructor", "instantiation", ".", "If", "new", "version", "found", "print", "Notification", "to", "STDERR", "." ]
1b2f92582b6a19769134914793bfd00e4caa074b
https://github.com/CloudGenix/sdk-python/blob/1b2f92582b6a19769134914793bfd00e4caa074b/cloudgenix/__init__.py#L446-L503
train
CloudGenix/sdk-python
cloudgenix/__init__.py
API.ssl_verify
def ssl_verify(self, ssl_verify): """ Modify ssl verification settings **Parameters:** - ssl_verify: - True: Verify using builtin BYTE_CA_BUNDLE. - False: No SSL Verification. - Str: Full path to a x509 PEM CA File or bundle. **Returns:...
python
def ssl_verify(self, ssl_verify): """ Modify ssl verification settings **Parameters:** - ssl_verify: - True: Verify using builtin BYTE_CA_BUNDLE. - False: No SSL Verification. - Str: Full path to a x509 PEM CA File or bundle. **Returns:...
[ "def", "ssl_verify", "(", "self", ",", "ssl_verify", ")", ":", "self", ".", "verify", "=", "ssl_verify", "# if verify true/false, set ca_verify_file appropriately", "if", "isinstance", "(", "self", ".", "verify", ",", "bool", ")", ":", "if", "self", ".", "verify...
Modify ssl verification settings **Parameters:** - ssl_verify: - True: Verify using builtin BYTE_CA_BUNDLE. - False: No SSL Verification. - Str: Full path to a x509 PEM CA File or bundle. **Returns:** Mutates API object in place, no return.
[ "Modify", "ssl", "verification", "settings" ]
1b2f92582b6a19769134914793bfd00e4caa074b
https://github.com/CloudGenix/sdk-python/blob/1b2f92582b6a19769134914793bfd00e4caa074b/cloudgenix/__init__.py#L505-L546
train
CloudGenix/sdk-python
cloudgenix/__init__.py
API.modify_rest_retry
def modify_rest_retry(self, total=8, connect=None, read=None, redirect=None, status=None, method_whitelist=urllib3.util.retry.Retry.DEFAULT_METHOD_WHITELIST, status_forcelist=None, backoff_factor=0.705883, raise_on_redirect=True, raise_on_status=True, ...
python
def modify_rest_retry(self, total=8, connect=None, read=None, redirect=None, status=None, method_whitelist=urllib3.util.retry.Retry.DEFAULT_METHOD_WHITELIST, status_forcelist=None, backoff_factor=0.705883, raise_on_redirect=True, raise_on_status=True, ...
[ "def", "modify_rest_retry", "(", "self", ",", "total", "=", "8", ",", "connect", "=", "None", ",", "read", "=", "None", ",", "redirect", "=", "None", ",", "status", "=", "None", ",", "method_whitelist", "=", "urllib3", ".", "util", ".", "retry", ".", ...
Modify retry parameters for the SDK's rest call object. Parameters are directly from and passed directly to `urllib3.util.retry.Retry`, and get applied directly to the underlying `requests.Session` object. Default retry with total=8 and backoff_factor=0.705883: - Try 1, 0 delay (0 tot...
[ "Modify", "retry", "parameters", "for", "the", "SDK", "s", "rest", "call", "object", "." ]
1b2f92582b6a19769134914793bfd00e4caa074b
https://github.com/CloudGenix/sdk-python/blob/1b2f92582b6a19769134914793bfd00e4caa074b/cloudgenix/__init__.py#L548-L604
train
CloudGenix/sdk-python
cloudgenix/__init__.py
API.view_rest_retry
def view_rest_retry(self, url=None): """ View current rest retry settings in the `requests.Session()` object **Parameters:** - **url:** URL to use to determine retry methods for. Defaults to 'https://' **Returns:** Dict, Key header, value is header value. """ ...
python
def view_rest_retry(self, url=None): """ View current rest retry settings in the `requests.Session()` object **Parameters:** - **url:** URL to use to determine retry methods for. Defaults to 'https://' **Returns:** Dict, Key header, value is header value. """ ...
[ "def", "view_rest_retry", "(", "self", ",", "url", "=", "None", ")", ":", "if", "url", "is", "None", ":", "url", "=", "\"https://\"", "return", "vars", "(", "self", ".", "_session", ".", "get_adapter", "(", "url", ")", ".", "max_retries", ")" ]
View current rest retry settings in the `requests.Session()` object **Parameters:** - **url:** URL to use to determine retry methods for. Defaults to 'https://' **Returns:** Dict, Key header, value is header value.
[ "View", "current", "rest", "retry", "settings", "in", "the", "requests", ".", "Session", "()", "object" ]
1b2f92582b6a19769134914793bfd00e4caa074b
https://github.com/CloudGenix/sdk-python/blob/1b2f92582b6a19769134914793bfd00e4caa074b/cloudgenix/__init__.py#L606-L618
train
CloudGenix/sdk-python
cloudgenix/__init__.py
API.view_cookies
def view_cookies(self): """ View current cookies in the `requests.Session()` object **Returns:** List of Dicts, one cookie per Dict. """ return_list = [] for cookie in self._session.cookies: return_list.append(vars(cookie)) return return_list
python
def view_cookies(self): """ View current cookies in the `requests.Session()` object **Returns:** List of Dicts, one cookie per Dict. """ return_list = [] for cookie in self._session.cookies: return_list.append(vars(cookie)) return return_list
[ "def", "view_cookies", "(", "self", ")", ":", "return_list", "=", "[", "]", "for", "cookie", "in", "self", ".", "_session", ".", "cookies", ":", "return_list", ".", "append", "(", "vars", "(", "cookie", ")", ")", "return", "return_list" ]
View current cookies in the `requests.Session()` object **Returns:** List of Dicts, one cookie per Dict.
[ "View", "current", "cookies", "in", "the", "requests", ".", "Session", "()", "object" ]
1b2f92582b6a19769134914793bfd00e4caa074b
https://github.com/CloudGenix/sdk-python/blob/1b2f92582b6a19769134914793bfd00e4caa074b/cloudgenix/__init__.py#L662-L672
train
CloudGenix/sdk-python
cloudgenix/__init__.py
API.set_debug
def set_debug(self, debuglevel): """ Change the debug level of the API **Returns:** No item returned. """ if isinstance(debuglevel, int): self._debuglevel = debuglevel if self._debuglevel == 1: logging.basicConfig(level=logging.INFO, ...
python
def set_debug(self, debuglevel): """ Change the debug level of the API **Returns:** No item returned. """ if isinstance(debuglevel, int): self._debuglevel = debuglevel if self._debuglevel == 1: logging.basicConfig(level=logging.INFO, ...
[ "def", "set_debug", "(", "self", ",", "debuglevel", ")", ":", "if", "isinstance", "(", "debuglevel", ",", "int", ")", ":", "self", ".", "_debuglevel", "=", "debuglevel", "if", "self", ".", "_debuglevel", "==", "1", ":", "logging", ".", "basicConfig", "("...
Change the debug level of the API **Returns:** No item returned.
[ "Change", "the", "debug", "level", "of", "the", "API" ]
1b2f92582b6a19769134914793bfd00e4caa074b
https://github.com/CloudGenix/sdk-python/blob/1b2f92582b6a19769134914793bfd00e4caa074b/cloudgenix/__init__.py#L674-L708
train
CloudGenix/sdk-python
cloudgenix/__init__.py
API._subclass_container
def _subclass_container(self): """ Call subclasses via function to allow passing parent namespace to subclasses. **Returns:** dict with subclass references. """ _parent_class = self class GetWrapper(Get): def __init__(self): self._parent_cla...
python
def _subclass_container(self): """ Call subclasses via function to allow passing parent namespace to subclasses. **Returns:** dict with subclass references. """ _parent_class = self class GetWrapper(Get): def __init__(self): self._parent_cla...
[ "def", "_subclass_container", "(", "self", ")", ":", "_parent_class", "=", "self", "class", "GetWrapper", "(", "Get", ")", ":", "def", "__init__", "(", "self", ")", ":", "self", ".", "_parent_class", "=", "_parent_class", "class", "PostWrapper", "(", "Post",...
Call subclasses via function to allow passing parent namespace to subclasses. **Returns:** dict with subclass references.
[ "Call", "subclasses", "via", "function", "to", "allow", "passing", "parent", "namespace", "to", "subclasses", "." ]
1b2f92582b6a19769134914793bfd00e4caa074b
https://github.com/CloudGenix/sdk-python/blob/1b2f92582b6a19769134914793bfd00e4caa074b/cloudgenix/__init__.py#L710-L753
train
CloudGenix/sdk-python
cloudgenix/__init__.py
API.rest_call
def rest_call(self, url, method, data=None, sensitive=False, timeout=None, content_json=True, retry=None, max_retry=None, retry_sleep=None): """ Generic REST call worker function **Parameters:** - **url:** URL for the REST call - **method:** METHOD for the...
python
def rest_call(self, url, method, data=None, sensitive=False, timeout=None, content_json=True, retry=None, max_retry=None, retry_sleep=None): """ Generic REST call worker function **Parameters:** - **url:** URL for the REST call - **method:** METHOD for the...
[ "def", "rest_call", "(", "self", ",", "url", ",", "method", ",", "data", "=", "None", ",", "sensitive", "=", "False", ",", "timeout", "=", "None", ",", "content_json", "=", "True", ",", "retry", "=", "None", ",", "max_retry", "=", "None", ",", "retry...
Generic REST call worker function **Parameters:** - **url:** URL for the REST call - **method:** METHOD for the REST call - **data:** Optional DATA for the call (for POST/PUT/etc.) - **sensitive:** Flag if content request/response should be hidden from logging functions...
[ "Generic", "REST", "call", "worker", "function" ]
1b2f92582b6a19769134914793bfd00e4caa074b
https://github.com/CloudGenix/sdk-python/blob/1b2f92582b6a19769134914793bfd00e4caa074b/cloudgenix/__init__.py#L755-L890
train
CloudGenix/sdk-python
cloudgenix/__init__.py
API._cleanup_ca_temp_file
def _cleanup_ca_temp_file(self): """ Function to clean up ca temp file for requests. **Returns:** Removes TEMP ca file, no return """ if os.name == 'nt': if isinstance(self.ca_verify_filename, (binary_type, text_type)): # windows requires file to be c...
python
def _cleanup_ca_temp_file(self): """ Function to clean up ca temp file for requests. **Returns:** Removes TEMP ca file, no return """ if os.name == 'nt': if isinstance(self.ca_verify_filename, (binary_type, text_type)): # windows requires file to be c...
[ "def", "_cleanup_ca_temp_file", "(", "self", ")", ":", "if", "os", ".", "name", "==", "'nt'", ":", "if", "isinstance", "(", "self", ".", "ca_verify_filename", ",", "(", "binary_type", ",", "text_type", ")", ")", ":", "# windows requires file to be closed for acc...
Function to clean up ca temp file for requests. **Returns:** Removes TEMP ca file, no return
[ "Function", "to", "clean", "up", "ca", "temp", "file", "for", "requests", "." ]
1b2f92582b6a19769134914793bfd00e4caa074b
https://github.com/CloudGenix/sdk-python/blob/1b2f92582b6a19769134914793bfd00e4caa074b/cloudgenix/__init__.py#L892-L904
train
CloudGenix/sdk-python
cloudgenix/__init__.py
API.parse_auth_token
def parse_auth_token(self, auth_token): """ Break auth_token up into it's constituent values. **Parameters:** - **auth_token:** Auth_token string **Returns:** dict with Auth Token constituents """ # remove the random security key value from the front of the a...
python
def parse_auth_token(self, auth_token): """ Break auth_token up into it's constituent values. **Parameters:** - **auth_token:** Auth_token string **Returns:** dict with Auth Token constituents """ # remove the random security key value from the front of the a...
[ "def", "parse_auth_token", "(", "self", ",", "auth_token", ")", ":", "# remove the random security key value from the front of the auth_token", "auth_token_cleaned", "=", "auth_token", ".", "split", "(", "'-'", ",", "1", ")", "[", "1", "]", "# URL Decode the Auth Token", ...
Break auth_token up into it's constituent values. **Parameters:** - **auth_token:** Auth_token string **Returns:** dict with Auth Token constituents
[ "Break", "auth_token", "up", "into", "it", "s", "constituent", "values", "." ]
1b2f92582b6a19769134914793bfd00e4caa074b
https://github.com/CloudGenix/sdk-python/blob/1b2f92582b6a19769134914793bfd00e4caa074b/cloudgenix/__init__.py#L906-L931
train
CloudGenix/sdk-python
cloudgenix/__init__.py
API.update_region_to_controller
def update_region_to_controller(self, region): """ Update the controller string with dynamic region info. Controller string should end up as `<name[-env]>.<region>.cloudgenix.com` **Parameters:** - **region:** region string. **Returns:** No return value, mutates the ...
python
def update_region_to_controller(self, region): """ Update the controller string with dynamic region info. Controller string should end up as `<name[-env]>.<region>.cloudgenix.com` **Parameters:** - **region:** region string. **Returns:** No return value, mutates the ...
[ "def", "update_region_to_controller", "(", "self", ",", "region", ")", ":", "# default region position in a list", "region_position", "=", "1", "# Check for a global \"ignore region\" flag", "if", "self", ".", "ignore_region", ":", "# bypass", "api_logger", ".", "debug", ...
Update the controller string with dynamic region info. Controller string should end up as `<name[-env]>.<region>.cloudgenix.com` **Parameters:** - **region:** region string. **Returns:** No return value, mutates the controller in the class namespace
[ "Update", "the", "controller", "string", "with", "dynamic", "region", "info", ".", "Controller", "string", "should", "end", "up", "as", "<name", "[", "-", "env", "]", ">", ".", "<region", ">", ".", "cloudgenix", ".", "com" ]
1b2f92582b6a19769134914793bfd00e4caa074b
https://github.com/CloudGenix/sdk-python/blob/1b2f92582b6a19769134914793bfd00e4caa074b/cloudgenix/__init__.py#L933-L997
train
CloudGenix/sdk-python
cloudgenix/__init__.py
API.parse_region
def parse_region(self, login_response): """ Return region from a successful login response. **Parameters:** - **login_response:** requests.Response from a successful login. **Returns:** region name. """ auth_token = login_response.cgx_content['x_auth_token'] ...
python
def parse_region(self, login_response): """ Return region from a successful login response. **Parameters:** - **login_response:** requests.Response from a successful login. **Returns:** region name. """ auth_token = login_response.cgx_content['x_auth_token'] ...
[ "def", "parse_region", "(", "self", ",", "login_response", ")", ":", "auth_token", "=", "login_response", ".", "cgx_content", "[", "'x_auth_token'", "]", "auth_token_dict", "=", "self", ".", "parse_auth_token", "(", "auth_token", ")", "auth_region", "=", "auth_tok...
Return region from a successful login response. **Parameters:** - **login_response:** requests.Response from a successful login. **Returns:** region name.
[ "Return", "region", "from", "a", "successful", "login", "response", "." ]
1b2f92582b6a19769134914793bfd00e4caa074b
https://github.com/CloudGenix/sdk-python/blob/1b2f92582b6a19769134914793bfd00e4caa074b/cloudgenix/__init__.py#L999-L1012
train
CloudGenix/sdk-python
cloudgenix/__init__.py
API.reparse_login_cookie_after_region_update
def reparse_login_cookie_after_region_update(self, login_response): """ Sometimes, login cookie gets sent with region info instead of api.cloudgenix.com. This function re-parses the original login request and applies cookies to the session if they now match the new region. **Parameters:...
python
def reparse_login_cookie_after_region_update(self, login_response): """ Sometimes, login cookie gets sent with region info instead of api.cloudgenix.com. This function re-parses the original login request and applies cookies to the session if they now match the new region. **Parameters:...
[ "def", "reparse_login_cookie_after_region_update", "(", "self", ",", "login_response", ")", ":", "login_url", "=", "login_response", ".", "request", ".", "url", "api_logger", ".", "debug", "(", "\"ORIGINAL REQUEST URL = %s\"", ",", "login_url", ")", "# replace old contr...
Sometimes, login cookie gets sent with region info instead of api.cloudgenix.com. This function re-parses the original login request and applies cookies to the session if they now match the new region. **Parameters:** - **login_response:** requests.Response from a non-region login. ...
[ "Sometimes", "login", "cookie", "gets", "sent", "with", "region", "info", "instead", "of", "api", ".", "cloudgenix", ".", "com", ".", "This", "function", "re", "-", "parses", "the", "original", "login", "request", "and", "applies", "cookies", "to", "the", ...
1b2f92582b6a19769134914793bfd00e4caa074b
https://github.com/CloudGenix/sdk-python/blob/1b2f92582b6a19769134914793bfd00e4caa074b/cloudgenix/__init__.py#L1014-L1038
train
CloudGenix/sdk-python
cloudgenix/__init__.py
API._catch_nonjson_streamresponse
def _catch_nonjson_streamresponse(rawresponse): """ Validate a streamed response is JSON. Return a Python dictionary either way. **Parameters:** - **rawresponse:** Streamed Response from Requests. **Returns:** Dictionary """ # attempt to load response for re...
python
def _catch_nonjson_streamresponse(rawresponse): """ Validate a streamed response is JSON. Return a Python dictionary either way. **Parameters:** - **rawresponse:** Streamed Response from Requests. **Returns:** Dictionary """ # attempt to load response for re...
[ "def", "_catch_nonjson_streamresponse", "(", "rawresponse", ")", ":", "# attempt to load response for return.", "try", ":", "response", "=", "json", ".", "loads", "(", "rawresponse", ")", "except", "(", "ValueError", ",", "TypeError", ")", ":", "if", "rawresponse", ...
Validate a streamed response is JSON. Return a Python dictionary either way. **Parameters:** - **rawresponse:** Streamed Response from Requests. **Returns:** Dictionary
[ "Validate", "a", "streamed", "response", "is", "JSON", ".", "Return", "a", "Python", "dictionary", "either", "way", "." ]
1b2f92582b6a19769134914793bfd00e4caa074b
https://github.com/CloudGenix/sdk-python/blob/1b2f92582b6a19769134914793bfd00e4caa074b/cloudgenix/__init__.py#L1041-L1069
train
CloudGenix/sdk-python
cloudgenix/__init__.py
API.url_decode
def url_decode(url): """ URL Decode function using REGEX **Parameters:** - **url:** URLENCODED text string **Returns:** Non URLENCODED string """ return re.compile('%([0-9a-fA-F]{2})', re.M).sub(lambda m: chr(int(m.group(1), 16)), url)
python
def url_decode(url): """ URL Decode function using REGEX **Parameters:** - **url:** URLENCODED text string **Returns:** Non URLENCODED string """ return re.compile('%([0-9a-fA-F]{2})', re.M).sub(lambda m: chr(int(m.group(1), 16)), url)
[ "def", "url_decode", "(", "url", ")", ":", "return", "re", ".", "compile", "(", "'%([0-9a-fA-F]{2})'", ",", "re", ".", "M", ")", ".", "sub", "(", "lambda", "m", ":", "chr", "(", "int", "(", "m", ".", "group", "(", "1", ")", ",", "16", ")", ")",...
URL Decode function using REGEX **Parameters:** - **url:** URLENCODED text string **Returns:** Non URLENCODED string
[ "URL", "Decode", "function", "using", "REGEX" ]
1b2f92582b6a19769134914793bfd00e4caa074b
https://github.com/CloudGenix/sdk-python/blob/1b2f92582b6a19769134914793bfd00e4caa074b/cloudgenix/__init__.py#L1072-L1082
train
deplicate/deplicate
duplicate/utils/fs/nt.py
blksize
def blksize(path): """ Get optimal file system buffer size (in bytes) for I/O calls. """ diskfreespace = win32file.GetDiskFreeSpace dirname = os.path.dirname(fullpath(path)) try: cluster_sectors, sector_size = diskfreespace(dirname)[:2] size = cluster_sectors * sector_size e...
python
def blksize(path): """ Get optimal file system buffer size (in bytes) for I/O calls. """ diskfreespace = win32file.GetDiskFreeSpace dirname = os.path.dirname(fullpath(path)) try: cluster_sectors, sector_size = diskfreespace(dirname)[:2] size = cluster_sectors * sector_size e...
[ "def", "blksize", "(", "path", ")", ":", "diskfreespace", "=", "win32file", ".", "GetDiskFreeSpace", "dirname", "=", "os", ".", "path", ".", "dirname", "(", "fullpath", "(", "path", ")", ")", "try", ":", "cluster_sectors", ",", "sector_size", "=", "diskfre...
Get optimal file system buffer size (in bytes) for I/O calls.
[ "Get", "optimal", "file", "system", "buffer", "size", "(", "in", "bytes", ")", "for", "I", "/", "O", "calls", "." ]
9975502571d1d024a990f5cb304d01b63c0d7717
https://github.com/deplicate/deplicate/blob/9975502571d1d024a990f5cb304d01b63c0d7717/duplicate/utils/fs/nt.py#L28-L44
train
greyli/flask-avatars
flask_avatars/__init__.py
_Avatars.gravatar
def gravatar(hash, size=100, rating='g', default='identicon', include_extension=False, force_default=False): """Pass email hash, return Gravatar URL. You can get email hash like this:: import hashlib avatar_hash = hashlib.md5(email.lower().encode('utf-8')).hexdigest() Visit htt...
python
def gravatar(hash, size=100, rating='g', default='identicon', include_extension=False, force_default=False): """Pass email hash, return Gravatar URL. You can get email hash like this:: import hashlib avatar_hash = hashlib.md5(email.lower().encode('utf-8')).hexdigest() Visit htt...
[ "def", "gravatar", "(", "hash", ",", "size", "=", "100", ",", "rating", "=", "'g'", ",", "default", "=", "'identicon'", ",", "include_extension", "=", "False", ",", "force_default", "=", "False", ")", ":", "if", "include_extension", ":", "hash", "+=", "'...
Pass email hash, return Gravatar URL. You can get email hash like this:: import hashlib avatar_hash = hashlib.md5(email.lower().encode('utf-8')).hexdigest() Visit https://en.gravatar.com/site/implement/images/ for more information. :param hash: The email hash used to generate ...
[ "Pass", "email", "hash", "return", "Gravatar", "URL", ".", "You", "can", "get", "email", "hash", "like", "this", "::" ]
13eca90342349c58962fef0ec541edcb1b009c70
https://github.com/greyli/flask-avatars/blob/13eca90342349c58962fef0ec541edcb1b009c70/flask_avatars/__init__.py#L27-L50
train
greyli/flask-avatars
flask_avatars/__init__.py
_Avatars.social_media
def social_media(username, platform='twitter', size='medium'): """Return avatar URL at social media. Visit https://avatars.io for more information. :param username: The username of the social media. :param platform: One of facebook, instagram, twitter, gravatar. :param size: The...
python
def social_media(username, platform='twitter', size='medium'): """Return avatar URL at social media. Visit https://avatars.io for more information. :param username: The username of the social media. :param platform: One of facebook, instagram, twitter, gravatar. :param size: The...
[ "def", "social_media", "(", "username", ",", "platform", "=", "'twitter'", ",", "size", "=", "'medium'", ")", ":", "return", "'https://avatars.io/{platform}/{username}/{size}'", ".", "format", "(", "platform", "=", "platform", ",", "username", "=", "username", ","...
Return avatar URL at social media. Visit https://avatars.io for more information. :param username: The username of the social media. :param platform: One of facebook, instagram, twitter, gravatar. :param size: The size of avatar, one of small, medium and large.
[ "Return", "avatar", "URL", "at", "social", "media", ".", "Visit", "https", ":", "//", "avatars", ".", "io", "for", "more", "information", "." ]
13eca90342349c58962fef0ec541edcb1b009c70
https://github.com/greyli/flask-avatars/blob/13eca90342349c58962fef0ec541edcb1b009c70/flask_avatars/__init__.py#L63-L72
train
greyli/flask-avatars
flask_avatars/__init__.py
_Avatars.jcrop_css
def jcrop_css(css_url=None): """Load jcrop css file. :param css_url: The custom CSS URL. """ if css_url is None: if current_app.config['AVATARS_SERVE_LOCAL']: css_url = url_for('avatars.static', filename='jcrop/css/jquery.Jcrop.min.css') else: ...
python
def jcrop_css(css_url=None): """Load jcrop css file. :param css_url: The custom CSS URL. """ if css_url is None: if current_app.config['AVATARS_SERVE_LOCAL']: css_url = url_for('avatars.static', filename='jcrop/css/jquery.Jcrop.min.css') else: ...
[ "def", "jcrop_css", "(", "css_url", "=", "None", ")", ":", "if", "css_url", "is", "None", ":", "if", "current_app", ".", "config", "[", "'AVATARS_SERVE_LOCAL'", "]", ":", "css_url", "=", "url_for", "(", "'avatars.static'", ",", "filename", "=", "'jcrop/css/j...
Load jcrop css file. :param css_url: The custom CSS URL.
[ "Load", "jcrop", "css", "file", "." ]
13eca90342349c58962fef0ec541edcb1b009c70
https://github.com/greyli/flask-avatars/blob/13eca90342349c58962fef0ec541edcb1b009c70/flask_avatars/__init__.py#L84-L94
train
greyli/flask-avatars
flask_avatars/__init__.py
_Avatars.jcrop_js
def jcrop_js(js_url=None, with_jquery=True): """Load jcrop Javascript file. :param js_url: The custom JavaScript URL. :param with_jquery: Include jQuery or not, default to ``True``. """ serve_local = current_app.config['AVATARS_SERVE_LOCAL'] if js_url is None: ...
python
def jcrop_js(js_url=None, with_jquery=True): """Load jcrop Javascript file. :param js_url: The custom JavaScript URL. :param with_jquery: Include jQuery or not, default to ``True``. """ serve_local = current_app.config['AVATARS_SERVE_LOCAL'] if js_url is None: ...
[ "def", "jcrop_js", "(", "js_url", "=", "None", ",", "with_jquery", "=", "True", ")", ":", "serve_local", "=", "current_app", ".", "config", "[", "'AVATARS_SERVE_LOCAL'", "]", "if", "js_url", "is", "None", ":", "if", "serve_local", ":", "js_url", "=", "url_...
Load jcrop Javascript file. :param js_url: The custom JavaScript URL. :param with_jquery: Include jQuery or not, default to ``True``.
[ "Load", "jcrop", "Javascript", "file", "." ]
13eca90342349c58962fef0ec541edcb1b009c70
https://github.com/greyli/flask-avatars/blob/13eca90342349c58962fef0ec541edcb1b009c70/flask_avatars/__init__.py#L97-L119
train
greyli/flask-avatars
flask_avatars/__init__.py
_Avatars.crop_box
def crop_box(endpoint=None, filename=None): """Create a crop box. :param endpoint: The endpoint of view function that serve avatar image file. :param filename: The filename of the image that need to be crop. """ crop_size = current_app.config['AVATARS_CROP_BASE_WIDTH'] ...
python
def crop_box(endpoint=None, filename=None): """Create a crop box. :param endpoint: The endpoint of view function that serve avatar image file. :param filename: The filename of the image that need to be crop. """ crop_size = current_app.config['AVATARS_CROP_BASE_WIDTH'] ...
[ "def", "crop_box", "(", "endpoint", "=", "None", ",", "filename", "=", "None", ")", ":", "crop_size", "=", "current_app", ".", "config", "[", "'AVATARS_CROP_BASE_WIDTH'", "]", "if", "endpoint", "is", "None", "or", "filename", "is", "None", ":", "url", "=",...
Create a crop box. :param endpoint: The endpoint of view function that serve avatar image file. :param filename: The filename of the image that need to be crop.
[ "Create", "a", "crop", "box", "." ]
13eca90342349c58962fef0ec541edcb1b009c70
https://github.com/greyli/flask-avatars/blob/13eca90342349c58962fef0ec541edcb1b009c70/flask_avatars/__init__.py#L122-L134
train
greyli/flask-avatars
flask_avatars/__init__.py
_Avatars.preview_box
def preview_box(endpoint=None, filename=None): """Create a preview box. :param endpoint: The endpoint of view function that serve avatar image file. :param filename: The filename of the image that need to be crop. """ preview_size = current_app.config['AVATARS_CROP_PREVIEW_SIZE'...
python
def preview_box(endpoint=None, filename=None): """Create a preview box. :param endpoint: The endpoint of view function that serve avatar image file. :param filename: The filename of the image that need to be crop. """ preview_size = current_app.config['AVATARS_CROP_PREVIEW_SIZE'...
[ "def", "preview_box", "(", "endpoint", "=", "None", ",", "filename", "=", "None", ")", ":", "preview_size", "=", "current_app", ".", "config", "[", "'AVATARS_CROP_PREVIEW_SIZE'", "]", "or", "current_app", ".", "config", "[", "'AVATARS_SIZE_TUPLE'", "]", "[", "...
Create a preview box. :param endpoint: The endpoint of view function that serve avatar image file. :param filename: The filename of the image that need to be crop.
[ "Create", "a", "preview", "box", "." ]
13eca90342349c58962fef0ec541edcb1b009c70
https://github.com/greyli/flask-avatars/blob/13eca90342349c58962fef0ec541edcb1b009c70/flask_avatars/__init__.py#L137-L154
train
greyli/flask-avatars
flask_avatars/__init__.py
_Avatars.init_jcrop
def init_jcrop(min_size=None): """Initialize jcrop. :param min_size: The minimal size of crop area. """ init_x = current_app.config['AVATARS_CROP_INIT_POS'][0] init_y = current_app.config['AVATARS_CROP_INIT_POS'][1] init_size = current_app.config['AVATARS_CROP_INIT_SIZE'...
python
def init_jcrop(min_size=None): """Initialize jcrop. :param min_size: The minimal size of crop area. """ init_x = current_app.config['AVATARS_CROP_INIT_POS'][0] init_y = current_app.config['AVATARS_CROP_INIT_POS'][1] init_size = current_app.config['AVATARS_CROP_INIT_SIZE'...
[ "def", "init_jcrop", "(", "min_size", "=", "None", ")", ":", "init_x", "=", "current_app", ".", "config", "[", "'AVATARS_CROP_INIT_POS'", "]", "[", "0", "]", "init_y", "=", "current_app", ".", "config", "[", "'AVATARS_CROP_INIT_POS'", "]", "[", "1", "]", "...
Initialize jcrop. :param min_size: The minimal size of crop area.
[ "Initialize", "jcrop", "." ]
13eca90342349c58962fef0ec541edcb1b009c70
https://github.com/greyli/flask-avatars/blob/13eca90342349c58962fef0ec541edcb1b009c70/flask_avatars/__init__.py#L157-L226
train
greyli/flask-avatars
flask_avatars/__init__.py
Avatars.resize_avatar
def resize_avatar(self, img, base_width): """Resize an avatar. :param img: The image that needs to be resize. :param base_width: The width of output image. """ w_percent = (base_width / float(img.size[0])) h_size = int((float(img.size[1]) * float(w_percent))) img...
python
def resize_avatar(self, img, base_width): """Resize an avatar. :param img: The image that needs to be resize. :param base_width: The width of output image. """ w_percent = (base_width / float(img.size[0])) h_size = int((float(img.size[1]) * float(w_percent))) img...
[ "def", "resize_avatar", "(", "self", ",", "img", ",", "base_width", ")", ":", "w_percent", "=", "(", "base_width", "/", "float", "(", "img", ".", "size", "[", "0", "]", ")", ")", "h_size", "=", "int", "(", "(", "float", "(", "img", ".", "size", "...
Resize an avatar. :param img: The image that needs to be resize. :param base_width: The width of output image.
[ "Resize", "an", "avatar", "." ]
13eca90342349c58962fef0ec541edcb1b009c70
https://github.com/greyli/flask-avatars/blob/13eca90342349c58962fef0ec541edcb1b009c70/flask_avatars/__init__.py#L278-L287
train
greyli/flask-avatars
flask_avatars/__init__.py
Avatars.save_avatar
def save_avatar(self, image): """Save an avatar as raw image, return new filename. :param image: The image that needs to be saved. """ path = current_app.config['AVATARS_SAVE_PATH'] filename = uuid4().hex + '_raw.png' image.save(os.path.join(path, filename)) retu...
python
def save_avatar(self, image): """Save an avatar as raw image, return new filename. :param image: The image that needs to be saved. """ path = current_app.config['AVATARS_SAVE_PATH'] filename = uuid4().hex + '_raw.png' image.save(os.path.join(path, filename)) retu...
[ "def", "save_avatar", "(", "self", ",", "image", ")", ":", "path", "=", "current_app", ".", "config", "[", "'AVATARS_SAVE_PATH'", "]", "filename", "=", "uuid4", "(", ")", ".", "hex", "+", "'_raw.png'", "image", ".", "save", "(", "os", ".", "path", ".",...
Save an avatar as raw image, return new filename. :param image: The image that needs to be saved.
[ "Save", "an", "avatar", "as", "raw", "image", "return", "new", "filename", "." ]
13eca90342349c58962fef0ec541edcb1b009c70
https://github.com/greyli/flask-avatars/blob/13eca90342349c58962fef0ec541edcb1b009c70/flask_avatars/__init__.py#L289-L297
train
greyli/flask-avatars
flask_avatars/__init__.py
Avatars.crop_avatar
def crop_avatar(self, filename, x, y, w, h): """Crop avatar with given size, return a list of file name: [filename_s, filename_m, filename_l]. :param filename: The raw image's filename. :param x: The x-pos to start crop. :param y: The y-pos to start crop. :param w: The crop widt...
python
def crop_avatar(self, filename, x, y, w, h): """Crop avatar with given size, return a list of file name: [filename_s, filename_m, filename_l]. :param filename: The raw image's filename. :param x: The x-pos to start crop. :param y: The y-pos to start crop. :param w: The crop widt...
[ "def", "crop_avatar", "(", "self", ",", "filename", ",", "x", ",", "y", ",", "w", ",", "h", ")", ":", "x", "=", "int", "(", "x", ")", "y", "=", "int", "(", "y", ")", "w", "=", "int", "(", "w", ")", "h", "=", "int", "(", "h", ")", "sizes...
Crop avatar with given size, return a list of file name: [filename_s, filename_m, filename_l]. :param filename: The raw image's filename. :param x: The x-pos to start crop. :param y: The y-pos to start crop. :param w: The crop width. :param h: The crop height.
[ "Crop", "avatar", "with", "given", "size", "return", "a", "list", "of", "file", "name", ":", "[", "filename_s", "filename_m", "filename_l", "]", "." ]
13eca90342349c58962fef0ec541edcb1b009c70
https://github.com/greyli/flask-avatars/blob/13eca90342349c58962fef0ec541edcb1b009c70/flask_avatars/__init__.py#L299-L349
train
greyli/flask-avatars
flask_avatars/identicon.py
Identicon.get_image
def get_image(self, string, width, height, pad=0): """ Byte representation of a PNG image """ hex_digest_byte_list = self._string_to_byte_list(string) matrix = self._create_matrix(hex_digest_byte_list) return self._create_image(matrix, width, height, pad)
python
def get_image(self, string, width, height, pad=0): """ Byte representation of a PNG image """ hex_digest_byte_list = self._string_to_byte_list(string) matrix = self._create_matrix(hex_digest_byte_list) return self._create_image(matrix, width, height, pad)
[ "def", "get_image", "(", "self", ",", "string", ",", "width", ",", "height", ",", "pad", "=", "0", ")", ":", "hex_digest_byte_list", "=", "self", ".", "_string_to_byte_list", "(", "string", ")", "matrix", "=", "self", ".", "_create_matrix", "(", "hex_diges...
Byte representation of a PNG image
[ "Byte", "representation", "of", "a", "PNG", "image" ]
13eca90342349c58962fef0ec541edcb1b009c70
https://github.com/greyli/flask-avatars/blob/13eca90342349c58962fef0ec541edcb1b009c70/flask_avatars/identicon.py#L72-L78
train
greyli/flask-avatars
flask_avatars/identicon.py
Identicon._get_pastel_colour
def _get_pastel_colour(self, lighten=127): """ Create a pastel colour hex colour string """ def r(): return random.randint(0, 128) + lighten return r(), r(), r()
python
def _get_pastel_colour(self, lighten=127): """ Create a pastel colour hex colour string """ def r(): return random.randint(0, 128) + lighten return r(), r(), r()
[ "def", "_get_pastel_colour", "(", "self", ",", "lighten", "=", "127", ")", ":", "def", "r", "(", ")", ":", "return", "random", ".", "randint", "(", "0", ",", "128", ")", "+", "lighten", "return", "r", "(", ")", ",", "r", "(", ")", ",", "r", "("...
Create a pastel colour hex colour string
[ "Create", "a", "pastel", "colour", "hex", "colour", "string" ]
13eca90342349c58962fef0ec541edcb1b009c70
https://github.com/greyli/flask-avatars/blob/13eca90342349c58962fef0ec541edcb1b009c70/flask_avatars/identicon.py#L87-L93
train
greyli/flask-avatars
flask_avatars/identicon.py
Identicon._luminance
def _luminance(self, rgb): """ Determine the liminanace of an RGB colour """ a = [] for v in rgb: v = v / float(255) if v < 0.03928: result = v / 12.92 else: result = math.pow(((v + 0.055) / 1.055), 2.4) ...
python
def _luminance(self, rgb): """ Determine the liminanace of an RGB colour """ a = [] for v in rgb: v = v / float(255) if v < 0.03928: result = v / 12.92 else: result = math.pow(((v + 0.055) / 1.055), 2.4) ...
[ "def", "_luminance", "(", "self", ",", "rgb", ")", ":", "a", "=", "[", "]", "for", "v", "in", "rgb", ":", "v", "=", "v", "/", "float", "(", "255", ")", "if", "v", "<", "0.03928", ":", "result", "=", "v", "/", "12.92", "else", ":", "result", ...
Determine the liminanace of an RGB colour
[ "Determine", "the", "liminanace", "of", "an", "RGB", "colour" ]
13eca90342349c58962fef0ec541edcb1b009c70
https://github.com/greyli/flask-avatars/blob/13eca90342349c58962fef0ec541edcb1b009c70/flask_avatars/identicon.py#L95-L108
train
greyli/flask-avatars
flask_avatars/identicon.py
Identicon._string_to_byte_list
def _string_to_byte_list(self, data): """ Creates a hex digest of the input string given to create the image, if it's not already hexadecimal Returns: Length 16 list of rgb value range integers (each representing a byte of the hex digest) """ byte...
python
def _string_to_byte_list(self, data): """ Creates a hex digest of the input string given to create the image, if it's not already hexadecimal Returns: Length 16 list of rgb value range integers (each representing a byte of the hex digest) """ byte...
[ "def", "_string_to_byte_list", "(", "self", ",", "data", ")", ":", "bytes_length", "=", "16", "m", "=", "self", ".", "digest", "(", ")", "m", ".", "update", "(", "str", ".", "encode", "(", "data", ")", ")", "hex_digest", "=", "m", ".", "hexdigest", ...
Creates a hex digest of the input string given to create the image, if it's not already hexadecimal Returns: Length 16 list of rgb value range integers (each representing a byte of the hex digest)
[ "Creates", "a", "hex", "digest", "of", "the", "input", "string", "given", "to", "create", "the", "image", "if", "it", "s", "not", "already", "hexadecimal" ]
13eca90342349c58962fef0ec541edcb1b009c70
https://github.com/greyli/flask-avatars/blob/13eca90342349c58962fef0ec541edcb1b009c70/flask_avatars/identicon.py#L110-L126
train
greyli/flask-avatars
flask_avatars/identicon.py
Identicon._bit_is_one
def _bit_is_one(self, n, hash_bytes): """ Check if the n (index) of hash_bytes is 1 or 0. """ scale = 16 # hexadecimal if not hash_bytes[int(n / (scale / 2))] >> int( (scale / 2) - ((n % (scale / 2)) + 1)) & 1 == 1: return False return True
python
def _bit_is_one(self, n, hash_bytes): """ Check if the n (index) of hash_bytes is 1 or 0. """ scale = 16 # hexadecimal if not hash_bytes[int(n / (scale / 2))] >> int( (scale / 2) - ((n % (scale / 2)) + 1)) & 1 == 1: return False return True
[ "def", "_bit_is_one", "(", "self", ",", "n", ",", "hash_bytes", ")", ":", "scale", "=", "16", "# hexadecimal", "if", "not", "hash_bytes", "[", "int", "(", "n", "/", "(", "scale", "/", "2", ")", ")", "]", ">>", "int", "(", "(", "scale", "/", "2", ...
Check if the n (index) of hash_bytes is 1 or 0.
[ "Check", "if", "the", "n", "(", "index", ")", "of", "hash_bytes", "is", "1", "or", "0", "." ]
13eca90342349c58962fef0ec541edcb1b009c70
https://github.com/greyli/flask-avatars/blob/13eca90342349c58962fef0ec541edcb1b009c70/flask_avatars/identicon.py#L128-L138
train
greyli/flask-avatars
flask_avatars/identicon.py
Identicon._create_image
def _create_image(self, matrix, width, height, pad): """ Generates a PNG byte list """ image = Image.new("RGB", (width + (pad * 2), height + (pad * 2)), self.bg_colour) image_draw = ImageDraw.Draw(image) # Calculate the block width and ...
python
def _create_image(self, matrix, width, height, pad): """ Generates a PNG byte list """ image = Image.new("RGB", (width + (pad * 2), height + (pad * 2)), self.bg_colour) image_draw = ImageDraw.Draw(image) # Calculate the block width and ...
[ "def", "_create_image", "(", "self", ",", "matrix", ",", "width", ",", "height", ",", "pad", ")", ":", "image", "=", "Image", ".", "new", "(", "\"RGB\"", ",", "(", "width", "+", "(", "pad", "*", "2", ")", ",", "height", "+", "(", "pad", "*", "2...
Generates a PNG byte list
[ "Generates", "a", "PNG", "byte", "list" ]
13eca90342349c58962fef0ec541edcb1b009c70
https://github.com/greyli/flask-avatars/blob/13eca90342349c58962fef0ec541edcb1b009c70/flask_avatars/identicon.py#L140-L167
train
greyli/flask-avatars
flask_avatars/identicon.py
Identicon._create_matrix
def _create_matrix(self, byte_list): """ This matrix decides which blocks should be filled fg/bg colour True for fg_colour False for bg_colour hash_bytes - array of hash bytes values. RGB range values in each slot Returns: List representation of the matrix ...
python
def _create_matrix(self, byte_list): """ This matrix decides which blocks should be filled fg/bg colour True for fg_colour False for bg_colour hash_bytes - array of hash bytes values. RGB range values in each slot Returns: List representation of the matrix ...
[ "def", "_create_matrix", "(", "self", ",", "byte_list", ")", ":", "# Number of rows * cols halfed and rounded", "# in order to fill opposite side", "cells", "=", "int", "(", "self", ".", "rows", "*", "self", ".", "cols", "/", "2", "+", "self", ".", "cols", "%", ...
This matrix decides which blocks should be filled fg/bg colour True for fg_colour False for bg_colour hash_bytes - array of hash bytes values. RGB range values in each slot Returns: List representation of the matrix [[True, True, True, True], [False,...
[ "This", "matrix", "decides", "which", "blocks", "should", "be", "filled", "fg", "/", "bg", "colour", "True", "for", "fg_colour", "False", "for", "bg_colour" ]
13eca90342349c58962fef0ec541edcb1b009c70
https://github.com/greyli/flask-avatars/blob/13eca90342349c58962fef0ec541edcb1b009c70/flask_avatars/identicon.py#L169-L203
train
greyli/flask-avatars
flask_avatars/identicon.py
Identicon.generate
def generate(self, text): """Generate and save avatars, return a list of file name: [filename_s, filename_m, filename_l]. :param text: The text used to generate image. """ sizes = current_app.config['AVATARS_SIZE_TUPLE'] path = current_app.config['AVATARS_SAVE_PATH'] suf...
python
def generate(self, text): """Generate and save avatars, return a list of file name: [filename_s, filename_m, filename_l]. :param text: The text used to generate image. """ sizes = current_app.config['AVATARS_SIZE_TUPLE'] path = current_app.config['AVATARS_SAVE_PATH'] suf...
[ "def", "generate", "(", "self", ",", "text", ")", ":", "sizes", "=", "current_app", ".", "config", "[", "'AVATARS_SIZE_TUPLE'", "]", "path", "=", "current_app", ".", "config", "[", "'AVATARS_SAVE_PATH'", "]", "suffix", "=", "{", "sizes", "[", "0", "]", "...
Generate and save avatars, return a list of file name: [filename_s, filename_m, filename_l]. :param text: The text used to generate image.
[ "Generate", "and", "save", "avatars", "return", "a", "list", "of", "file", "name", ":", "[", "filename_s", "filename_m", "filename_l", "]", "." ]
13eca90342349c58962fef0ec541edcb1b009c70
https://github.com/greyli/flask-avatars/blob/13eca90342349c58962fef0ec541edcb1b009c70/flask_avatars/identicon.py#L205-L221
train
rbuffat/pyepw
pyepw/epw.py
Location.read
def read(self, vals): """Read values. Args: vals (list): list of strings representing values """ i = 0 if len(vals[i]) == 0: self.city = None else: self.city = vals[i] i += 1 if len(vals[i]) == 0: self.stat...
python
def read(self, vals): """Read values. Args: vals (list): list of strings representing values """ i = 0 if len(vals[i]) == 0: self.city = None else: self.city = vals[i] i += 1 if len(vals[i]) == 0: self.stat...
[ "def", "read", "(", "self", ",", "vals", ")", ":", "i", "=", "0", "if", "len", "(", "vals", "[", "i", "]", ")", "==", "0", ":", "self", ".", "city", "=", "None", "else", ":", "self", ".", "city", "=", "vals", "[", "i", "]", "i", "+=", "1"...
Read values. Args: vals (list): list of strings representing values
[ "Read", "values", "." ]
373d4d3c8386c8d35789f086ac5f6018c2711745
https://github.com/rbuffat/pyepw/blob/373d4d3c8386c8d35789f086ac5f6018c2711745/pyepw/epw.py#L35-L87
train
rbuffat/pyepw
pyepw/epw.py
Location.city
def city(self, value=None): """Corresponds to IDD Field `city` Args: value (str): value for IDD Field `city` if `value` is None it will not be checked against the specification and is assumed to be a missing value Raises: ValueError: if `...
python
def city(self, value=None): """Corresponds to IDD Field `city` Args: value (str): value for IDD Field `city` if `value` is None it will not be checked against the specification and is assumed to be a missing value Raises: ValueError: if `...
[ "def", "city", "(", "self", ",", "value", "=", "None", ")", ":", "if", "value", "is", "not", "None", ":", "try", ":", "value", "=", "str", "(", "value", ")", "except", "ValueError", ":", "raise", "ValueError", "(", "'value {} need to be of type str '", "...
Corresponds to IDD Field `city` Args: value (str): value for IDD Field `city` if `value` is None it will not be checked against the specification and is assumed to be a missing value Raises: ValueError: if `value` is not a valid value
[ "Corresponds", "to", "IDD", "Field", "city" ]
373d4d3c8386c8d35789f086ac5f6018c2711745
https://github.com/rbuffat/pyepw/blob/373d4d3c8386c8d35789f086ac5f6018c2711745/pyepw/epw.py#L100-L122
train
rbuffat/pyepw
pyepw/epw.py
Location.state_province_region
def state_province_region(self, value=None): """Corresponds to IDD Field `state_province_region` Args: value (str): value for IDD Field `state_province_region` if `value` is None it will not be checked against the specification and is assumed to be a missing ...
python
def state_province_region(self, value=None): """Corresponds to IDD Field `state_province_region` Args: value (str): value for IDD Field `state_province_region` if `value` is None it will not be checked against the specification and is assumed to be a missing ...
[ "def", "state_province_region", "(", "self", ",", "value", "=", "None", ")", ":", "if", "value", "is", "not", "None", ":", "try", ":", "value", "=", "str", "(", "value", ")", "except", "ValueError", ":", "raise", "ValueError", "(", "'value {} need to be of...
Corresponds to IDD Field `state_province_region` Args: value (str): value for IDD Field `state_province_region` if `value` is None it will not be checked against the specification and is assumed to be a missing value Raises: ValueError: if `value...
[ "Corresponds", "to", "IDD", "Field", "state_province_region" ]
373d4d3c8386c8d35789f086ac5f6018c2711745
https://github.com/rbuffat/pyepw/blob/373d4d3c8386c8d35789f086ac5f6018c2711745/pyepw/epw.py#L135-L158
train
rbuffat/pyepw
pyepw/epw.py
Location.country
def country(self, value=None): """Corresponds to IDD Field `country` Args: value (str): value for IDD Field `country` if `value` is None it will not be checked against the specification and is assumed to be a missing value Raises: ValueEr...
python
def country(self, value=None): """Corresponds to IDD Field `country` Args: value (str): value for IDD Field `country` if `value` is None it will not be checked against the specification and is assumed to be a missing value Raises: ValueEr...
[ "def", "country", "(", "self", ",", "value", "=", "None", ")", ":", "if", "value", "is", "not", "None", ":", "try", ":", "value", "=", "str", "(", "value", ")", "except", "ValueError", ":", "raise", "ValueError", "(", "'value {} need to be of type str '", ...
Corresponds to IDD Field `country` Args: value (str): value for IDD Field `country` if `value` is None it will not be checked against the specification and is assumed to be a missing value Raises: ValueError: if `value` is not a valid value
[ "Corresponds", "to", "IDD", "Field", "country" ]
373d4d3c8386c8d35789f086ac5f6018c2711745
https://github.com/rbuffat/pyepw/blob/373d4d3c8386c8d35789f086ac5f6018c2711745/pyepw/epw.py#L171-L193
train
rbuffat/pyepw
pyepw/epw.py
Location.source
def source(self, value=None): """Corresponds to IDD Field `source` Args: value (str): value for IDD Field `source` if `value` is None it will not be checked against the specification and is assumed to be a missing value Raises: ValueError...
python
def source(self, value=None): """Corresponds to IDD Field `source` Args: value (str): value for IDD Field `source` if `value` is None it will not be checked against the specification and is assumed to be a missing value Raises: ValueError...
[ "def", "source", "(", "self", ",", "value", "=", "None", ")", ":", "if", "value", "is", "not", "None", ":", "try", ":", "value", "=", "str", "(", "value", ")", "except", "ValueError", ":", "raise", "ValueError", "(", "'value {} need to be of type str '", ...
Corresponds to IDD Field `source` Args: value (str): value for IDD Field `source` if `value` is None it will not be checked against the specification and is assumed to be a missing value Raises: ValueError: if `value` is not a valid value
[ "Corresponds", "to", "IDD", "Field", "source" ]
373d4d3c8386c8d35789f086ac5f6018c2711745
https://github.com/rbuffat/pyepw/blob/373d4d3c8386c8d35789f086ac5f6018c2711745/pyepw/epw.py#L206-L228
train
rbuffat/pyepw
pyepw/epw.py
Location.wmo
def wmo(self, value=None): """Corresponds to IDD Field `wmo` usually a 6 digit field. Used as alpha in EnergyPlus. Args: value (str): value for IDD Field `wmo` if `value` is None it will not be checked against the specification and is assumed to be a ...
python
def wmo(self, value=None): """Corresponds to IDD Field `wmo` usually a 6 digit field. Used as alpha in EnergyPlus. Args: value (str): value for IDD Field `wmo` if `value` is None it will not be checked against the specification and is assumed to be a ...
[ "def", "wmo", "(", "self", ",", "value", "=", "None", ")", ":", "if", "value", "is", "not", "None", ":", "try", ":", "value", "=", "str", "(", "value", ")", "except", "ValueError", ":", "raise", "ValueError", "(", "'value {} need to be of type str '", "'...
Corresponds to IDD Field `wmo` usually a 6 digit field. Used as alpha in EnergyPlus. Args: value (str): value for IDD Field `wmo` if `value` is None it will not be checked against the specification and is assumed to be a missing value Raises: ...
[ "Corresponds", "to", "IDD", "Field", "wmo", "usually", "a", "6", "digit", "field", ".", "Used", "as", "alpha", "in", "EnergyPlus", "." ]
373d4d3c8386c8d35789f086ac5f6018c2711745
https://github.com/rbuffat/pyepw/blob/373d4d3c8386c8d35789f086ac5f6018c2711745/pyepw/epw.py#L241-L264
train
rbuffat/pyepw
pyepw/epw.py
Location.latitude
def latitude(self, value=0.0): """Corresponds to IDD Field `latitude` + is North, - is South, degree minutes represented in decimal (i.e. 30 minutes is .5) Args: value (float): value for IDD Field `latitude` Unit: deg Default value: 0.0 ...
python
def latitude(self, value=0.0): """Corresponds to IDD Field `latitude` + is North, - is South, degree minutes represented in decimal (i.e. 30 minutes is .5) Args: value (float): value for IDD Field `latitude` Unit: deg Default value: 0.0 ...
[ "def", "latitude", "(", "self", ",", "value", "=", "0.0", ")", ":", "if", "value", "is", "not", "None", ":", "try", ":", "value", "=", "float", "(", "value", ")", "except", "ValueError", ":", "raise", "ValueError", "(", "'value {} need to be of type float ...
Corresponds to IDD Field `latitude` + is North, - is South, degree minutes represented in decimal (i.e. 30 minutes is .5) Args: value (float): value for IDD Field `latitude` Unit: deg Default value: 0.0 value >= -90.0 value <=...
[ "Corresponds", "to", "IDD", "Field", "latitude" ]
373d4d3c8386c8d35789f086ac5f6018c2711745
https://github.com/rbuffat/pyepw/blob/373d4d3c8386c8d35789f086ac5f6018c2711745/pyepw/epw.py#L277-L308
train
rbuffat/pyepw
pyepw/epw.py
Location.longitude
def longitude(self, value=0.0): """Corresponds to IDD Field `longitude` - is West, + is East, degree minutes represented in decimal (i.e. 30 minutes is .5) Args: value (float): value for IDD Field `longitude` Unit: deg Default value: 0.0 ...
python
def longitude(self, value=0.0): """Corresponds to IDD Field `longitude` - is West, + is East, degree minutes represented in decimal (i.e. 30 minutes is .5) Args: value (float): value for IDD Field `longitude` Unit: deg Default value: 0.0 ...
[ "def", "longitude", "(", "self", ",", "value", "=", "0.0", ")", ":", "if", "value", "is", "not", "None", ":", "try", ":", "value", "=", "float", "(", "value", ")", "except", "ValueError", ":", "raise", "ValueError", "(", "'value {} need to be of type float...
Corresponds to IDD Field `longitude` - is West, + is East, degree minutes represented in decimal (i.e. 30 minutes is .5) Args: value (float): value for IDD Field `longitude` Unit: deg Default value: 0.0 value >= -180.0 value <...
[ "Corresponds", "to", "IDD", "Field", "longitude" ]
373d4d3c8386c8d35789f086ac5f6018c2711745
https://github.com/rbuffat/pyepw/blob/373d4d3c8386c8d35789f086ac5f6018c2711745/pyepw/epw.py#L321-L352
train
rbuffat/pyepw
pyepw/epw.py
Location.timezone
def timezone(self, value=0.0): """Corresponds to IDD Field `timezone` Time relative to GMT. Args: value (float): value for IDD Field `timezone` Unit: hr - not on standard units list??? Default value: 0.0 value >= -12.0 value <=...
python
def timezone(self, value=0.0): """Corresponds to IDD Field `timezone` Time relative to GMT. Args: value (float): value for IDD Field `timezone` Unit: hr - not on standard units list??? Default value: 0.0 value >= -12.0 value <=...
[ "def", "timezone", "(", "self", ",", "value", "=", "0.0", ")", ":", "if", "value", "is", "not", "None", ":", "try", ":", "value", "=", "float", "(", "value", ")", "except", "ValueError", ":", "raise", "ValueError", "(", "'value {} need to be of type float ...
Corresponds to IDD Field `timezone` Time relative to GMT. Args: value (float): value for IDD Field `timezone` Unit: hr - not on standard units list??? Default value: 0.0 value >= -12.0 value <= 12.0 if `value` is None i...
[ "Corresponds", "to", "IDD", "Field", "timezone", "Time", "relative", "to", "GMT", "." ]
373d4d3c8386c8d35789f086ac5f6018c2711745
https://github.com/rbuffat/pyepw/blob/373d4d3c8386c8d35789f086ac5f6018c2711745/pyepw/epw.py#L365-L394
train
rbuffat/pyepw
pyepw/epw.py
Location.elevation
def elevation(self, value=0.0): """Corresponds to IDD Field `elevation` Args: value (float): value for IDD Field `elevation` Unit: m Default value: 0.0 value >= -1000.0 value < 9999.9 if `value` is None it will ...
python
def elevation(self, value=0.0): """Corresponds to IDD Field `elevation` Args: value (float): value for IDD Field `elevation` Unit: m Default value: 0.0 value >= -1000.0 value < 9999.9 if `value` is None it will ...
[ "def", "elevation", "(", "self", ",", "value", "=", "0.0", ")", ":", "if", "value", "is", "not", "None", ":", "try", ":", "value", "=", "float", "(", "value", ")", "except", "ValueError", ":", "raise", "ValueError", "(", "'value {} need to be of type float...
Corresponds to IDD Field `elevation` Args: value (float): value for IDD Field `elevation` Unit: m Default value: 0.0 value >= -1000.0 value < 9999.9 if `value` is None it will not be checked against the ...
[ "Corresponds", "to", "IDD", "Field", "elevation" ]
373d4d3c8386c8d35789f086ac5f6018c2711745
https://github.com/rbuffat/pyepw/blob/373d4d3c8386c8d35789f086ac5f6018c2711745/pyepw/epw.py#L407-L436
train
rbuffat/pyepw
pyepw/epw.py
Location.export
def export(self, top=True): """Exports object to its string representation. Args: top (bool): if True appends `internal_name` before values. All non list objects should be exported with value top=True, all list objects, that are embedded in as fields inlist ...
python
def export(self, top=True): """Exports object to its string representation. Args: top (bool): if True appends `internal_name` before values. All non list objects should be exported with value top=True, all list objects, that are embedded in as fields inlist ...
[ "def", "export", "(", "self", ",", "top", "=", "True", ")", ":", "out", "=", "[", "]", "if", "top", ":", "out", ".", "append", "(", "self", ".", "_internal_name", ")", "out", ".", "append", "(", "self", ".", "_to_str", "(", "self", ".", "city", ...
Exports object to its string representation. Args: top (bool): if True appends `internal_name` before values. All non list objects should be exported with value top=True, all list objects, that are embedded in as fields inlist objects should be expor...
[ "Exports", "object", "to", "its", "string", "representation", "." ]
373d4d3c8386c8d35789f086ac5f6018c2711745
https://github.com/rbuffat/pyepw/blob/373d4d3c8386c8d35789f086ac5f6018c2711745/pyepw/epw.py#L451-L476
train
rbuffat/pyepw
pyepw/epw.py
DesignCondition.read
def read(self, vals): """Read values. Args: vals (list): list of strings representing values """ i = 0 if len(vals[i]) == 0: self.title_of_design_condition = None else: self.title_of_design_condition = vals[i] i += 1 i...
python
def read(self, vals): """Read values. Args: vals (list): list of strings representing values """ i = 0 if len(vals[i]) == 0: self.title_of_design_condition = None else: self.title_of_design_condition = vals[i] i += 1 i...
[ "def", "read", "(", "self", ",", "vals", ")", ":", "i", "=", "0", "if", "len", "(", "vals", "[", "i", "]", ")", "==", "0", ":", "self", ".", "title_of_design_condition", "=", "None", "else", ":", "self", ".", "title_of_design_condition", "=", "vals",...
Read values. Args: vals (list): list of strings representing values
[ "Read", "values", "." ]
373d4d3c8386c8d35789f086ac5f6018c2711745
https://github.com/rbuffat/pyepw/blob/373d4d3c8386c8d35789f086ac5f6018c2711745/pyepw/epw.py#L559-L906
train
rbuffat/pyepw
pyepw/epw.py
DesignCondition.title_of_design_condition
def title_of_design_condition(self, value=None): """Corresponds to IDD Field `title_of_design_condition` Args: value (str): value for IDD Field `title_of_design_condition` if `value` is None it will not be checked against the specification and is assumed to b...
python
def title_of_design_condition(self, value=None): """Corresponds to IDD Field `title_of_design_condition` Args: value (str): value for IDD Field `title_of_design_condition` if `value` is None it will not be checked against the specification and is assumed to b...
[ "def", "title_of_design_condition", "(", "self", ",", "value", "=", "None", ")", ":", "if", "value", "is", "not", "None", ":", "try", ":", "value", "=", "str", "(", "value", ")", "except", "ValueError", ":", "raise", "ValueError", "(", "'value {} need to b...
Corresponds to IDD Field `title_of_design_condition` Args: value (str): value for IDD Field `title_of_design_condition` if `value` is None it will not be checked against the specification and is assumed to be a missing value Raises: ValueError: i...
[ "Corresponds", "to", "IDD", "Field", "title_of_design_condition" ]
373d4d3c8386c8d35789f086ac5f6018c2711745
https://github.com/rbuffat/pyepw/blob/373d4d3c8386c8d35789f086ac5f6018c2711745/pyepw/epw.py#L919-L942
train
rbuffat/pyepw
pyepw/epw.py
DesignCondition.unkown_field
def unkown_field(self, value=None): """Corresponds to IDD Field `unkown_field` Empty field in data. Args: value (str): value for IDD Field `unkown_field` if `value` is None it will not be checked against the specification and is assumed to be a missing value ...
python
def unkown_field(self, value=None): """Corresponds to IDD Field `unkown_field` Empty field in data. Args: value (str): value for IDD Field `unkown_field` if `value` is None it will not be checked against the specification and is assumed to be a missing value ...
[ "def", "unkown_field", "(", "self", ",", "value", "=", "None", ")", ":", "if", "value", "is", "not", "None", ":", "try", ":", "value", "=", "str", "(", "value", ")", "except", "ValueError", ":", "raise", "ValueError", "(", "'value {} need to be of type str...
Corresponds to IDD Field `unkown_field` Empty field in data. Args: value (str): value for IDD Field `unkown_field` if `value` is None it will not be checked against the specification and is assumed to be a missing value Raises: ValueError: if `va...
[ "Corresponds", "to", "IDD", "Field", "unkown_field", "Empty", "field", "in", "data", "." ]
373d4d3c8386c8d35789f086ac5f6018c2711745
https://github.com/rbuffat/pyepw/blob/373d4d3c8386c8d35789f086ac5f6018c2711745/pyepw/epw.py#L955-L977
train
rbuffat/pyepw
pyepw/epw.py
DesignCondition.design_stat_heating
def design_stat_heating(self, value="Heating"): """Corresponds to IDD Field `design_stat_heating` Args: value (str): value for IDD Field `design_stat_heating` Accepted values are: - Heating Default value: Heating if `valu...
python
def design_stat_heating(self, value="Heating"): """Corresponds to IDD Field `design_stat_heating` Args: value (str): value for IDD Field `design_stat_heating` Accepted values are: - Heating Default value: Heating if `valu...
[ "def", "design_stat_heating", "(", "self", ",", "value", "=", "\"Heating\"", ")", ":", "if", "value", "is", "not", "None", ":", "try", ":", "value", "=", "str", "(", "value", ")", "except", "ValueError", ":", "raise", "ValueError", "(", "'value {} need to ...
Corresponds to IDD Field `design_stat_heating` Args: value (str): value for IDD Field `design_stat_heating` Accepted values are: - Heating Default value: Heating if `value` is None it will not be checked against the ...
[ "Corresponds", "to", "IDD", "Field", "design_stat_heating" ]
373d4d3c8386c8d35789f086ac5f6018c2711745
https://github.com/rbuffat/pyepw/blob/373d4d3c8386c8d35789f086ac5f6018c2711745/pyepw/epw.py#L990-L1021
train
rbuffat/pyepw
pyepw/epw.py
DesignCondition.coldestmonth
def coldestmonth(self, value=None): """Corresponds to IDD Field `coldestmonth` Args: value (int): value for IDD Field `coldestmonth` value >= 1 value <= 12 if `value` is None it will not be checked against the specification and...
python
def coldestmonth(self, value=None): """Corresponds to IDD Field `coldestmonth` Args: value (int): value for IDD Field `coldestmonth` value >= 1 value <= 12 if `value` is None it will not be checked against the specification and...
[ "def", "coldestmonth", "(", "self", ",", "value", "=", "None", ")", ":", "if", "value", "is", "not", "None", ":", "try", ":", "value", "=", "int", "(", "value", ")", "except", "ValueError", ":", "raise", "ValueError", "(", "'value {} need to be of type int...
Corresponds to IDD Field `coldestmonth` Args: value (int): value for IDD Field `coldestmonth` value >= 1 value <= 12 if `value` is None it will not be checked against the specification and is assumed to be a missing value Rais...
[ "Corresponds", "to", "IDD", "Field", "coldestmonth" ]
373d4d3c8386c8d35789f086ac5f6018c2711745
https://github.com/rbuffat/pyepw/blob/373d4d3c8386c8d35789f086ac5f6018c2711745/pyepw/epw.py#L1034-L1061
train
rbuffat/pyepw
pyepw/epw.py
DesignCondition.db996
def db996(self, value=None): """ Corresponds to IDD Field `db996` Dry-bulb temperature corresponding to 99.6% annual cumulative frequency of occurrence (cold conditions) Args: value (float): value for IDD Field `db996` Unit: C if `value` is N...
python
def db996(self, value=None): """ Corresponds to IDD Field `db996` Dry-bulb temperature corresponding to 99.6% annual cumulative frequency of occurrence (cold conditions) Args: value (float): value for IDD Field `db996` Unit: C if `value` is N...
[ "def", "db996", "(", "self", ",", "value", "=", "None", ")", ":", "if", "value", "is", "not", "None", ":", "try", ":", "value", "=", "float", "(", "value", ")", "except", "ValueError", ":", "raise", "ValueError", "(", "'value {} need to be of type float '"...
Corresponds to IDD Field `db996` Dry-bulb temperature corresponding to 99.6% annual cumulative frequency of occurrence (cold conditions) Args: value (float): value for IDD Field `db996` Unit: C if `value` is None it will not be checked against the ...
[ "Corresponds", "to", "IDD", "Field", "db996", "Dry", "-", "bulb", "temperature", "corresponding", "to", "99", ".", "6%", "annual", "cumulative", "frequency", "of", "occurrence", "(", "cold", "conditions", ")" ]
373d4d3c8386c8d35789f086ac5f6018c2711745
https://github.com/rbuffat/pyepw/blob/373d4d3c8386c8d35789f086ac5f6018c2711745/pyepw/epw.py#L1074-L1095
train
rbuffat/pyepw
pyepw/epw.py
DesignCondition.db990
def db990(self, value=None): """ Corresponds to IDD Field `db990` Dry-bulb temperature corresponding to 90.0% annual cumulative frequency of occurrence (cold conditions) Args: value (float): value for IDD Field `db990` Unit: C if `value` is N...
python
def db990(self, value=None): """ Corresponds to IDD Field `db990` Dry-bulb temperature corresponding to 90.0% annual cumulative frequency of occurrence (cold conditions) Args: value (float): value for IDD Field `db990` Unit: C if `value` is N...
[ "def", "db990", "(", "self", ",", "value", "=", "None", ")", ":", "if", "value", "is", "not", "None", ":", "try", ":", "value", "=", "float", "(", "value", ")", "except", "ValueError", ":", "raise", "ValueError", "(", "'value {} need to be of type float '"...
Corresponds to IDD Field `db990` Dry-bulb temperature corresponding to 90.0% annual cumulative frequency of occurrence (cold conditions) Args: value (float): value for IDD Field `db990` Unit: C if `value` is None it will not be checked against the ...
[ "Corresponds", "to", "IDD", "Field", "db990", "Dry", "-", "bulb", "temperature", "corresponding", "to", "90", ".", "0%", "annual", "cumulative", "frequency", "of", "occurrence", "(", "cold", "conditions", ")" ]
373d4d3c8386c8d35789f086ac5f6018c2711745
https://github.com/rbuffat/pyepw/blob/373d4d3c8386c8d35789f086ac5f6018c2711745/pyepw/epw.py#L1108-L1129
train
rbuffat/pyepw
pyepw/epw.py
DesignCondition.dp996
def dp996(self, value=None): """ Corresponds to IDD Field `dp996` Dew-point temperature corresponding to 99.6% annual cumulative frequency of occurrence (cold conditions) Args: value (float): value for IDD Field `dp996` Unit: C if `value` is ...
python
def dp996(self, value=None): """ Corresponds to IDD Field `dp996` Dew-point temperature corresponding to 99.6% annual cumulative frequency of occurrence (cold conditions) Args: value (float): value for IDD Field `dp996` Unit: C if `value` is ...
[ "def", "dp996", "(", "self", ",", "value", "=", "None", ")", ":", "if", "value", "is", "not", "None", ":", "try", ":", "value", "=", "float", "(", "value", ")", "except", "ValueError", ":", "raise", "ValueError", "(", "'value {} need to be of type float '"...
Corresponds to IDD Field `dp996` Dew-point temperature corresponding to 99.6% annual cumulative frequency of occurrence (cold conditions) Args: value (float): value for IDD Field `dp996` Unit: C if `value` is None it will not be checked against the ...
[ "Corresponds", "to", "IDD", "Field", "dp996", "Dew", "-", "point", "temperature", "corresponding", "to", "99", ".", "6%", "annual", "cumulative", "frequency", "of", "occurrence", "(", "cold", "conditions", ")" ]
373d4d3c8386c8d35789f086ac5f6018c2711745
https://github.com/rbuffat/pyepw/blob/373d4d3c8386c8d35789f086ac5f6018c2711745/pyepw/epw.py#L1142-L1163
train
rbuffat/pyepw
pyepw/epw.py
DesignCondition.hr_dp996
def hr_dp996(self, value=None): """ Corresponds to IDD Field `hr_dp996` humidity ratio, calculated at standard atmospheric pressure at elevation of station, corresponding to Dew-point temperature corresponding to 99.6% annual cumulative frequency of occurrence (cold conditions) ...
python
def hr_dp996(self, value=None): """ Corresponds to IDD Field `hr_dp996` humidity ratio, calculated at standard atmospheric pressure at elevation of station, corresponding to Dew-point temperature corresponding to 99.6% annual cumulative frequency of occurrence (cold conditions) ...
[ "def", "hr_dp996", "(", "self", ",", "value", "=", "None", ")", ":", "if", "value", "is", "not", "None", ":", "try", ":", "value", "=", "float", "(", "value", ")", "except", "ValueError", ":", "raise", "ValueError", "(", "'value {} need to be of type float...
Corresponds to IDD Field `hr_dp996` humidity ratio, calculated at standard atmospheric pressure at elevation of station, corresponding to Dew-point temperature corresponding to 99.6% annual cumulative frequency of occurrence (cold conditions) Args: value (float): val...
[ "Corresponds", "to", "IDD", "Field", "hr_dp996", "humidity", "ratio", "calculated", "at", "standard", "atmospheric", "pressure", "at", "elevation", "of", "station", "corresponding", "to", "Dew", "-", "point", "temperature", "corresponding", "to", "99", ".", "6%", ...
373d4d3c8386c8d35789f086ac5f6018c2711745
https://github.com/rbuffat/pyepw/blob/373d4d3c8386c8d35789f086ac5f6018c2711745/pyepw/epw.py#L1176-L1198
train
rbuffat/pyepw
pyepw/epw.py
DesignCondition.db_dp996
def db_dp996(self, value=None): """ Corresponds to IDD Field `db_dp996` mean coincident drybulb temperature corresponding to Dew-point temperature corresponding to 99.6% annual cumulative frequency of occurrence (cold conditions) Args: value (float): value for IDD F...
python
def db_dp996(self, value=None): """ Corresponds to IDD Field `db_dp996` mean coincident drybulb temperature corresponding to Dew-point temperature corresponding to 99.6% annual cumulative frequency of occurrence (cold conditions) Args: value (float): value for IDD F...
[ "def", "db_dp996", "(", "self", ",", "value", "=", "None", ")", ":", "if", "value", "is", "not", "None", ":", "try", ":", "value", "=", "float", "(", "value", ")", "except", "ValueError", ":", "raise", "ValueError", "(", "'value {} need to be of type float...
Corresponds to IDD Field `db_dp996` mean coincident drybulb temperature corresponding to Dew-point temperature corresponding to 99.6% annual cumulative frequency of occurrence (cold conditions) Args: value (float): value for IDD Field `db_dp996` Unit: C ...
[ "Corresponds", "to", "IDD", "Field", "db_dp996", "mean", "coincident", "drybulb", "temperature", "corresponding", "to", "Dew", "-", "point", "temperature", "corresponding", "to", "99", ".", "6%", "annual", "cumulative", "frequency", "of", "occurrence", "(", "cold"...
373d4d3c8386c8d35789f086ac5f6018c2711745
https://github.com/rbuffat/pyepw/blob/373d4d3c8386c8d35789f086ac5f6018c2711745/pyepw/epw.py#L1211-L1233
train
rbuffat/pyepw
pyepw/epw.py
DesignCondition.dp990
def dp990(self, value=None): """ Corresponds to IDD Field `dp990` Dew-point temperature corresponding to 90.0% annual cumulative frequency of occurrence (cold conditions) Args: value (float): value for IDD Field `dp990` Unit: C if `value` is ...
python
def dp990(self, value=None): """ Corresponds to IDD Field `dp990` Dew-point temperature corresponding to 90.0% annual cumulative frequency of occurrence (cold conditions) Args: value (float): value for IDD Field `dp990` Unit: C if `value` is ...
[ "def", "dp990", "(", "self", ",", "value", "=", "None", ")", ":", "if", "value", "is", "not", "None", ":", "try", ":", "value", "=", "float", "(", "value", ")", "except", "ValueError", ":", "raise", "ValueError", "(", "'value {} need to be of type float '"...
Corresponds to IDD Field `dp990` Dew-point temperature corresponding to 90.0% annual cumulative frequency of occurrence (cold conditions) Args: value (float): value for IDD Field `dp990` Unit: C if `value` is None it will not be checked against the ...
[ "Corresponds", "to", "IDD", "Field", "dp990", "Dew", "-", "point", "temperature", "corresponding", "to", "90", ".", "0%", "annual", "cumulative", "frequency", "of", "occurrence", "(", "cold", "conditions", ")" ]
373d4d3c8386c8d35789f086ac5f6018c2711745
https://github.com/rbuffat/pyepw/blob/373d4d3c8386c8d35789f086ac5f6018c2711745/pyepw/epw.py#L1246-L1267
train
rbuffat/pyepw
pyepw/epw.py
DesignCondition.hr_dp990
def hr_dp990(self, value=None): """ Corresponds to IDD Field `hr_dp990` humidity ratio, calculated at standard atmospheric pressure at elevation of station, corresponding to Dew-point temperature corresponding to 90.0% annual cumulative frequency of occurrence (cold conditions) ...
python
def hr_dp990(self, value=None): """ Corresponds to IDD Field `hr_dp990` humidity ratio, calculated at standard atmospheric pressure at elevation of station, corresponding to Dew-point temperature corresponding to 90.0% annual cumulative frequency of occurrence (cold conditions) ...
[ "def", "hr_dp990", "(", "self", ",", "value", "=", "None", ")", ":", "if", "value", "is", "not", "None", ":", "try", ":", "value", "=", "float", "(", "value", ")", "except", "ValueError", ":", "raise", "ValueError", "(", "'value {} need to be of type float...
Corresponds to IDD Field `hr_dp990` humidity ratio, calculated at standard atmospheric pressure at elevation of station, corresponding to Dew-point temperature corresponding to 90.0% annual cumulative frequency of occurrence (cold conditions) Args: value (float): val...
[ "Corresponds", "to", "IDD", "Field", "hr_dp990", "humidity", "ratio", "calculated", "at", "standard", "atmospheric", "pressure", "at", "elevation", "of", "station", "corresponding", "to", "Dew", "-", "point", "temperature", "corresponding", "to", "90", ".", "0%", ...
373d4d3c8386c8d35789f086ac5f6018c2711745
https://github.com/rbuffat/pyepw/blob/373d4d3c8386c8d35789f086ac5f6018c2711745/pyepw/epw.py#L1280-L1302
train
rbuffat/pyepw
pyepw/epw.py
DesignCondition.db_dp990
def db_dp990(self, value=None): """ Corresponds to IDD Field `db_dp990` mean coincident drybulb temperature corresponding to Dew-point temperature corresponding to 90.0% annual cumulative frequency of occurrence (cold conditions) Args: value (float): value for IDD F...
python
def db_dp990(self, value=None): """ Corresponds to IDD Field `db_dp990` mean coincident drybulb temperature corresponding to Dew-point temperature corresponding to 90.0% annual cumulative frequency of occurrence (cold conditions) Args: value (float): value for IDD F...
[ "def", "db_dp990", "(", "self", ",", "value", "=", "None", ")", ":", "if", "value", "is", "not", "None", ":", "try", ":", "value", "=", "float", "(", "value", ")", "except", "ValueError", ":", "raise", "ValueError", "(", "'value {} need to be of type float...
Corresponds to IDD Field `db_dp990` mean coincident drybulb temperature corresponding to Dew-point temperature corresponding to 90.0% annual cumulative frequency of occurrence (cold conditions) Args: value (float): value for IDD Field `db_dp990` Unit: C ...
[ "Corresponds", "to", "IDD", "Field", "db_dp990", "mean", "coincident", "drybulb", "temperature", "corresponding", "to", "Dew", "-", "point", "temperature", "corresponding", "to", "90", ".", "0%", "annual", "cumulative", "frequency", "of", "occurrence", "(", "cold"...
373d4d3c8386c8d35789f086ac5f6018c2711745
https://github.com/rbuffat/pyepw/blob/373d4d3c8386c8d35789f086ac5f6018c2711745/pyepw/epw.py#L1315-L1337
train