text_prompt stringlengths 157 13.1k | code_prompt stringlengths 7 19.8k ⌀ |
|---|---|
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def _insert_or_update(self, resourcetype, source, mode='insert', hhclass='Service'):
""" Insert or update a record in the repository """ |
keywords = []
if self.filter is not None:
catalog = Catalog.objects.get(id=int(self.filter.split()[-1]))
try:
if hhclass == 'Layer':
# TODO: better way of figuring out duplicates
match = Layer.objects.filter(name=source.name,
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def delete(self, constraint):
""" Delete a record from the repository """ |
results = self._get_repo_filter(Service.objects).extra(where=[constraint['where']],
params=constraint['values']).all()
deleted = len(results)
results.delete()
return deleted |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def check(func):
""" Check the permissions, http method and login state. """ |
def iCheck(request, *args, **kwargs):
if not request.method == "POST":
return HttpResponseBadRequest("Must be POST request.")
follow = func(request, *args, **kwargs)
if request.is_ajax():
return HttpResponse('ok')
try:
if 'next' in request.GET:
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def register(model, field_name=None, related_name=None, lookup_method_name='get_follows'):
""" This registers any model class to be follow-able. """ |
if model in registry:
return
registry.append(model)
if not field_name:
field_name = 'target_%s' % model._meta.module_name
if not related_name:
related_name = 'follow_%s' % model._meta.module_name
field = ForeignKey(model, related_name=related_name, null=True,... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def follow(user, obj):
""" Make a user follow an object """ |
follow, created = Follow.objects.get_or_create(user, obj)
return follow |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def unfollow(user, obj):
""" Make a user unfollow an object """ |
try:
follow = Follow.objects.get_follows(obj).get(user=user)
follow.delete()
return follow
except Follow.DoesNotExist:
pass |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def create(self, user, obj, **kwargs):
""" Create a new follow link between a user and an object of a registered model type. """ |
follow = Follow(user=user)
follow.target = obj
follow.save()
return follow |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def get_or_create(self, user, obj, **kwargs):
""" Almost the same as `FollowManager.objects.create` - behaves the same as the normal `get_or_create` methods in d... |
if not self.is_following(user, obj):
return self.create(user, obj, **kwargs), True
return self.get_follows(obj).get(user=user), False |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def is_following(self, user, obj):
""" Returns `True` or `False` """ |
if isinstance(user, AnonymousUser):
return False
return 0 < self.get_follows(obj).filter(user=user).count() |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def get_follows(self, model_or_obj_or_qs):
""" Returns all the followers of a model, an object or a queryset. """ |
fname = self.fname(model_or_obj_or_qs)
if isinstance(model_or_obj_or_qs, QuerySet):
return self.filter(**{'%s__in' % fname: model_or_obj_or_qs})
if inspect.isclass(model_or_obj_or_qs):
return self.exclude(**{fname:None})
return self.filter(**{f... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def create_event_regressors(self, event_times_indices, covariates = None, durations = None):
"""create_event_regressors creates the part of the design matrix cor... |
# check covariates
if covariates is None:
covariates = np.ones(self.event_times_indices.shape)
# check/create durations, convert from seconds to samples time, and compute mean duration for this event type.
if durations is None:
durations = np.ones(self.event_ti... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def regress(self, method = 'lstsq'):
"""regress performs linear least squares regression of the designmatrix on the data. :param method: method, or backend to be... |
if method is 'lstsq':
self.betas, residuals_sum, rank, s = LA.lstsq(self.design_matrix.T, self.resampled_signal.T)
self.residuals = self.resampled_signal - self.predict_from_design_matrix(self.design_matrix)
elif method is 'sm_ols':
import statsmodels.api as sm
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def predict_from_design_matrix(self, design_matrix):
"""predict_from_design_matrix predicts signals given a design matrix. :param design_matrix: design matrix fr... |
# check if we have already run the regression - which is necessary
assert hasattr(self, 'betas'), 'no betas found, please run regression before prediction'
assert design_matrix.shape[0] == self.betas.shape[0], \
'designmatrix needs to have the same number of regressors as th... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def resource_urls(request):
"""Global values to pass to templates""" |
url_parsed = urlparse(settings.SEARCH_URL)
defaults = dict(
APP_NAME=__description__,
APP_VERSION=__version__,
SITE_URL=settings.SITE_URL.rstrip('/'),
SEARCH_TYPE=settings.SEARCH_TYPE,
SEARCH_URL=settings.SEARCH_URL,
SEARCH_IP='%s://%s:%s' % (url_parsed.scheme, ... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def remove_service_checks(self, service_id):
""" Remove all checks from a service. """ |
from hypermap.aggregator.models import Service
service = Service.objects.get(id=service_id)
service.check_set.all().delete()
layer_to_process = service.layer_set.all()
for layer in layer_to_process:
layer.check_set.all().delete() |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def index_service(self, service_id):
""" Index a service in search engine. """ |
from hypermap.aggregator.models import Service
service = Service.objects.get(id=service_id)
if not service.is_valid:
LOGGER.debug('Not indexing service with id %s in search engine as it is not valid' % service.id)
return
LOGGER.debug('Indexing service %s' % service.id)
layer_to_p... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def index_layer(self, layer_id, use_cache=False):
""" Index a layer in the search backend. If cache is set, append it to the list, if it isn't send the transacti... |
from hypermap.aggregator.models import Layer
layer = Layer.objects.get(id=layer_id)
if not layer.is_valid:
LOGGER.debug('Not indexing or removing layer with id %s in search engine as it is not valid' % layer.id)
unindex_layer(layer.id, use_cache)
return
if layer.was_deleted:
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def unindex_layers_with_issues(self, use_cache=False):
""" Remove the index for layers in search backend, which are linked to an issue. """ |
from hypermap.aggregator.models import Issue, Layer, Service
from django.contrib.contenttypes.models import ContentType
layer_type = ContentType.objects.get_for_model(Layer)
service_type = ContentType.objects.get_for_model(Service)
for issue in Issue.objects.filter(content_type__pk=layer_type.id)... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def unindex_layer(self, layer_id, use_cache=False):
""" Remove the index for a layer in the search backend. If cache is set, append it to the list of removed lay... |
from hypermap.aggregator.models import Layer
layer = Layer.objects.get(id=layer_id)
if use_cache:
LOGGER.debug('Caching layer with id %s for being removed from search engine' % layer.id)
deleted_layers = cache.get('deleted_layers')
if deleted_layers is None:
deleted_la... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def index_all_layers(self):
""" Index all layers in search engine. """ |
from hypermap.aggregator.models import Layer
if not settings.REGISTRY_SKIP_CELERY:
layers_cache = set(Layer.objects.filter(is_valid=True).values_list('id', flat=True))
deleted_layers_cache = set(Layer.objects.filter(is_valid=False).values_list('id', flat=True))
cache.set('layers', laye... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def bbox2wktpolygon(bbox):
""" Return OGC WKT Polygon of a simple bbox list """ |
try:
minx = float(bbox[0])
miny = float(bbox[1])
maxx = float(bbox[2])
maxy = float(bbox[3])
except:
LOGGER.debug("Invalid bbox, setting it to a zero POLYGON")
minx = 0
miny = 0
maxx = 0
maxy = 0
return 'POLYGON((%.2f %.2f, %.2f %.2... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def gen_anytext(*args):
""" Convenience function to create bag of words for anytext property """ |
bag = []
for term in args:
if term is not None:
if isinstance(term, list):
for term2 in term:
if term2 is not None:
bag.append(term2)
else:
bag.append(term)
return ' '.join(bag) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def endpointlist_post_save(instance, *args, **kwargs):
""" Used to process the lines of the endpoint list. """ |
with open(instance.upload.file.name, mode='rb') as f:
lines = f.readlines()
for url in lines:
if len(url) > 255:
LOGGER.debug('Skipping this endpoint, as it is more than 255 characters: %s' % url)
else:
if Endpoint.objects.filter(url=url, catalog=instance.catalog... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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.service.is_valid:
is_valid = False
LOGGER.debug('Layer with id %s is ma... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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_layer(instance.id)
else: # just index
index_layer(instance.id) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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)
elif self.type == 'OGC:WMTS':
update_layers_wmts(self)
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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 invalid:
# 0. any service not exposed in SUPPORTED_SRS
# 1. any... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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 endp... |
endpoint = self.url
if self.type not in ('Hypermap:WorldMap',):
endpoint = 'registry/%s/layer/%s/map/wmts/1.0.0/WMTSCapabilities.xml' % (
self.catalog.slug,
self.id
)
return endpoint |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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, sender=Layer)
try:
self.update_thumbnail()
except ValueError, err:
# caused ... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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_REGEX.match(url)
ssh_match = _SSH_REGEX.match(url)
if not http_match and not ssh_match:
raise RuntimeErro... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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') as f:
return f.read()
except (OSError, IOError):
raise Runtime... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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 ... |
try:
repo = git.Repo(path)
except Exception:
raise RuntimeError('Couldn\'t locate a repository at `%s`.' % path)
commited = False
try:
try:
repo.delete_remote('trytravis')
except Exception:
pass
print('Adding a temporary remote to '
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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()
build_id = None
while time.time() - start_time < 60:
with requests.get('https://api.travis-ci.org/repos/%s/bui... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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,
headers=_travis_headers()) as r:
json = r.json()
if build_size... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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 colorama.Fore.LIGHTYELLOW_EX, '*', True
elif state == 'passed':
return colorama.Fore.LIGHTGREEN_EX, 'P', False
elif state == 'failed':
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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 repository.' % url)
if http_match:
return '/'.join(http_match.groups())
else:
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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(e) + colorama.Style.RESET_ALL)
sys.exit(1)
else:
sys.exit(0) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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(request, url=url, catalog_id=catalog.id) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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)):
return False
except ValueError:
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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') |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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/questions/
# 16312889-is-automatic-index-creation-disabled-?new=1631... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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().splitlines():
if procname in line and scriptname in line:
pid = int(line.split()[1])
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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.harvard.edu'
),
(
'NYPL MapWarper',
'The New York Public Library (NYPL) MapWarper web... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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(digest2[i:i+2],16) for i in range(0,63,2)])
bits = 0
for i in range(32):
bits += POPC[255 & digest1[i] ^ digest2[i]]
return 128 - bits |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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)
self.count += 1
# incr accumulators for triplets
if self.lastch[1] > -1:
self.acc[self.tran3(ch, self.lastch[0], self.lastch[1], 0... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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
total = 4
elif self.count > 4: # otherwise 8 triplets/char ... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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() |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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 differen... |
bits = 0
myd = self.digest()
if ishex:
# convert to 32-tuple of unsighed two-byte INTs
otherdigest = tuple([int(otherdigest[i:i+2],16) for i in range(0,63,2)])
for i in range(32):
bits += POPC[255 & myd[i] ^ otherdigest[i]]
return 128 - bits |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def jdout(api_response):
""" JD Output function. Does quick pretty printing of a CloudGenix Response body. This function returns a string instead of directly pri... |
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 (TypeError, ValueError, AttributeError):
# cgx_content did not exist, or was not JSON serializable. Try pretty output the base obj.
try:... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def jdout_detailed(api_response, sensitive=False):
""" JD Output Detailed function. Meant for quick DETAILED pretty-printing of CloudGenix Request and Response o... |
try:
# try to be super verbose.
output = "REQUEST: {0} {1}\n".format(api_response.request.method, api_response.request.path_url)
output += "REQUEST HEADERS:\n"
for key, value in api_response.request.headers.items():
# look for sensitive values
if key.lower() ... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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... |
# broad exception clause, if this fails for any reason just return.
try:
recommend_update = False
update_check_resp = requests.get(self.update_info_url, timeout=3)
web_version = update_check_resp.json()["info"]["version"]
api_logger.debug("RETRIEVED_VERS... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def ssl_verify(self, ssl_verify):
""" Modify ssl verification settings **Parameters:** - ssl_verify: - True: Verify using builtin BYTE_CA_BUNDLE. - False: No SSL... |
self.verify = ssl_verify
# if verify true/false, set ca_verify_file appropriately
if isinstance(self.verify, bool):
if self.verify: # True
if os.name == 'nt':
# Windows does not allow tmpfile access w/out close. Close file then delete it when don... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def modify_rest_retry(self, total=8, connect=None, read=None, redirect=None, status=None, method_whitelist=urllib3.util.retry.Retry.DEFAULT_METHOD_WHITELIST, stat... |
# Cloudgenix responses with 502/504 are usually recoverable. Use them if no list specified.
if status_forcelist is None:
status_forcelist = (413, 429, 502, 503, 504)
retry = urllib3.util.retry.Retry(total=total,
connect=connect,
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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,
format="%(levelname)s [%(name)s.%(funcName)s:%(lineno)d] %(message)s")
api_logger.setLevel(logging.INFO)
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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_class = _parent_class
class PostWrapper(Post):
def __init__(self):
self._parent_class = _parent_class
class PutWrapper(Put):
def __init_... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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 closed for access. Have to manually remove
os.unlink(self.ca_verify_filename)
else:
# other OS's allow close and delete of file.
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def parse_auth_token(self, auth_token):
""" Break auth_token up into it's constituent values. **Parameters:** - **auth_token:** Auth_token string **Returns:** di... |
# 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
auth_token_decoded = self.url_decode(auth_token_cleaned)
# Create a new dict to hold the response.
auth_dict = {}
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def parse_region(self, login_response):
""" Return region from a successful login response. **Parameters:** - **login_response:** requests.Response from a succes... |
auth_token = login_response.cgx_content['x_auth_token']
auth_token_dict = self.parse_auth_token(auth_token)
auth_region = auth_token_dict.get('region')
return auth_region |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def _catch_nonjson_streamresponse(rawresponse):
""" Validate a streamed response is JSON. Return a Python dictionary either way. **Parameters:** - **rawresponse:... |
# attempt to load response for return.
try:
response = json.loads(rawresponse)
except (ValueError, TypeError):
if rawresponse:
response = {
'_error': [
{
'message': 'Response not in J... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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:
css_url = 'https://cdn.jsdelivr.net/npm/jcrop-0.9.12@0.9.12/css/jquery.Jcrop.min.css'
return Mar... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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: T... |
crop_size = current_app.config['AVATARS_CROP_BASE_WIDTH']
if endpoint is None or filename is None:
url = url_for('avatars.static', filename='default/default_l.jpg')
else:
url = url_for(endpoint, filename=filename)
return Markup('<img src="%s" id="crop-box" style... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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 = img.resize((base_width, h_size), PIL.Image.ANTIALIAS)
return img |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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))
return filename |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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() |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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)
a.append(result)
return a[0] * 0.2126 + a[1] * 0.7152 + a[2] * 0.0722 |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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 ... |
bytes_length = 16
m = self.digest()
m.update(str.encode(data))
hex_digest = m.hexdigest()
return list(int(hex_digest[num * 2:num * 2 + 2], bytes_length)
for num in range(bytes_length)) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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 height.
block_width = float(width) / self.cols
block_height = float(height) / self.rows
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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 t... |
if value is not None:
try:
value = str(value)
except ValueError:
raise ValueError('value {} need to be of type str '
'for field `city`'.format(value))
if ',' in value:
raise ValueError('value sh... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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 not None:
try:
value = str(value)
except ValueError:
raise ValueError(
'value {} need to be of type str '
'for field `state_province_region`'.format(value))
if ',' in value:
r... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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 ... |
if value is not None:
try:
value = str(value)
except ValueError:
raise ValueError('value {} need to be of type str '
'for field `country`'.format(value))
if ',' in value:
raise ValueError('value... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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 aga... |
if value is not None:
try:
value = str(value)
except ValueError:
raise ValueError('value {} need to be of type str '
'for field `source`'.format(value))
if ',' in value:
raise ValueError('value ... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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 not None:
try:
value = str(value)
except ValueError:
raise ValueError('value {} need to be of type str '
'for field `wmo`'.format(value))
if ',' in value:
raise ValueError('value sho... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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:... |
if value is not None:
try:
value = float(value)
except ValueError:
raise ValueError('value {} need to be of type float '
'for field `latitude`'.format(value))
if value < -90.0:
raise ValueError(... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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:... |
if value is not None:
try:
value = float(value)
except ValueError:
raise ValueError('value {} need to be of type float '
'for field `longitude`'.format(value))
if value < -180.0:
raise ValueErro... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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 o... |
if value is not None:
try:
value = float(value)
except ValueError:
raise ValueError('value {} need to be of type float '
'for field `timezone`'.format(value))
if value < -12.0:
raise ValueError(... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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 >=... |
if value is not None:
try:
value = float(value)
except ValueError:
raise ValueError('value {} need to be of type float '
'for field `elevation`'.format(value))
if value < -1000.0:
raise ValueErr... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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... |
if value is not None:
try:
value = str(value)
except ValueError:
raise ValueError(
'value {} need to be of type str '
'for field `title_of_design_condition`'.format(value))
if ',' in value:
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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 `va... |
if value is not None:
try:
value = str(value)
except ValueError:
raise ValueError('value {} need to be of type str '
'for field `unkown_field`'.format(value))
if ',' in value:
raise ValueError('... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def design_stat_heating(self, value="Heating"):
"""Corresponds to IDD Field `design_stat_heating` Args: value (str):
value for IDD Field `design_stat_heating` A... |
if value is not None:
try:
value = str(value)
except ValueError:
raise ValueError(
'value {} need to be of type str '
'for field `design_stat_heating`'.format(value))
if ',' in value:
rai... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def coldestmonth(self, value=None):
"""Corresponds to IDD Field `coldestmonth` Args: value (int):
value for IDD Field `coldestmonth` value >= 1 value <= 12 if `... |
if value is not None:
try:
value = int(value)
except ValueError:
raise ValueError('value {} need to be of type int '
'for field `coldestmonth`'.format(value))
if value < 1:
raise ValueError('val... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def ws004c(self, value=None):
"""Corresponds to IDD Field `ws004c` Args: value (float):
value for IDD Field `ws004c` Unit: m/s if `value` is None it will not be... |
if value is not None:
try:
value = float(value)
except ValueError:
raise ValueError('value {} need to be of type float '
'for field `ws004c`'.format(value))
self._ws004c = value |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def db_ws004c(self, value=None):
""" Corresponds to IDD Field `db_ws004c` Mean coincident dry-bulb temperature to wind speed corresponding to 0.40% cumulative fr... |
if value is not None:
try:
value = float(value)
except ValueError:
raise ValueError('value {} need to be of type float '
'for field `db_ws004c`'.format(value))
self._db_ws004c = value |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def ws010c(self, value=None):
""" Corresponds to IDD Field `ws010c` Wind speed corresponding to 1.0% cumulative frequency of occurrence for coldest month; Args: ... |
if value is not None:
try:
value = float(value)
except ValueError:
raise ValueError('value {} need to be of type float '
'for field `ws010c`'.format(value))
self._ws010c = value |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def db_ws010c(self, value=None):
""" Corresponds to IDD Field `db_ws010c` Mean coincident dry-bulb temperature to wind speed corresponding to 1.0% cumulative fre... |
if value is not None:
try:
value = float(value)
except ValueError:
raise ValueError('value {} need to be of type float '
'for field `db_ws010c`'.format(value))
self._db_ws010c = value |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def ws_db996(self, value=None):
""" Corresponds to IDD Field `ws_db996` Mean wind speed coincident with 99.6% dry-bulb temperature Args: value (float):
value fo... |
if value is not None:
try:
value = float(value)
except ValueError:
raise ValueError('value {} need to be of type float '
'for field `ws_db996`'.format(value))
self._ws_db996 = value |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def design_stat_cooling(self, value="Cooling"):
"""Corresponds to IDD Field `design_stat_cooling` Args: value (str):
value for IDD Field `design_stat_cooling` A... |
if value is not None:
try:
value = str(value)
except ValueError:
raise ValueError(
'value {} need to be of type str '
'for field `design_stat_cooling`'.format(value))
if ',' in value:
rai... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def dbr(self, value=None):
"""Corresponds to IDD Field `dbr` Daily temperature range for hottest month. [defined as mean of the difference between daily maximum ... |
if value is not None:
try:
value = float(value)
except ValueError:
raise ValueError('value {} need to be of type float '
'for field `dbr`'.format(value))
self._dbr = value |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def wb004(self, value=None):
""" Corresponds to IDD Field `wb004` Wet-bulb temperature corresponding to 0.4% annual cumulative frequency of occurrence Args: valu... |
if value is not None:
try:
value = float(value)
except ValueError:
raise ValueError('value {} need to be of type float '
'for field `wb004`'.format(value))
self._wb004 = value |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def db_wb004(self, value=None):
""" Corresponds to IDD Field `db_wb004` mean coincident dry-bulb temperature to Wet-bulb temperature corresponding to 0.4% annual... |
if value is not None:
try:
value = float(value)
except ValueError:
raise ValueError('value {} need to be of type float '
'for field `db_wb004`'.format(value))
self._db_wb004 = value |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def wb010(self, value=None):
""" Corresponds to IDD Field `wb010` Wet-bulb temperature corresponding to 1.0% annual cumulative frequency of occurrence Args: valu... |
if value is not None:
try:
value = float(value)
except ValueError:
raise ValueError('value {} need to be of type float '
'for field `wb010`'.format(value))
self._wb010 = value |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def db_wb010(self, value=None):
""" Corresponds to IDD Field `db_wb010` mean coincident dry-bulb temperature to Wet-bulb temperature corresponding to 1.0% annual... |
if value is not None:
try:
value = float(value)
except ValueError:
raise ValueError('value {} need to be of type float '
'for field `db_wb010`'.format(value))
self._db_wb010 = value |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def wb020(self, value=None):
""" Corresponds to IDD Field `wb020` Wet-bulb temperature corresponding to 02.0% annual cumulative frequency of occurrence Args: val... |
if value is not None:
try:
value = float(value)
except ValueError:
raise ValueError('value {} need to be of type float '
'for field `wb020`'.format(value))
self._wb020 = value |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def db_wb020(self, value=None):
""" Corresponds to IDD Field `db_wb020` mean coincident dry-bulb temperature to Wet-bulb temperature corresponding to 2.0% annual... |
if value is not None:
try:
value = float(value)
except ValueError:
raise ValueError('value {} need to be of type float '
'for field `db_wb020`'.format(value))
self._db_wb020 = value |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def ws_db004(self, value=None):
""" Corresponds to IDD Field `ws_db004` Mean wind speed coincident with 0.4% dry-bulb temperature Args: value (float):
value for... |
if value is not None:
try:
value = float(value)
except ValueError:
raise ValueError('value {} need to be of type float '
'for field `ws_db004`'.format(value))
self._ws_db004 = value |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def dp004(self, value=None):
""" Corresponds to IDD Field `dp004` Dew-point temperature corresponding to 0.4% annual cumulative frequency of occurrence Args: val... |
if value is not None:
try:
value = float(value)
except ValueError:
raise ValueError('value {} need to be of type float '
'for field `dp004`'.format(value))
self._dp004 = value |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def hr_dp004(self, value=None):
""" Corresponds to IDD Field `hr_dp004` humidity ratio corresponding to Dew-point temperature corresponding to 0.4% annual cumula... |
if value is not None:
try:
value = float(value)
except ValueError:
raise ValueError('value {} need to be of type float '
'for field `hr_dp004`'.format(value))
self._hr_dp004 = value |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.