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 get_issues_by_resource(resource_id, table):
"""Get all issues for a specific job.""" |
v1_utils.verify_existence_and_get(resource_id, table)
# When retrieving the issues for a job, we actually retrieve
# the issues attach to the job itself + the issues attached to
# the components the job has been run with.
if table.name == 'jobs':
JJI = models.JOIN_JOBS_ISSUES
JJC ... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def unattach_issue(resource_id, issue_id, table):
"""Unattach an issue from a specific job.""" |
v1_utils.verify_existence_and_get(issue_id, _TABLE)
if table.name == 'jobs':
join_table = models.JOIN_JOBS_ISSUES
where_clause = sql.and_(join_table.c.job_id == resource_id,
join_table.c.issue_id == issue_id)
else:
join_table = models.JOIN_COMPONENTS... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def attach_issue(resource_id, table, user_id):
"""Attach an issue to a specific job.""" |
data = schemas.issue.post(flask.request.json)
issue = _get_or_create_issue(data)
# Second, insert a join record in the JOIN_JOBS_ISSUES or
# JOIN_COMPONENTS_ISSUES database.
if table.name == 'jobs':
join_table = models.JOIN_JOBS_ISSUES
else:
join_table = models.JOIN_COMPONENTS_... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def collect_staticroot_removal(app, blueprints):
"""Remove collect's static root folder from list.""" |
collect_root = app.extensions['collect'].static_root
return [bp for bp in blueprints if (
bp.has_static_folder and bp.static_folder != collect_root)] |
<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_all_jobstates(user, job_id):
"""Get all jobstates. """ |
args = schemas.args(flask.request.args.to_dict())
job = v1_utils.verify_existence_and_get(job_id, models.JOBS)
if user.is_not_super_admin() and user.is_not_read_only_user():
if (job['team_id'] not in user.teams_ids and
job['team_id'] not in user.child_teams_ids):
raise dci_e... |
<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_client(access_token):
"""Create the dci client in the master realm.""" |
url = 'http://keycloak:8080/auth/admin/realms/dci-test/clients'
r = requests.post(url,
data=json.dumps(client_data),
headers=get_auth_headers(access_token))
if r.status_code in (201, 409):
print('Keycloak client dci created successfully.')
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 create_user_dci(access_token):
"""Create the a dci user. username=dci, password=dci, email=dci@distributed-ci.io""" |
user_data = {'username': 'dci',
'email': 'dci@distributed-ci.io',
'enabled': True,
'emailVerified': True,
'credentials': [{'type': 'password',
'value': 'dci'}]}
r = requests.post('http://keycloak:8080/auth/adm... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def _serializeBooleans(params):
""""Convert all booleans to lowercase strings""" |
serialized = {}
for name, value in params.items():
if value is True:
value = 'true'
elif value is False:
value = 'false'
serialized[name] = value
return serialized
for k, v in params.items():
if isinstance(... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def request(self, method, url, parameters=dict()):
"""Requests wrapper function""" |
# The requests library uses urllib, which serializes to "True"/"False" while Pingdom requires lowercase
parameters = self._serializeBooleans(parameters)
headers = {'App-Key': self.apikey}
if self.accountemail:
headers.update({'Account-Email': self.accountemail})
#... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def getChecks(self, **parameters):
"""Pulls all checks from pingdom Optional Parameters: * limit -- Limits the number of returned probes to the specified quantit... |
# Warn user about unhandled parameters
for key in parameters:
if key not in ['limit', 'offset', 'tags']:
sys.stderr.write('%s not a valid argument for getChecks()\n'
% key)
response = self.request('GET', 'checks', parameters)
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def getCheck(self, checkid):
"""Returns a detailed description of a specified check.""" |
check = PingdomCheck(self, {'id': checkid})
check.getDetails()
return check |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def probes(self, **kwargs):
"""Returns a list of all Pingdom probe servers Parameters: * limit -- Limits the number of returned probes to the specified quantity ... |
# Warn user about unhandled parameters
for key in kwargs:
if key not in ['limit', 'offset', 'onlyactive', 'includedeleted']:
sys.stderr.write("'%s'" % key + ' is not a valid argument ' +
'of probes()\n')
return self.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 traceroute(self, host, probeid):
"""Perform a traceroute to a specified target from a specified Pingdom probe. Provide hostname to check and probeid to check... |
response = self.request('GET', 'traceroute', {'host': host,
'probeid': probeid})
return response.json()['traceroute'] |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def getContacts(self, **kwargs):
"""Returns a list of all contacts. Optional Parameters: * limit -- Limits the number of returned contacts to the specified quant... |
# Warn user about unhandled parameters
for key in kwargs:
if key not in ['limit', 'offset']:
sys.stderr.write("'%s'" % key + ' is not a valid argument ' +
'of getContacts()\n')
return [PingdomContact(self, x) for x in
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def modifyContacts(self, contactids, paused):
"""Modifies a list of contacts. Provide comma separated list of contact ids and desired paused state Returns status... |
response = self.request("PUT", "notification_contacts", {'contactids': contactids,
'paused': paused})
return response.json()['message'] |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def getEmailReports(self):
"""Returns a list of PingdomEmailReport instances.""" |
reports = [PingdomEmailReport(self, x) for x in
self.request('GET',
'reports.email').json()['subscriptions']]
return reports |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def newEmailReport(self, name, **kwargs):
"""Creates a new email report Returns status message for operation Optional parameters: * checkid -- Check identifier. ... |
# Warn user about unhandled parameters
for key in kwargs:
if key not in ['checkid', 'frequency', 'contactids',
'additionalemails']:
sys.stderr.write("'%s'" % key + ' is not a valid argument ' +
'of newEmailReport()... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def getSharedReports(self):
"""Returns a list of PingdomSharedReport instances""" |
response = self.request('GET',
'reports.shared').json()['shared']['banners']
reports = [PingdomSharedReport(self, x) for x in response]
return reports |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def download(url, directory, filename=None):
""" Download a file and return its filename on the local file system. If the file is already there, it will not be d... |
if not filename:
_, filename = os.path.split(url)
directory = os.path.expanduser(directory)
ensure_directory(directory)
filepath = os.path.join(directory, filename)
if os.path.isfile(filepath):
return filepath
print('Download', filepath)
with urlopen(url) as response, open(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 ensure_directory(directory):
""" Create the directories along the provided directory path that do not exist. """ |
directory = os.path.expanduser(directory)
try:
os.makedirs(directory)
except OSError as e:
if e.errno != errno.EEXIST:
raise e |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def _process_validation_function_s(validation_func, # type: ValidationFuncs auto_and_wrapper=True # type: bool ):
""" This function handles the various ways that... |
# handle the case where validation_func is not yet a list or is empty or none
if validation_func is None:
raise ValueError('mandatory validation_func is None')
elif not isinstance(validation_func, list):
# so not use list() because we do not want to convert tuples here.
validation... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def pop_kwargs(kwargs, names_with_defaults, # type: List[Tuple[str, Any]] allow_others=False ):
""" Internal utility method to extract optional arguments from kw... |
all_arguments = []
for name, default_ in names_with_defaults:
try:
val = kwargs.pop(name)
except KeyError:
val = default_
all_arguments.append(val)
if not allow_others and len(kwargs) > 0:
raise ValueError("Unsupported arguments: %s" % kwargs)
i... |
<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_details(self):
""" Overrides the base method in order to give details on the various successes and failures """ |
# transform the dictionary of failures into a printable form
need_to_print_value = True
failures_for_print = OrderedDict()
for validator, failure in self.failures.items():
name = get_callable_name(validator)
if isinstance(failure, Exception):
if ... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def play_all_validators(self, validators, value):
""" Utility method to play all the provided validators on the provided value and output the :param validators: ... |
successes = list()
failures = OrderedDict()
for validator in validators:
name = get_callable_name(validator)
try:
res = validator(value)
if result_is_success(res):
successes.append(name)
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 gen_secret(length=64):
""" Generates a secret of given length """ |
charset = string.ascii_letters + string.digits
return ''.join(random.SystemRandom().choice(charset)
for _ in range(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 _tokenize(cls, sentence):
""" Split a sentence while preserving tags. """ |
while True:
match = cls._regex_tag.search(sentence)
if not match:
yield from cls._split(sentence)
return
chunk = sentence[:match.start()]
yield from cls._split(chunk)
tag = match.group(0)
yield tag
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def dump(self):
"""Return the object itself.""" |
return {
'title': self.title,
'issue_id': self.issue_id,
'reporter': self.reporter,
'assignee': self.assignee,
'status': self.status,
'product': self.product,
'component': self.component,
'created_at': self.created... |
<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_product_owner(self, team_id):
"""Ensure the user is a PRODUCT_OWNER.""" |
if self.is_super_admin():
return True
team_id = uuid.UUID(str(team_id))
return team_id in self.child_teams_ids |
<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_in_team(self, team_id):
"""Test if user is in team""" |
if self.is_super_admin():
return True
team_id = uuid.UUID(str(team_id))
return team_id in self.teams or team_id in self.child_teams_ids |
<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_remoteci(self, team_id=None):
"""Ensure ther resource has the role REMOTECI.""" |
if team_id is None:
return self._is_remoteci
team_id = uuid.UUID(str(team_id))
if team_id not in self.teams_ids:
return False
return self.teams[team_id]['role'] == 'REMOTECI' |
<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_feeder(self, team_id=None):
"""Ensure ther resource has the role FEEDER.""" |
if team_id is None:
return self._is_feeder
team_id = uuid.UUID(str(team_id))
if team_id not in self.teams_ids:
return False
return self.teams[team_id]['role'] == 'FEEDER' |
<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, destroy=True):
""" Delete this node from the owning document. :param bool destroy: if True the child node will be destroyed in addition to being... |
removed_child = self.adapter.remove_node_child(
self.adapter.get_node_parent(self.impl_node), self.impl_node,
destroy_node=destroy)
if removed_child is not None:
return self.adapter.wrap_node(removed_child, None, self.adapter)
else:
return None |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def xpath(self, xpath, **kwargs):
""" Perform an XPath query on the current node. :param string xpath: XPath query. :param dict kwargs: Optional keyword argument... |
result = self.adapter.xpath_on_node(self.impl_node, xpath, **kwargs)
if isinstance(result, (list, tuple)):
return [self._maybe_wrap_node(r) for r in result]
else:
return self._maybe_wrap_node(result) |
<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_attributes(self, attr_obj=None, ns_uri=None, **attr_dict):
""" Add or update this element's attributes, where attributes can be specified in a number of ... |
self._set_element_attributes(self.impl_node,
attr_obj=attr_obj, ns_uri=ns_uri, **attr_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 set_ns_prefix(self, prefix, ns_uri):
""" Define a namespace prefix that will serve as shorthand for the given namespace URI in element names. :param string p... |
self._add_ns_prefix_attr(self.impl_node, prefix, ns_uri) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def add_element(self, name, ns_uri=None, attributes=None, text=None, before_this_element=False):
""" Add a new child element to this element, with an optional na... |
# Determine local name, namespace and prefix info from tag name
prefix, local_name, node_ns_uri = \
self.adapter.get_ns_info_from_node_name(name, self.impl_node)
if prefix:
qname = u'%s:%s' % (prefix, local_name)
else:
qname = local_name
# If ... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def add_text(self, text):
""" Add a text node to this element. Adding text with this method is subtly different from assigning a new text value with :meth:`text`... |
if not isinstance(text, basestring):
text = unicode(text)
self._add_text(self.impl_node, text) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def add_instruction(self, target, data):
""" Add an instruction node to this element. :param string text: text content to add as an instruction. """ |
self._add_instruction(self.impl_node, target, data) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def filter(self, local_name=None, name=None, ns_uri=None, node_type=None, filter_fn=None, first_only=False):
""" Apply filters to the set of nodes in this list. ... |
# Build our own filter function unless a custom function is provided
if filter_fn is None:
def filter_fn(n):
# Test node type first in case other tests require this type
if node_type is not None:
# Node type can be specified as an integer ... |
<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_all_analytics(user, job_id):
"""Get all analytics of a job.""" |
args = schemas.args(flask.request.args.to_dict())
v1_utils.verify_existence_and_get(job_id, models.JOBS)
query = v1_utils.QueryBuilder(_TABLE, args, _A_COLUMNS)
# If not admin nor rh employee then restrict the view to the team
if user.is_not_super_admin() and not user.is_read_only_user():
... |
<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_analytic(user, job_id, anc_id):
"""Get an analytic.""" |
v1_utils.verify_existence_and_get(job_id, models.JOBS)
analytic = v1_utils.verify_existence_and_get(anc_id, _TABLE)
analytic = dict(analytic)
if not user.is_in_team(analytic['team_id']):
raise dci_exc.Unauthorized()
return flask.jsonify({'analytic': analytic}) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def retrieve_info(self):
"""Query Bugzilla API to retrieve the needed infos.""" |
scheme = urlparse(self.url).scheme
netloc = urlparse(self.url).netloc
query = urlparse(self.url).query
if scheme not in ('http', 'https'):
return
for item in query.split('&'):
if 'id=' in item:
ticket_id = item.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 is_in(allowed_values # type: Set ):
""" 'Values in' validation_function generator. Returns a validation_function to check that x is in the provided set of al... |
def is_in_allowed_values(x):
if x in allowed_values:
return True
else:
# raise Failure('is_in: x in ' + str(allowed_values) + ' does not hold for x=' + str(x))
raise NotInAllowedValues(wrong_value=x, allowed_values=allowed_values)
is_in_allowed_values.__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 is_subset(reference_set # type: Set ):
""" 'Is subset' validation_function generator. Returns a validation_function to check that x is a subset of reference_... |
def is_subset_of(x):
missing = x - reference_set
if len(missing) == 0:
return True
else:
# raise Failure('is_subset: len(x - reference_set) == 0 does not hold for x=' + str(x)
# + ' and reference_set=' + str(reference_set) + '. x contain... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def contains(ref_value):
""" 'Contains' validation_function generator. Returns a validation_function to check that `ref_value in x` :param ref_value: a value tha... |
def contains_ref_value(x):
if ref_value in x:
return True
else:
raise DoesNotContainValue(wrong_value=x, ref_value=ref_value)
contains_ref_value.__name__ = 'contains_{}'.format(ref_value)
return contains_ref_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 is_superset(reference_set # type: Set ):
""" 'Is superset' validation_function generator. Returns a validation_function to check that x is a superset of refe... |
def is_superset_of(x):
missing = reference_set - x
if len(missing) == 0:
return True
else:
# raise Failure('is_superset: len(reference_set - x) == 0 does not hold for x=' + str(x)
# + ' and reference_set=' + str(reference_set) + '. x does no... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def on_all_(*validation_func):
""" Generates a validation_function for collection inputs where each element of the input will be validated against the validation... |
# create the validation functions
validation_function_func = _process_validation_function_s(list(validation_func))
def on_all_val(x):
# validate all elements in x in turn
for idx, x_elt in enumerate(x):
try:
res = validation_function_func(x_elt)
exce... |
<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_jobs_events_from_sequence(user, sequence):
"""Get all the jobs events from a given sequence number.""" |
args = schemas.args(flask.request.args.to_dict())
if user.is_not_super_admin():
raise dci_exc.Unauthorized()
query = sql.select([models.JOBS_EVENTS]). \
select_from(models.JOBS_EVENTS.join(models.JOBS,
models.JOBS.c.id == models.JOBS_EVENTS.c.job_id)). \
where... |
<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_node_text(self, node):
""" Return contatenated value of all text node children of this element """ |
text_children = [n.nodeValue for n in self.get_node_children(node)
if n.nodeType == xml.dom.Node.TEXT_NODE]
if text_children:
return u''.join(text_children)
else:
return None |
<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_node_text(self, node, text):
""" Set text value as sole Text child node of element; any existing Text nodes are removed """ |
# Remove any existing Text node children
for child in self.get_node_children(node):
if child.nodeType == xml.dom.Node.TEXT_NODE:
self.remove_node_child(node, child, True)
if text is not None:
text_node = self.new_impl_text(text)
self.add_node_... |
<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_contents(self):
"""Create strings from glob strings.""" |
def files():
for value in super(GlobBundle, self)._get_contents():
for path in glob.glob(value):
yield path
return list(files()) |
<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_none_policy_text(none_policy, # type: int verbose=False # type: bool ):
""" Returns a user-friendly description of a NonePolicy taking into account NoneA... |
if none_policy is NonePolicy.SKIP:
return "accept None without performing validation" if verbose else 'SKIP'
elif none_policy is NonePolicy.FAIL:
return "fail on None without performing validation" if verbose else 'FAIL'
elif none_policy is NonePolicy.VALIDATE:
return "validate None... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def _add_none_handler(validation_callable, # type: Callable none_policy # type: int ):
""" Adds a wrapper or nothing around the provided validation_callable, dep... |
if none_policy is NonePolicy.SKIP:
return _none_accepter(validation_callable) # accept all None values
elif none_policy is NonePolicy.FAIL:
return _none_rejecter(validation_callable) # reject all None values
elif none_policy is NonePolicy.VALIDATE:
return validation_callable ... |
<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_manually(cls, validation_function_name, # type: str var_name, # type: str var_value, validation_outcome=None, # type: Any help_msg=None, # type: str ap... |
# create a dummy validator
def val_fun(x):
pass
val_fun.__name__ = validation_function_name
validator = Validator(val_fun, error_type=cls, help_msg=help_msg, **kw_context_args)
# create the exception
# e = cls(validator, var_value, var_name, validation_outco... |
<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_variable_str(self):
""" Utility method to get the variable value or 'var_name=value' if name is not None. Note that values with large string representati... |
if self.var_name is None:
prefix = ''
else:
prefix = self.var_name
suffix = str(self.var_value)
if len(suffix) == 0:
suffix = "''"
elif len(suffix) > self.__max_str_length_displayed__:
suffix = ''
if len(prefix) > 0 and l... |
<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_validation_error(self, name, # type: str value, # type: Any validation_outcome=None, # type: Any error_type=None, # type: Type[ValidationError] help_m... |
# first merge the info provided in arguments and in self
error_type = error_type or self.error_type
help_msg = help_msg or self.help_msg
ctx = copy(self.kw_context_args)
ctx.update(kw_context_args)
# allow the class to override the name
name = self._get_name_fo... |
<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_valid(self, value # type: Any ):
""" Validates the provided value and returns a boolean indicating success or failure. Any Exception happening in the vali... |
# noinspection PyBroadException
try:
# perform validation
res = self.main_function(value)
# return a boolean indicating if success or failure
return result_is_success(res)
except Exception:
# caught exception means failure > return 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_tags(user):
"""Create a tag.""" |
values = {
'id': utils.gen_uuid(),
'created_at': datetime.datetime.utcnow().isoformat()
}
values.update(schemas.tag.post(flask.request.json))
with flask.g.db_conn.begin():
where_clause = sql.and_(
_TABLE.c.name == values['name'])
query = sql.select([_TABLE.c... |
<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_tags(user):
"""Get all tags.""" |
args = schemas.args(flask.request.args.to_dict())
query = v1_utils.QueryBuilder(_TABLE, args, _T_COLUMNS)
nb_rows = query.get_number_of_rows()
rows = query.execute(fetchall=True)
rows = v1_utils.format_result(rows, _TABLE.name)
return flask.jsonify({'tags': rows, '_meta': {'count': nb_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 load_entrypoint(self, entry_point_group):
"""Load entrypoint. :param entry_point_group: A name of entry point group used to load ``webassets`` bundles. .. ve... |
for ep in pkg_resources.iter_entry_points(entry_point_group):
self.env.register(ep.name, ep.load()) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def reject():
"""Sends a 401 reject response that enables basic auth.""" |
auth_message = ('Could not verify your access level for that URL.'
'Please login with proper credentials.')
auth_message = json.dumps({'_status': 'Unauthorized',
'message': auth_message})
headers = {'WWW-Authenticate': 'Basic realm="Login required"'}
... |
<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(self, **kwargs):
"""Modify a contact. Returns status message Optional Parameters: * name -- Contact name Type: String * email -- Contact email address... |
# Warn user about unhandled parameters
for key in kwargs:
if key not in ['email', 'cellphone', 'countrycode', 'countryiso',
'defaultsmsprovider', 'directtwitter',
'twitteruser', 'name']:
sys.stderr.write("'%s'" % key + '... |
<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(user, topic):
"""If the topic has it's export_control set to True then all the teams under the product team can access to the topic's resources. :para... |
# if export_control then check the team is associated to the product, ie.:
# - the current user belongs to the product's team
# OR
# - the product's team belongs to the user's parents teams
if topic['export_control']:
product = v1_utils.verify_existence_and_get(topic['product_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 get_stream_or_content_from_request(request):
"""Ensure the proper content is uploaded. Stream might be already consumed by authentication process. Hence flas... |
if request.stream.tell():
logger.info('Request stream already consumed. '
'Storing file content using in-memory data.')
return request.data
else:
logger.info('Storing file content using request stream.')
return request.stream |
<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_etag():
"""Generate random etag based on MD5.""" |
my_salt = gen_uuid()
if six.PY2:
my_salt = my_salt.decode('utf-8')
elif six.PY3:
my_salt = my_salt.encode('utf-8')
md5 = hashlib.md5()
md5.update(my_salt)
return md5.hexdigest() |
<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):
"""Delete this email report""" |
response = self.pingdom.request('DELETE',
'reports.shared/%s' % self.id)
return response.json()['message'] |
<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_all_components(user, topic_id):
"""Get all components of a topic.""" |
args = schemas.args(flask.request.args.to_dict())
query = v1_utils.QueryBuilder(_TABLE, args, _C_COLUMNS)
query.add_extra_condition(sql.and_(
_TABLE.c.topic_id == topic_id,
_TABLE.c.state != 'archived'))
nb_rows = query.get_number_of_rows()
rows = query.execute(fetchall=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 get_component_types_from_topic(topic_id, db_conn=None):
"""Returns the component types of a topic.""" |
db_conn = db_conn or flask.g.db_conn
query = sql.select([models.TOPICS]).\
where(models.TOPICS.c.id == topic_id)
topic = db_conn.execute(query).fetchone()
topic = dict(topic)
return topic['component_types'] |
<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_component_types(topic_id, remoteci_id, db_conn=None):
"""Returns either the topic component types or the rconfigration's component types.""" |
db_conn = db_conn or flask.g.db_conn
rconfiguration = remotecis.get_remoteci_configuration(topic_id,
remoteci_id,
db_conn=db_conn)
# if there is no rconfiguration associated to the remoteci... |
<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_last_components_by_type(component_types, topic_id, db_conn=None):
"""For each component type of a topic, get the last one.""" |
db_conn = db_conn or flask.g.db_conn
schedule_components_ids = []
for ct in component_types:
where_clause = sql.and_(models.COMPONENTS.c.type == ct,
models.COMPONENTS.c.topic_id == topic_id,
models.COMPONENTS.c.export_control == 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 verify_and_get_components_ids(topic_id, components_ids, component_types, db_conn=None):
"""Process some verifications of the provided components ids.""" |
db_conn = db_conn or flask.g.db_conn
if len(components_ids) != len(component_types):
msg = 'The number of component ids does not match the number ' \
'of component types %s' % component_types
raise dci_exc.DCIException(msg, status_code=412)
# get the components from their ids... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def retrieve_tags_from_component(user, c_id):
"""Retrieve all tags attached to a component.""" |
JCT = models.JOIN_COMPONENTS_TAGS
query = (sql.select([models.TAGS])
.select_from(JCT.join(models.TAGS))
.where(JCT.c.component_id == c_id))
rows = flask.g.db_conn.execute(query)
return flask.jsonify({'tags': rows, '_meta': {'count': rows.rowcount}}) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def add_tag_for_component(user, c_id):
"""Add a tag on a specific component.""" |
v1_utils.verify_existence_and_get(c_id, _TABLE)
values = {
'component_id': c_id
}
component_tagged = tags.add_tag_to_resource(values,
models.JOIN_COMPONENTS_TAGS)
return flask.Response(json.dumps(component_tagged), 201,
... |
<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_tag_for_component(user, c_id, tag_id):
"""Delete a tag on a specific component.""" |
# Todo : check c_id and tag_id exist in db
query = _TABLE_TAGS.delete().where(_TABLE_TAGS.c.tag_id == tag_id and
_TABLE_TAGS.c.component_id == c_id)
try:
flask.g.db_conn.execute(query)
except sa_exc.IntegrityError:
raise dci_exc.DCICreationConfli... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def should_be_hidden_as_cause(exc):
""" Used everywhere to decide if some exception type should be displayed or hidden as the casue of an error """ |
# reduced traceback in case of HasWrongType (instance_of checks)
from valid8.validation_lib.types import HasWrongType, IsWrongType
return isinstance(exc, (HasWrongType, IsWrongType)) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def _failure_raiser(validation_callable, # type: Callable failure_type=None, # type: Type[WrappingFailure] help_msg=None, # type: str **kw_context_args):
""" Wra... |
# check failure type
if failure_type is not None and help_msg is not None:
raise ValueError('Only one of failure_type and help_msg can be set at the same time')
# convert mini-lambdas to functions if needed
validation_callable = as_function(validation_callable)
# create wrapper
# opt... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def _none_accepter(validation_callable # type: Callable ):
""" Wraps the given validation callable to accept None values silently. When a None value is received ... |
# option (a) use the `decorate()` helper method to preserve name and signature of the inner object
# ==> NO, we want to support also non-function callable objects
# option (b) simply create a wrapper manually
def accept_none(x):
if x is not None:
# proceed with validation as usual
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def _none_rejecter(validation_callable # type: Callable ):
""" Wraps the given validation callable to reject None values. When a None value is received by the wr... |
# option (a) use the `decorate()` helper method to preserve name and signature of the inner object
# ==> NO, we want to support also non-function callable objects
# option (b) simply create a wrapper manually
def reject_none(x):
if x is not None:
return validation_callable(x)
... |
<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_help_msg(self, dotspace_ending=False, # type: bool **kwargs):
""" The method used to get the formatted help message according to kwargs. By default it re... |
context = self.get_context_for_help_msgs(kwargs)
if self.help_msg is not None and len(self.help_msg) > 0:
# create a copy because we will modify it
context = copy(context)
# first format if needed
try:
help_msg = self.help_msg
... |
<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_details(self):
""" Overrides the method in Failure so as to add a few details about the wrapped function and outcome """ |
if isinstance(self.validation_outcome, Exception):
if isinstance(self.validation_outcome, Failure):
# do not say again what was the value, it is already mentioned inside :)
end_str = ''
else:
end_str = ' for value [{value}]'.format(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 get_context_for_help_msgs(self, context_dict):
""" We override this method from HelpMsgMixIn to replace wrapped_func with its name """ |
context_dict = copy(context_dict)
context_dict['wrapped_func'] = get_callable_name(context_dict['wrapped_func'])
return context_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 decorate_several_with_validation(func, _out_=None, # type: ValidationFuncs none_policy=None, # type: int **validation_funcs # type: ValidationFuncs ):
""" Th... |
# add validation for output if provided
if _out_ is not None:
func = decorate_with_validation(func, _OUT_KEY, _out_, none_policy=none_policy)
# add validation for each of the listed arguments
for att_name, att_validation_funcs in validation_funcs.items():
func = decorate_with_validati... |
<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_final_none_policy_for_validator(is_nonable, # type: bool none_policy # type: NoneArgPolicy ):
""" Depending on none_policy and of the fact that the targ... |
if none_policy in {NonePolicy.VALIDATE, NonePolicy.SKIP, NonePolicy.FAIL}:
none_policy_to_use = none_policy
elif none_policy is NoneArgPolicy.SKIP_IF_NONABLE_ELSE_VALIDATE:
none_policy_to_use = NonePolicy.SKIP if is_nonable else NonePolicy.VALIDATE
elif none_policy is NoneArgPolicy.SKIP_I... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def decorate_with_validators(func, func_signature=None, # type: Signature **validators # type: Validator ):
""" Utility method to decorate the provided function ... |
# first turn the dictionary values into lists only
for arg_name, validator in validators.items():
if not isinstance(validator, list):
validators[arg_name] = [validator]
if hasattr(func, '__wrapped__') and hasattr(func.__wrapped__, '__validators__'):
# ---- This function is alre... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def generate_nonce_timestamp():
""" Generate unique nonce with counter, uuid and rng.""" |
global count
rng = botan.rng().get(30)
uuid4 = uuid.uuid4().bytes # 16 byte
tmpnonce = (bytes(str(count).encode('utf-8'))) + uuid4 + rng
nonce = tmpnonce[:41] # 41 byte (328 bit)
count += 1
return nonce |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def schedule_jobs(user):
"""Dispatch jobs to remotecis. The remoteci can use this method to request a new job. Before a job is dispatched, the server will flag a... |
values = schemas.job_schedule.post(flask.request.json)
values.update({
'id': utils.gen_uuid(),
'created_at': datetime.datetime.utcnow().isoformat(),
'updated_at': datetime.datetime.utcnow().isoformat(),
'etag': utils.gen_etag(),
'status': 'new',
'remoteci_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 create_new_update_job_from_an_existing_job(user, job_id):
"""Create a new job in the same topic as the job_id provided and associate the latest components of... |
values = {
'id': utils.gen_uuid(),
'created_at': datetime.datetime.utcnow().isoformat(),
'updated_at': datetime.datetime.utcnow().isoformat(),
'etag': utils.gen_etag(),
'status': 'new'
}
original_job_id = job_id
original_job = v1_utils.verify_existence_and_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 create_new_upgrade_job_from_an_existing_job(user):
"""Create a new job in the 'next topic' of the topic of the provided job_id.""" |
values = schemas.job_upgrade.post(flask.request.json)
values.update({
'id': utils.gen_uuid(),
'created_at': datetime.datetime.utcnow().isoformat(),
'updated_at': datetime.datetime.utcnow().isoformat(),
'etag': utils.gen_etag(),
'status': 'new'
})
original_job_i... |
<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_all_jobs(user, topic_id=None):
"""Get all jobs. If topic_id is not None, then return all the jobs with a topic pointed by topic_id. """ |
# get the diverse parameters
args = schemas.args(flask.request.args.to_dict())
# build the query thanks to the QueryBuilder class
query = v1_utils.QueryBuilder(_TABLE, args, _JOBS_COLUMNS)
# add extra conditions for filtering
# # If not admin nor rh employee then restrict the view to the tea... |
<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_job_by_id(user, job_id):
"""Update a job """ |
# get If-Match header
if_match_etag = utils.check_and_get_etag(flask.request.headers)
# get the diverse parameters
values = schemas.job.put(flask.request.json)
job = v1_utils.verify_existence_and_get(job_id, _TABLE)
job = dict(job)
if not user.is_in_team(job['team_id']):
raise dc... |
<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_all_results_from_jobs(user, j_id):
"""Get all results from job. """ |
job = v1_utils.verify_existence_and_get(j_id, _TABLE)
if not user.is_in_team(job['team_id']) and not user.is_read_only_user():
raise dci_exc.Unauthorized()
# get testscases from tests_results
query = sql.select([models.TESTS_RESULTS]). \
where(models.TESTS_RESULTS.c.job_id == job['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 get_tags_from_job(user, job_id):
"""Retrieve all tags attached to a job.""" |
job = v1_utils.verify_existence_and_get(job_id, _TABLE)
if not user.is_in_team(job['team_id']) and not user.is_read_only_user():
raise dci_exc.Unauthorized()
JTT = models.JOIN_JOBS_TAGS
query = (sql.select([models.TAGS])
.select_from(JTT.join(models.TAGS))
.where(JTT... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def add_tag_to_job(user, job_id):
"""Add a tag to a job.""" |
job = v1_utils.verify_existence_and_get(job_id, _TABLE)
if not user.is_in_team(job['team_id']):
raise dci_exc.Unauthorized()
values = {
'job_id': job_id
}
job_tagged = tags.add_tag_to_resource(values, models.JOIN_JOBS_TAGS)
return flask.Response(json.dumps(job_tagged), 201,
... |
<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_tag_from_job(user, job_id, tag_id):
"""Delete a tag from a job.""" |
_JJT = models.JOIN_JOBS_TAGS
job = v1_utils.verify_existence_and_get(job_id, _TABLE)
if not user.is_in_team(job['team_id']):
raise dci_exc.Unauthorized()
v1_utils.verify_existence_and_get(tag_id, models.TAGS)
query = _JJT.delete().where(sql.and_(_JJT.c.tag_id == tag_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 _is_node_an_element(self, node):
""" Return True if the given node is an ElementTree Element, a fact that can be tricky to determine if the cElementTree impl... |
# Try the simplest approach first, works for plain old ElementTree
if isinstance(node, BaseET.Element):
return True
# For cElementTree we need to be more cunning (or find a better way)
if hasattr(node, 'makeelement') and isinstance(node.tag, basestring):
return T... |
<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_to_purge_archived_resources(user, table):
"""List the entries to be purged from the database. """ |
if user.is_not_super_admin():
raise dci_exc.Unauthorized()
archived_resources = get_archived_resources(table)
return flask.jsonify({table.name: archived_resources,
'_meta': {'count': len(archived_resources)}}) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def purge_archived_resources(user, table):
"""Remove the entries to be purged from the database. """ |
if user.is_not_super_admin():
raise dci_exc.Unauthorized()
where_clause = sql.and_(
table.c.state == 'archived'
)
query = table.delete().where(where_clause)
flask.g.db_conn.execute(query)
return flask.Response(None, 204, content_type='application/json') |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def refresh_api_secret(user, resource, table):
"""Refresh the resource API Secret. """ |
resource_name = table.name[0:-1]
where_clause = sql.and_(
table.c.etag == resource['etag'],
table.c.id == resource['id'],
)
values = {
'api_secret': signature.gen_secret(),
'etag': utils.gen_etag()
}
query = table.update().where(where_clause).values(**values)... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def npm(package_json, output_file, pinned_file):
"""Generate a package.json file.""" |
amd_build_deprecation_warning()
try:
version = get_distribution(current_app.name).version
except DistributionNotFound:
version = ''
output = {
'name': current_app.name,
'version': make_semver(version) if version else version,
'dependencies': {},
}
# Loa... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def getAnalyses(self, **kwargs):
"""Returns a list of the latest root cause analysis results for a specified check. Optional Parameters: * limit -- Limits the nu... |
# 'from' is a reserved word, use time_from instead
if kwargs.get('time_from'):
kwargs['from'] = kwargs.get('time_from')
del kwargs['time_from']
if kwargs.get('time_to'):
kwargs['to'] = kwargs.get('time_to')
del kwargs['time_to']
# Warn u... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.