output stringlengths 1 928k | instruction stringlengths 7 928k | system stringlengths 0 104k |
|---|---|---|
Return row tuple for row. | Make a summary of the following Python 3 code
def wrap(self, row: Union[Mapping[str, Any], Sequence[Any]]):
return (
self.dataclass(
**{
ident: row[column_name]
for ident, column_name in self.ids_and_column_names.items()
}
... | As a Python code translator, you convert algorithms and pseudocode into Python. |
def wrap_all(self, rows: Iterable[Union[Mapping[str, Any], Sequence[Any]]]):
"""Return row tuple for each row in rows."""
return (self.wrap(r) for r in rows) | How would you code a function in Python 3 to
return row tuple for each row in rows. | As a Python code translator, you convert algorithms and pseudocode into Python. |
def add_error_handlers(app):
"""Add custom error handlers for PyMacaronCoreExceptions to the app"""
def handle_validation_error(error):
response = jsonify({'message': str(error)})
response.status_code = error.status_code
return response
app.errorhandler(ValidationError)(handle_vali... | Can you implement a function in Python 3 that
adds custom error handlers for PyMacaronCoreExceptions to the app | You are a Python code generator, capable of creating scripts from specifications. |
List all backends for a particular service and version. | Explain what the following Python 3 code does
def list_backends(self, service_id, version_number):
content = self._fetch("/service/%s/version/%d/backend" % (service_id, version_number))
return map(lambda x: FastlyBackend(self, x), content) | You are a Python code generator, capable of creating scripts from specifications. |
def create_backend(self,
service_id,
version_number,
name,
address,
use_ssl=False,
port=80,
connect_timeout=1000,
first_byte_timeout=15000,
between_bytes_timeout=10000,
error_threshold=0,
max_conn=20,
weight=100,
auto_loadbalance=False,
shield=None,
request_condition=None,
healthcheck... | Write a Python 3 function for
creating a backend for a particular service and version. | As a Python code translator, you convert algorithms and pseudocode into Python. |
def get_backend(self, service_id, version_number, name):
"""Get the backend for a particular service and version."""
content = self._fetch("/service/%s/version/%d/backend/%s" % (service_id, version_number, name))
return FastlyBackend(self, content) | Write a Python 3 script to
get the backend for a particular service and version. | As a Python code composer, you craft elegant and concise scripts. |
Update the backend for a particular service and version. | Given the following Python 3 function, write the documentation
def update_backend(self, service_id, version_number, name_key, **kwargs):
body = self._formdata(kwargs, FastlyBackend.FIELDS)
content = self._fetch("/service/%s/version/%d/backend/%s" % (service_id, version_number, name_key), method="PUT", body=body)
... | As a python code expert, you are capable of creating scripts from specifications. |
Performs a health check against each backend in version. | How would you explain what the following Python 3 function does
def check_backends(self, service_id, version_number):
content = self._fetch("/service/%s/version/%d/backend/check_all" % (service_id, version_number))
# TODO: Use a strong-typed class for output?
return content | As a python code expert, you are capable of creating scripts from specifications. |
Get a list of all cache settings for a particular service and version. | Can you generate the documentation for the following Python 3 function
def list_cache_settings(self, service_id, version_number):
content = self._fetch("/service/%s/version/%d/cache_settings" % (service_id, version_number))
return map(lambda x: FastlyCacheSettings(self, x), content) | As a Python code translator, you convert algorithms and pseudocode into Python. |
def create_cache_settings(self,
service_id,
version_number,
name,
action,
ttl=None,
stale_ttl=None,
cache_condition=None):
"""Create a new cache settings object."""
body = self._formdata({
"name": name,
"action": action,
"ttl": ttl,
"stale_ttl": stale_ttl,
"cache_condition": cache_co... | Write a Python 3 function for
creating a new cache settings object. | As a Python code composer, you craft elegant and concise scripts. |
def get_cache_settings(self, service_id, version_number, name):
"""Get a specific cache settings object."""
content = self._fetch("/service/%s/version/%d/cache_settings/%s" % (service_id, version_number, name))
return FastlyCacheSettings(self, content) | Can you write a function in Python 3 where it
gets a specific cache settings object. | As a Python code composer, you craft elegant and concise scripts. |
Update a specific cache settings object. | Can you generate a brief explanation for the following Python 3 code
def update_cache_settings(self, service_id, version_number, name_key, **kwargs):
body = self._formdata(kwargs, FastlyCacheSettings.FIELDS)
content = self._fetch("/service/%s/version/%d/cache_settings/%s" % (service_id, version_number, name_key), m... | You are a Python code analyst, evaluating scripts for potential improvements. |
Delete a specific cache settings object. | Explain what the following Python 3 code does
def delete_cache_settings(self, service_id, version_number, name):
content = self._fetch("/service/%s/version/%d/cache_settings/%s" % (service_id, version_number, name), method="DELETE")
return self._status(content) | You are a Python code generator, capable of creating scripts from specifications. |
Gets all conditions for a particular service and version. | Can you tell what is the following Python 3 function doing
def list_conditions(self, service_id, version_number):
content = self._fetch("/service/%s/version/%d/condition" % (service_id, version_number))
return map(lambda x: FastlyCondition(self, x), content) | You are a Python code architect, reviewing and designing scalable and efficient code |
Creates a new condition. | Here you have a function in Python 3, explain what it does
def create_condition(self,
service_id,
version_number,
name,
_type,
statement,
priority="10",
comment=None):
"""Creates a new condition."""
body = self._formdata({
"name": name,
"type": _type,
"statement": statement,
"priority":... | You are a Python code analyst, evaluating scripts for potential improvements. |
Gets a specified condition. | Can you generate the documentation for the following Python 3 function
def get_condition(self, service_id, version_number, name):
content = self._fetch("/service/%s/version/%d/condition/%s" % (service_id, version_number, name))
return FastlyCondition(self, content) | You are a Python code analyst, evaluating scripts for potential improvements. |
Updates the specified condition. | How would you explain what the following Python 3 function does
def update_condition(self, service_id, version_number, name_key, **kwargs):
body = self._formdata(kwargs, FastlyCondition.FIELDS)
content = self._fetch("/service/%s/version/%d/condition/%s" % (service_id, version_number, name_key), method="PUT", body=b... | You are a Python code generator, capable of creating scripts from specifications. |
def content_edge_check(self, url):
"""Retrieve headers and MD5 hash of the content for a particular url from each Fastly edge server."""
prefixes = ["http://", "https://"]
for prefix in prefixes:
if url.startswith(prefix):
url = url[len(prefix):]
break
content = self._fetch("/content/edge_check/%s" %... | How would you implement a function in Python 3 that
retrieves headers and MD5 hash of the content for a particular url from each Fastly edge server. | You are a Python code generator, capable of creating scripts from specifications. |
Get a specific customer. | Can you generate a brief explanation for the following Python 3 code
def get_customer(self, customer_id):
content = self._fetch("/customer/%s" % customer_id)
return FastlyCustomer(self, content) | As a python code expert, you are capable of creating scripts from specifications. |
def list_customer_users(self, customer_id):
"""List all users from a specified customer id."""
content = self._fetch("/customer/users/%s" % customer_id)
return map(lambda x: FastlyUser(self, x), content) | Write a Python 3 script to
list all users from a specified customer id. | You are a Python code generator, capable of creating scripts from specifications. |
List the directors for a particular service and version. | Can you generate the documentation for the following Python 3 function
def list_directors(self, service_id, version_number):
content = self._fetch("/service/%s/version/%d/director" % (service_id, version_number))
return map(lambda x: FastlyDirector(self, x), content) | As a Python code composer, you craft elegant and concise scripts. |
Create a director for a particular service and version. | How would you explain what the following Python 3 function does
def create_director(self, service_id, version_number,
name,
quorum=75,
_type=FastlyDirectorType.RANDOM,
retries=5,
shield=None):
"""Create a director for a particular service and version."""
body = self._formdata({
"name": name,
"quor... | As a python code expert, you are capable of creating scripts from specifications. |
def get_director(self, service_id, version_number, name):
"""Get the director for a particular service and version."""
content = self._fetch("/service/%s/version/%d/director/%s" % (service_id, version_number, name))
return FastlyDirector(self, content) | Implement a function in Python 3 to
get the director for a particular service and version. | As a Python code analyst, you investigate and solve complex coding mysteries |
Update the director for a particular service and version. | Here you have a function in Python 3, explain what it does
def update_director(self, service_id, version_number, name_key, **kwargs):
body = self._formdata(kwargs, FastlyDirector.FIELDS)
content = self._fetch("/service/%s/version/%d/director/%s" % (service_id, version_number, name_key), method="PUT", body=body)
r... | You are a Python code analyst, evaluating scripts for potential improvements. |
Returns the relationship between a Backend and a Director. | Here you have a function in Python 3, explain what it does
def get_director_backend(self, service_id, version_number, director_name, backend_name):
content = self._fetch("/service/%s/version/%d/director/%s/backend/%s" % (service_id, version_number, director_name, backend_name), method="GET")
return FastlyDirectorBa... | As a Python code composer, you craft elegant and concise scripts. |
Deletes the relationship between a Backend and a Director. | Here you have a function in Python 3, explain what it does
def delete_director_backend(self, service_id, version_number, director_name, backend_name):
content = self._fetch("/service/%s/version/%d/director/%s/backend/%s" % (service_id, version_number, director_name, backend_name), method="DELETE")
return self._stat... | As a python code expert, you are capable of creating scripts from specifications. |
def list_domains(self, service_id, version_number):
"""List the domains for a particular service and version."""
content = self._fetch("/service/%s/version/%d/domain" % (service_id, version_number))
return map(lambda x: FastlyDomain(self, x), content) | Create a Python 3 function for
listing the domains for a particular service and version. | As a Python code composer, you craft elegant and concise scripts. |
def create_domain(self,
service_id,
version_number,
name,
comment=None):
"""Create a domain for a particular service and version."""
body = self._formdata({
"name": name,
"comment": comment,
}, FastlyDomain.FIELDS)
content = self._fetch("/service/%s/version/%d/domain" % (service_id, version_nu... | Write a Python 3 function that can
create a domain for a particular service and version. | As a Python code translator, you convert algorithms and pseudocode into Python. |
def get_domain(self, service_id, version_number, name):
"""Get the domain for a particular service and version."""
content = self._fetch("/service/%s/version/%d/domain/%s" % (service_id, version_number, name))
return FastlyDomain(self, content) | Implement a function in Python 3 to
get the domain for a particular service and version. | As a Python code composer, you craft elegant and concise scripts. |
Update the domain for a particular service and version. | Can you generate the documentation for the following Python 3 function
def update_domain(self, service_id, version_number, name_key, **kwargs):
body = self._formdata(kwargs, FastlyDomain.FIELDS)
content = self._fetch("/service/%s/version/%d/domain/%s" % (service_id, version_number, name_key), method="PUT", body=bod... | You are a Python code generator, capable of creating scripts from specifications. |
def check_domain(self, service_id, version_number, name):
"""Checks the status of a domain's DNS record. Returns an array of 3 items. The first is the details for the domain. The second is the current CNAME of the domain. The third is a boolean indicating whether or not it has been properly setup to use Fastly."""
... | Create a Python 3 function for
checking the status of a domain. Returns an array of 3 items. The first is the details for the domain. The second is the current CNAME of the domain. The third is a boolean indicating whether or not the domain has been properly setup to use Fastly. | You are a Python code generator, capable of creating scripts from specifications. |
Checks the status of all domain DNS records for a Service Version. Returns an array of items in the same format as the single domain / check. | How would you explain what the following Python 3 function does
def check_domains(self, service_id, version_number):
content = self._fetch("/service/%s/version/%d/domain/check_all" % (service_id, version_number))
return map(lambda x: FastlyDomainCheck(self, x), content) | You are a Python code architect, reviewing and designing scalable and efficient code |
def get_event_log(self, object_id):
"""Get the specified event log."""
content = self._fetch("/event_log/%s" % object_id, method="GET")
return FastlyEventLog(self, content) | Implement a Python 3 function for
getting the specified event log. | As a Python code translator, you convert algorithms and pseudocode into Python. |
def list_headers(self, service_id, version_number):
"""Retrieves all Header objects for a particular Version of a Service."""
content = self._fetch("/service/%s/version/%d/header" % (service_id, version_number))
return map(lambda x: FastlyHeader(self, x), content) | Create a Python 3 function to
retrieve all Header objects for a particular Service and Version. | As a Python code translator, you convert algorithms and pseudocode into Python. |
def create_header(self, service_id, version_number, name, destination, source, _type=FastlyHeaderType.RESPONSE, action=FastlyHeaderAction.SET, regex=None, substitution=None, ignore_if_set=None, priority=10, response_condition=None, cache_condition=None, request_condition=None):
body = self._formdata({
"name": name... | Implement a function in Python 3 to
create a new Header object. | As a python code expert, you are capable of creating scripts from specifications. |
Retrieves a Header object by name. | Can you generate the documentation for the following Python 3 function
def get_header(self, service_id, version_number, name):
content = self._fetch("/service/%s/version/%d/header/%s" % (service_id, version_number, name))
return FastlyHeader(self, content) | As a Python code composer, you craft elegant and concise scripts. |
Modifies an existing Header object by name. | Can you tell what is the following Python 3 function doing
def update_header(self, service_id, version_number, name_key, **kwargs):
body = self._formdata(kwargs, FastlyHeader.FIELDS)
content = self._fetch("/service/%s/version/%d/header/%s" % (service_id, version_number, name_key), method="PUT", body=body)
return ... | As a Python code analyst, you investigate and solve complex coding mysteries |
List all of the healthchecks for a particular service and version. | How would you explain what the following Python 3 function does
def list_healthchecks(self, service_id, version_number):
content = self._fetch("/service/%s/version/%d/healthcheck" % (service_id, version_number))
return map(lambda x: FastlyHealthCheck(self, x), content) | You are a Python code analyst, evaluating scripts for potential improvements. |
Create a healthcheck for a particular service and version. | Can you generate a brief explanation for the following Python 3 code
def create_healthcheck(self,
service_id,
version_number,
name,
host,
method="HEAD",
path="/",
http_version="1.1",
timeout=1000,
check_interval=5000,
expected_response=200,
window=5,
threshold=3,
initial=1):
"""Create a hea... | As a Python code translator, you convert algorithms and pseudocode into Python. |
def get_healthcheck(self, service_id, version_number, name):
"""Get the healthcheck for a particular service and version."""
content = self._fetch("/service/%s/version/%d/healthcheck/%s" % (service_id, version_number, name))
return FastlyHealthCheck(self, content) | Create a Python 3 function to
get the healthcheck for a particular service and version. | As a Python code composer, you craft elegant and concise scripts. |
def purge_url(self, host, path):
"""Purge an individual URL."""
content = self._fetch(path, method="PURGE", headers={ "Host": host })
return FastlyPurge(self, content) | Create a Python 3 function for
purging an individual URL. | As a Python code translator, you convert algorithms and pseudocode into Python. |
def check_purge_status(self, purge_id):
"""Get the status and times of a recently completed purge."""
content = self._fetch("/purge?id=%s" % purge_id)
return map(lambda x: FastlyPurgeStatus(self, x), content) | Can you create a Python 3 function that
gets the status and times of a recently completed purge. | You are a Python code generator, capable of creating scripts from specifications. |
Returns a list of all Request Settings objects for the given service and version. | Here you have a function in Python 3, explain what it does
def list_request_settings(self, service_id, version_number):
content = self._fetch("/service/%s/version/%d/request_settings" % (service_id, version_number))
return map(lambda x: FastlyRequestSetting(self, x), content) | You are a Python code generator, capable of creating scripts from specifications. |
def create_request_setting(self,
service_id,
version_number,
name,
default_host=None,
force_miss=None,
force_ssl=None,
action=None,
bypass_busy_wait=None,
max_stale_age=None,
hash_keys=None,
xff=None,
timer_support=None,
geo_headers=None,
request_condition=None):
"""Creates a new Request S... | Write a Python 3 script to
create a new Request Settings object. | As a Python code analyst, you investigate and solve complex coding mysteries |
def get_request_setting(self, service_id, version_number, name):
"""Gets the specified Request Settings object."""
content = self._fetch("/service/%s/version/%d/request_settings/%s" % (service_id, version_number, name))
return FastlyRequestSetting(self, content) | Implement a Python 3 function for
getting the specified Request Settings object. | As a python code expert, you are capable of creating scripts from specifications. |
def update_request_setting(self, service_id, version_number, name_key, **kwargs):
"""Updates the specified Request Settings object."""
body = self._formdata(kwargs, FastlyHealthCheck.FIELDS)
content = self._fetch("/service/%s/version/%d/request_settings/%s" % (service_id, version_number, name_key), method="PUT", ... | How would you implement a function in Python 3 that
updates the specified Request Settings object. | You are a Python code architect, reviewing and designing scalable and efficient code |
Returns all Response Objects for the specified service and version. | Explain what the following Python 3 code does
def list_response_objects(self, service_id, version_number):
content = self._fetch("/service/%s/version/%d/response_object" % (service_id, version_number))
return map(lambda x: FastlyResponseObject(self, x), content) | As a python code expert, you are capable of creating scripts from specifications. |
def create_response_object(self, service_id, version_number, name, status="200", response="OK", content="", request_condition=None, cache_condition=None):
"""Creates a new Response Object."""
body = self._formdata({
"name": name,
"status": status,
"response": response,
"content": content,
"request_co... | How would you code a function in Python 3 to
create a new Response Object. | As a Python code translator, you convert algorithms and pseudocode into Python. |
Gets the specified Response Object. | Can you tell what is the following Python 3 function doing
def get_response_object(self, service_id, version_number, name):
content = self._fetch("/service/%s/version/%d/response_object/%s" % (service_id, version_number, name))
return FastlyResponseObject(self, content) | As a Python code analyst, you investigate and solve complex coding mysteries |
Updates the specified Response Object. | Can you generate a brief explanation for the following Python 3 code
def update_response_object(self, service_id, version_number, name_key, **kwargs):
body = self._formdata(kwargs, FastlyResponseObject.FIELDS)
content = self._fetch("/service/%s/version/%d/response_object/%s" % (service_id, version_number, name_key)... | You are a Python code generator, capable of creating scripts from specifications. |
def get_service(self, service_id):
"""Get a specific service by id."""
content = self._fetch("/service/%s" % service_id)
return FastlyService(self, content) | Write a Python 3 script for
getting a specific service by id. | You are a Python code generator, capable of creating scripts from specifications. |
def get_service_details(self, service_id):
"""List detailed information on a specified service."""
content = self._fetch("/service/%s/details" % service_id)
return FastlyService(self, content) | Write a Python 3 script for
listing detailed information on a specified service. | As a Python code analyst, you investigate and solve complex coding mysteries |
def get_service_by_name(self, service_name):
"""Get a specific service by name."""
content = self._fetch("/service/search?name=%s" % service_name)
return FastlyService(self, content) | Create a Python 3 function to
get a specific service by name. | You are a Python code analyst, evaluating scripts for potential improvements. |
def list_domains_by_service(self, service_id):
"""List the domains within a service."""
content = self._fetch("/service/%s/domain" % service_id, method="GET")
return map(lambda x: FastlyDomain(self, x), content) | Implement a Python 3 function for
listing the domains within a service. | You are a Python code generator, capable of creating scripts from specifications. |
def purge_service(self, service_id):
"""Purge everything from a service."""
content = self._fetch("/service/%s/purge_all" % service_id, method="POST")
return self._status(content) | Create a Python 3 function for
purging everything from a service. | You are a Python code analyst, evaluating scripts for potential improvements. |
def purge_service_by_key(self, service_id, key):
"""Purge a particular service by a key."""
content = self._fetch("/service/%s/purge/%s" % (service_id, key), method="POST")
return self._status(content) | Implement a Python 3 function for
purging a particular service by a key. | As a Python code composer, you craft elegant and concise scripts. |
def get_settings(self, service_id, version_number):
"""Get the settings for a particular service and version."""
content = self._fetch("/service/%s/version/%d/settings" % (service_id, version_number))
return FastlySettings(self, content) | Write a Python 3 script for
getting the settings for a particular service and version. | As a Python code composer, you craft elegant and concise scripts. |
def update_settings(self, service_id, version_number, settings={}):
"""Update the settings for a particular service and version."""
body = urllib.urlencode(settings)
content = self._fetch("/service/%s/version/%d/settings" % (service_id, version_number), method="PUT", body=body)
return FastlySettings(self, conte... | Write a Python 3 function for
updating the settings for a particular service and version. | You are a Python code analyst, evaluating scripts for potential improvements. |
def get_stats(self, service_id, stat_type=FastlyStatsType.ALL):
"""Get the stats from a service."""
content = self._fetch("/service/%s/stats/%s" % (service_id, stat_type))
return content | Write a Python 3 script to
get the stats from a service. | As a python code expert, you are capable of creating scripts from specifications. |
List all of the Syslogs for a particular service and version. | How would you explain what the following Python 3 function does
def list_syslogs(self, service_id, version_number):
content = self._fetch("/service/%s/version/%d/syslog" % (service_id, version_number))
return map(lambda x: FastlySyslog(self, x), content) | You are a Python code architect, reviewing and designing scalable and efficient code |
Create a Syslog for a particular service and version. | Explain what the following Python 3 code does
def create_syslog(self,
service_id,
version_number,
name,
address,
port=514,
use_tls="0",
tls_ca_cert=None,
token=None,
_format=None,
response_condition=None):
"""Create a Syslog for a particular service and version."""
body = self._formdata({
"na... | You are a Python code architect, reviewing and designing scalable and efficient code |
def get_syslog(self, service_id, version_number, name):
"""Get the Syslog for a particular service and version."""
content = self._fetch("/service/%s/version/%d/syslog/%s" % (service_id, version_number, name))
return FastlySyslog(self, content) | Write a Python 3 function that can
get the Syslog for a particular service and version. | You are a Python code analyst, evaluating scripts for potential improvements. |
Update the Syslog for a particular service and version. | Given the following Python 3 function, write the documentation
def update_syslog(self, service_id, version_number, name_key, **kwargs):
body = self._formdata(kwargs, FastlySyslog.FIELDS)
content = self._fetch("/service/%s/version/%d/syslog/%s" % (service_id, version_number, name_key), method="PUT", body=body)
ret... | As a python code expert, you are capable of creating scripts from specifications. |
def change_password(self, old_password, new_password):
"""Update the user's password to a new one."""
body = self._formdata({
"old_password": old_password,
"password": new_password,
}, ["old_password", "password"])
content = self._fetch("/current_user/password", method="POST", body=body)
return FastlyUs... | Implement a function in Python 3 to
update the user s password to a new one. | As a Python code composer, you craft elegant and concise scripts. |
Get a specific user. | Can you tell what is the following Python 3 function doing
def get_user(self, user_id):
content = self._fetch("/user/%s" % user_id)
return FastlyUser(self, content) | As a Python code translator, you convert algorithms and pseudocode into Python. |
def request_password_reset(self, user_id):
"""Requests a password reset for the specified user."""
content = self._fetch("/user/%s/password/request_reset" % (user_id), method="POST")
return FastlyUser(self, content) | Implement a function in Python 3 to
request a password reset for the specified user. | You are a Python code analyst, evaluating scripts for potential improvements. |
List the uploaded VCLs for a particular service and version. | Here you have a function in Python 3, explain what it does
def list_vcls(self, service_id, version_number):
content = self._fetch("/service/%s/version/%d/vcl" % (service_id, version_number))
return map(lambda x: FastlyVCL(self, x), content) | You are a Python code generator, capable of creating scripts from specifications. |
Upload a VCL for a particular service and version. | How would you explain what the following Python 3 function does
def upload_vcl(self, service_id, version_number, name, content, main=None, comment=None):
body = self._formdata({
"name": name,
"content": content,
"comment": comment,
"main": main,
}, FastlyVCL.FIELDS)
content = self._fetch("/service/%s/... | As a Python code analyst, you investigate and solve complex coding mysteries |
Get the uploaded VCL for a particular service and version. | Can you generate the documentation for the following Python 3 function
def get_vcl(self, service_id, version_number, name, include_content=True):
content = self._fetch("/service/%s/version/%d/vcl/%s?include_content=%d" % (service_id, version_number, name, int(include_content)))
return FastlyVCL(self, content) | As a python code expert, you are capable of creating scripts from specifications. |
def get_vcl_html(self, service_id, version_number, name):
"""Get the uploaded VCL for a particular service and version with HTML syntax highlighting."""
content = self._fetch("/service/%s/version/%d/vcl/%s/content" % (service_id, version_number, name))
return content.get("content", None) | Create a Python 3 function to
get the uploaded VCL for a particular service and version with HTML syntax highlighting. | As a Python code analyst, you investigate and solve complex coding mysteries |
def get_generated_vcl(self, service_id, version_number):
"""Display the generated VCL for a particular service and version."""
content = self._fetch("/service/%s/version/%d/generated_vcl" % (service_id, version_number))
return FastlyVCL(self, content) | Can you implement a function in Python 3 that
displays the generated VCL for a particular service and version. | As a Python code analyst, you investigate and solve complex coding mysteries |
def get_generated_vcl_html(self, service_id, version_number):
"""Display the content of generated VCL with HTML syntax highlighting."""
content = self._fetch("/service/%s/version/%d/generated_vcl/content" % (service_id, version_number))
return content.get("content", None) | Write a Python 3 script for
displaying the content of generated VCL with HTML syntax highlighting. | As a Python code composer, you craft elegant and concise scripts. |
Set the specified VCL as the main VCL. | Can you generate a brief explanation for the following Python 3 code
def set_main_vcl(self, service_id, version_number, name):
content = self._fetch("/service/%s/version/%d/vcl/%s/main" % (service_id, version_number, name), method="PUT")
return FastlyVCL(self, content) | You are a Python code analyst, evaluating scripts for potential improvements. |
Update the uploaded VCL for a particular service and version. | Make a summary of the following Python 3 code
def update_vcl(self, service_id, version_number, name_key, **kwargs):
body = self._formdata(kwargs, FastlyVCL.FIELDS)
content = self._fetch("/service/%s/version/%d/vcl/%s" % (service_id, version_number, name_key), method="PUT", body=body)
return FastlyVCL(self, conten... | You are a Python code architect, reviewing and designing scalable and efficient code |
Create a version for a particular service. | Can you tell what is the following Python 3 function doing
def create_version(self, service_id, inherit_service_id=None, comment=None):
body = self._formdata({
"service_id": service_id,
"inherit_service_id": inherit_service_id,
"comment": comment,
}, FastlyVersion.FIELDS)
content = self._fetch("/service/... | As a Python code composer, you craft elegant and concise scripts. |
Get the version for a particular service. | Explain what the following Python 3 code does
def get_version(self, service_id, version_number):
content = self._fetch("/service/%s/version/%d" % (service_id, version_number))
return FastlyVersion(self, content) | You are a Python code generator, capable of creating scripts from specifications. |
Update a particular version for a particular service. | How would you explain what the following Python 3 function does
def update_version(self, service_id, version_number, **kwargs):
body = self._formdata(kwargs, FastlyVersion.FIELDS)
content = self._fetch("/service/%s/version/%d/" % (service_id, version_number), method="PUT", body=body)
return FastlyVersion(self, co... | As a Python code analyst, you investigate and solve complex coding mysteries |
def clone_version(self, service_id, version_number):
"""Clone the current configuration into a new version."""
content = self._fetch("/service/%s/version/%d/clone" % (service_id, version_number), method="PUT")
return FastlyVersion(self, content) | Write a Python 3 script to
clone the current configuration into a new version. | You are a Python code architect, reviewing and designing scalable and efficient code |
def activate_version(self, service_id, version_number):
"""Activate the current version."""
content = self._fetch("/service/%s/version/%d/activate" % (service_id, version_number), method="PUT")
return FastlyVersion(self, content) | How would you implement a function in Python 3 that
activates the current version. | You are a Python code architect, reviewing and designing scalable and efficient code |
def deactivate_version(self, service_id, version_number):
"""Deactivate the current version."""
content = self._fetch("/service/%s/version/%d/deactivate" % (service_id, version_number), method="PUT")
return FastlyVersion(self, content) | How would you implement a function in Python 3 that
deactivates the current version. | You are a Python code generator, capable of creating scripts from specifications. |
Validate the version for a particular service and version. | Can you tell what is the following Python 3 function doing
def validate_version(self, service_id, version_number):
content = self._fetch("/service/%s/version/%d/validate" % (service_id, version_number))
return self._status(content) | You are a Python code analyst, evaluating scripts for potential improvements. |
Locks the specified version. | Can you generate a brief explanation for the following Python 3 code
def lock_version(self, service_id, version_number):
content = self._fetch("/service/%s/version/%d/lock" % (service_id, version_number))
return self._status(content) | You are a Python code analyst, evaluating scripts for potential improvements. |
def list_wordpressess(self, service_id, version_number):
"""Get all of the wordpresses for a specified service and version."""
content = self._fetch("/service/%s/version/%d/wordpress" % (service_id, version_number))
return map(lambda x: FastlyWordpress(self, x), content) | Write a Python 3 function for
getting all of the wordpresses for a specified service and version. | You are a Python code generator, capable of creating scripts from specifications. |
def create_wordpress(self,
service_id,
version_number,
name,
path,
comment=None):
"""Create a wordpress for the specified service and version."""
body = self._formdata({
"name": name,
"path": path,
"comment": comment,
}, FastlyWordpress.FIELDS)
content = self._fetch("/service/%s/version/%d/wo... | Write a Python 3 function for
creating a wordpress for the specified service and version. | As a Python code translator, you convert algorithms and pseudocode into Python. |
Get information on a specific wordpress. | Make a summary of the following Python 3 code
def get_wordpress(self, service_id, version_number, name):
content = self._fetch("/service/%s/version/%d/wordpress/%s" % (service_id, version_number, name))
return FastlyWordpress(self, content) | As a Python code analyst, you investigate and solve complex coding mysteries |
Update a specified wordpress. | Explain what the following Python 3 code does
def update_wordpress(self, service_id, version_number, name_key, **kwargs):
body = self._formdata(kwargs, FastlyWordpress.FIELDS)
content = self._fetch("/service/%s/version/%d/wordpress/%s" % (service_id, version_number, name_key), method="PUT", body=body)
return Fast... | As a python code expert, you are capable of creating scripts from specifications. |
def annotate(self, word):
'''Annotate 'word' for syllabification, stress, weights, and vowels.'''
info = [] # e.g., [ ('\'nak.su.`tus.ta', 'PUSU', 'HLHL', 'AUUA'), ]
for syllabification, _ in syllabify(self.normalize(word), stress=True):
stresses = ''
weights = ''
... | Can you write a function in Python 3 where it
annotates word for syllabification stress weights and vowels. | As a Python code analyst, you investigate and solve complex coding mysteries |
Run the analyses in the correct order and create the reports and metadata printers. | Can you generate the documentation for the following Python 3 function
def runner(self):
logging.info('Starting {} analysis pipeline'.format(self.analysistype))
# Run the analyses
Sippr(self, self.cutoff)
self.serotype_escherichia()
self.serotype_salmonella()
# Create the... | You are a Python code analyst, evaluating scripts for potential improvements. |
Creates a report of the results of the selected analyses | Can you generate the documentation for the following Python 3 function
def reporter(self):
logging.info('Creating {} report'.format(self.analysistype))
# Create the path in which the reports are stored
make_path(self.reportpath)
header = 'Strain,Serotype\n'
data = ''
with... | You are a Python code architect, reviewing and designing scalable and efficient code |
Create attributes storing the best results for the O and H types | Can you generate a brief explanation for the following Python 3 code
def serotype_escherichia(self):
for sample in self.runmetadata.samples:
# Initialise negative results to be overwritten when necessary
sample[self.analysistype].best_o_pid = '-'
sample[self.analysistype].o_g... | You are a Python code architect, reviewing and designing scalable and efficient code |
Syllabify the given word. | Given the following Python 3 function, write the documentation
def _syllabify(word):
'''Syllabify the given word.'''
word = replace_umlauts(word)
word, CONTINUE_VV, CONTINUE_VVV, applied_rules = apply_T1(word)
if CONTINUE_VV:
word, T2 = apply_T2(word)
word, T4 = apply_T4(word)
a... | As a Python code composer, you craft elegant and concise scripts. |
This function applies T2 to the word. | Can you generate a brief explanation for the following Python 3 code
def apply_T2(word):
'''There is a syllable boundary within a sequence VV of two nonidentical
vowels that are not a genuine diphthong, e.g., [ta.e], [ko.et.taa].'''
T2 = ''
WORD = word.split('.')
for i, v in enumerate(WORD):
... | As a Python code analyst, you investigate and solve complex coding mysteries |
def apply_T5(word): # BROKEN
'''If a (V)VVV-sequence contains a VV-sequence that could be an /i/-final
diphthong, there is a syllable boundary between it and the third vowel,
e.g., [raa.ois.sa], [huo.uim.me], [la.eis.sa], [sel.vi.äi.si], [tai.an],
[säi.e], [oi.om.me].'''
T5 = ''
WORD = word.spl... | Implement a Python 3 function for
applying T5 to a word. | You are a Python code generator, capable of creating scripts from specifications. |
This function applies T6 to the word. | Here you have a function in Python 3, explain what it does
def apply_T6(word):
'''If a VVV-sequence contains a long vowel, there is a syllable boundary
between it and the third vowel, e.g. [kor.ke.aa], [yh.ti.öön], [ruu.an],
[mää.yt.te].'''
T6 = ''
WORD = word.split('.')
for i, v in enumerate(W... | You are a Python code generator, capable of creating scripts from specifications. |
Apply T7 to a VVV - sequence. | Here you have a function in Python 3, explain what it does
def apply_T7(word):
'''If a VVV-sequence does not contain a potential /i/-final diphthong,
there is a syllable boundary between the second and third vowels, e.g.
[kau.an], [leu.an], [kiu.as].'''
T7 = ''
WORD = word.split('.')
for i, v i... | You are a Python code architect, reviewing and designing scalable and efficient code |
This function is used to upload a vcl file to a fastly service. | Can you generate the documentation for the following Python 3 function
def main():
parser = OptionParser(description=
"Upload a vcl file (set as main) to a given fastly service. All arguments are required.")
parser.add_option("-k", "--key", dest="apikey", help="fastly api key")
parser.add_opti... | You are a Python code analyst, evaluating scripts for potential improvements. |
def main(self):
"""
Run the necessary methods in the correct order
"""
self.target_validate()
self.gene_names()
Sippr(inputobject=self,
k=self.kmer_size,
allow_soft_clips=self.allow_soft_clips)
self.report() | Write a Python 3 script for
running the necessary methods in the correct order | As a python code expert, you are capable of creating scripts from specifications. |
def gene_names(self):
"""
Extract the names of the user-supplied targets
"""
# Iterate through all the target names in the formatted targets file
for record in SeqIO.parse(self.targets, 'fasta'):
# Append all the gene names to the list of names
self.genes.... | Can you implement a function in Python 3 that
extracts the names of the user - supplied targets | As a Python code analyst, you investigate and solve complex coding mysteries |
Create the report for the user - supplied target names and their associated results. | Explain what the following Python 3 code does
def report(self):
# Add all the genes to the header
header = 'Sample,'
data = str()
with open(os.path.join(self.reportpath, '{at}.csv'.format(at=self.analysistype)), 'w') as report:
write_header = True
for sample in se... | As a Python code translator, you convert algorithms and pseudocode into Python. |
def on_add(self, item):
"""Convert to pseuso acces"""
super(Tels, self).on_add(list_views.PseudoAccesCategorie(item)) | Implement a function in Python 3 to
convert to pseuso acces | As a Python code translator, you convert algorithms and pseudocode into Python. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.