output stringlengths 1 928k | instruction stringlengths 7 928k | system stringlengths 0 104k |
|---|---|---|
Add an error page for all HTTP status codes. | Can you generate a brief explanation for the following Python 3 code
def set_error_pages(self, codes_map=None, common_prefix=None):
statuses = [403, 404, 500]
if common_prefix:
if not codes_map:
codes_map = {code: '%s.html' % code for code in statuses}
for code,... | As a Python code translator, you convert algorithms and pseudocode into Python. |
Sets GeoIP parameters.
* http://uwsgi.readthedocs.io/en/latest/GeoIP.html
:param str|unicode db_country: Country database file path.
:param str|unicode db_city: City database file path. Example: ``GeoLiteCity.dat``. | Here you have a function in Python 3, explain what it does
def set_geoip_params(self, db_country=None, db_city=None):
self._set('geoip-country', db_country, plugin='geoip')
self._set('geoip-city', db_city, plugin='geoip')
return self._section | As a python code expert, you are capable of creating scripts from specifications. |
Store the specified response header in a request var
. | Make a summary of the following Python 3 code
def header_collect(self, name, target_var, pull=False):
self._set(
'pull-header' if pull else 'collect-header',
'%s %s' % (name, target_var), multi=True)
return self._section | As a Python code translator, you convert algorithms and pseudocode into Python. |
def register_static_map(self, mountpoint, target, retain_resource_path=False, safe_target=False):
"""Allows mapping mountpoint to a static directory (or file).
* http://uwsgi.readthedocs.io/en/latest/StaticFiles.html#mode-3-using-static-file-mount-points
:param str|unicode mountpoint:
... | How would you implement a function in Python 3 that
allows mapping mountpoint to a static file or file. | As a Python code composer, you craft elegant and concise scripts. |
Adds a statics expiration rule based on a criterion. | Make a summary of the following Python 3 code
def add_expiration_rule(self, criterion, value, timeout, use_mod_time=False):
command = 'static-expires'
separator = ' '
if criterion != self.expiration_criteria.FILENAME:
command += '-%s' % criterion
if criterion == self.expir... | You are a Python code analyst, evaluating scripts for potential improvements. |
Sets the static - cache - paths and static - cache - paths - name parameters for the uWSGI cache. | Can you generate the documentation for the following Python 3 function
def set_paths_caching_params(self, timeout=None, cache_name=None):
self._set('static-cache-paths', timeout)
self._set('static-cache-paths-name', cache_name)
return self._section | As a Python code analyst, you investigate and solve complex coding mysteries |
def set_socket_params(
self, send_timeout=None, keep_alive=None, no_defer_accept=None,
buffer_send=None, buffer_receive=None):
"""Sets common socket params.
:param int send_timeout: Send (write) timeout in seconds.
:param bool keep_alive: Enable TCP KEEPALIVEs.
... | How would you code a function in Python 3 to
set common socket params. | As a Python code analyst, you investigate and solve complex coding mysteries |
def set_unix_socket_params(self, abstract=None, permissions=None, owner=None, umask=None):
"""Sets Unix-socket related params.
:param bool abstract: Force UNIX socket into abstract mode (Linux only).
:param str permissions: UNIX sockets are filesystem objects that obey
UNIX permiss... | Create a Python 3 function to
set the Unix - socket related params. | You are a Python code analyst, evaluating scripts for potential improvements. |
def set_bsd_socket_params(self, port_reuse=None):
"""Sets BSD-sockets related params.
:param bool port_reuse: Enable REUSE_PORT flag on socket to allow multiple
instances binding on the same address (BSD only).
"""
self._set('reuse-port', port_reuse, cast=bool)
ret... | Implement a Python 3 function for
setting BSD - socket related params. | As a python code expert, you are capable of creating scripts from specifications. |
def register_socket(self, socket):
"""Registers the given socket(s) for further use.
:param Socket|list[Socket] socket: Socket type object. See ``.sockets``.
"""
sockets = self._sockets
for socket in listify(socket):
uses_shared = isinstance(socket.address, Socket... | Write a Python 3 script for
registering the given socket for further use. | As a Python code composer, you craft elegant and concise scripts. |
def set_sni_params(self, name, cert, key, ciphers=None, client_ca=None, wildcard=False):
"""Allows setting Server Name Identification (virtual hosting for SSL nodes) params.
* http://uwsgi.readthedocs.io/en/latest/SNI.html
:param str|unicode name: Node/server/host name.
:param str|uni... | Implement a Python 3 function for
allowing setting server name identification params. | You are a Python code generator, capable of creating scripts from specifications. |
def set_sni_dir_params(self, dir, ciphers=None):
"""Enable checking for cert/key/client_ca file in the specified directory
and create a sni/ssl context on demand.
Expected filenames:
* <sni-name>.crt
* <sni-name>.key
* <sni-name>.ca - this file is optional
... | How would you code a function in Python 3 to
enable checking for cert key client ca file in the specified directory and create a sni ssl context on demand. | You are a Python code analyst, evaluating scripts for potential improvements. |
def enable(self, size, block_size=None, store=None, store_sync_interval=None):
"""Enables shared queue of the given size.
:param int size: Queue size.
:param int block_size: Block size in bytes. Default: 8 KiB.
:param str|unicode store: Persist the queue into file.
:param int... | How would you implement a function in Python 3 that
enables the shared queue of the given size. | You are a Python code architect, reviewing and designing scalable and efficient code |
def set_basic_params(self, count=None, thunder_lock=None, lock_engine=None):
"""
:param int count: Create the specified number of shared locks.
:param bool thunder_lock: Serialize accept() usage (if possible)
Could improve performance on Linux with robust pthread mutexes.
... | Create a Python 3 function for
setting basic parameters for the resource store. | As a Python code composer, you craft elegant and concise scripts. |
Sets the ipcsem lock engine params. | Can you generate the documentation for the following Python 3 function
def set_ipcsem_params(self, ftok=None, persistent=None):
self._set('ftok', ftok)
self._set('persistent-ipcsem', persistent, cast=bool)
return self._section | You are a Python code architect, reviewing and designing scalable and efficient code |
Locks the specified file. | How would you explain what the following Python 3 function does
def lock_file(self, fpath, after_setup=False, wait=False):
command = 'flock-wait' if wait else 'flock'
if after_setup:
command = '%s2' % command
self._set(command, fpath)
return self._section | As a python code expert, you are capable of creating scripts from specifications. |
Decorator. Allows registering a function for RPC. | Here you have a function in Python 3, explain what it does
def register_rpc(name=None):
def wrapper(func):
func_name = func.__name__
rpc_name = name or func_name
uwsgi.register_rpc(rpc_name, func)
_LOG.debug("Registering '%s' for RPC under '%s' alias ...", func_name, rpc_name)
... | As a Python code composer, you craft elegant and concise scripts. |
Performs an RPC function call with the given arguments. | How would you explain what the following Python 3 function does
def make_rpc_call(func_name, args=None, remote=None):
args = args or []
args = [encode(str(arg)) for arg in args]
if remote:
result = uwsgi.rpc(remote, func_name, *args)
else:
result = uwsgi.call(func_name, *args)
retu... | As a Python code composer, you craft elegant and concise scripts. |
Sets the Emperor command related parameters. | Here you have a function in Python 3, explain what it does
def set_emperor_command_params(
self, command_socket=None,
wait_for_command=None, wait_for_command_exclude=None):
"""Emperor commands related parameters.
* http://uwsgi-docs.readthedocs.io/en/latest/tutorials/EmperorSubs... | As a Python code composer, you craft elegant and concise scripts. |
def set_vassals_wrapper_params(self, wrapper=None, overrides=None, fallbacks=None):
"""Binary wrapper for vassals parameters.
:param str|unicode wrapper: Set a binary wrapper for vassals.
:param str|unicode|list[str|unicode] overrides: Set a binary wrapper for vassals to try before the default... | Can you implement a function in Python 3 that
sets the emperor - wrapper and emperor - wrapper - overrides parameters for vassals. | As a Python code translator, you convert algorithms and pseudocode into Python. |
Throttling options.
* http://uwsgi-docs.readthedocs.io/en/latest/Emperor.html#throttling
* http://uwsgi-docs.readthedocs.io/en/latest/Emperor.html#loyalty
:param int level: Set throttling level (in milliseconds) for bad behaving vassals. Default: 1000.
:param int level_max: Set maximu... | Make a summary of the following Python 3 code
def set_throttle_params(self, level=None, level_max=None):
self._set('emperor-throttle', level)
self._set('emperor-max-throttle', level_max)
return self._section | As a Python code translator, you convert algorithms and pseudocode into Python. |
def set_mode_tyrant_params(self, enable=None, links_no_follow=None, use_initgroups=None):
"""Tyrant mode (secure multi-user hosting).
In Tyrant mode the Emperor will run the vassal using the UID/GID of the vassal
configuration file.
* http://uwsgi-docs.readthedocs.io/en/latest/Emperor.... | How would you implement a function in Python 3 that
sets the emperor - tyrant - nofollow and emperor - tyrant - initgroups attributes. | As a Python code translator, you convert algorithms and pseudocode into Python. |
def set_mode_broodlord_params(
self, zerg_count=None,
vassal_overload_sos_interval=None, vassal_queue_items_sos=None):
"""This mode is a way for a vassal to ask for reinforcements to the Emperor.
Reinforcements are new vassals spawned on demand generally bound on the same socket... | Create a Python 3 function to
set the mode to Broodlord. | As a Python code analyst, you investigate and solve complex coding mysteries |
Run the specified command as worker. | Here you have a function in Python 3, explain what it does
def run_command_as_worker(self, command, after_post_fork_hook=False):
self._set('worker-exec2' if after_post_fork_hook else 'worker-exec', command, multi=True)
return self._section | You are a Python code analyst, evaluating scripts for potential improvements. |
def set_count_auto(self, count=None):
"""Sets workers count.
By default sets it to detected number of available cores
:param int count:
"""
count = count or self._section.vars.CPU_CORES
self._set('workers', count)
return self._section | Can you implement a function in Python 3 that
sets the count of available workers by default sets it to detected number of available cores. | You are a Python code architect, reviewing and designing scalable and efficient code |
def set_thread_params(
self, enable=None, count=None, count_offload=None, stack_size=None, no_wait=None):
"""Sets threads related params.
:param bool enable: Enable threads in the embedded languages.
This will allow to spawn threads in your app.
.. warning:: Threads... | Implement a Python 3 function for
setting the threads related params. | As a Python code translator, you convert algorithms and pseudocode into Python. |
def set_mules_params(
self, mules=None, touch_reload=None, harakiri_timeout=None, farms=None, reload_mercy=None,
msg_buffer=None, msg_buffer_recv=None):
"""Sets mules related params.
http://uwsgi.readthedocs.io/en/latest/Mules.html
Mules are worker processes living in t... | How would you code a function in Python 3 to
set the mules related params. | You are a Python code generator, capable of creating scripts from specifications. |
def set_reload_params(
self, min_lifetime=None, max_lifetime=None,
max_requests=None, max_requests_delta=None,
max_addr_space=None, max_rss=None, max_uss=None, max_pss=None,
max_addr_space_forced=None, max_rss_forced=None, watch_interval_forced=None,
mercy=Non... | Implement a function in Python 3 to
set the reload parameters for the specified worker. | You are a Python code architect, reviewing and designing scalable and efficient code |
def set_reload_on_exception_params(self, do_reload=None, etype=None, evalue=None, erepr=None):
"""Sets workers reload on exceptions parameters.
:param bool do_reload: Reload a worker when an exception is raised.
:param str etype: Reload a worker when a specific exception type is raised.
... | Create a Python 3 function to
set the reload - on - exception parameters. | As a Python code analyst, you investigate and solve complex coding mysteries |
Sets the worker harakiri parameters. | Can you generate the documentation for the following Python 3 function
def set_harakiri_params(self, timeout=None, verbose=None, disable_for_arh=None):
self._set('harakiri', timeout)
self._set('harakiri-verbose', verbose, cast=bool)
self._set('harakiri-no-arh', disable_for_arh, cast=bool)
... | You are a Python code analyst, evaluating scripts for potential improvements. |
Sets the Zerg server params. | Given the following Python 3 function, write the documentation
def set_zerg_server_params(self, socket, clients_socket_pool=None):
if clients_socket_pool:
self._set('zergpool', '%s:%s' % (socket, ','.join(listify(clients_socket_pool))), multi=True)
else:
self._set('zerg-server',... | You are a Python code analyst, evaluating scripts for potential improvements. |
def set_zerg_client_params(self, server_sockets, use_fallback_socket=None):
"""Zerg mode. Zergs params.
:param str|unicode|list[str|unicode] server_sockets: Attaches zerg to a zerg server.
:param bool use_fallback_socket: Fallback to normal sockets if the zerg server is not available
... | Can you create a Python 3 function that
sets the zerg client parameters. | As a Python code translator, you convert algorithms and pseudocode into Python. |
Format given text using ANSI formatting escape sequences. | Can you generate a brief explanation for the following Python 3 code
def format_print_text(text, color_fg=None, color_bg=None):
from .config import Section
color_fg = {
'black': '30',
'red': '31',
'reder': '91',
'green': '32',
'greener': '92',
'yellow': '33',
... | As a python code expert, you are capable of creating scripts from specifications. |
Iterates over the options of the configuration sections groups options. | Here you have a function in Python 3, explain what it does
def iter_options(self):
for section in self.sections:
name = str(section)
for key, value in section._get_options():
yield name, key, value | As a python code expert, you are capable of creating scripts from specifications. |
def set_memory_params(self, ksm_interval=None, no_swap=None):
"""Set memory related parameters.
:param int ksm_interval: Kernel Samepage Merging frequency option, that can reduce memory usage.
Accepts a number of requests (or master process cycles) to run page scanner after.
..... | Can you write a function in Python 3 where it
sets memory related parameters. | As a Python code composer, you craft elegant and concise scripts. |
def change_dir(self, to, after_app_loading=False):
"""Chdir to specified directory before or after apps loading.
:param str|unicode to: Target directory.
:param bool after_app_loading:
*True* - after load
*False* - before load
"""
self._set('chd... | Write a Python 3 function that can
change the directory of the cache entry. | As a Python code analyst, you investigate and solve complex coding mysteries |
Set process owner params. | Here you have a function in Python 3, explain what it does
def set_owner_params(self, uid=None, gid=None, add_gids=None, set_asap=False):
prefix = 'immediate-' if set_asap else ''
self._set(prefix + 'uid', uid)
self._set(prefix + 'gid', gid)
self._set('add-gid', add_gids, multi=True)
... | As a Python code translator, you convert algorithms and pseudocode into Python. |
Return the owner and group IDs of the current user. | How would you explain what the following Python 3 function does
def get_owner(self, default=True):
uid, gid = self.owner
if not uid and default:
uid = os.getuid()
if not gid and default:
gid = os.getgid()
return uid, gid | As a Python code translator, you convert algorithms and pseudocode into Python. |
def set_hook(self, phase, action):
"""Allows setting hooks (attaching actions) for various uWSGI phases.
:param str|unicode phase: See constants in ``.phases``.
:param str|unicode|list|HookAction|list[HookAction] action:
"""
self._set('hook-%s' % phase, action, multi=True)
... | Write a Python 3 function for
allowing setting hooks for various uWSGI phases. | As a Python code translator, you convert algorithms and pseudocode into Python. |
Allows running certain action when the specified file is touched. | Here you have a function in Python 3, explain what it does
def set_hook_touch(self, fpath, action):
self._set('hook-touch', '%s %s' % (fpath, action), multi=True)
return self._section | You are a Python code generator, capable of creating scripts from specifications. |
Set the function to be run after each request. | Explain what the following Python 3 code does
def set_hook_after_request(self, func):
self._set('after-request-hook', func, multi=True)
return self._section | As a Python code translator, you convert algorithms and pseudocode into Python. |
Sets the params related to process exit procedure. | Can you generate the documentation for the following Python 3 function
def set_on_exit_params(self, skip_hooks=None, skip_teardown=None):
self._set('skip-atexit', skip_hooks, cast=bool)
self._set('skip-atexit-teardown', skip_teardown, cast=bool)
return self._section | As a python code expert, you are capable of creating scripts from specifications. |
def run_command_on_event(self, command, phase=phases.ASAP):
"""Run the given command on a given phase.
:param str|unicode command:
:param str|unicode phase: See constants in ``Phases`` class.
"""
self._set('exec-%s' % phase, command, multi=True)
return self._section | How would you code a function in Python 3 to
run a given command on a given phase. | As a Python code translator, you convert algorithms and pseudocode into Python. |
def run_command_on_touch(self, command, target):
"""Run command when the specified file is modified/touched.
:param str|unicode command:
:param str|unicode target: File path.
"""
self._set('touch-exec', '%s %s' % (target, command), multi=True)
return self._section | How would you code a function in Python 3 to
run command when the specified file is modified or touched. | You are a Python code generator, capable of creating scripts from specifications. |
def set_pid_file(self, fpath, before_priv_drop=True, safe=False):
"""Creates pidfile before or after privileges drop.
:param str|unicode fpath: File path.
:param bool before_priv_drop: Whether to create pidfile before privileges are dropped.
.. note:: Vacuum is made after privileg... | Write a Python 3 function for
creating a pidfile before or after privileges drop. | As a python code expert, you are capable of creating scripts from specifications. |
Sets the processes naming parameters. | Make a summary of the following Python 3 code
def set_naming_params(self, autonaming=None, prefix=None, suffix=None, name=None):
self._set('auto-procname', autonaming, cast=bool)
self._set('procname-prefix%s' % ('-spaced' if prefix and prefix.endswith(' ') else ''), prefix)
self._set('procname-a... | You are a Python code analyst, evaluating scripts for potential improvements. |
Print out descriptions from ConfigurationError. | Explain what the following Python 3 code does
def errorprint():
try:
yield
except ConfigurationError as e:
click.secho('%s' % e, err=True, fg='red')
sys.exit(1) | As a Python code analyst, you investigate and solve complex coding mysteries |
Runs uWSGI passing to it using the default or another uwsgiconf configuration module. | How would you explain what the following Python 3 function does
def run(conf, only):
with errorprint():
config = ConfModule(conf)
spawned = config.spawn_uwsgi(only)
for alias, pid in spawned:
click.secho("Spawned uWSGI for configuration aliased '%s'. PID %s" % (alias, pid), fg='... | You are a Python code generator, capable of creating scripts from specifications. |
def compile(conf):
"""Compiles classic uWSGI configuration file using the default
or given `uwsgiconf` configuration module.
"""
with errorprint():
config = ConfModule(conf)
for conf in config.configurations:
conf.format(do_print=True) | Write a Python 3 function for
compiling classic uWSGI configuration file using the default or given uwsgiconf configuration module. | As a Python code analyst, you investigate and solve complex coding mysteries |
Outputs configuration for system initialization subsystem. | Can you generate a brief explanation for the following Python 3 code
def sysinit(systype, conf, project):
click.secho(get_config(
systype,
conf=ConfModule(conf).configurations[0],
conf_path=conf,
project_name=project,
)) | You are a Python code generator, capable of creating scripts from specifications. |
Runs uWSGI to determine what plugins are available. | Make a summary of the following Python 3 code
def probe_plugins():
plugins = UwsgiRunner().get_plugins()
for plugin in sorted(plugins.generic):
click.secho(plugin)
click.secho('')
for plugin in sorted(plugins.request):
click.secho(plugin) | As a Python code translator, you convert algorithms and pseudocode into Python. |
Run a spooler on the specified directory. | Can you generate a brief explanation for the following Python 3 code
def add(self, work_dir, external=False):
command = 'spooler'
if external:
command += '-external'
self._set(command, self._section.replace_placeholders(work_dir), multi=True)
return self._section | You are a Python code architect, reviewing and designing scalable and efficient code |
def configure(self):
"""Configures broodlord mode and returns emperor and zerg sections.
:rtype: tuple
"""
section_emperor = self.section_emperor
section_zerg = self.section_zerg
socket = self.socket
section_emperor.workers.set_zerg_server_params(socket=socket)... | Write a Python 3 function that can
configure broodlord mode and returns emperor and zerg sections. | As a Python code analyst, you investigate and solve complex coding mysteries |
Returns default log message format. | Explain what the following Python 3 code does
def get_log_format_default(self):
vars = self.logging.vars
format_default = (
'[pid: %s|app: %s|req: %s/%s] %s (%s) {%s vars in %s bytes} [%s] %s %s => '
'generated %s bytes in %s %s%s(%s %s) %s headers in %s bytes (%s switches on co... | As a Python code translator, you convert algorithms and pseudocode into Python. |
Shortcut to set process owner data. | Explain what the following Python 3 code does
def configure_owner(self, owner='www-data'):
if owner is not None:
self.main_process.set_owner_params(uid=owner, gid=owner)
return self | As a Python code analyst, you investigate and solve complex coding mysteries |
Set basic alarm parameters. | Can you tell what is the following Python 3 function doing
def set_basic_params(self, msg_size=None, cheap=None, anti_loop_timeout=None):
self._set('alarm-msg-size', msg_size)
self._set('alarm-cheap', cheap, cast=bool)
self._set('alarm-freq', anti_loop_timeout)
return self._section | As a python code expert, you are capable of creating scripts from specifications. |
def register_alarm(self, alarm):
"""Register (create) an alarm.
:param AlarmType|list[AlarmType] alarm: Alarm.
"""
for alarm in listify(alarm):
if alarm not in self._alarms:
self._set('alarm', alarm, multi=True)
self._alarms.append(alarm)
... | Can you implement a function in Python 3 that
registers (create) an alarm. :param AlarmType|list[AlarmType] alarm: Alarm. | As a Python code composer, you craft elegant and concise scripts. |
Raise or skip the specified alarm when a log line matches the specified regexp. | Explain what the following Python 3 code does
def alarm_on_log(self, alarm, matcher, skip=False):
self.register_alarm(alarm)
value = '%s %s' % (
','.join(map(attrgetter('alias'), listify(alarm))),
matcher)
self._set('not-alarm-log' if skip else 'alarm-log', value)
... | As a Python code analyst, you investigate and solve complex coding mysteries |
Triggers the alarm when the specified file descriptor is ready for read. | Explain what the following Python 3 code does
def alarm_on_fd_ready(self, alarm, fd, message, byte_count=None):
self.register_alarm(alarm)
value = fd
if byte_count:
value += ':%s' % byte_count
value += ' %s' % message
for alarm in listify(alarm):
self.... | As a Python code analyst, you investigate and solve complex coding mysteries |
Raise the specified alarm when segmentation fault handler is executed. | Given the following Python 3 function, write the documentation
def alarm_on_segfault(self, alarm):
self.register_alarm(alarm)
for alarm in listify(alarm):
self._set('alarm-segfault', alarm.alias, multi=True)
return self._section | As a Python code translator, you convert algorithms and pseudocode into Python. |
Returns the contents of a configuration file. | How would you explain what the following Python 3 function does
def get_config(systype, conf, conf_path, runner=None, project_name=None):
runner = runner or ('%s run' % Finder.uwsgiconf())
conf_path = abspath(conf_path)
if isinstance(conf, Configuration):
conf = conf.sections[0] # todo Maybe somet... | You are a Python code analyst, evaluating scripts for potential improvements. |
This is another simple WSGI application that will be served by uWSGI. | Given the following Python 3 function, write the documentation
def app_2(env, start_response):
import random
start_response('200 OK', [('Content-Type','text/html')])
data = [
'<h1>uwsgiconf demo: one file second app</h1>',
'<div>Some random number for you: %s</div>' % random.randint(1, 9... | You are a Python code analyst, evaluating scripts for potential improvements. |
Configure uWSGI.
This returns several configuration objects, which will be used
to spawn several uWSGI processes.
Applications are on 127.0.0.1 on ports starting from 8000. | Given the following Python 3 function, write the documentation
def configure():
import os
from uwsgiconf.presets.nice import PythonSection
FILE = os.path.abspath(__file__)
port = 8000
configurations = []
for idx in range(2):
alias = 'app_%s' % (idx + 1)
section = PythonSecti... | As a Python code translator, you convert algorithms and pseudocode into Python. |
r Convert raw headers to a dictionary. | Given the following Python 3 function, write the documentation
def headers_raw_to_dict(headers_raw):
if headers_raw is None:
return None
headers = headers_raw.splitlines()
headers_tuples = [header.split(b':', 1) for header in headers]
result_dict = {}
for header_item in headers_tuples:
... | As a Python code translator, you convert algorithms and pseudocode into Python. |
def log_into(self, target, before_priv_drop=True):
"""Simple file or UDP logging.
.. note:: This doesn't require any Logger plugin and can be used
if no log routing is required.
:param str|unicode target: Filepath or UDP address.
:param bool before_priv_drop: Whether to lo... | How would you code a function in Python 3 to
log the current state of the entry into the specified target. | As a Python code analyst, you investigate and solve complex coding mysteries |
Set various parameters related to file logging. | Here you have a function in Python 3, explain what it does
def set_file_params(
self, reopen_on_reload=None, trucate_on_statup=None, max_size=None, rotation_fname=None,
touch_reopen=None, touch_rotate=None, owner=None, mode=None):
"""Set various parameters related to file logging.
... | As a python code expert, you are capable of creating scripts from specifications. |
def set_filters(self, include=None, exclude=None, write_errors=None, write_errors_tolerance=None, sigpipe=None):
"""Set various log data filters.
:param str|unicode|list include: Show only log lines matching the specified regexp.
.. note:: Requires enabled PCRE support.
:param str... | Write a Python 3 function for
setting various log data filters. | As a Python code composer, you craft elegant and concise scripts. |
Set various log data filters. | Can you generate a brief explanation for the following Python 3 code
def set_requests_filters(
self, slower=None, bigger=None, status_4xx=None, status_5xx=None,
no_body=None, sendfile=None, io_errors=None):
"""Set various log data filters.
:param int slower: Log requests slower ... | You are a Python code architect, reviewing and designing scalable and efficient code |
def set_master_logging_params(
self, enable=None, dedicate_thread=None, buffer=None,
sock_stream=None, sock_stream_requests_only=None):
"""Sets logging params for delegating logging to master process.
:param bool enable: Delegate logging to master process.
Delegate t... | Write a Python 3 script for
setting logging params for delegating logging to master process. | You are a Python code architect, reviewing and designing scalable and efficient code |
def add_logger(self, logger, requests_only=False, for_single_worker=False):
"""Set/add a common logger or a request requests only.
:param str|unicode|list|Logger|list[Logger] logger:
:param bool requests_only: Logger used only for requests information messages.
:param bool for_single_... | Create a Python 3 function to
set or add a common logger or a request requests only. | You are a Python code analyst, evaluating scripts for potential improvements. |
def add_logger_route(self, logger, matcher, requests_only=False):
"""Log to the specified named logger if regexp applied on log item matches.
:param str|unicode|list|Logger|list[Logger] logger: Logger to associate route with.
:param str|unicode matcher: Regular expression to apply to log item.... | Write a Python 3 function for
logging to the specified named logger if regexp applied on log item matches. | You are a Python code analyst, evaluating scripts for potential improvements. |
Add an item to the log encoder or request encoder chain. | Can you generate the documentation for the following Python 3 function
def add_logger_encoder(self, encoder, logger=None, requests_only=False, for_single_worker=False):
if for_single_worker:
command = 'worker-log-req-encoder' if requests_only else 'worker-log-encoder'
else:
comma... | As a Python code composer, you craft elegant and concise scripts. |
def _compiler_type():
"""
Gets the compiler type from distutils. On Windows with MSVC it will be
"msvc". On macOS and linux it is "unix".
Borrowed from https://github.com/pyca/cryptography/blob\
/05b34433fccdc2fec0bb014c3668068169d769fd/src/_cffi_src/utils.py#L78
"""
dist = dist... | Create a Python 3 function for
returning the compiler type from distutils. | You are a Python code analyst, evaluating scripts for potential improvements. |
Sets basic Metrics subsystem params. | Given the following Python 3 function, write the documentation
def set_metrics_params(self, enable=None, store_dir=None, restore=None, no_cores=None):
self._set('enable-metrics', enable, cast=bool)
self._set('metrics-dir', self._section.replace_placeholders(store_dir))
self._set('metrics-dir-res... | You are a Python code analyst, evaluating scripts for potential improvements. |
def set_metrics_threshold(self, name, value, check_interval=None, reset_to=None, alarm=None, alarm_message=None):
"""Sets metric threshold parameters.
:param str|unicode name: Metric name.
:param int value: Threshold value.
:param int reset_to: Reset value to when threshold is reached... | Write a Python 3 script for
setting the metric threshold parameter. | You are a Python code architect, reviewing and designing scalable and efficient code |
Enables stats server on the specified address. | Make a summary of the following Python 3 code
def set_stats_params(
self, address=None, enable_http=None,
minify=None, no_cores=None, no_metrics=None, push_interval=None):
"""Enables stats server on the specified address.
* http://uwsgi.readthedocs.io/en/latest/StatsServer.html
... | You are a Python code architect, reviewing and designing scalable and efficient code |
def register_stats_pusher(self, pusher):
"""Registers a pusher to be used for pushing statistics to various remotes/locals.
:param Pusher|list[Pusher] pusher:
"""
for pusher in listify(pusher):
self._set('stats-push', pusher, multi=True)
return self._section | Can you create a Python 3 function that
registers a pusher to be used for pushing statistics to various remotes / locals. | You are a Python code analyst, evaluating scripts for potential improvements. |
Enables SNMP.
uWSGI server embeds a tiny SNMP server that you can use to integrate
your web apps with your monitoring infrastructure.
* http://uwsgi.readthedocs.io/en/latest/SNMP.html
.. note:: SNMP server is started in the master process after dropping the privileges.
If ... | Make a summary of the following Python 3 code
def enable_snmp(self, address, community_string):
self._set('snmp', address)
self._set('snmp-community', community_string)
return self._section | You are a Python code architect, reviewing and designing scalable and efficient code |
def mount(self, mountpoint, app, into_worker=False):
"""Load application under mountpoint.
Example:
* .mount('', 'app0.py') -- Root URL part
* .mount('/app1', 'app1.py') -- URL part
* .mount('/pinax/here', '/var/www/pinax/deploy/pinax.wsgi')
* .mount('the... | Can you create a Python 3 function that
mounts application under mountpoint. | As a Python code analyst, you investigate and solve complex coding mysteries |
Switches uWSGI to lazy mode. | Given the following Python 3 function, write the documentation
def switch_into_lazy_mode(self, affect_master=None):
self._set('lazy' if affect_master else 'lazy-apps', True, cast=bool)
return self._section | As a python code expert, you are capable of creating scripts from specifications. |
Sets basic HTTP parameters for the router. | Explain what the following Python 3 code does
def set_basic_params(
self, workers=None, zerg_server=None, fallback_node=None, concurrent_events=None,
cheap_mode=None, stats_server=None, quiet=None, buffer_size=None,
keepalive=None, resubscribe_addresses=None):
"""
:pa... | As a python code expert, you are capable of creating scripts from specifications. |
Sets connection - related parameters. | Make a summary of the following Python 3 code
def set_connections_params(
self, harakiri=None, timeout_socket=None, retry_delay=None, timeout_headers=None, timeout_backend=None):
"""Sets connection-related parameters.
:param int harakiri: Set gateway harakiri timeout (seconds).
:pa... | As a python code expert, you are capable of creating scripts from specifications. |
Allows enabling automatic management mechanics. | Explain what the following Python 3 code does
def set_manage_params(
self, chunked_input=None, chunked_output=None, gzip=None, websockets=None, source_method=None,
rtsp=None, proxy_protocol=None):
"""Allows enabling various automatic management mechanics.
* http://uwsgi.readthed... | As a Python code translator, you convert algorithms and pseudocode into Python. |
Drop http router privileges to specified user and group. | Can you generate a brief explanation for the following Python 3 code
def set_owner_params(self, uid=None, gid=None):
self._set_aliased('uid', uid)
self._set_aliased('gid', gid)
return self | As a Python code translator, you convert algorithms and pseudocode into Python. |
Sets connection - related parameters. | Given the following Python 3 function, write the documentation
def set_connections_params(self, harakiri=None, timeout_socket=None, retry_delay=None, retry_max=None):
super(RouterSsl, self).set_connections_params(**filter_locals(locals(), ['retry_max']))
self._set_aliased('max-retries', retry_max)
... | You are a Python code generator, capable of creating scripts from specifications. |
Set basic parameters for router. | Can you tell what is the following Python 3 function doing
def set_basic_params(
self, workers=None, zerg_server=None, fallback_node=None, concurrent_events=None,
cheap_mode=None, stats_server=None, quiet=None, buffer_size=None,
fallback_nokey=None, subscription_key=None, emperor_com... | You are a Python code architect, reviewing and designing scalable and efficient code |
Set the parameters for the subscription server to be forwarded to. | Given the following Python 3 function, write the documentation
def set_resubscription_params(self, addresses=None, bind_to=None):
self._set_aliased('resubscribe', addresses, multi=True)
self._set_aliased('resubscribe-bind', bind_to)
return self | You are a Python code generator, capable of creating scripts from specifications. |
Sets connection - related parameters. | How would you explain what the following Python 3 function does
def set_connections_params(self, harakiri=None, timeout_socket=None, retry_delay=None, retry_max=None, defer=None):
super(RouterFast, self).set_connections_params(**filter_locals(locals(), ['retry_max', 'defer']))
self._set_aliased('max-re... | You are a Python code architect, reviewing and designing scalable and efficient code |
def set_postbuffering_params(self, size=None, store_dir=None):
"""Sets buffering params.
Web-proxies like nginx are "buffered", so they wait til the whole request (and its body)
has been read, and then it sends it to the backends.
:param int size: The size (in bytes) of the request bod... | Create a Python 3 function for
setting the post - buffering params for the current HTTP request. | You are a Python code generator, capable of creating scripts from specifications. |
def set_connections_params(
self, harakiri=None, timeout_socket=None, retry_delay=None, retry_max=None, use_xclient=None):
"""Sets connection-related parameters.
:param int harakiri: Set gateway harakiri timeout (seconds).
:param int timeout_socket: Node socket timeout (seconds). ... | Implement a function in Python 3 to
set connection - related parameters. | As a python code expert, you are capable of creating scripts from specifications. |
Sets connection - related parameters. | Explain what the following Python 3 code does
def set_connections_params(self, harakiri=None, timeout_socket=None):
self._set_aliased('harakiri', harakiri)
self._set_aliased('timeout', timeout_socket)
return self | As a python code expert, you are capable of creating scripts from specifications. |
def set_window_params(self, cols=None, rows=None):
"""Sets pty window params.
:param int cols:
:param int rows:
"""
self._set_aliased('cols', cols)
self._set_aliased('rows', rows)
return self | Can you write a function in Python 3 where it
sets pty window params. | As a Python code translator, you convert algorithms and pseudocode into Python. |
Set basic parameters for the current session. | Can you generate a brief explanation for the following Python 3 code
def set_basic_params(self, use_credentials=None, stats_server=None):
self._set_aliased('use-credentials', use_credentials)
self._set_aliased('router-stats', stats_server)
return self | You are a Python code analyst, evaluating scripts for potential improvements. |
Adds a routing rule to the tuntap router. | Can you generate a brief explanation for the following Python 3 code
def register_route(self, src, dst, gateway):
self._set_aliased('router-route', ' '.join((src, dst, gateway)), multi=True)
return self | As a python code expert, you are capable of creating scripts from specifications. |
def device_add_rule(self, direction, action, src, dst, target=None):
"""Adds a tuntap device rule.
To be used in a vassal.
:param str|unicode direction: Direction:
* in
* out.
:param str|unicode action: Action:
* allow
* deny
... | How would you code a function in Python 3 to
add a tuntap device rule. | As a Python code analyst, you investigate and solve complex coding mysteries |
Adds a firewall rule to the router. | Can you generate a brief explanation for the following Python 3 code
def add_firewall_rule(self, direction, action, src=None, dst=None):
value = [action]
if src:
value.extend((src, dst))
self._set_aliased('router-firewall-%s' % direction.lower(), ' '.join(value), multi=True)
... | As a Python code composer, you craft elegant and concise scripts. |
def configure_uwsgi(configurator_func):
"""Allows configuring uWSGI using Configuration objects returned
by the given configuration function.
.. code-block: python
# In configuration module, e.g `uwsgicfg.py`
from uwsgiconf.config import configure_uwsgi
configure_uwsgi(get_config... | Write a Python 3 function for
allowing configuring uWSGI using a function which returns a list of Configuration objects. | As a python code expert, you are capable of creating scripts from specifications. |
Replaces placeholders that can be used e. g. in filepaths.
| Can you generate a brief explanation for the following Python 3 code
def replace_placeholders(self, value):
if not value:
return value
is_list = isinstance(value, list)
values = []
for value in listify(value):
runtime_dir = self.get_runtime_dir()
pro... | As a Python code analyst, you investigate and solve complex coding mysteries |
Returns the directory where the runtime files are stored. | How would you explain what the following Python 3 function does
def get_runtime_dir(self, default=True):
dir_ = self._runtime_dir
if not dir_ and default:
uid = self.main_process.get_owner()[0]
dir_ = '/run/user/%s/' % uid if uid else '/run/'
return dir_ | You are a Python code generator, capable of creating scripts from specifications. |
Prints out a stamp containing useful information such as what and when has generated this configuration. | Make a summary of the following Python 3 code
def print_stamp(self):
from . import VERSION
print_out = partial(self.print_out, format_options='red')
print_out('This configuration was automatically generated using')
print_out('uwsgiconf v%s on %s' % ('.'.join(map(str, VERSION)), datetime... | As a Python code analyst, you investigate and solve complex coding mysteries |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.