repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 3
values | summary stringlengths 4 350 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
idlesign/uwsgiconf | uwsgiconf/options/applications.py | Applications.switch_into_lazy_mode | def switch_into_lazy_mode(self, affect_master=None):
"""Load apps in workers instead of master.
This option may have memory usage implications
as Copy-on-Write semantics can not be used.
.. note:: Consider using ``touch_chain_reload`` option in ``workers`` basic params
for ... | python | def switch_into_lazy_mode(self, affect_master=None):
"""Load apps in workers instead of master.
This option may have memory usage implications
as Copy-on-Write semantics can not be used.
.. note:: Consider using ``touch_chain_reload`` option in ``workers`` basic params
for ... | [
"def",
"switch_into_lazy_mode",
"(",
"self",
",",
"affect_master",
"=",
"None",
")",
":",
"self",
".",
"_set",
"(",
"'lazy'",
"if",
"affect_master",
"else",
"'lazy-apps'",
",",
"True",
",",
"cast",
"=",
"bool",
")",
"return",
"self",
".",
"_section"
] | Load apps in workers instead of master.
This option may have memory usage implications
as Copy-on-Write semantics can not be used.
.. note:: Consider using ``touch_chain_reload`` option in ``workers`` basic params
for lazy apps reloading.
:param bool affect_master: If **Tr... | [
"Load",
"apps",
"in",
"workers",
"instead",
"of",
"master",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/applications.py#L70-L88 | train | Switches uWSGI to lazy mode. |
idlesign/uwsgiconf | uwsgiconf/options/routing_routers.py | RouterHttp.set_basic_params | 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):
"""
:param int workers: Number of worker processes to... | python | 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):
"""
:param int workers: Number of worker processes to... | [
"def",
"set_basic_params",
"(",
"self",
",",
"workers",
"=",
"None",
",",
"zerg_server",
"=",
"None",
",",
"fallback_node",
"=",
"None",
",",
"concurrent_events",
"=",
"None",
",",
"cheap_mode",
"=",
"None",
",",
"stats_server",
"=",
"None",
",",
"quiet",
... | :param int workers: Number of worker processes to spawn.
:param str|unicode zerg_server: Attach the router to a zerg server.
:param str|unicode fallback_node: Fallback to the specified node in case of error.
:param int concurrent_events: Set the maximum number of concurrent events router can ... | [
":",
"param",
"int",
"workers",
":",
"Number",
"of",
"worker",
"processes",
"to",
"spawn",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/routing_routers.py#L319-L364 | train | Sets basic HTTP parameters for the router. |
idlesign/uwsgiconf | uwsgiconf/options/routing_routers.py | RouterHttp.set_connections_params | 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).
:param int timeout_socket: Node socket timeout (s... | python | 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).
:param int timeout_socket: Node socket timeout (s... | [
"def",
"set_connections_params",
"(",
"self",
",",
"harakiri",
"=",
"None",
",",
"timeout_socket",
"=",
"None",
",",
"retry_delay",
"=",
"None",
",",
"timeout_headers",
"=",
"None",
",",
"timeout_backend",
"=",
"None",
")",
":",
"super",
"(",
"RouterHttp",
"... | Sets connection-related parameters.
:param int harakiri: Set gateway harakiri timeout (seconds).
:param int timeout_socket: Node socket timeout (seconds).
Used to set the SPDY timeout. This is the maximum amount of inactivity after
the SPDY connection is closed.
De... | [
"Sets",
"connection",
"-",
"related",
"parameters",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/routing_routers.py#L366-L397 | train | Sets connection - related parameters. |
idlesign/uwsgiconf | uwsgiconf/options/routing_routers.py | RouterHttp.set_manage_params | 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.readthedocs.io/en/latest/Changelog-1.9.html#http-route... | python | 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.readthedocs.io/en/latest/Changelog-1.9.html#http-route... | [
"def",
"set_manage_params",
"(",
"self",
",",
"chunked_input",
"=",
"None",
",",
"chunked_output",
"=",
"None",
",",
"gzip",
"=",
"None",
",",
"websockets",
"=",
"None",
",",
"source_method",
"=",
"None",
",",
"rtsp",
"=",
"None",
",",
"proxy_protocol",
"=... | Allows enabling various automatic management mechanics.
* http://uwsgi.readthedocs.io/en/latest/Changelog-1.9.html#http-router-keepalive-auto-chunking-auto-gzip-and-transparent-websockets
:param bool chunked_input: Automatically detect chunked input requests and put the session in raw mode.
:... | [
"Allows",
"enabling",
"various",
"automatic",
"management",
"mechanics",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/routing_routers.py#L399-L434 | train | Allows enabling automatic management mechanics. |
idlesign/uwsgiconf | uwsgiconf/options/routing_routers.py | RouterHttp.set_owner_params | def set_owner_params(self, uid=None, gid=None):
"""Drop http router privileges to specified user and group.
:param str|unicode|int uid: Set uid to the specified username or uid.
:param str|unicode|int gid: Set gid to the specified groupname or gid.
"""
self._set_aliased('uid',... | python | def set_owner_params(self, uid=None, gid=None):
"""Drop http router privileges to specified user and group.
:param str|unicode|int uid: Set uid to the specified username or uid.
:param str|unicode|int gid: Set gid to the specified groupname or gid.
"""
self._set_aliased('uid',... | [
"def",
"set_owner_params",
"(",
"self",
",",
"uid",
"=",
"None",
",",
"gid",
"=",
"None",
")",
":",
"self",
".",
"_set_aliased",
"(",
"'uid'",
",",
"uid",
")",
"self",
".",
"_set_aliased",
"(",
"'gid'",
",",
"gid",
")",
"return",
"self"
] | Drop http router privileges to specified user and group.
:param str|unicode|int uid: Set uid to the specified username or uid.
:param str|unicode|int gid: Set gid to the specified groupname or gid. | [
"Drop",
"http",
"router",
"privileges",
"to",
"specified",
"user",
"and",
"group",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/routing_routers.py#L436-L447 | train | Drop http router privileges to specified user and group. |
idlesign/uwsgiconf | uwsgiconf/options/routing_routers.py | RouterSsl.set_connections_params | def set_connections_params(self, harakiri=None, timeout_socket=None, retry_delay=None, retry_max=None):
"""Sets connection-related parameters.
:param int harakiri: Set gateway harakiri timeout (seconds).
:param int timeout_socket: Node socket timeout (seconds). Default: 60.
:param int... | python | def set_connections_params(self, harakiri=None, timeout_socket=None, retry_delay=None, retry_max=None):
"""Sets connection-related parameters.
:param int harakiri: Set gateway harakiri timeout (seconds).
:param int timeout_socket: Node socket timeout (seconds). Default: 60.
:param int... | [
"def",
"set_connections_params",
"(",
"self",
",",
"harakiri",
"=",
"None",
",",
"timeout_socket",
"=",
"None",
",",
"retry_delay",
"=",
"None",
",",
"retry_max",
"=",
"None",
")",
":",
"super",
"(",
"RouterSsl",
",",
"self",
")",
".",
"set_connections_param... | Sets connection-related parameters.
:param int harakiri: Set gateway harakiri timeout (seconds).
:param int timeout_socket: Node socket timeout (seconds). Default: 60.
:param int retry_delay: Retry connections to dead static nodes after the specified
amount of seconds. Default: 30... | [
"Sets",
"connection",
"-",
"related",
"parameters",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/routing_routers.py#L569-L586 | train | Sets connection - related parameters. |
idlesign/uwsgiconf | uwsgiconf/options/routing_routers.py | RouterFast.set_basic_params | 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_command_socket=None):
"""
:param int workers: ... | python | 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_command_socket=None):
"""
:param int workers: ... | [
"def",
"set_basic_params",
"(",
"self",
",",
"workers",
"=",
"None",
",",
"zerg_server",
"=",
"None",
",",
"fallback_node",
"=",
"None",
",",
"concurrent_events",
"=",
"None",
",",
"cheap_mode",
"=",
"None",
",",
"stats_server",
"=",
"None",
",",
"quiet",
... | :param int workers: Number of worker processes to spawn.
:param str|unicode zerg_server: Attach the router to a zerg server.
:param str|unicode fallback_node: Fallback to the specified node in case of error.
:param int concurrent_events: Set the maximum number of concurrent events router can ... | [
":",
"param",
"int",
"workers",
":",
"Number",
"of",
"worker",
"processes",
"to",
"spawn",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/routing_routers.py#L599-L644 | train | Set basic parameters for router. |
idlesign/uwsgiconf | uwsgiconf/options/routing_routers.py | RouterFast.set_resubscription_params | def set_resubscription_params(self, addresses=None, bind_to=None):
"""You can specify a dgram address (udp or unix) on which all of the subscriptions
request will be forwarded to (obviously changing the node address to the router one).
The system could be useful to build 'federated' setup.
... | python | def set_resubscription_params(self, addresses=None, bind_to=None):
"""You can specify a dgram address (udp or unix) on which all of the subscriptions
request will be forwarded to (obviously changing the node address to the router one).
The system could be useful to build 'federated' setup.
... | [
"def",
"set_resubscription_params",
"(",
"self",
",",
"addresses",
"=",
"None",
",",
"bind_to",
"=",
"None",
")",
":",
"self",
".",
"_set_aliased",
"(",
"'resubscribe'",
",",
"addresses",
",",
"multi",
"=",
"True",
")",
"self",
".",
"_set_aliased",
"(",
"'... | You can specify a dgram address (udp or unix) on which all of the subscriptions
request will be forwarded to (obviously changing the node address to the router one).
The system could be useful to build 'federated' setup.
* http://uwsgi.readthedocs.io/en/latest/Changelog-2.0.1.html#resubscripti... | [
"You",
"can",
"specify",
"a",
"dgram",
"address",
"(",
"udp",
"or",
"unix",
")",
"on",
"which",
"all",
"of",
"the",
"subscriptions",
"request",
"will",
"be",
"forwarded",
"to",
"(",
"obviously",
"changing",
"the",
"node",
"address",
"to",
"the",
"router",
... | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/routing_routers.py#L646-L662 | train | Set the parameters for the subscription server to be forwarded to. |
idlesign/uwsgiconf | uwsgiconf/options/routing_routers.py | RouterFast.set_connections_params | def set_connections_params(self, harakiri=None, timeout_socket=None, retry_delay=None, retry_max=None, defer=None):
"""Sets connection-related parameters.
:param int harakiri: Set gateway harakiri timeout (seconds).
:param int timeout_socket: Node socket timeout (seconds). Default: 60.
... | python | def set_connections_params(self, harakiri=None, timeout_socket=None, retry_delay=None, retry_max=None, defer=None):
"""Sets connection-related parameters.
:param int harakiri: Set gateway harakiri timeout (seconds).
:param int timeout_socket: Node socket timeout (seconds). Default: 60.
... | [
"def",
"set_connections_params",
"(",
"self",
",",
"harakiri",
"=",
"None",
",",
"timeout_socket",
"=",
"None",
",",
"retry_delay",
"=",
"None",
",",
"retry_max",
"=",
"None",
",",
"defer",
"=",
"None",
")",
":",
"super",
"(",
"RouterFast",
",",
"self",
... | Sets connection-related parameters.
:param int harakiri: Set gateway harakiri timeout (seconds).
:param int timeout_socket: Node socket timeout (seconds). Default: 60.
:param int retry_delay: Retry connections to dead static nodes after the specified
amount of seconds. Default: 3... | [
"Sets",
"connection",
"-",
"related",
"parameters",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/routing_routers.py#L664-L684 | train | Sets connection - related parameters. |
idlesign/uwsgiconf | uwsgiconf/options/routing_routers.py | RouterFast.set_postbuffering_params | 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... | python | 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... | [
"def",
"set_postbuffering_params",
"(",
"self",
",",
"size",
"=",
"None",
",",
"store_dir",
"=",
"None",
")",
":",
"self",
".",
"_set_aliased",
"(",
"'post-buffering'",
",",
"size",
")",
"self",
".",
"_set_aliased",
"(",
"'post-buffering-dir'",
",",
"store_dir... | 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 body after which the body will
be stored to disk (as a temporary ... | [
"Sets",
"buffering",
"params",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/routing_routers.py#L686-L701 | train | Sets the post - buffering params for the current HTTP request. |
idlesign/uwsgiconf | uwsgiconf/options/routing_routers.py | RouterRaw.set_connections_params | 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). ... | python | 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). ... | [
"def",
"set_connections_params",
"(",
"self",
",",
"harakiri",
"=",
"None",
",",
"timeout_socket",
"=",
"None",
",",
"retry_delay",
"=",
"None",
",",
"retry_max",
"=",
"None",
",",
"use_xclient",
"=",
"None",
")",
":",
"super",
"(",
"RouterRaw",
",",
"self... | Sets connection-related parameters.
:param int harakiri: Set gateway harakiri timeout (seconds).
:param int timeout_socket: Node socket timeout (seconds). Default: 60.
:param int retry_delay: Retry connections to dead static nodes after the specified
amount of seconds. Default: 3... | [
"Sets",
"connection",
"-",
"related",
"parameters",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/routing_routers.py#L726-L747 | train | Sets connection - related parameters. |
idlesign/uwsgiconf | uwsgiconf/options/routing_routers.py | RouterForkPty.set_connections_params | def set_connections_params(self, harakiri=None, timeout_socket=None):
"""Sets connection-related parameters.
:param int harakiri: Set gateway harakiri timeout (seconds).
:param int timeout_socket: Node socket timeout (seconds). Default: 60.
"""
self._set_aliased('harakiri', ha... | python | def set_connections_params(self, harakiri=None, timeout_socket=None):
"""Sets connection-related parameters.
:param int harakiri: Set gateway harakiri timeout (seconds).
:param int timeout_socket: Node socket timeout (seconds). Default: 60.
"""
self._set_aliased('harakiri', ha... | [
"def",
"set_connections_params",
"(",
"self",
",",
"harakiri",
"=",
"None",
",",
"timeout_socket",
"=",
"None",
")",
":",
"self",
".",
"_set_aliased",
"(",
"'harakiri'",
",",
"harakiri",
")",
"self",
".",
"_set_aliased",
"(",
"'timeout'",
",",
"timeout_socket"... | Sets connection-related parameters.
:param int harakiri: Set gateway harakiri timeout (seconds).
:param int timeout_socket: Node socket timeout (seconds). Default: 60. | [
"Sets",
"connection",
"-",
"related",
"parameters",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/routing_routers.py#L814-L825 | train | Sets connection - related parameters. |
idlesign/uwsgiconf | uwsgiconf/options/routing_routers.py | RouterForkPty.set_window_params | 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 | python | 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 | [
"def",
"set_window_params",
"(",
"self",
",",
"cols",
"=",
"None",
",",
"rows",
"=",
"None",
")",
":",
"self",
".",
"_set_aliased",
"(",
"'cols'",
",",
"cols",
")",
"self",
".",
"_set_aliased",
"(",
"'rows'",
",",
"rows",
")",
"return",
"self"
] | Sets pty window params.
:param int cols:
:param int rows: | [
"Sets",
"pty",
"window",
"params",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/routing_routers.py#L827-L837 | train | Sets pty window params. |
idlesign/uwsgiconf | uwsgiconf/options/routing_routers.py | RouterTunTap.set_basic_params | def set_basic_params(self, use_credentials=None, stats_server=None):
"""
:param str|unicode use_credentials: Enable check of SCM_CREDENTIALS for tuntap client/server.
:param str|unicode stats_server: Router stats server address to run at.
"""
self._set_aliased('use-credentials'... | python | def set_basic_params(self, use_credentials=None, stats_server=None):
"""
:param str|unicode use_credentials: Enable check of SCM_CREDENTIALS for tuntap client/server.
:param str|unicode stats_server: Router stats server address to run at.
"""
self._set_aliased('use-credentials'... | [
"def",
"set_basic_params",
"(",
"self",
",",
"use_credentials",
"=",
"None",
",",
"stats_server",
"=",
"None",
")",
":",
"self",
".",
"_set_aliased",
"(",
"'use-credentials'",
",",
"use_credentials",
")",
"self",
".",
"_set_aliased",
"(",
"'router-stats'",
",",
... | :param str|unicode use_credentials: Enable check of SCM_CREDENTIALS for tuntap client/server.
:param str|unicode stats_server: Router stats server address to run at. | [
":",
"param",
"str|unicode",
"use_credentials",
":",
"Enable",
"check",
"of",
"SCM_CREDENTIALS",
"for",
"tuntap",
"client",
"/",
"server",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/routing_routers.py#L885-L895 | train | Set basic parameters for the current session. |
idlesign/uwsgiconf | uwsgiconf/options/routing_routers.py | RouterTunTap.register_route | def register_route(self, src, dst, gateway):
"""Adds a routing rule to the tuntap router.
:param str|unicode src: Source/mask.
:param str|unicode dst: Destination/mask.
:param str|unicode gateway: Gateway address.
"""
self._set_aliased('router-route', ' '.join((src, d... | python | def register_route(self, src, dst, gateway):
"""Adds a routing rule to the tuntap router.
:param str|unicode src: Source/mask.
:param str|unicode dst: Destination/mask.
:param str|unicode gateway: Gateway address.
"""
self._set_aliased('router-route', ' '.join((src, d... | [
"def",
"register_route",
"(",
"self",
",",
"src",
",",
"dst",
",",
"gateway",
")",
":",
"self",
".",
"_set_aliased",
"(",
"'router-route'",
",",
"' '",
".",
"join",
"(",
"(",
"src",
",",
"dst",
",",
"gateway",
")",
")",
",",
"multi",
"=",
"True",
"... | Adds a routing rule to the tuntap router.
:param str|unicode src: Source/mask.
:param str|unicode dst: Destination/mask.
:param str|unicode gateway: Gateway address. | [
"Adds",
"a",
"routing",
"rule",
"to",
"the",
"tuntap",
"router",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/routing_routers.py#L897-L909 | train | Adds a routing rule to the tuntap router. |
idlesign/uwsgiconf | uwsgiconf/options/routing_routers.py | RouterTunTap.device_add_rule | 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
... | python | 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
... | [
"def",
"device_add_rule",
"(",
"self",
",",
"direction",
",",
"action",
",",
"src",
",",
"dst",
",",
"target",
"=",
"None",
")",
":",
"value",
"=",
"[",
"direction",
",",
"src",
",",
"dst",
",",
"action",
"]",
"if",
"target",
":",
"value",
".",
"ap... | 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
* route
* gateway.
:param str|unicode src: Source/mask.
... | [
"Adds",
"a",
"tuntap",
"device",
"rule",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/routing_routers.py#L929-L962 | train | Adds a tuntap device rule. |
idlesign/uwsgiconf | uwsgiconf/options/routing_routers.py | RouterTunTap.add_firewall_rule | def add_firewall_rule(self, direction, action, src=None, dst=None):
"""Adds a firewall rule to the router.
The TunTap router includes a very simple firewall for governing vassal's traffic.
The first matching rule stops the chain, if no rule applies, the policy is "allow".
:param str|un... | python | def add_firewall_rule(self, direction, action, src=None, dst=None):
"""Adds a firewall rule to the router.
The TunTap router includes a very simple firewall for governing vassal's traffic.
The first matching rule stops the chain, if no rule applies, the policy is "allow".
:param str|un... | [
"def",
"add_firewall_rule",
"(",
"self",
",",
"direction",
",",
"action",
",",
"src",
"=",
"None",
",",
"dst",
"=",
"None",
")",
":",
"value",
"=",
"[",
"action",
"]",
"if",
"src",
":",
"value",
".",
"extend",
"(",
"(",
"src",
",",
"dst",
")",
")... | Adds a firewall rule to the router.
The TunTap router includes a very simple firewall for governing vassal's traffic.
The first matching rule stops the chain, if no rule applies, the policy is "allow".
:param str|unicode direction: Direction:
* in
* out
:param... | [
"Adds",
"a",
"firewall",
"rule",
"to",
"the",
"router",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/routing_routers.py#L964-L992 | train | Adds a firewall rule to the router. |
idlesign/uwsgiconf | uwsgiconf/config.py | configure_uwsgi | 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... | python | 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... | [
"def",
"configure_uwsgi",
"(",
"configurator_func",
")",
":",
"from",
".",
"settings",
"import",
"ENV_CONF_READY",
",",
"ENV_CONF_ALIAS",
",",
"CONFIGS_MODULE_ATTR",
"if",
"os",
".",
"environ",
".",
"get",
"(",
"ENV_CONF_READY",
")",
":",
"# This call is from uWSGI ... | 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_configurations)
:param callable configurator_fu... | [
"Allows",
"configuring",
"uWSGI",
"using",
"Configuration",
"objects",
"returned",
"by",
"the",
"given",
"configuration",
"function",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/config.py#L663-L759 | train | Allows configuring uWSGI using a function which returns a list of Configuration objects. |
idlesign/uwsgiconf | uwsgiconf/config.py | Section.replace_placeholders | def replace_placeholders(self, value):
"""Replaces placeholders that can be used e.g. in filepaths.
Supported placeholders:
* {project_runtime_dir}
* {project_name}
* {runtime_dir}
:param str|unicode|list[str|unicode]|None value:
:rtype: None|str|uni... | python | def replace_placeholders(self, value):
"""Replaces placeholders that can be used e.g. in filepaths.
Supported placeholders:
* {project_runtime_dir}
* {project_name}
* {runtime_dir}
:param str|unicode|list[str|unicode]|None value:
:rtype: None|str|uni... | [
"def",
"replace_placeholders",
"(",
"self",
",",
"value",
")",
":",
"if",
"not",
"value",
":",
"return",
"value",
"is_list",
"=",
"isinstance",
"(",
"value",
",",
"list",
")",
"values",
"=",
"[",
"]",
"for",
"value",
"in",
"listify",
"(",
"value",
")",... | Replaces placeholders that can be used e.g. in filepaths.
Supported placeholders:
* {project_runtime_dir}
* {project_name}
* {runtime_dir}
:param str|unicode|list[str|unicode]|None value:
:rtype: None|str|unicode|list[str|unicode] | [
"Replaces",
"placeholders",
"that",
"can",
"be",
"used",
"e",
".",
"g",
".",
"in",
"filepaths",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/config.py#L180-L210 | train | Replaces placeholders that can be used e. g. in filepaths.
|
idlesign/uwsgiconf | uwsgiconf/config.py | Section.get_runtime_dir | def get_runtime_dir(self, default=True):
"""Directory to store runtime files.
See ``.replace_placeholders()``
.. note:: This can be used to store PID files, sockets, master FIFO, etc.
:param bool default: Whether to return [system] default if not set.
:rtype: str|unicode
... | python | def get_runtime_dir(self, default=True):
"""Directory to store runtime files.
See ``.replace_placeholders()``
.. note:: This can be used to store PID files, sockets, master FIFO, etc.
:param bool default: Whether to return [system] default if not set.
:rtype: str|unicode
... | [
"def",
"get_runtime_dir",
"(",
"self",
",",
"default",
"=",
"True",
")",
":",
"dir_",
"=",
"self",
".",
"_runtime_dir",
"if",
"not",
"dir_",
"and",
"default",
":",
"uid",
"=",
"self",
".",
"main_process",
".",
"get_owner",
"(",
")",
"[",
"0",
"]",
"d... | Directory to store runtime files.
See ``.replace_placeholders()``
.. note:: This can be used to store PID files, sockets, master FIFO, etc.
:param bool default: Whether to return [system] default if not set.
:rtype: str|unicode | [
"Directory",
"to",
"store",
"runtime",
"files",
".",
"See",
".",
"replace_placeholders",
"()"
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/config.py#L224-L240 | train | Returns the directory where the runtime files are stored. |
idlesign/uwsgiconf | uwsgiconf/config.py | Section.print_stamp | def print_stamp(self):
"""Prints out a stamp containing useful information,
such as what and when has generated this configuration.
"""
from . import VERSION
print_out = partial(self.print_out, format_options='red')
print_out('This configuration was automatically genera... | python | def print_stamp(self):
"""Prints out a stamp containing useful information,
such as what and when has generated this configuration.
"""
from . import VERSION
print_out = partial(self.print_out, format_options='red')
print_out('This configuration was automatically genera... | [
"def",
"print_stamp",
"(",
"self",
")",
":",
"from",
".",
"import",
"VERSION",
"print_out",
"=",
"partial",
"(",
"self",
".",
"print_out",
",",
"format_options",
"=",
"'red'",
")",
"print_out",
"(",
"'This configuration was automatically generated using'",
")",
"p... | Prints out a stamp containing useful information,
such as what and when has generated this configuration. | [
"Prints",
"out",
"a",
"stamp",
"containing",
"useful",
"information",
"such",
"as",
"what",
"and",
"when",
"has",
"generated",
"this",
"configuration",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/config.py#L272-L283 | train | Prints out a stamp containing useful information such as what and when has generated this configuration. |
idlesign/uwsgiconf | uwsgiconf/config.py | Section.print_out | def print_out(self, value, indent=None, format_options=None, asap=False):
"""Prints out the given value.
:param value:
:param str|unicode indent:
:param dict|str|unicode format_options: text color
:param bool asap: Print as soon as possible.
"""
if indent is ... | python | def print_out(self, value, indent=None, format_options=None, asap=False):
"""Prints out the given value.
:param value:
:param str|unicode indent:
:param dict|str|unicode format_options: text color
:param bool asap: Print as soon as possible.
"""
if indent is ... | [
"def",
"print_out",
"(",
"self",
",",
"value",
",",
"indent",
"=",
"None",
",",
"format_options",
"=",
"None",
",",
"asap",
"=",
"False",
")",
":",
"if",
"indent",
"is",
"None",
":",
"indent",
"=",
"'> '",
"text",
"=",
"indent",
"+",
"str",
"(",
... | Prints out the given value.
:param value:
:param str|unicode indent:
:param dict|str|unicode format_options: text color
:param bool asap: Print as soon as possible. | [
"Prints",
"out",
"the",
"given",
"value",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/config.py#L285-L315 | train | Prints out the given value. |
idlesign/uwsgiconf | uwsgiconf/config.py | Section.print_variables | def print_variables(self):
"""Prints out magic variables available in config files
alongside with their values and descriptions.
May be useful for debugging.
http://uwsgi-docs.readthedocs.io/en/latest/Configuration.html#magic-variables
"""
print_out = partial(self.print... | python | def print_variables(self):
"""Prints out magic variables available in config files
alongside with their values and descriptions.
May be useful for debugging.
http://uwsgi-docs.readthedocs.io/en/latest/Configuration.html#magic-variables
"""
print_out = partial(self.print... | [
"def",
"print_variables",
"(",
"self",
")",
":",
"print_out",
"=",
"partial",
"(",
"self",
".",
"print_out",
",",
"format_options",
"=",
"'green'",
")",
"print_out",
"(",
"'===== variables ====='",
")",
"for",
"var",
",",
"hint",
"in",
"self",
".",
"vars",
... | Prints out magic variables available in config files
alongside with their values and descriptions.
May be useful for debugging.
http://uwsgi-docs.readthedocs.io/en/latest/Configuration.html#magic-variables | [
"Prints",
"out",
"magic",
"variables",
"available",
"in",
"config",
"files",
"alongside",
"with",
"their",
"values",
"and",
"descriptions",
".",
"May",
"be",
"useful",
"for",
"debugging",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/config.py#L317-L334 | train | Prints out magic variables available in config files
alongside with their values and descriptions. |
idlesign/uwsgiconf | uwsgiconf/config.py | Section.set_plugins_params | def set_plugins_params(self, plugins=None, search_dirs=None, autoload=None, required=False):
"""Sets plugin-related parameters.
:param list|str|unicode|OptionsGroup|list[OptionsGroup] plugins: uWSGI plugins to load
:param list|str|unicode search_dirs: Directories to search for uWSGI plugins.
... | python | def set_plugins_params(self, plugins=None, search_dirs=None, autoload=None, required=False):
"""Sets plugin-related parameters.
:param list|str|unicode|OptionsGroup|list[OptionsGroup] plugins: uWSGI plugins to load
:param list|str|unicode search_dirs: Directories to search for uWSGI plugins.
... | [
"def",
"set_plugins_params",
"(",
"self",
",",
"plugins",
"=",
"None",
",",
"search_dirs",
"=",
"None",
",",
"autoload",
"=",
"None",
",",
"required",
"=",
"False",
")",
":",
"plugins",
"=",
"plugins",
"or",
"[",
"]",
"command",
"=",
"'need-plugin'",
"if... | Sets plugin-related parameters.
:param list|str|unicode|OptionsGroup|list[OptionsGroup] plugins: uWSGI plugins to load
:param list|str|unicode search_dirs: Directories to search for uWSGI plugins.
:param bool autoload: Try to automatically load plugins when unknown options are found.
... | [
"Sets",
"plugin",
"-",
"related",
"parameters",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/config.py#L336-L361 | train | Sets plugin - related parameters. |
idlesign/uwsgiconf | uwsgiconf/config.py | Section.set_fallback | def set_fallback(self, target):
"""Sets a fallback configuration for section.
Re-exec uWSGI with the specified config when exit code is 1.
:param str|unicode|Section target: File path or Section to include.
"""
if isinstance(target, Section):
target = ':' + target.n... | python | def set_fallback(self, target):
"""Sets a fallback configuration for section.
Re-exec uWSGI with the specified config when exit code is 1.
:param str|unicode|Section target: File path or Section to include.
"""
if isinstance(target, Section):
target = ':' + target.n... | [
"def",
"set_fallback",
"(",
"self",
",",
"target",
")",
":",
"if",
"isinstance",
"(",
"target",
",",
"Section",
")",
":",
"target",
"=",
"':'",
"+",
"target",
".",
"name",
"self",
".",
"_set",
"(",
"'fallback-config'",
",",
"target",
")",
"return",
"se... | Sets a fallback configuration for section.
Re-exec uWSGI with the specified config when exit code is 1.
:param str|unicode|Section target: File path or Section to include. | [
"Sets",
"a",
"fallback",
"configuration",
"for",
"section",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/config.py#L363-L375 | train | Sets a fallback configuration for section. |
idlesign/uwsgiconf | uwsgiconf/config.py | Section.set_placeholder | def set_placeholder(self, key, value):
"""Placeholders are custom magic variables defined during configuration
time.
.. note:: These are accessible, like any uWSGI option, in your application code via
``.runtime.environ.uwsgi_env.config``.
:param str|unicode key:
:... | python | def set_placeholder(self, key, value):
"""Placeholders are custom magic variables defined during configuration
time.
.. note:: These are accessible, like any uWSGI option, in your application code via
``.runtime.environ.uwsgi_env.config``.
:param str|unicode key:
:... | [
"def",
"set_placeholder",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"self",
".",
"_set",
"(",
"'set-placeholder'",
",",
"'%s=%s'",
"%",
"(",
"key",
",",
"value",
")",
",",
"multi",
"=",
"True",
")",
"return",
"self"
] | Placeholders are custom magic variables defined during configuration
time.
.. note:: These are accessible, like any uWSGI option, in your application code via
``.runtime.environ.uwsgi_env.config``.
:param str|unicode key:
:param str|unicode value: | [
"Placeholders",
"are",
"custom",
"magic",
"variables",
"defined",
"during",
"configuration",
"time",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/config.py#L377-L391 | train | Sets a placeholder for the current locale. |
idlesign/uwsgiconf | uwsgiconf/config.py | Section.env | def env(self, key, value=None, unset=False, asap=False):
"""Processes (sets/unsets) environment variable.
If is not given in `set` mode value will be taken from current env.
:param str|unicode key:
:param value:
:param bool unset: Whether to unset this variable.
:par... | python | def env(self, key, value=None, unset=False, asap=False):
"""Processes (sets/unsets) environment variable.
If is not given in `set` mode value will be taken from current env.
:param str|unicode key:
:param value:
:param bool unset: Whether to unset this variable.
:par... | [
"def",
"env",
"(",
"self",
",",
"key",
",",
"value",
"=",
"None",
",",
"unset",
"=",
"False",
",",
"asap",
"=",
"False",
")",
":",
"if",
"unset",
":",
"self",
".",
"_set",
"(",
"'unenv'",
",",
"key",
",",
"multi",
"=",
"True",
")",
"else",
":",... | Processes (sets/unsets) environment variable.
If is not given in `set` mode value will be taken from current env.
:param str|unicode key:
:param value:
:param bool unset: Whether to unset this variable.
:param bool asap: If True env variable will be set as soon as possible. | [
"Processes",
"(",
"sets",
"/",
"unsets",
")",
"environment",
"variable",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/config.py#L393-L415 | train | Processes environment variable. |
idlesign/uwsgiconf | uwsgiconf/config.py | Section.include | def include(self, target):
"""Includes target contents into config.
:param str|unicode|Section|list target: File path or Section to include.
"""
for target_ in listify(target):
if isinstance(target_, Section):
target_ = ':' + target_.name
self._s... | python | def include(self, target):
"""Includes target contents into config.
:param str|unicode|Section|list target: File path or Section to include.
"""
for target_ in listify(target):
if isinstance(target_, Section):
target_ = ':' + target_.name
self._s... | [
"def",
"include",
"(",
"self",
",",
"target",
")",
":",
"for",
"target_",
"in",
"listify",
"(",
"target",
")",
":",
"if",
"isinstance",
"(",
"target_",
",",
"Section",
")",
":",
"target_",
"=",
"':'",
"+",
"target_",
".",
"name",
"self",
".",
"_set",... | Includes target contents into config.
:param str|unicode|Section|list target: File path or Section to include. | [
"Includes",
"target",
"contents",
"into",
"config",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/config.py#L417-L428 | train | Includes target contents into config. |
idlesign/uwsgiconf | uwsgiconf/config.py | Section.derive_from | def derive_from(cls, section, name=None):
"""Creates a new section based on the given.
:param Section section: Section to derive from,
:param str|unicode name: New section name.
:rtype: Section
"""
new_section = deepcopy(section)
if name:
new_secti... | python | def derive_from(cls, section, name=None):
"""Creates a new section based on the given.
:param Section section: Section to derive from,
:param str|unicode name: New section name.
:rtype: Section
"""
new_section = deepcopy(section)
if name:
new_secti... | [
"def",
"derive_from",
"(",
"cls",
",",
"section",
",",
"name",
"=",
"None",
")",
":",
"new_section",
"=",
"deepcopy",
"(",
"section",
")",
"if",
"name",
":",
"new_section",
".",
"name",
"=",
"name",
"return",
"new_section"
] | Creates a new section based on the given.
:param Section section: Section to derive from,
:param str|unicode name: New section name.
:rtype: Section | [
"Creates",
"a",
"new",
"section",
"based",
"on",
"the",
"given",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/config.py#L431-L445 | train | Create a new section based on the given section. |
idlesign/uwsgiconf | uwsgiconf/config.py | Configuration._validate_sections | def _validate_sections(cls, sections):
"""Validates sections types and uniqueness."""
names = []
for section in sections:
if not hasattr(section, 'name'):
raise ConfigurationError('`sections` attribute requires a list of Section')
name = section.name
... | python | def _validate_sections(cls, sections):
"""Validates sections types and uniqueness."""
names = []
for section in sections:
if not hasattr(section, 'name'):
raise ConfigurationError('`sections` attribute requires a list of Section')
name = section.name
... | [
"def",
"_validate_sections",
"(",
"cls",
",",
"sections",
")",
":",
"names",
"=",
"[",
"]",
"for",
"section",
"in",
"sections",
":",
"if",
"not",
"hasattr",
"(",
"section",
",",
"'name'",
")",
":",
"raise",
"ConfigurationError",
"(",
"'`sections` attribute r... | Validates sections types and uniqueness. | [
"Validates",
"sections",
"types",
"and",
"uniqueness",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/config.py#L595-L607 | train | Validates sections types and uniqueness. |
idlesign/uwsgiconf | uwsgiconf/config.py | Configuration.format | def format(self, do_print=False, stamp=True):
"""Applies formatting to configuration.
*Currently formats to .ini*
:param bool do_print: Whether to print out formatted config.
:param bool stamp: Whether to add stamp data to the first configuration section.
:rtype: str|unicode
... | python | def format(self, do_print=False, stamp=True):
"""Applies formatting to configuration.
*Currently formats to .ini*
:param bool do_print: Whether to print out formatted config.
:param bool stamp: Whether to add stamp data to the first configuration section.
:rtype: str|unicode
... | [
"def",
"format",
"(",
"self",
",",
"do_print",
"=",
"False",
",",
"stamp",
"=",
"True",
")",
":",
"if",
"stamp",
"and",
"self",
".",
"sections",
":",
"self",
".",
"sections",
"[",
"0",
"]",
".",
"print_stamp",
"(",
")",
"formatted",
"=",
"IniFormatte... | Applies formatting to configuration.
*Currently formats to .ini*
:param bool do_print: Whether to print out formatted config.
:param bool stamp: Whether to add stamp data to the first configuration section.
:rtype: str|unicode | [
"Applies",
"formatting",
"to",
"configuration",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/config.py#L609-L626 | train | Applies formatting to configuration. |
idlesign/uwsgiconf | uwsgiconf/config.py | Configuration.tofile | def tofile(self, filepath=None):
"""Saves configuration into a file and returns its path.
Convenience method.
:param str|unicode filepath: Filepath to save configuration into.
If not provided a temporary file will be automatically generated.
:rtype: str|unicode
""... | python | def tofile(self, filepath=None):
"""Saves configuration into a file and returns its path.
Convenience method.
:param str|unicode filepath: Filepath to save configuration into.
If not provided a temporary file will be automatically generated.
:rtype: str|unicode
""... | [
"def",
"tofile",
"(",
"self",
",",
"filepath",
"=",
"None",
")",
":",
"if",
"filepath",
"is",
"None",
":",
"with",
"NamedTemporaryFile",
"(",
"prefix",
"=",
"'%s_'",
"%",
"self",
".",
"alias",
",",
"suffix",
"=",
"'.ini'",
",",
"delete",
"=",
"False",
... | Saves configuration into a file and returns its path.
Convenience method.
:param str|unicode filepath: Filepath to save configuration into.
If not provided a temporary file will be automatically generated.
:rtype: str|unicode | [
"Saves",
"configuration",
"into",
"a",
"file",
"and",
"returns",
"its",
"path",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/config.py#L635-L660 | train | Saves the current configuration into a file and returns its path. |
idlesign/uwsgiconf | uwsgiconf/options/python.py | Python._set_name | def _set_name(self, version=AUTO):
"""Returns plugin name."""
name = 'python'
if version:
if version is AUTO:
version = sys.version_info[0]
if version == 2:
version = ''
name = '%s%s' % (name, version)
self.... | python | def _set_name(self, version=AUTO):
"""Returns plugin name."""
name = 'python'
if version:
if version is AUTO:
version = sys.version_info[0]
if version == 2:
version = ''
name = '%s%s' % (name, version)
self.... | [
"def",
"_set_name",
"(",
"self",
",",
"version",
"=",
"AUTO",
")",
":",
"name",
"=",
"'python'",
"if",
"version",
":",
"if",
"version",
"is",
"AUTO",
":",
"version",
"=",
"sys",
".",
"version_info",
"[",
"0",
"]",
"if",
"version",
"==",
"2",
":",
"... | Returns plugin name. | [
"Returns",
"plugin",
"name",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/python.py#L74-L88 | train | Sets the name of the object. |
idlesign/uwsgiconf | uwsgiconf/options/python.py | Python.set_app_args | def set_app_args(self, *args):
"""Sets ``sys.argv`` for python apps.
Examples:
* pyargv="one two three" will set ``sys.argv`` to ``('one', 'two', 'three')``.
:param args:
"""
if args:
self._set('pyargv', ' '.join(args))
return self._section | python | def set_app_args(self, *args):
"""Sets ``sys.argv`` for python apps.
Examples:
* pyargv="one two three" will set ``sys.argv`` to ``('one', 'two', 'three')``.
:param args:
"""
if args:
self._set('pyargv', ' '.join(args))
return self._section | [
"def",
"set_app_args",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"args",
":",
"self",
".",
"_set",
"(",
"'pyargv'",
",",
"' '",
".",
"join",
"(",
"args",
")",
")",
"return",
"self",
".",
"_section"
] | Sets ``sys.argv`` for python apps.
Examples:
* pyargv="one two three" will set ``sys.argv`` to ``('one', 'two', 'three')``.
:param args: | [
"Sets",
"sys",
".",
"argv",
"for",
"python",
"apps",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/python.py#L98-L109 | train | Sets sys. argv for python apps. |
idlesign/uwsgiconf | uwsgiconf/options/python.py | Python.set_wsgi_params | def set_wsgi_params(self, module=None, callable_name=None, env_strategy=None):
"""Set wsgi related parameters.
:param str|unicode module:
* load .wsgi file as the Python application
* load a WSGI module as the application.
.. note:: The module (sans ``.py``) must be... | python | def set_wsgi_params(self, module=None, callable_name=None, env_strategy=None):
"""Set wsgi related parameters.
:param str|unicode module:
* load .wsgi file as the Python application
* load a WSGI module as the application.
.. note:: The module (sans ``.py``) must be... | [
"def",
"set_wsgi_params",
"(",
"self",
",",
"module",
"=",
"None",
",",
"callable_name",
"=",
"None",
",",
"env_strategy",
"=",
"None",
")",
":",
"module",
"=",
"module",
"or",
"''",
"if",
"'/'",
"in",
"module",
":",
"self",
".",
"_set",
"(",
"'wsgi-fi... | Set wsgi related parameters.
:param str|unicode module:
* load .wsgi file as the Python application
* load a WSGI module as the application.
.. note:: The module (sans ``.py``) must be importable, ie. be in ``PYTHONPATH``.
Examples:
* mypackage.... | [
"Set",
"wsgi",
"related",
"parameters",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/python.py#L111-L147 | train | Set the wsgi related parameters. |
idlesign/uwsgiconf | uwsgiconf/options/python.py | Python.set_autoreload_params | def set_autoreload_params(self, scan_interval=None, ignore_modules=None):
"""Sets autoreload related parameters.
:param int scan_interval: Seconds. Monitor Python modules' modification times to trigger reload.
.. warning:: Use only in development.
:param list|st|unicode ignore_mod... | python | def set_autoreload_params(self, scan_interval=None, ignore_modules=None):
"""Sets autoreload related parameters.
:param int scan_interval: Seconds. Monitor Python modules' modification times to trigger reload.
.. warning:: Use only in development.
:param list|st|unicode ignore_mod... | [
"def",
"set_autoreload_params",
"(",
"self",
",",
"scan_interval",
"=",
"None",
",",
"ignore_modules",
"=",
"None",
")",
":",
"self",
".",
"_set",
"(",
"'py-auto-reload'",
",",
"scan_interval",
")",
"self",
".",
"_set",
"(",
"'py-auto-reload-ignore'",
",",
"ig... | Sets autoreload related parameters.
:param int scan_interval: Seconds. Monitor Python modules' modification times to trigger reload.
.. warning:: Use only in development.
:param list|st|unicode ignore_modules: Ignore the specified module during auto-reload scan. | [
"Sets",
"autoreload",
"related",
"parameters",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/python.py#L158-L171 | train | Sets autoreload related parameters. |
idlesign/uwsgiconf | uwsgiconf/options/python.py | Python.register_module_alias | def register_module_alias(self, alias, module_path, after_init=False):
"""Adds an alias for a module.
http://uwsgi-docs.readthedocs.io/en/latest/PythonModuleAlias.html
:param str|unicode alias:
:param str|unicode module_path:
:param bool after_init: add a python module alias af... | python | def register_module_alias(self, alias, module_path, after_init=False):
"""Adds an alias for a module.
http://uwsgi-docs.readthedocs.io/en/latest/PythonModuleAlias.html
:param str|unicode alias:
:param str|unicode module_path:
:param bool after_init: add a python module alias af... | [
"def",
"register_module_alias",
"(",
"self",
",",
"alias",
",",
"module_path",
",",
"after_init",
"=",
"False",
")",
":",
"command",
"=",
"'post-pymodule-alias'",
"if",
"after_init",
"else",
"'pymodule-alias'",
"self",
".",
"_set",
"(",
"command",
",",
"'%s=%s'"... | Adds an alias for a module.
http://uwsgi-docs.readthedocs.io/en/latest/PythonModuleAlias.html
:param str|unicode alias:
:param str|unicode module_path:
:param bool after_init: add a python module alias after uwsgi module initialization | [
"Adds",
"an",
"alias",
"for",
"a",
"module",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/python.py#L173-L185 | train | Adds an alias for a module. |
idlesign/uwsgiconf | uwsgiconf/options/python.py | Python.import_module | def import_module(self, modules, shared=False, into_spooler=False):
"""Imports a python module.
:param list|str|unicode modules:
:param bool shared: Import a python module in all of the processes.
This is done after fork but before request processing.
:param bool into_spoo... | python | def import_module(self, modules, shared=False, into_spooler=False):
"""Imports a python module.
:param list|str|unicode modules:
:param bool shared: Import a python module in all of the processes.
This is done after fork but before request processing.
:param bool into_spoo... | [
"def",
"import_module",
"(",
"self",
",",
"modules",
",",
"shared",
"=",
"False",
",",
"into_spooler",
"=",
"False",
")",
":",
"if",
"all",
"(",
"(",
"shared",
",",
"into_spooler",
")",
")",
":",
"raise",
"ConfigurationError",
"(",
"'Unable to set both `shar... | Imports a python module.
:param list|str|unicode modules:
:param bool shared: Import a python module in all of the processes.
This is done after fork but before request processing.
:param bool into_spooler: Import a python module in the spooler.
http://uwsgi-docs.readt... | [
"Imports",
"a",
"python",
"module",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/python.py#L187-L209 | train | Imports a python module. |
idlesign/uwsgiconf | uwsgiconf/options/subscriptions.py | Subscriptions.set_server_params | def set_server_params(
self, client_notify_address=None, mountpoints_depth=None, require_vassal=None,
tolerance=None, tolerance_inactive=None, key_dot_split=None):
"""Sets subscription server related params.
:param str|unicode client_notify_address: Set the notification socket f... | python | def set_server_params(
self, client_notify_address=None, mountpoints_depth=None, require_vassal=None,
tolerance=None, tolerance_inactive=None, key_dot_split=None):
"""Sets subscription server related params.
:param str|unicode client_notify_address: Set the notification socket f... | [
"def",
"set_server_params",
"(",
"self",
",",
"client_notify_address",
"=",
"None",
",",
"mountpoints_depth",
"=",
"None",
",",
"require_vassal",
"=",
"None",
",",
"tolerance",
"=",
"None",
",",
"tolerance_inactive",
"=",
"None",
",",
"key_dot_split",
"=",
"None... | Sets subscription server related params.
:param str|unicode client_notify_address: Set the notification socket for subscriptions.
When you subscribe to a server, you can ask it to "acknowledge" the acceptance of your request.
pointing address (Unix socket or UDP), on which your instance... | [
"Sets",
"subscription",
"server",
"related",
"params",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/subscriptions.py#L32-L64 | train | Sets the server related params for the subscription server. |
idlesign/uwsgiconf | uwsgiconf/options/subscriptions.py | Subscriptions.set_server_verification_params | def set_server_verification_params(
self, digest_algo=None, dir_cert=None, tolerance=None, no_check_uid=None,
dir_credentials=None, pass_unix_credentials=None):
"""Sets peer verification params for subscription server.
These are for secured subscriptions.
:param str|uni... | python | def set_server_verification_params(
self, digest_algo=None, dir_cert=None, tolerance=None, no_check_uid=None,
dir_credentials=None, pass_unix_credentials=None):
"""Sets peer verification params for subscription server.
These are for secured subscriptions.
:param str|uni... | [
"def",
"set_server_verification_params",
"(",
"self",
",",
"digest_algo",
"=",
"None",
",",
"dir_cert",
"=",
"None",
",",
"tolerance",
"=",
"None",
",",
"no_check_uid",
"=",
"None",
",",
"dir_credentials",
"=",
"None",
",",
"pass_unix_credentials",
"=",
"None",
... | Sets peer verification params for subscription server.
These are for secured subscriptions.
:param str|unicode digest_algo: Digest algorithm. Example: SHA1
.. note:: Also requires ``dir_cert`` to be set.
:param str|unicode dir_cert: Certificate directory.
.. note:: A... | [
"Sets",
"peer",
"verification",
"params",
"for",
"subscription",
"server",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/subscriptions.py#L66-L101 | train | Sets peer verification params for subscription server. |
idlesign/uwsgiconf | uwsgiconf/options/subscriptions.py | Subscriptions.set_client_params | def set_client_params(
self, start_unsubscribed=None, clear_on_exit=None, unsubscribe_on_reload=None,
announce_interval=None):
"""Sets subscribers related params.
:param bool start_unsubscribed: Configure subscriptions but do not send them.
.. note:: Useful with mast... | python | def set_client_params(
self, start_unsubscribed=None, clear_on_exit=None, unsubscribe_on_reload=None,
announce_interval=None):
"""Sets subscribers related params.
:param bool start_unsubscribed: Configure subscriptions but do not send them.
.. note:: Useful with mast... | [
"def",
"set_client_params",
"(",
"self",
",",
"start_unsubscribed",
"=",
"None",
",",
"clear_on_exit",
"=",
"None",
",",
"unsubscribe_on_reload",
"=",
"None",
",",
"announce_interval",
"=",
"None",
")",
":",
"self",
".",
"_set",
"(",
"'start-unsubscribed'",
",",... | Sets subscribers related params.
:param bool start_unsubscribed: Configure subscriptions but do not send them.
.. note:: Useful with master FIFO.
:param bool clear_on_exit: Force clear instead of unsubscribe during shutdown.
:param bool unsubscribe_on_reload: Force unsubscribe req... | [
"Sets",
"subscribers",
"related",
"params",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/subscriptions.py#L103-L123 | train | Sets the client related params. |
idlesign/uwsgiconf | uwsgiconf/options/subscriptions.py | Subscriptions.subscribe | def subscribe(
self, server=None, key=None, address=None, address_vassal=None,
balancing_weight=None, balancing_algo=None, modifier=None, signing=None, check_file=None, protocol=None,
sni_cert=None, sni_key=None, sni_client_ca=None):
"""Registers a subscription intent.
... | python | def subscribe(
self, server=None, key=None, address=None, address_vassal=None,
balancing_weight=None, balancing_algo=None, modifier=None, signing=None, check_file=None, protocol=None,
sni_cert=None, sni_key=None, sni_client_ca=None):
"""Registers a subscription intent.
... | [
"def",
"subscribe",
"(",
"self",
",",
"server",
"=",
"None",
",",
"key",
"=",
"None",
",",
"address",
"=",
"None",
",",
"address_vassal",
"=",
"None",
",",
"balancing_weight",
"=",
"None",
",",
"balancing_algo",
"=",
"None",
",",
"modifier",
"=",
"None",... | Registers a subscription intent.
:param str|unicode server: Subscription server address (UDP or UNIX socket).
Examples:
* 127.0.0.1:7171
:param str|unicode key: Key to subscribe. Generally the domain name (+ optional '/< mountpoint>').
Examples:
... | [
"Registers",
"a",
"subscription",
"intent",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/subscriptions.py#L125-L216 | train | Registers a new subscription intent. |
idlesign/uwsgiconf | uwsgiconf/contrib/django/uwsgify/toolbox.py | find_project_dir | def find_project_dir():
"""Runs up the stack to find the location of manage.py
which will be considered a project base path.
:rtype: str|unicode
"""
frame = inspect.currentframe()
while True:
frame = frame.f_back
fname = frame.f_globals['__file__']
if os.path.basename(... | python | def find_project_dir():
"""Runs up the stack to find the location of manage.py
which will be considered a project base path.
:rtype: str|unicode
"""
frame = inspect.currentframe()
while True:
frame = frame.f_back
fname = frame.f_globals['__file__']
if os.path.basename(... | [
"def",
"find_project_dir",
"(",
")",
":",
"frame",
"=",
"inspect",
".",
"currentframe",
"(",
")",
"while",
"True",
":",
"frame",
"=",
"frame",
".",
"f_back",
"fname",
"=",
"frame",
".",
"f_globals",
"[",
"'__file__'",
"]",
"if",
"os",
".",
"path",
".",... | Runs up the stack to find the location of manage.py
which will be considered a project base path.
:rtype: str|unicode | [
"Runs",
"up",
"the",
"stack",
"to",
"find",
"the",
"location",
"of",
"manage",
".",
"py",
"which",
"will",
"be",
"considered",
"a",
"project",
"base",
"path",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/contrib/django/uwsgify/toolbox.py#L9-L24 | train | Runs up the stack to find the location of manage. py
which will be considered a project base path. |
idlesign/uwsgiconf | uwsgiconf/contrib/django/uwsgify/toolbox.py | run_uwsgi | def run_uwsgi(config_section, compile_only=False):
"""Runs uWSGI using the given section configuration.
:param Section config_section:
:param bool compile_only: Do not run, only compile and output configuration file for run.
"""
config = config_section.as_configuration()
if compile_only:
... | python | def run_uwsgi(config_section, compile_only=False):
"""Runs uWSGI using the given section configuration.
:param Section config_section:
:param bool compile_only: Do not run, only compile and output configuration file for run.
"""
config = config_section.as_configuration()
if compile_only:
... | [
"def",
"run_uwsgi",
"(",
"config_section",
",",
"compile_only",
"=",
"False",
")",
":",
"config",
"=",
"config_section",
".",
"as_configuration",
"(",
")",
"if",
"compile_only",
":",
"config",
".",
"print_ini",
"(",
")",
"return",
"config_path",
"=",
"config",... | Runs uWSGI using the given section configuration.
:param Section config_section:
:param bool compile_only: Do not run, only compile and output configuration file for run. | [
"Runs",
"uWSGI",
"using",
"the",
"given",
"section",
"configuration",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/contrib/django/uwsgify/toolbox.py#L234-L248 | train | Runs uWSGI using the given section configuration. |
idlesign/uwsgiconf | uwsgiconf/contrib/django/uwsgify/toolbox.py | SectionMutator.spawn | def spawn(cls, options=None, dir_base=None):
"""Alternative constructor. Creates a mutator and returns section object.
:param dict options:
:param str|unicode dir_base:
:rtype: SectionMutator
"""
from uwsgiconf.utils import ConfModule
options = options or {
... | python | def spawn(cls, options=None, dir_base=None):
"""Alternative constructor. Creates a mutator and returns section object.
:param dict options:
:param str|unicode dir_base:
:rtype: SectionMutator
"""
from uwsgiconf.utils import ConfModule
options = options or {
... | [
"def",
"spawn",
"(",
"cls",
",",
"options",
"=",
"None",
",",
"dir_base",
"=",
"None",
")",
":",
"from",
"uwsgiconf",
".",
"utils",
"import",
"ConfModule",
"options",
"=",
"options",
"or",
"{",
"'compile'",
":",
"True",
",",
"}",
"dir_base",
"=",
"os",... | Alternative constructor. Creates a mutator and returns section object.
:param dict options:
:param str|unicode dir_base:
:rtype: SectionMutator | [
"Alternative",
"constructor",
".",
"Creates",
"a",
"mutator",
"and",
"returns",
"section",
"object",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/contrib/django/uwsgify/toolbox.py#L77-L114 | train | Alternative constructor. Creates a mutator and returns section object. |
idlesign/uwsgiconf | uwsgiconf/contrib/django/uwsgify/toolbox.py | SectionMutator._get_section_existing | def _get_section_existing(self, name_module, name_project):
"""Loads config section from existing configuration file (aka uwsgicfg.py)
:param str|unicode name_module:
:param str|unicode name_project:
:rtype: Section
"""
from importlib import import_module
from ... | python | def _get_section_existing(self, name_module, name_project):
"""Loads config section from existing configuration file (aka uwsgicfg.py)
:param str|unicode name_module:
:param str|unicode name_project:
:rtype: Section
"""
from importlib import import_module
from ... | [
"def",
"_get_section_existing",
"(",
"self",
",",
"name_module",
",",
"name_project",
")",
":",
"from",
"importlib",
"import",
"import_module",
"from",
"uwsgiconf",
".",
"settings",
"import",
"CONFIGS_MODULE_ATTR",
"config",
"=",
"getattr",
"(",
"import_module",
"("... | Loads config section from existing configuration file (aka uwsgicfg.py)
:param str|unicode name_module:
:param str|unicode name_project:
:rtype: Section | [
"Loads",
"config",
"section",
"from",
"existing",
"configuration",
"file",
"(",
"aka",
"uwsgicfg",
".",
"py",
")"
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/contrib/django/uwsgify/toolbox.py#L117-L133 | train | Loads config section from existing configuration file |
idlesign/uwsgiconf | uwsgiconf/contrib/django/uwsgify/toolbox.py | SectionMutator._get_section_new | def _get_section_new(cls, dir_base):
"""Creates a new section with default settings.
:param str|unicode dir_base:
:rtype: Section
"""
from uwsgiconf.presets.nice import PythonSection
from django.conf import settings
wsgi_app = settings.WSGI_APPLICATION
... | python | def _get_section_new(cls, dir_base):
"""Creates a new section with default settings.
:param str|unicode dir_base:
:rtype: Section
"""
from uwsgiconf.presets.nice import PythonSection
from django.conf import settings
wsgi_app = settings.WSGI_APPLICATION
... | [
"def",
"_get_section_new",
"(",
"cls",
",",
"dir_base",
")",
":",
"from",
"uwsgiconf",
".",
"presets",
".",
"nice",
"import",
"PythonSection",
"from",
"django",
".",
"conf",
"import",
"settings",
"wsgi_app",
"=",
"settings",
".",
"WSGI_APPLICATION",
"path_wsgi",... | Creates a new section with default settings.
:param str|unicode dir_base:
:rtype: Section | [
"Creates",
"a",
"new",
"section",
"with",
"default",
"settings",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/contrib/django/uwsgify/toolbox.py#L136-L159 | train | Creates a new section with default settings. |
idlesign/uwsgiconf | uwsgiconf/contrib/django/uwsgify/toolbox.py | SectionMutator.contribute_static | def contribute_static(self):
"""Contributes static and media file serving settings to an existing section."""
options = self.options
if options['compile'] or not options['use_static_handler']:
return
from django.core.management import call_command
settings = self.s... | python | def contribute_static(self):
"""Contributes static and media file serving settings to an existing section."""
options = self.options
if options['compile'] or not options['use_static_handler']:
return
from django.core.management import call_command
settings = self.s... | [
"def",
"contribute_static",
"(",
"self",
")",
":",
"options",
"=",
"self",
".",
"options",
"if",
"options",
"[",
"'compile'",
"]",
"or",
"not",
"options",
"[",
"'use_static_handler'",
"]",
":",
"return",
"from",
"django",
".",
"core",
".",
"management",
"i... | Contributes static and media file serving settings to an existing section. | [
"Contributes",
"static",
"and",
"media",
"file",
"serving",
"settings",
"to",
"an",
"existing",
"section",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/contrib/django/uwsgify/toolbox.py#L161-L175 | train | Contributes static and media file serving settings to an existing section. |
idlesign/uwsgiconf | uwsgiconf/contrib/django/uwsgify/toolbox.py | SectionMutator.contribute_error_pages | def contribute_error_pages(self):
"""Contributes generic static error massage pages to an existing section."""
static_dir = self.settings.STATIC_ROOT
if not static_dir:
# Source static directory is not configured. Use temporary.
import tempfile
static_dir = ... | python | def contribute_error_pages(self):
"""Contributes generic static error massage pages to an existing section."""
static_dir = self.settings.STATIC_ROOT
if not static_dir:
# Source static directory is not configured. Use temporary.
import tempfile
static_dir = ... | [
"def",
"contribute_error_pages",
"(",
"self",
")",
":",
"static_dir",
"=",
"self",
".",
"settings",
".",
"STATIC_ROOT",
"if",
"not",
"static_dir",
":",
"# Source static directory is not configured. Use temporary.",
"import",
"tempfile",
"static_dir",
"=",
"os",
".",
"... | Contributes generic static error massage pages to an existing section. | [
"Contributes",
"generic",
"static",
"error",
"massage",
"pages",
"to",
"an",
"existing",
"section",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/contrib/django/uwsgify/toolbox.py#L177-L189 | train | Contributes generic static error massage pages to an existing section. |
idlesign/uwsgiconf | uwsgiconf/contrib/django/uwsgify/toolbox.py | SectionMutator.mutate | def mutate(self):
"""Mutates current section."""
section = self.section
project_name = self.project_name
section.project_name = project_name
self.contribute_runtime_dir()
main = section.main_process
main.set_naming_params(prefix='[%s] ' % project_name)
... | python | def mutate(self):
"""Mutates current section."""
section = self.section
project_name = self.project_name
section.project_name = project_name
self.contribute_runtime_dir()
main = section.main_process
main.set_naming_params(prefix='[%s] ' % project_name)
... | [
"def",
"mutate",
"(",
"self",
")",
":",
"section",
"=",
"self",
".",
"section",
"project_name",
"=",
"self",
".",
"project_name",
"section",
".",
"project_name",
"=",
"project_name",
"self",
".",
"contribute_runtime_dir",
"(",
")",
"main",
"=",
"section",
".... | Mutates current section. | [
"Mutates",
"current",
"section",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/contrib/django/uwsgify/toolbox.py#L201-L231 | train | Mutates current section. |
idlesign/uwsgiconf | uwsgiconf/runtime/monitoring.py | register_file_monitor | def register_file_monitor(filename, target=None):
"""Maps a specific file/directory modification event to a signal.
:param str|unicode filename: File or a directory to watch for its modification.
:param int|Signal|str|unicode target: Existing signal to raise
or Signal Target to register signal imp... | python | def register_file_monitor(filename, target=None):
"""Maps a specific file/directory modification event to a signal.
:param str|unicode filename: File or a directory to watch for its modification.
:param int|Signal|str|unicode target: Existing signal to raise
or Signal Target to register signal imp... | [
"def",
"register_file_monitor",
"(",
"filename",
",",
"target",
"=",
"None",
")",
":",
"return",
"_automate_signal",
"(",
"target",
",",
"func",
"=",
"lambda",
"sig",
":",
"uwsgi",
".",
"add_file_monitor",
"(",
"int",
"(",
"sig",
")",
",",
"filename",
")",... | Maps a specific file/directory modification event to a signal.
:param str|unicode filename: File or a directory to watch for its modification.
:param int|Signal|str|unicode target: Existing signal to raise
or Signal Target to register signal implicitly.
Available targets:
* ``wor... | [
"Maps",
"a",
"specific",
"file",
"/",
"directory",
"modification",
"event",
"to",
"a",
"signal",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/runtime/monitoring.py#L5-L29 | train | Maps a specific file or directory modification event to a signal. |
idlesign/uwsgiconf | uwsgiconf/runtime/monitoring.py | Metric.set | def set(self, value, mode=None):
"""Sets metric value.
:param int|long value: New value.
:param str|unicode mode: Update mode.
* None - Unconditional update.
* max - Sets metric value if it is greater that the current one.
* min - Sets metric value if it is... | python | def set(self, value, mode=None):
"""Sets metric value.
:param int|long value: New value.
:param str|unicode mode: Update mode.
* None - Unconditional update.
* max - Sets metric value if it is greater that the current one.
* min - Sets metric value if it is... | [
"def",
"set",
"(",
"self",
",",
"value",
",",
"mode",
"=",
"None",
")",
":",
"if",
"mode",
"==",
"'max'",
":",
"func",
"=",
"uwsgi",
".",
"metric_set_max",
"elif",
"mode",
"==",
"'min'",
":",
"func",
"=",
"uwsgi",
".",
"metric_set_min",
"else",
":",
... | Sets metric value.
:param int|long value: New value.
:param str|unicode mode: Update mode.
* None - Unconditional update.
* max - Sets metric value if it is greater that the current one.
* min - Sets metric value if it is less that the current one.
:rtype:... | [
"Sets",
"metric",
"value",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/runtime/monitoring.py#L50-L73 | train | Sets the value of the current metric. |
idlesign/uwsgiconf | uwsgiconf/runtime/mules.py | Mule.get_message | def get_message(cls, signals=True, farms=False, buffer_size=65536, timeout=-1):
"""Block until a mule message is received and return it.
This can be called from multiple threads in the same programmed mule.
:param bool signals: Whether to manage signals.
:param bool farms: Whether to ... | python | def get_message(cls, signals=True, farms=False, buffer_size=65536, timeout=-1):
"""Block until a mule message is received and return it.
This can be called from multiple threads in the same programmed mule.
:param bool signals: Whether to manage signals.
:param bool farms: Whether to ... | [
"def",
"get_message",
"(",
"cls",
",",
"signals",
"=",
"True",
",",
"farms",
"=",
"False",
",",
"buffer_size",
"=",
"65536",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"return",
"decode",
"(",
"uwsgi",
".",
"mule_get_msg",
"(",
"signals",
",",
"farms",
... | Block until a mule message is received and return it.
This can be called from multiple threads in the same programmed mule.
:param bool signals: Whether to manage signals.
:param bool farms: Whether to manage farms.
:param int buffer_size:
:param int timeout: Seconds.
... | [
"Block",
"until",
"a",
"mule",
"message",
"is",
"received",
"and",
"return",
"it",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/runtime/mules.py#L26-L43 | train | Block until a mule message is received and return it. |
theacodes/cmarkgfm | noxfile.py | regenerate | def regenerate(session):
"""Regenerates header files for cmark under ./generated."""
if platform.system() == 'Windows':
output_dir = '../generated/windows'
else:
output_dir = '../generated/unix'
session.run(shutil.rmtree, 'build', ignore_errors=True)
session.run(os.makedirs,... | python | def regenerate(session):
"""Regenerates header files for cmark under ./generated."""
if platform.system() == 'Windows':
output_dir = '../generated/windows'
else:
output_dir = '../generated/unix'
session.run(shutil.rmtree, 'build', ignore_errors=True)
session.run(os.makedirs,... | [
"def",
"regenerate",
"(",
"session",
")",
":",
"if",
"platform",
".",
"system",
"(",
")",
"==",
"'Windows'",
":",
"output_dir",
"=",
"'../generated/windows'",
"else",
":",
"output_dir",
"=",
"'../generated/unix'",
"session",
".",
"run",
"(",
"shutil",
".",
"... | Regenerates header files for cmark under ./generated. | [
"Regenerates",
"header",
"files",
"for",
"cmark",
"under",
".",
"/",
"generated",
"."
] | 742cc59c7dadbee3c1f54b86167840bd0d3f2d49 | https://github.com/theacodes/cmarkgfm/blob/742cc59c7dadbee3c1f54b86167840bd0d3f2d49/noxfile.py#L33-L49 | train | Regenerates header files for cmark under. generated. |
idlesign/uwsgiconf | uwsgiconf/utils.py | output_capturing | def output_capturing():
"""Temporarily captures/redirects stdout."""
out = sys.stdout
sys.stdout = StringIO()
try:
yield
finally:
sys.stdout = out | python | def output_capturing():
"""Temporarily captures/redirects stdout."""
out = sys.stdout
sys.stdout = StringIO()
try:
yield
finally:
sys.stdout = out | [
"def",
"output_capturing",
"(",
")",
":",
"out",
"=",
"sys",
".",
"stdout",
"sys",
".",
"stdout",
"=",
"StringIO",
"(",
")",
"try",
":",
"yield",
"finally",
":",
"sys",
".",
"stdout",
"=",
"out"
] | Temporarily captures/redirects stdout. | [
"Temporarily",
"captures",
"/",
"redirects",
"stdout",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/utils.py#L49-L59 | train | Temporarily captures stdout. |
idlesign/uwsgiconf | uwsgiconf/utils.py | filter_locals | def filter_locals(locals_dict, drop=None, include=None):
"""Filters a dictionary produced by locals().
:param dict locals_dict:
:param list drop: Keys to drop from dict.
:param list include: Keys to include into dict.
:rtype: dict
"""
drop = drop or []
drop.extend([
'self',
... | python | def filter_locals(locals_dict, drop=None, include=None):
"""Filters a dictionary produced by locals().
:param dict locals_dict:
:param list drop: Keys to drop from dict.
:param list include: Keys to include into dict.
:rtype: dict
"""
drop = drop or []
drop.extend([
'self',
... | [
"def",
"filter_locals",
"(",
"locals_dict",
",",
"drop",
"=",
"None",
",",
"include",
"=",
"None",
")",
":",
"drop",
"=",
"drop",
"or",
"[",
"]",
"drop",
".",
"extend",
"(",
"[",
"'self'",
",",
"'__class__'",
",",
"# py3",
"]",
")",
"include",
"=",
... | Filters a dictionary produced by locals().
:param dict locals_dict:
:param list drop: Keys to drop from dict.
:param list include: Keys to include into dict.
:rtype: dict | [
"Filters",
"a",
"dictionary",
"produced",
"by",
"locals",
"()",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/utils.py#L160-L183 | train | Filters a dictionary produced by locals. |
idlesign/uwsgiconf | uwsgiconf/utils.py | get_output | def get_output(cmd, args):
"""Runs a command and returns its output (stdout + stderr).
:param str|unicode cmd:
:param str|unicode|list[str|unicode] args:
:rtype: str|unicode
"""
from subprocess import Popen, STDOUT, PIPE
command = [cmd]
command.extend(listify(args))
process = Po... | python | def get_output(cmd, args):
"""Runs a command and returns its output (stdout + stderr).
:param str|unicode cmd:
:param str|unicode|list[str|unicode] args:
:rtype: str|unicode
"""
from subprocess import Popen, STDOUT, PIPE
command = [cmd]
command.extend(listify(args))
process = Po... | [
"def",
"get_output",
"(",
"cmd",
",",
"args",
")",
":",
"from",
"subprocess",
"import",
"Popen",
",",
"STDOUT",
",",
"PIPE",
"command",
"=",
"[",
"cmd",
"]",
"command",
".",
"extend",
"(",
"listify",
"(",
"args",
")",
")",
"process",
"=",
"Popen",
"(... | Runs a command and returns its output (stdout + stderr).
:param str|unicode cmd:
:param str|unicode|list[str|unicode] args:
:rtype: str|unicode | [
"Runs",
"a",
"command",
"and",
"returns",
"its",
"output",
"(",
"stdout",
"+",
"stderr",
")",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/utils.py#L237-L254 | train | Runs a command and returns its output. |
idlesign/uwsgiconf | uwsgiconf/utils.py | parse_command_plugins_output | def parse_command_plugins_output(out):
"""Parses ``plugin-list`` command output from uWSGI
and returns object containing lists of embedded plugin names.
:param str|unicode out:
:rtype EmbeddedPlugins:
"""
out = out.split('--- end of plugins list ---')[0]
out = out.partition('plugins ***')... | python | def parse_command_plugins_output(out):
"""Parses ``plugin-list`` command output from uWSGI
and returns object containing lists of embedded plugin names.
:param str|unicode out:
:rtype EmbeddedPlugins:
"""
out = out.split('--- end of plugins list ---')[0]
out = out.partition('plugins ***')... | [
"def",
"parse_command_plugins_output",
"(",
"out",
")",
":",
"out",
"=",
"out",
".",
"split",
"(",
"'--- end of plugins list ---'",
")",
"[",
"0",
"]",
"out",
"=",
"out",
".",
"partition",
"(",
"'plugins ***'",
")",
"[",
"2",
"]",
"out",
"=",
"out",
".",... | Parses ``plugin-list`` command output from uWSGI
and returns object containing lists of embedded plugin names.
:param str|unicode out:
:rtype EmbeddedPlugins: | [
"Parses",
"plugin",
"-",
"list",
"command",
"output",
"from",
"uWSGI",
"and",
"returns",
"object",
"containing",
"lists",
"of",
"embedded",
"plugin",
"names",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/utils.py#L411-L443 | train | Parses uWSGI
and returns object containing lists of embedded plugin names. |
idlesign/uwsgiconf | uwsgiconf/utils.py | get_uwsgi_stub_attrs_diff | def get_uwsgi_stub_attrs_diff():
"""Returns attributes difference two elements tuple between
real uwsgi module and its stub.
Might be of use while describing in stub new uwsgi functions.
:return: (uwsgi_only_attrs, stub_only_attrs)
:rtype: tuple
"""
try:
import uwsgi
except ... | python | def get_uwsgi_stub_attrs_diff():
"""Returns attributes difference two elements tuple between
real uwsgi module and its stub.
Might be of use while describing in stub new uwsgi functions.
:return: (uwsgi_only_attrs, stub_only_attrs)
:rtype: tuple
"""
try:
import uwsgi
except ... | [
"def",
"get_uwsgi_stub_attrs_diff",
"(",
")",
":",
"try",
":",
"import",
"uwsgi",
"except",
"ImportError",
":",
"from",
"uwsgiconf",
".",
"exceptions",
"import",
"UwsgiconfException",
"raise",
"UwsgiconfException",
"(",
"'`uwsgi` module is unavailable. Calling `get_attrs_di... | Returns attributes difference two elements tuple between
real uwsgi module and its stub.
Might be of use while describing in stub new uwsgi functions.
:return: (uwsgi_only_attrs, stub_only_attrs)
:rtype: tuple | [
"Returns",
"attributes",
"difference",
"two",
"elements",
"tuple",
"between",
"real",
"uwsgi",
"module",
"and",
"its",
"stub",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/utils.py#L446-L477 | train | Returns attributes difference two elements tuple between uwsgi module and uwsgi stub module. |
idlesign/uwsgiconf | uwsgiconf/utils.py | ConfModule.spawn_uwsgi | def spawn_uwsgi(self, only=None):
"""Spawns uWSGI process(es) which will use configuration(s) from the module.
Returns list of tuples:
(configuration_alias, uwsgi_process_id)
If only one configuration found current process (uwsgiconf) is replaced with a new one (uWSGI),
oth... | python | def spawn_uwsgi(self, only=None):
"""Spawns uWSGI process(es) which will use configuration(s) from the module.
Returns list of tuples:
(configuration_alias, uwsgi_process_id)
If only one configuration found current process (uwsgiconf) is replaced with a new one (uWSGI),
oth... | [
"def",
"spawn_uwsgi",
"(",
"self",
",",
"only",
"=",
"None",
")",
":",
"spawned",
"=",
"[",
"]",
"configs",
"=",
"self",
".",
"configurations",
"if",
"len",
"(",
"configs",
")",
"==",
"1",
":",
"alias",
"=",
"configs",
"[",
"0",
"]",
".",
"alias",
... | Spawns uWSGI process(es) which will use configuration(s) from the module.
Returns list of tuples:
(configuration_alias, uwsgi_process_id)
If only one configuration found current process (uwsgiconf) is replaced with a new one (uWSGI),
otherwise a number of new detached processes is ... | [
"Spawns",
"uWSGI",
"process",
"(",
"es",
")",
"which",
"will",
"use",
"configuration",
"(",
"s",
")",
"from",
"the",
"module",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/utils.py#L79-L110 | train | Spawns uWSGI processes which will use configuration from the module. |
idlesign/uwsgiconf | uwsgiconf/utils.py | ConfModule.configurations | def configurations(self):
"""Configurations from uwsgiconf module."""
if self._confs is not None:
return self._confs
with output_capturing():
module = self.load(self.fpath)
confs = getattr(module, CONFIGS_MODULE_ATTR)
confs = listify(confs)
... | python | def configurations(self):
"""Configurations from uwsgiconf module."""
if self._confs is not None:
return self._confs
with output_capturing():
module = self.load(self.fpath)
confs = getattr(module, CONFIGS_MODULE_ATTR)
confs = listify(confs)
... | [
"def",
"configurations",
"(",
"self",
")",
":",
"if",
"self",
".",
"_confs",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_confs",
"with",
"output_capturing",
"(",
")",
":",
"module",
"=",
"self",
".",
"load",
"(",
"self",
".",
"fpath",
")",
"co... | Configurations from uwsgiconf module. | [
"Configurations",
"from",
"uwsgiconf",
"module",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/utils.py#L113-L126 | train | Configurations from uwsgiconf module. |
idlesign/uwsgiconf | uwsgiconf/utils.py | ConfModule.load | def load(cls, fpath):
"""Loads a module and returns its object.
:param str|unicode fpath:
:rtype: module
"""
module_name = os.path.splitext(os.path.basename(fpath))[0]
sys.path.insert(0, os.path.dirname(fpath))
try:
module = import_module(module_name... | python | def load(cls, fpath):
"""Loads a module and returns its object.
:param str|unicode fpath:
:rtype: module
"""
module_name = os.path.splitext(os.path.basename(fpath))[0]
sys.path.insert(0, os.path.dirname(fpath))
try:
module = import_module(module_name... | [
"def",
"load",
"(",
"cls",
",",
"fpath",
")",
":",
"module_name",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"os",
".",
"path",
".",
"basename",
"(",
"fpath",
")",
")",
"[",
"0",
"]",
"sys",
".",
"path",
".",
"insert",
"(",
"0",
",",
"os",
... | Loads a module and returns its object.
:param str|unicode fpath:
:rtype: module | [
"Loads",
"a",
"module",
"and",
"returns",
"its",
"object",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/utils.py#L129-L144 | train | Loads a module and returns its object. |
idlesign/uwsgiconf | uwsgiconf/utils.py | Fifo.cmd_log | def cmd_log(self, reopen=False, rotate=False):
"""Allows managing of uWSGI log related stuff
:param bool reopen: Reopen log file. Could be required after third party rotation.
:param bool rotate: Trigger built-in log rotation.
"""
cmd = b''
if reopen:
cmd +... | python | def cmd_log(self, reopen=False, rotate=False):
"""Allows managing of uWSGI log related stuff
:param bool reopen: Reopen log file. Could be required after third party rotation.
:param bool rotate: Trigger built-in log rotation.
"""
cmd = b''
if reopen:
cmd +... | [
"def",
"cmd_log",
"(",
"self",
",",
"reopen",
"=",
"False",
",",
"rotate",
"=",
"False",
")",
":",
"cmd",
"=",
"b''",
"if",
"reopen",
":",
"cmd",
"+=",
"b'l'",
"if",
"rotate",
":",
"cmd",
"+=",
"b'L'",
"return",
"self",
".",
"send_command",
"(",
"c... | Allows managing of uWSGI log related stuff
:param bool reopen: Reopen log file. Could be required after third party rotation.
:param bool rotate: Trigger built-in log rotation. | [
"Allows",
"managing",
"of",
"uWSGI",
"log",
"related",
"stuff"
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/utils.py#L287-L302 | train | Allows managing of uWSGI log related stuff. |
idlesign/uwsgiconf | uwsgiconf/utils.py | Fifo.cmd_reload | def cmd_reload(self, force=False, workers_only=False, workers_chain=False):
"""Reloads uWSGI master process, workers.
:param bool force: Use forced (brutal) reload instead of a graceful one.
:param bool workers_only: Reload only workers.
:param bool workers_chain: Run chained workers re... | python | def cmd_reload(self, force=False, workers_only=False, workers_chain=False):
"""Reloads uWSGI master process, workers.
:param bool force: Use forced (brutal) reload instead of a graceful one.
:param bool workers_only: Reload only workers.
:param bool workers_chain: Run chained workers re... | [
"def",
"cmd_reload",
"(",
"self",
",",
"force",
"=",
"False",
",",
"workers_only",
"=",
"False",
",",
"workers_chain",
"=",
"False",
")",
":",
"if",
"workers_chain",
":",
"return",
"self",
".",
"send_command",
"(",
"b'c'",
")",
"if",
"workers_only",
":",
... | Reloads uWSGI master process, workers.
:param bool force: Use forced (brutal) reload instead of a graceful one.
:param bool workers_only: Reload only workers.
:param bool workers_chain: Run chained workers reload (one after another,
instead of destroying all of them in bulk). | [
"Reloads",
"uWSGI",
"master",
"process",
"workers",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/utils.py#L316-L331 | train | Reloads uWSGI master process. |
idlesign/uwsgiconf | uwsgiconf/utils.py | Fifo.send_command | def send_command(self, cmd):
"""Sends a generic command into FIFO.
:param bytes cmd: Command chars to send into FIFO.
"""
if not cmd:
return
with open(self.fifo, 'wb') as f:
f.write(cmd) | python | def send_command(self, cmd):
"""Sends a generic command into FIFO.
:param bytes cmd: Command chars to send into FIFO.
"""
if not cmd:
return
with open(self.fifo, 'wb') as f:
f.write(cmd) | [
"def",
"send_command",
"(",
"self",
",",
"cmd",
")",
":",
"if",
"not",
"cmd",
":",
"return",
"with",
"open",
"(",
"self",
".",
"fifo",
",",
"'wb'",
")",
"as",
"f",
":",
"f",
".",
"write",
"(",
"cmd",
")"
] | Sends a generic command into FIFO.
:param bytes cmd: Command chars to send into FIFO. | [
"Sends",
"a",
"generic",
"command",
"into",
"FIFO",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/utils.py#L333-L343 | train | Sends a generic command into the FIFO. |
idlesign/uwsgiconf | uwsgiconf/utils.py | UwsgiRunner.get_env_path | def get_env_path(cls):
"""Returns PATH environment variable updated to run uwsgiconf in
(e.g. for virtualenv).
:rtype: str|unicode
"""
return os.path.dirname(Finder.python()) + os.pathsep + os.environ['PATH'] | python | def get_env_path(cls):
"""Returns PATH environment variable updated to run uwsgiconf in
(e.g. for virtualenv).
:rtype: str|unicode
"""
return os.path.dirname(Finder.python()) + os.pathsep + os.environ['PATH'] | [
"def",
"get_env_path",
"(",
"cls",
")",
":",
"return",
"os",
".",
"path",
".",
"dirname",
"(",
"Finder",
".",
"python",
"(",
")",
")",
"+",
"os",
".",
"pathsep",
"+",
"os",
".",
"environ",
"[",
"'PATH'",
"]"
] | Returns PATH environment variable updated to run uwsgiconf in
(e.g. for virtualenv).
:rtype: str|unicode | [
"Returns",
"PATH",
"environment",
"variable",
"updated",
"to",
"run",
"uwsgiconf",
"in",
"(",
"e",
".",
"g",
".",
"for",
"virtualenv",
")",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/utils.py#L372-L378 | train | Returns the PATH environment variable updated to run uwsgiconf in
|
idlesign/uwsgiconf | uwsgiconf/utils.py | UwsgiRunner.prepare_env | def prepare_env(cls):
"""Prepares current environment and returns Python binary name.
This adds some virtualenv friendliness so that we try use uwsgi from it.
:rtype: str|unicode
"""
os.environ['PATH'] = cls.get_env_path()
return os.path.basename(Finder.python()) | python | def prepare_env(cls):
"""Prepares current environment and returns Python binary name.
This adds some virtualenv friendliness so that we try use uwsgi from it.
:rtype: str|unicode
"""
os.environ['PATH'] = cls.get_env_path()
return os.path.basename(Finder.python()) | [
"def",
"prepare_env",
"(",
"cls",
")",
":",
"os",
".",
"environ",
"[",
"'PATH'",
"]",
"=",
"cls",
".",
"get_env_path",
"(",
")",
"return",
"os",
".",
"path",
".",
"basename",
"(",
"Finder",
".",
"python",
"(",
")",
")"
] | Prepares current environment and returns Python binary name.
This adds some virtualenv friendliness so that we try use uwsgi from it.
:rtype: str|unicode | [
"Prepares",
"current",
"environment",
"and",
"returns",
"Python",
"binary",
"name",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/utils.py#L381-L389 | train | Prepares current environment and returns Python binary name. |
idlesign/uwsgiconf | uwsgiconf/utils.py | UwsgiRunner.spawn | def spawn(self, filepath, configuration_alias, replace=False):
"""Spawns uWSGI using the given configuration module.
:param str|unicode filepath:
:param str|unicode configuration_alias:
:param bool replace: Whether a new process should replace current one.
"""
# Pass ... | python | def spawn(self, filepath, configuration_alias, replace=False):
"""Spawns uWSGI using the given configuration module.
:param str|unicode filepath:
:param str|unicode configuration_alias:
:param bool replace: Whether a new process should replace current one.
"""
# Pass ... | [
"def",
"spawn",
"(",
"self",
",",
"filepath",
",",
"configuration_alias",
",",
"replace",
"=",
"False",
")",
":",
"# Pass --conf as an argument to have a chance to use",
"# touch reloading form .py configuration file change.",
"args",
"=",
"[",
"'uwsgi'",
",",
"'--ini'",
... | Spawns uWSGI using the given configuration module.
:param str|unicode filepath:
:param str|unicode configuration_alias:
:param bool replace: Whether a new process should replace current one. | [
"Spawns",
"uWSGI",
"using",
"the",
"given",
"configuration",
"module",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/utils.py#L391-L408 | train | Spawns uWSGI using the given configuration module. |
idlesign/uwsgiconf | uwsgiconf/runtime/caching.py | Cache.get | def get(self, key, default=None, as_int=False, setter=None):
"""Gets a value from the cache.
:param str|unicode key: The cache key to get value for.
:param default: Value to return if none found in cache.
:param bool as_int: Return 64bit number instead of str.
:param callable... | python | def get(self, key, default=None, as_int=False, setter=None):
"""Gets a value from the cache.
:param str|unicode key: The cache key to get value for.
:param default: Value to return if none found in cache.
:param bool as_int: Return 64bit number instead of str.
:param callable... | [
"def",
"get",
"(",
"self",
",",
"key",
",",
"default",
"=",
"None",
",",
"as_int",
"=",
"False",
",",
"setter",
"=",
"None",
")",
":",
"if",
"as_int",
":",
"val",
"=",
"uwsgi",
".",
"cache_num",
"(",
"key",
",",
"self",
".",
"name",
")",
"else",
... | Gets a value from the cache.
:param str|unicode key: The cache key to get value for.
:param default: Value to return if none found in cache.
:param bool as_int: Return 64bit number instead of str.
:param callable setter: Setter callable to automatically set cache
value if... | [
"Gets",
"a",
"value",
"from",
"the",
"cache",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/runtime/caching.py#L44-L77 | train | Gets a value from the cache. |
idlesign/uwsgiconf | uwsgiconf/runtime/caching.py | Cache.set | def set(self, key, value):
"""Sets the specified key value.
:param str|unicode key:
:param int|str|unicode value:
:rtype: bool
"""
return uwsgi.cache_set(key, value, self.timeout, self.name) | python | def set(self, key, value):
"""Sets the specified key value.
:param str|unicode key:
:param int|str|unicode value:
:rtype: bool
"""
return uwsgi.cache_set(key, value, self.timeout, self.name) | [
"def",
"set",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"return",
"uwsgi",
".",
"cache_set",
"(",
"key",
",",
"value",
",",
"self",
".",
"timeout",
",",
"self",
".",
"name",
")"
] | Sets the specified key value.
:param str|unicode key:
:param int|str|unicode value:
:rtype: bool | [
"Sets",
"the",
"specified",
"key",
"value",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/runtime/caching.py#L81-L90 | train | Sets the specified key value. |
idlesign/uwsgiconf | uwsgiconf/runtime/caching.py | Cache.incr | def incr(self, key, delta=1):
"""Increments the specified key value by the specified value.
:param str|unicode key:
:param int delta:
:rtype: bool
"""
return uwsgi.cache_inc(key, delta, self.timeout, self.name) | python | def incr(self, key, delta=1):
"""Increments the specified key value by the specified value.
:param str|unicode key:
:param int delta:
:rtype: bool
"""
return uwsgi.cache_inc(key, delta, self.timeout, self.name) | [
"def",
"incr",
"(",
"self",
",",
"key",
",",
"delta",
"=",
"1",
")",
":",
"return",
"uwsgi",
".",
"cache_inc",
"(",
"key",
",",
"delta",
",",
"self",
".",
"timeout",
",",
"self",
".",
"name",
")"
] | Increments the specified key value by the specified value.
:param str|unicode key:
:param int delta:
:rtype: bool | [
"Increments",
"the",
"specified",
"key",
"value",
"by",
"the",
"specified",
"value",
".",
":",
"param",
"str|unicode",
"key",
":",
":",
"param",
"int",
"delta",
":"
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/runtime/caching.py#L105-L114 | train | Increments the specified key value by the specified value. |
idlesign/uwsgiconf | uwsgiconf/runtime/caching.py | Cache.decr | def decr(self, key, delta=1):
"""Decrements the specified key value by the specified value.
:param str|unicode key:
:param int delta:
:rtype: bool
"""
return uwsgi.cache_dec(key, delta, self.timeout, self.name) | python | def decr(self, key, delta=1):
"""Decrements the specified key value by the specified value.
:param str|unicode key:
:param int delta:
:rtype: bool
"""
return uwsgi.cache_dec(key, delta, self.timeout, self.name) | [
"def",
"decr",
"(",
"self",
",",
"key",
",",
"delta",
"=",
"1",
")",
":",
"return",
"uwsgi",
".",
"cache_dec",
"(",
"key",
",",
"delta",
",",
"self",
".",
"timeout",
",",
"self",
".",
"name",
")"
] | Decrements the specified key value by the specified value.
:param str|unicode key:
:param int delta:
:rtype: bool | [
"Decrements",
"the",
"specified",
"key",
"value",
"by",
"the",
"specified",
"value",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/runtime/caching.py#L116-L125 | train | Decrements the specified key value by the specified value. |
idlesign/uwsgiconf | uwsgiconf/runtime/caching.py | Cache.mul | def mul(self, key, value=2):
"""Multiplies the specified key value by the specified value.
:param str|unicode key:
:param int value:
:rtype: bool
"""
return uwsgi.cache_mul(key, value, self.timeout, self.name) | python | def mul(self, key, value=2):
"""Multiplies the specified key value by the specified value.
:param str|unicode key:
:param int value:
:rtype: bool
"""
return uwsgi.cache_mul(key, value, self.timeout, self.name) | [
"def",
"mul",
"(",
"self",
",",
"key",
",",
"value",
"=",
"2",
")",
":",
"return",
"uwsgi",
".",
"cache_mul",
"(",
"key",
",",
"value",
",",
"self",
".",
"timeout",
",",
"self",
".",
"name",
")"
] | Multiplies the specified key value by the specified value.
:param str|unicode key:
:param int value:
:rtype: bool | [
"Multiplies",
"the",
"specified",
"key",
"value",
"by",
"the",
"specified",
"value",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/runtime/caching.py#L127-L136 | train | Multiplies the specified key value by the specified value. |
idlesign/uwsgiconf | uwsgiconf/runtime/caching.py | Cache.div | def div(self, key, value=2):
"""Divides the specified key value by the specified value.
:param str|unicode key:
:param int value:
:rtype: bool
"""
return uwsgi.cache_mul(key, value, self.timeout, self.name) | python | def div(self, key, value=2):
"""Divides the specified key value by the specified value.
:param str|unicode key:
:param int value:
:rtype: bool
"""
return uwsgi.cache_mul(key, value, self.timeout, self.name) | [
"def",
"div",
"(",
"self",
",",
"key",
",",
"value",
"=",
"2",
")",
":",
"return",
"uwsgi",
".",
"cache_mul",
"(",
"key",
",",
"value",
",",
"self",
".",
"timeout",
",",
"self",
".",
"name",
")"
] | Divides the specified key value by the specified value.
:param str|unicode key:
:param int value:
:rtype: bool | [
"Divides",
"the",
"specified",
"key",
"value",
"by",
"the",
"specified",
"value",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/runtime/caching.py#L138-L147 | train | Divides the specified key value by the specified value. |
idlesign/uwsgiconf | uwsgiconf/runtime/websockets.py | recv | def recv(request_context=None, non_blocking=False):
"""Receives data from websocket.
:param request_context:
:param bool non_blocking:
:rtype: bytes|str
:raises IOError: If unable to receive a message.
"""
if non_blocking:
result = uwsgi.websocket_recv_nb(request_context)
e... | python | def recv(request_context=None, non_blocking=False):
"""Receives data from websocket.
:param request_context:
:param bool non_blocking:
:rtype: bytes|str
:raises IOError: If unable to receive a message.
"""
if non_blocking:
result = uwsgi.websocket_recv_nb(request_context)
e... | [
"def",
"recv",
"(",
"request_context",
"=",
"None",
",",
"non_blocking",
"=",
"False",
")",
":",
"if",
"non_blocking",
":",
"result",
"=",
"uwsgi",
".",
"websocket_recv_nb",
"(",
"request_context",
")",
"else",
":",
"result",
"=",
"uwsgi",
".",
"websocket_re... | Receives data from websocket.
:param request_context:
:param bool non_blocking:
:rtype: bytes|str
:raises IOError: If unable to receive a message. | [
"Receives",
"data",
"from",
"websocket",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/runtime/websockets.py#L7-L25 | train | Receives data from the websocket. |
idlesign/uwsgiconf | uwsgiconf/runtime/websockets.py | send | def send(message, request_context=None, binary=False):
"""Sends a message to websocket.
:param str message: data to send
:param request_context:
:raises IOError: If unable to send a message.
"""
if binary:
return uwsgi.websocket_send_binary(message, request_context)
return uwsgi.... | python | def send(message, request_context=None, binary=False):
"""Sends a message to websocket.
:param str message: data to send
:param request_context:
:raises IOError: If unable to send a message.
"""
if binary:
return uwsgi.websocket_send_binary(message, request_context)
return uwsgi.... | [
"def",
"send",
"(",
"message",
",",
"request_context",
"=",
"None",
",",
"binary",
"=",
"False",
")",
":",
"if",
"binary",
":",
"return",
"uwsgi",
".",
"websocket_send_binary",
"(",
"message",
",",
"request_context",
")",
"return",
"uwsgi",
".",
"websocket_s... | Sends a message to websocket.
:param str message: data to send
:param request_context:
:raises IOError: If unable to send a message. | [
"Sends",
"a",
"message",
"to",
"websocket",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/runtime/websockets.py#L28-L40 | train | Sends a message to the current websocket. |
theacodes/cmarkgfm | src/cmarkgfm/cmark.py | markdown_to_html | def markdown_to_html(text, options=0):
"""Render the given text to Markdown.
This is a direct interface to ``cmark_markdown_to_html``.
Args:
text (str): The text to render to Markdown.
options (int): The cmark options.
Returns:
str: The rendered markdown.
"""
... | python | def markdown_to_html(text, options=0):
"""Render the given text to Markdown.
This is a direct interface to ``cmark_markdown_to_html``.
Args:
text (str): The text to render to Markdown.
options (int): The cmark options.
Returns:
str: The rendered markdown.
"""
... | [
"def",
"markdown_to_html",
"(",
"text",
",",
"options",
"=",
"0",
")",
":",
"encoded_text",
"=",
"text",
".",
"encode",
"(",
"'utf-8'",
")",
"raw_result",
"=",
"_cmark",
".",
"lib",
".",
"cmark_markdown_to_html",
"(",
"encoded_text",
",",
"len",
"(",
"enco... | Render the given text to Markdown.
This is a direct interface to ``cmark_markdown_to_html``.
Args:
text (str): The text to render to Markdown.
options (int): The cmark options.
Returns:
str: The rendered markdown. | [
"Render",
"the",
"given",
"text",
"to",
"Markdown",
".",
"This",
"is",
"a",
"direct",
"interface",
"to",
"cmark_markdown_to_html",
".",
"Args",
":",
"text",
"(",
"str",
")",
":",
"The",
"text",
"to",
"render",
"to",
"Markdown",
".",
"options",
"(",
"int"... | 742cc59c7dadbee3c1f54b86167840bd0d3f2d49 | https://github.com/theacodes/cmarkgfm/blob/742cc59c7dadbee3c1f54b86167840bd0d3f2d49/src/cmarkgfm/cmark.py#L26-L41 | train | Render the given text to HTML. |
theacodes/cmarkgfm | src/cmarkgfm/cmark.py | markdown_to_html_with_extensions | def markdown_to_html_with_extensions(text, options=0, extensions=None):
"""Render the given text to Markdown, using extensions.
This is a high-level wrapper over the various functions needed to enable
extensions, attach them to a parser, and render html.
Args:
text (str): The text to re... | python | def markdown_to_html_with_extensions(text, options=0, extensions=None):
"""Render the given text to Markdown, using extensions.
This is a high-level wrapper over the various functions needed to enable
extensions, attach them to a parser, and render html.
Args:
text (str): The text to re... | [
"def",
"markdown_to_html_with_extensions",
"(",
"text",
",",
"options",
"=",
"0",
",",
"extensions",
"=",
"None",
")",
":",
"if",
"extensions",
"is",
"None",
":",
"extensions",
"=",
"[",
"]",
"core_extensions_ensure_registered",
"(",
")",
"cmark_extensions",
"="... | Render the given text to Markdown, using extensions.
This is a high-level wrapper over the various functions needed to enable
extensions, attach them to a parser, and render html.
Args:
text (str): The text to render to Markdown.
options (int): The cmark options.
extensions... | [
"Render",
"the",
"given",
"text",
"to",
"Markdown",
"using",
"extensions",
".",
"This",
"is",
"a",
"high",
"-",
"level",
"wrapper",
"over",
"the",
"various",
"functions",
"needed",
"to",
"enable",
"extensions",
"attach",
"them",
"to",
"a",
"parser",
"and",
... | 742cc59c7dadbee3c1f54b86167840bd0d3f2d49 | https://github.com/theacodes/cmarkgfm/blob/742cc59c7dadbee3c1f54b86167840bd0d3f2d49/src/cmarkgfm/cmark.py#L44-L90 | train | Render the given text to HTML using the given extensions. |
theacodes/cmarkgfm | src/cmarkgfm/cmark.py | parse_document | def parse_document(text, options=0):
"""Parse a document and return the root node.
Args:
text (str): The text to parse.
options (int): The cmark options.
Returns:
Any: Opaque reference to the root node of the parsed syntax tree.
"""
encoded_text = text.encode('utf... | python | def parse_document(text, options=0):
"""Parse a document and return the root node.
Args:
text (str): The text to parse.
options (int): The cmark options.
Returns:
Any: Opaque reference to the root node of the parsed syntax tree.
"""
encoded_text = text.encode('utf... | [
"def",
"parse_document",
"(",
"text",
",",
"options",
"=",
"0",
")",
":",
"encoded_text",
"=",
"text",
".",
"encode",
"(",
"'utf-8'",
")",
"return",
"_cmark",
".",
"lib",
".",
"cmark_parse_document",
"(",
"encoded_text",
",",
"len",
"(",
"encoded_text",
")... | Parse a document and return the root node.
Args:
text (str): The text to parse.
options (int): The cmark options.
Returns:
Any: Opaque reference to the root node of the parsed syntax tree. | [
"Parse",
"a",
"document",
"and",
"return",
"the",
"root",
"node",
".",
"Args",
":",
"text",
"(",
"str",
")",
":",
"The",
"text",
"to",
"parse",
".",
"options",
"(",
"int",
")",
":",
"The",
"cmark",
"options",
".",
"Returns",
":",
"Any",
":",
"Opaqu... | 742cc59c7dadbee3c1f54b86167840bd0d3f2d49 | https://github.com/theacodes/cmarkgfm/blob/742cc59c7dadbee3c1f54b86167840bd0d3f2d49/src/cmarkgfm/cmark.py#L111-L123 | train | Parse a text string and return the root node of the parsed syntax tree. |
theacodes/cmarkgfm | src/cmarkgfm/cmark.py | parser_feed | def parser_feed(parser, text):
"""Direct wrapper over cmark_parser_feed."""
encoded_text = text.encode('utf-8')
return _cmark.lib.cmark_parser_feed(
parser, encoded_text, len(encoded_text)) | python | def parser_feed(parser, text):
"""Direct wrapper over cmark_parser_feed."""
encoded_text = text.encode('utf-8')
return _cmark.lib.cmark_parser_feed(
parser, encoded_text, len(encoded_text)) | [
"def",
"parser_feed",
"(",
"parser",
",",
"text",
")",
":",
"encoded_text",
"=",
"text",
".",
"encode",
"(",
"'utf-8'",
")",
"return",
"_cmark",
".",
"lib",
".",
"cmark_parser_feed",
"(",
"parser",
",",
"encoded_text",
",",
"len",
"(",
"encoded_text",
")",... | Direct wrapper over cmark_parser_feed. | [
"Direct",
"wrapper",
"over",
"cmark_parser_feed",
"."
] | 742cc59c7dadbee3c1f54b86167840bd0d3f2d49 | https://github.com/theacodes/cmarkgfm/blob/742cc59c7dadbee3c1f54b86167840bd0d3f2d49/src/cmarkgfm/cmark.py#L136-L140 | train | Direct wrapper over cmark_parser_feed. |
theacodes/cmarkgfm | src/cmarkgfm/cmark.py | render_html | def render_html(root, options=0, extensions=None):
"""Render a given syntax tree as HTML.
Args:
root (Any): The reference to the root node of the syntax tree.
options (int): The cmark options.
extensions (Any): The reference to the syntax extensions, generally
from :f... | python | def render_html(root, options=0, extensions=None):
"""Render a given syntax tree as HTML.
Args:
root (Any): The reference to the root node of the syntax tree.
options (int): The cmark options.
extensions (Any): The reference to the syntax extensions, generally
from :f... | [
"def",
"render_html",
"(",
"root",
",",
"options",
"=",
"0",
",",
"extensions",
"=",
"None",
")",
":",
"if",
"extensions",
"is",
"None",
":",
"extensions",
"=",
"_cmark",
".",
"ffi",
".",
"NULL",
"raw_result",
"=",
"_cmark",
".",
"lib",
".",
"cmark_ren... | Render a given syntax tree as HTML.
Args:
root (Any): The reference to the root node of the syntax tree.
options (int): The cmark options.
extensions (Any): The reference to the syntax extensions, generally
from :func:`parser_get_syntax_extensions`
Returns:
... | [
"Render",
"a",
"given",
"syntax",
"tree",
"as",
"HTML",
".",
"Args",
":",
"root",
"(",
"Any",
")",
":",
"The",
"reference",
"to",
"the",
"root",
"node",
"of",
"the",
"syntax",
"tree",
".",
"options",
"(",
"int",
")",
":",
"The",
"cmark",
"options",
... | 742cc59c7dadbee3c1f54b86167840bd0d3f2d49 | https://github.com/theacodes/cmarkgfm/blob/742cc59c7dadbee3c1f54b86167840bd0d3f2d49/src/cmarkgfm/cmark.py#L148-L166 | train | Render a given syntax tree as HTML. |
theacodes/cmarkgfm | src/cmarkgfm/cmark.py | find_syntax_extension | def find_syntax_extension(name):
"""Direct wrapper over cmark_find_syntax_extension."""
encoded_name = name.encode('utf-8')
extension = _cmark.lib.cmark_find_syntax_extension(encoded_name)
if extension == _cmark.ffi.NULL:
return None
else:
return extension | python | def find_syntax_extension(name):
"""Direct wrapper over cmark_find_syntax_extension."""
encoded_name = name.encode('utf-8')
extension = _cmark.lib.cmark_find_syntax_extension(encoded_name)
if extension == _cmark.ffi.NULL:
return None
else:
return extension | [
"def",
"find_syntax_extension",
"(",
"name",
")",
":",
"encoded_name",
"=",
"name",
".",
"encode",
"(",
"'utf-8'",
")",
"extension",
"=",
"_cmark",
".",
"lib",
".",
"cmark_find_syntax_extension",
"(",
"encoded_name",
")",
"if",
"extension",
"==",
"_cmark",
"."... | Direct wrapper over cmark_find_syntax_extension. | [
"Direct",
"wrapper",
"over",
"cmark_find_syntax_extension",
"."
] | 742cc59c7dadbee3c1f54b86167840bd0d3f2d49 | https://github.com/theacodes/cmarkgfm/blob/742cc59c7dadbee3c1f54b86167840bd0d3f2d49/src/cmarkgfm/cmark.py#L174-L182 | train | Direct wrapper over cmark_find_syntax_extension. |
idlesign/uwsgiconf | uwsgiconf/options/caching.py | Caching.set_basic_params | def set_basic_params(self, no_expire=None, expire_scan_interval=None, report_freed=None):
"""
:param bool no_expire: Disable auto sweep of expired items.
Since uWSGI 1.2, cache item expiration is managed by a thread in the master process,
to reduce the risk of deadlock. This thre... | python | def set_basic_params(self, no_expire=None, expire_scan_interval=None, report_freed=None):
"""
:param bool no_expire: Disable auto sweep of expired items.
Since uWSGI 1.2, cache item expiration is managed by a thread in the master process,
to reduce the risk of deadlock. This thre... | [
"def",
"set_basic_params",
"(",
"self",
",",
"no_expire",
"=",
"None",
",",
"expire_scan_interval",
"=",
"None",
",",
"report_freed",
"=",
"None",
")",
":",
"self",
".",
"_set",
"(",
"'cache-no-expire'",
",",
"no_expire",
",",
"cast",
"=",
"bool",
")",
"se... | :param bool no_expire: Disable auto sweep of expired items.
Since uWSGI 1.2, cache item expiration is managed by a thread in the master process,
to reduce the risk of deadlock. This thread can be disabled
(making item expiry a no-op) with the this option.
:param int expire_s... | [
":",
"param",
"bool",
"no_expire",
":",
"Disable",
"auto",
"sweep",
"of",
"expired",
"items",
".",
"Since",
"uWSGI",
"1",
".",
"2",
"cache",
"item",
"expiration",
"is",
"managed",
"by",
"a",
"thread",
"in",
"the",
"master",
"process",
"to",
"reduce",
"th... | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/caching.py#L19-L37 | train | Set basic parameters for the cache item expiration command. |
idlesign/uwsgiconf | uwsgiconf/options/caching.py | Caching.add_item | def add_item(self, key, value, cache_name=None):
"""Add an item into the given cache.
This is a commodity option (mainly useful for testing) allowing you
to store an item in a uWSGI cache during startup.
:param str|unicode key:
:param value:
:param str|unicode cache_n... | python | def add_item(self, key, value, cache_name=None):
"""Add an item into the given cache.
This is a commodity option (mainly useful for testing) allowing you
to store an item in a uWSGI cache during startup.
:param str|unicode key:
:param value:
:param str|unicode cache_n... | [
"def",
"add_item",
"(",
"self",
",",
"key",
",",
"value",
",",
"cache_name",
"=",
"None",
")",
":",
"cache_name",
"=",
"cache_name",
"or",
"''",
"value",
"=",
"'%s %s=%s'",
"%",
"(",
"cache_name",
",",
"key",
",",
"value",
")",
"self",
".",
"_set",
"... | Add an item into the given cache.
This is a commodity option (mainly useful for testing) allowing you
to store an item in a uWSGI cache during startup.
:param str|unicode key:
:param value:
:param str|unicode cache_name: If not set, default will be used. | [
"Add",
"an",
"item",
"into",
"the",
"given",
"cache",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/caching.py#L39-L57 | train | Add an item into the given cache. |
idlesign/uwsgiconf | uwsgiconf/options/caching.py | Caching.add_file | def add_file(self, filepath, gzip=False, cache_name=None):
"""Load a static file in the cache.
.. note:: Items are stored with the filepath as is (relative or absolute) as the key.
:param str|unicode filepath:
:param bool gzip: Use gzip compression.
:param str|unicode cache_n... | python | def add_file(self, filepath, gzip=False, cache_name=None):
"""Load a static file in the cache.
.. note:: Items are stored with the filepath as is (relative or absolute) as the key.
:param str|unicode filepath:
:param bool gzip: Use gzip compression.
:param str|unicode cache_n... | [
"def",
"add_file",
"(",
"self",
",",
"filepath",
",",
"gzip",
"=",
"False",
",",
"cache_name",
"=",
"None",
")",
":",
"command",
"=",
"'load-file-in-cache'",
"if",
"gzip",
":",
"command",
"+=",
"'-gzip'",
"cache_name",
"=",
"cache_name",
"or",
"''",
"value... | Load a static file in the cache.
.. note:: Items are stored with the filepath as is (relative or absolute) as the key.
:param str|unicode filepath:
:param bool gzip: Use gzip compression.
:param str|unicode cache_name: If not set, default will be used. | [
"Load",
"a",
"static",
"file",
"in",
"the",
"cache",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/caching.py#L59-L81 | train | Add a static file to the cache. |
idlesign/uwsgiconf | uwsgiconf/options/caching.py | Caching.add_cache | def add_cache(
self, name, max_items, expires=None, store=None, store_sync_interval=None, store_delete=None,
hash_algo=None, hash_size=None, key_size=None, udp_clients=None, udp_servers=None,
block_size=None, block_count=None, sync_from=None, mode_bitmap=None, use_lastmod=None,
... | python | def add_cache(
self, name, max_items, expires=None, store=None, store_sync_interval=None, store_delete=None,
hash_algo=None, hash_size=None, key_size=None, udp_clients=None, udp_servers=None,
block_size=None, block_count=None, sync_from=None, mode_bitmap=None, use_lastmod=None,
... | [
"def",
"add_cache",
"(",
"self",
",",
"name",
",",
"max_items",
",",
"expires",
"=",
"None",
",",
"store",
"=",
"None",
",",
"store_sync_interval",
"=",
"None",
",",
"store_delete",
"=",
"None",
",",
"hash_algo",
"=",
"None",
",",
"hash_size",
"=",
"None... | Creates cache. Default mode: single block.
.. note:: This uses new generation ``cache2`` option available since uWSGI 1.9.
.. note:: When at least one cache is configured without ``full_purge_lru``
and the master is enabled a thread named "the cache sweeper" is started.
Its mai... | [
"Creates",
"cache",
".",
"Default",
"mode",
":",
"single",
"block",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/caching.py#L83-L196 | train | Creates a new cache. |
idlesign/uwsgiconf | uwsgiconf/runtime/scheduling.py | register_timer | def register_timer(period, target=None):
"""Add timer.
Can be used as a decorator:
.. code-block:: python
@register_timer(3)
def repeat():
do()
:param int period: The interval (seconds) at which to raise the signal.
:param int|Signal|str|unicode targe... | python | def register_timer(period, target=None):
"""Add timer.
Can be used as a decorator:
.. code-block:: python
@register_timer(3)
def repeat():
do()
:param int period: The interval (seconds) at which to raise the signal.
:param int|Signal|str|unicode targe... | [
"def",
"register_timer",
"(",
"period",
",",
"target",
"=",
"None",
")",
":",
"return",
"_automate_signal",
"(",
"target",
",",
"func",
"=",
"lambda",
"sig",
":",
"uwsgi",
".",
"add_timer",
"(",
"int",
"(",
"sig",
")",
",",
"period",
")",
")"
] | Add timer.
Can be used as a decorator:
.. code-block:: python
@register_timer(3)
def repeat():
do()
:param int period: The interval (seconds) at which to raise the signal.
:param int|Signal|str|unicode target: Existing signal to raise
or Signal Ta... | [
"Add",
"timer",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/runtime/scheduling.py#L13-L47 | train | Register a timer that will repeat the current time period seconds. |
idlesign/uwsgiconf | uwsgiconf/runtime/scheduling.py | register_timer_rb | def register_timer_rb(period, repeat=None, target=None):
"""Add a red-black timer (based on black-red tree).
.. code-block:: python
@register_timer_rb(3)
def repeat():
do()
:param int period: The interval (seconds) at which the signal is raised.
:param int... | python | def register_timer_rb(period, repeat=None, target=None):
"""Add a red-black timer (based on black-red tree).
.. code-block:: python
@register_timer_rb(3)
def repeat():
do()
:param int period: The interval (seconds) at which the signal is raised.
:param int... | [
"def",
"register_timer_rb",
"(",
"period",
",",
"repeat",
"=",
"None",
",",
"target",
"=",
"None",
")",
":",
"return",
"_automate_signal",
"(",
"target",
",",
"func",
"=",
"lambda",
"sig",
":",
"uwsgi",
".",
"add_rb_timer",
"(",
"int",
"(",
"sig",
")",
... | Add a red-black timer (based on black-red tree).
.. code-block:: python
@register_timer_rb(3)
def repeat():
do()
:param int period: The interval (seconds) at which the signal is raised.
:param int repeat: How many times to repeat. Default: None - infinitely.
... | [
"Add",
"a",
"red",
"-",
"black",
"timer",
"(",
"based",
"on",
"black",
"-",
"red",
"tree",
")",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/runtime/scheduling.py#L50-L84 | train | Register a red - black timer based on black - red tree. |
idlesign/uwsgiconf | uwsgiconf/runtime/scheduling.py | register_cron | def register_cron(weekday=None, month=None, day=None, hour=None, minute=None, target=None):
"""Adds cron. The interface to the uWSGI signal cron facility.
.. code-block:: python
@register_cron(hour=-3) # Every 3 hours.
def repeat():
do()
.. note:: Arguments wo... | python | def register_cron(weekday=None, month=None, day=None, hour=None, minute=None, target=None):
"""Adds cron. The interface to the uWSGI signal cron facility.
.. code-block:: python
@register_cron(hour=-3) # Every 3 hours.
def repeat():
do()
.. note:: Arguments wo... | [
"def",
"register_cron",
"(",
"weekday",
"=",
"None",
",",
"month",
"=",
"None",
",",
"day",
"=",
"None",
",",
"hour",
"=",
"None",
",",
"minute",
"=",
"None",
",",
"target",
"=",
"None",
")",
":",
"task_args_initial",
"=",
"{",
"name",
":",
"val",
... | Adds cron. The interface to the uWSGI signal cron facility.
.. code-block:: python
@register_cron(hour=-3) # Every 3 hours.
def repeat():
do()
.. note:: Arguments work similarly to a standard crontab,
but instead of "*", use -1,
and instead of "/2"... | [
"Adds",
"cron",
".",
"The",
"interface",
"to",
"the",
"uWSGI",
"signal",
"cron",
"facility",
"."
] | 475407acb44199edbf7e0a66261bfeb51de1afae | https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/runtime/scheduling.py#L87-L221 | train | Register a cron for the current locale. |
aljungberg/pyle | pyle.py | truncate_ellipsis | def truncate_ellipsis(line, length=30):
"""Truncate a line to the specified length followed by ``...`` unless its shorter than length already."""
l = len(line)
return line if l < length else line[:length - 3] + "..." | python | def truncate_ellipsis(line, length=30):
"""Truncate a line to the specified length followed by ``...`` unless its shorter than length already."""
l = len(line)
return line if l < length else line[:length - 3] + "..." | [
"def",
"truncate_ellipsis",
"(",
"line",
",",
"length",
"=",
"30",
")",
":",
"l",
"=",
"len",
"(",
"line",
")",
"return",
"line",
"if",
"l",
"<",
"length",
"else",
"line",
"[",
":",
"length",
"-",
"3",
"]",
"+",
"\"...\""
] | Truncate a line to the specified length followed by ``...`` unless its shorter than length already. | [
"Truncate",
"a",
"line",
"to",
"the",
"specified",
"length",
"followed",
"by",
"...",
"unless",
"its",
"shorter",
"than",
"length",
"already",
"."
] | e0f25f42f5f35f0cefd0f7f9afafb6c9f37cc499 | https://github.com/aljungberg/pyle/blob/e0f25f42f5f35f0cefd0f7f9afafb6c9f37cc499/pyle.py#L43-L47 | train | Truncate a line to the specified length followed by... unless it s shorter than length already. |
aljungberg/pyle | pyle.py | pyle_evaluate | def pyle_evaluate(expressions=None, modules=(), inplace=False, files=None, print_traceback=False):
"""The main method of pyle."""
eval_globals = {}
eval_globals.update(STANDARD_MODULES)
for module_arg in modules or ():
for module in module_arg.strip().split(","):
module = module.s... | python | def pyle_evaluate(expressions=None, modules=(), inplace=False, files=None, print_traceback=False):
"""The main method of pyle."""
eval_globals = {}
eval_globals.update(STANDARD_MODULES)
for module_arg in modules or ():
for module in module_arg.strip().split(","):
module = module.s... | [
"def",
"pyle_evaluate",
"(",
"expressions",
"=",
"None",
",",
"modules",
"=",
"(",
")",
",",
"inplace",
"=",
"False",
",",
"files",
"=",
"None",
",",
"print_traceback",
"=",
"False",
")",
":",
"eval_globals",
"=",
"{",
"}",
"eval_globals",
".",
"update",... | The main method of pyle. | [
"The",
"main",
"method",
"of",
"pyle",
"."
] | e0f25f42f5f35f0cefd0f7f9afafb6c9f37cc499 | https://github.com/aljungberg/pyle/blob/e0f25f42f5f35f0cefd0f7f9afafb6c9f37cc499/pyle.py#L50-L127 | train | The main method of pyle. |
aljungberg/pyle | pyle.py | pyle | def pyle(argv=None):
"""Execute pyle with the specified arguments, or sys.argv if no arguments specified."""
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("-m", "--modules", dest="modules", action='append',
help="import MODULE before evaluation. May be specified more th... | python | def pyle(argv=None):
"""Execute pyle with the specified arguments, or sys.argv if no arguments specified."""
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("-m", "--modules", dest="modules", action='append',
help="import MODULE before evaluation. May be specified more th... | [
"def",
"pyle",
"(",
"argv",
"=",
"None",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"__doc__",
")",
"parser",
".",
"add_argument",
"(",
"\"-m\"",
",",
"\"--modules\"",
",",
"dest",
"=",
"\"modules\"",
",",
"action"... | Execute pyle with the specified arguments, or sys.argv if no arguments specified. | [
"Execute",
"pyle",
"with",
"the",
"specified",
"arguments",
"or",
"sys",
".",
"argv",
"if",
"no",
"arguments",
"specified",
"."
] | e0f25f42f5f35f0cefd0f7f9afafb6c9f37cc499 | https://github.com/aljungberg/pyle/blob/e0f25f42f5f35f0cefd0f7f9afafb6c9f37cc499/pyle.py#L130-L149 | train | Execute pyle with the specified arguments or sys. argv if no arguments specified. |
chdzq/ARPAbetAndIPAConvertor | arpabetandipaconvertor/arpabet2phoneticalphabet.py | ARPAbet2PhoneticAlphabetConvertor.convert_to_international_phonetic_alphabet | def convert_to_international_phonetic_alphabet(self, arpabet):
'''
转换成国际音标
:param arpabet:
:return:
'''
word = self._convert_to_word(arpabet=arpabet)
if not word:
return None
return word.translate_to_international_phonetic_alphabet() | python | def convert_to_international_phonetic_alphabet(self, arpabet):
'''
转换成国际音标
:param arpabet:
:return:
'''
word = self._convert_to_word(arpabet=arpabet)
if not word:
return None
return word.translate_to_international_phonetic_alphabet() | [
"def",
"convert_to_international_phonetic_alphabet",
"(",
"self",
",",
"arpabet",
")",
":",
"word",
"=",
"self",
".",
"_convert_to_word",
"(",
"arpabet",
"=",
"arpabet",
")",
"if",
"not",
"word",
":",
"return",
"None",
"return",
"word",
".",
"translate_to_intern... | 转换成国际音标
:param arpabet:
:return: | [
"转换成国际音标",
":",
"param",
"arpabet",
":",
":",
"return",
":"
] | e8b2fdbb5b7134c4f779f4d6dcd5dc30979a0a26 | https://github.com/chdzq/ARPAbetAndIPAConvertor/blob/e8b2fdbb5b7134c4f779f4d6dcd5dc30979a0a26/arpabetandipaconvertor/arpabet2phoneticalphabet.py#L76-L88 | train | Convert the arpabet to the international phonetic alphabet. |
chdzq/ARPAbetAndIPAConvertor | arpabetandipaconvertor/arpabet2phoneticalphabet.py | ARPAbet2PhoneticAlphabetConvertor.convert_to_american_phonetic_alphabet | def convert_to_american_phonetic_alphabet(self, arpabet):
'''
转换成美音
:param arpabet:
:return:
'''
word = self._convert_to_word(arpabet=arpabet)
if not word:
return None
return word.translate_to_american_phonetic_alphabet() | python | def convert_to_american_phonetic_alphabet(self, arpabet):
'''
转换成美音
:param arpabet:
:return:
'''
word = self._convert_to_word(arpabet=arpabet)
if not word:
return None
return word.translate_to_american_phonetic_alphabet() | [
"def",
"convert_to_american_phonetic_alphabet",
"(",
"self",
",",
"arpabet",
")",
":",
"word",
"=",
"self",
".",
"_convert_to_word",
"(",
"arpabet",
"=",
"arpabet",
")",
"if",
"not",
"word",
":",
"return",
"None",
"return",
"word",
".",
"translate_to_american_ph... | 转换成美音
:param arpabet:
:return: | [
"转换成美音",
":",
"param",
"arpabet",
":",
":",
"return",
":"
] | e8b2fdbb5b7134c4f779f4d6dcd5dc30979a0a26 | https://github.com/chdzq/ARPAbetAndIPAConvertor/blob/e8b2fdbb5b7134c4f779f4d6dcd5dc30979a0a26/arpabetandipaconvertor/arpabet2phoneticalphabet.py#L90-L102 | train | Convert the arpabet to a list of american phonetic alphabets. |
chdzq/ARPAbetAndIPAConvertor | arpabetandipaconvertor/arpabet2phoneticalphabet.py | ARPAbet2PhoneticAlphabetConvertor.convert_to_english_phonetic_alphabet | def convert_to_english_phonetic_alphabet(self, arpabet):
'''
转换成英音
:param arpabet:
:return:
'''
word = self._convert_to_word(arpabet=arpabet)
if not word:
return None
return word.translate_to_english_phonetic_alphabet() | python | def convert_to_english_phonetic_alphabet(self, arpabet):
'''
转换成英音
:param arpabet:
:return:
'''
word = self._convert_to_word(arpabet=arpabet)
if not word:
return None
return word.translate_to_english_phonetic_alphabet() | [
"def",
"convert_to_english_phonetic_alphabet",
"(",
"self",
",",
"arpabet",
")",
":",
"word",
"=",
"self",
".",
"_convert_to_word",
"(",
"arpabet",
"=",
"arpabet",
")",
"if",
"not",
"word",
":",
"return",
"None",
"return",
"word",
".",
"translate_to_english_phon... | 转换成英音
:param arpabet:
:return: | [
"转换成英音",
":",
"param",
"arpabet",
":",
":",
"return",
":"
] | e8b2fdbb5b7134c4f779f4d6dcd5dc30979a0a26 | https://github.com/chdzq/ARPAbetAndIPAConvertor/blob/e8b2fdbb5b7134c4f779f4d6dcd5dc30979a0a26/arpabetandipaconvertor/arpabet2phoneticalphabet.py#L104-L116 | train | Convert the arpabet to a non - English alphabet. |
chdzq/ARPAbetAndIPAConvertor | arpabetandipaconvertor/model/syllable.py | Syllable.translate_to_arpabet | def translate_to_arpabet(self):
'''
转换成arpabet
:return:
'''
translations = []
for phoneme in self._phoneme_list:
if phoneme.is_vowel:
translations.append(phoneme.arpabet + self.stress.mark_arpabet())
else:
translat... | python | def translate_to_arpabet(self):
'''
转换成arpabet
:return:
'''
translations = []
for phoneme in self._phoneme_list:
if phoneme.is_vowel:
translations.append(phoneme.arpabet + self.stress.mark_arpabet())
else:
translat... | [
"def",
"translate_to_arpabet",
"(",
"self",
")",
":",
"translations",
"=",
"[",
"]",
"for",
"phoneme",
"in",
"self",
".",
"_phoneme_list",
":",
"if",
"phoneme",
".",
"is_vowel",
":",
"translations",
".",
"append",
"(",
"phoneme",
".",
"arpabet",
"+",
"self... | 转换成arpabet
:return: | [
"转换成arpabet",
":",
"return",
":"
] | e8b2fdbb5b7134c4f779f4d6dcd5dc30979a0a26 | https://github.com/chdzq/ARPAbetAndIPAConvertor/blob/e8b2fdbb5b7134c4f779f4d6dcd5dc30979a0a26/arpabetandipaconvertor/model/syllable.py#L41-L55 | train | Translate the list of phonemes to the ARPabet. |
chdzq/ARPAbetAndIPAConvertor | arpabetandipaconvertor/model/syllable.py | Syllable.translate_to_american_phonetic_alphabet | def translate_to_american_phonetic_alphabet(self, hide_stress_mark=False):
'''
转换成美音音。只要一个元音的时候需要隐藏重音标识
:param hide_stress_mark:
:return:
'''
translations = self.stress.mark_ipa() if (not hide_stress_mark) and self.have_vowel else ""
for phoneme in self._phonem... | python | def translate_to_american_phonetic_alphabet(self, hide_stress_mark=False):
'''
转换成美音音。只要一个元音的时候需要隐藏重音标识
:param hide_stress_mark:
:return:
'''
translations = self.stress.mark_ipa() if (not hide_stress_mark) and self.have_vowel else ""
for phoneme in self._phonem... | [
"def",
"translate_to_american_phonetic_alphabet",
"(",
"self",
",",
"hide_stress_mark",
"=",
"False",
")",
":",
"translations",
"=",
"self",
".",
"stress",
".",
"mark_ipa",
"(",
")",
"if",
"(",
"not",
"hide_stress_mark",
")",
"and",
"self",
".",
"have_vowel",
... | 转换成美音音。只要一个元音的时候需要隐藏重音标识
:param hide_stress_mark:
:return: | [
"转换成美音音。只要一个元音的时候需要隐藏重音标识",
":",
"param",
"hide_stress_mark",
":",
":",
"return",
":"
] | e8b2fdbb5b7134c4f779f4d6dcd5dc30979a0a26 | https://github.com/chdzq/ARPAbetAndIPAConvertor/blob/e8b2fdbb5b7134c4f779f4d6dcd5dc30979a0a26/arpabetandipaconvertor/model/syllable.py#L57-L70 | train | Translate the list of phonemes to a list of AMerican letters. |
chdzq/ARPAbetAndIPAConvertor | arpabetandipaconvertor/model/syllable.py | Syllable.translate_to_english_phonetic_alphabet | def translate_to_english_phonetic_alphabet(self, hide_stress_mark=False):
'''
转换成英音。只要一个元音的时候需要隐藏重音标识
:param hide_stress_mark:
:return:
'''
translations = self.stress.mark_ipa() if (not hide_stress_mark) and self.have_vowel else ""
for phoneme in self._phoneme_l... | python | def translate_to_english_phonetic_alphabet(self, hide_stress_mark=False):
'''
转换成英音。只要一个元音的时候需要隐藏重音标识
:param hide_stress_mark:
:return:
'''
translations = self.stress.mark_ipa() if (not hide_stress_mark) and self.have_vowel else ""
for phoneme in self._phoneme_l... | [
"def",
"translate_to_english_phonetic_alphabet",
"(",
"self",
",",
"hide_stress_mark",
"=",
"False",
")",
":",
"translations",
"=",
"self",
".",
"stress",
".",
"mark_ipa",
"(",
")",
"if",
"(",
"not",
"hide_stress_mark",
")",
"and",
"self",
".",
"have_vowel",
"... | 转换成英音。只要一个元音的时候需要隐藏重音标识
:param hide_stress_mark:
:return: | [
"转换成英音。只要一个元音的时候需要隐藏重音标识",
":",
"param",
"hide_stress_mark",
":",
":",
"return",
":"
] | e8b2fdbb5b7134c4f779f4d6dcd5dc30979a0a26 | https://github.com/chdzq/ARPAbetAndIPAConvertor/blob/e8b2fdbb5b7134c4f779f4d6dcd5dc30979a0a26/arpabetandipaconvertor/model/syllable.py#L72-L84 | train | Translate the list of phonemes to their English alphabet. |
chdzq/ARPAbetAndIPAConvertor | arpabetandipaconvertor/model/syllable.py | Syllable.translate_to_international_phonetic_alphabet | def translate_to_international_phonetic_alphabet(self, hide_stress_mark=False):
'''
转换成国际音标。只要一个元音的时候需要隐藏重音标识
:param hide_stress_mark:
:return:
'''
translations = self.stress.mark_ipa() if (not hide_stress_mark) and self.have_vowel else ""
for phoneme in self._p... | python | def translate_to_international_phonetic_alphabet(self, hide_stress_mark=False):
'''
转换成国际音标。只要一个元音的时候需要隐藏重音标识
:param hide_stress_mark:
:return:
'''
translations = self.stress.mark_ipa() if (not hide_stress_mark) and self.have_vowel else ""
for phoneme in self._p... | [
"def",
"translate_to_international_phonetic_alphabet",
"(",
"self",
",",
"hide_stress_mark",
"=",
"False",
")",
":",
"translations",
"=",
"self",
".",
"stress",
".",
"mark_ipa",
"(",
")",
"if",
"(",
"not",
"hide_stress_mark",
")",
"and",
"self",
".",
"have_vowel... | 转换成国际音标。只要一个元音的时候需要隐藏重音标识
:param hide_stress_mark:
:return: | [
"转换成国际音标。只要一个元音的时候需要隐藏重音标识",
":",
"param",
"hide_stress_mark",
":",
":",
"return",
":"
] | e8b2fdbb5b7134c4f779f4d6dcd5dc30979a0a26 | https://github.com/chdzq/ARPAbetAndIPAConvertor/blob/e8b2fdbb5b7134c4f779f4d6dcd5dc30979a0a26/arpabetandipaconvertor/model/syllable.py#L86-L98 | train | Translate to international phonetic alphabet. |
Shapeways/coyote_framework | example/example_app/page_objects/example_home_page.py | ExampleHomePage.get_login_form_component | def get_login_form_component(self):
"""Initializes and returns the login form component
@rtype: LoginForm
@return: Initialized component
"""
self.dw.wait_until(
lambda: self.dw.is_present(LoginForm.locators.form),
failure_message='login form was never pre... | python | def get_login_form_component(self):
"""Initializes and returns the login form component
@rtype: LoginForm
@return: Initialized component
"""
self.dw.wait_until(
lambda: self.dw.is_present(LoginForm.locators.form),
failure_message='login form was never pre... | [
"def",
"get_login_form_component",
"(",
"self",
")",
":",
"self",
".",
"dw",
".",
"wait_until",
"(",
"lambda",
":",
"self",
".",
"dw",
".",
"is_present",
"(",
"LoginForm",
".",
"locators",
".",
"form",
")",
",",
"failure_message",
"=",
"'login form was never... | Initializes and returns the login form component
@rtype: LoginForm
@return: Initialized component | [
"Initializes",
"and",
"returns",
"the",
"login",
"form",
"component"
] | cb29899b984a21d56bf65d0b1d907073948fe16c | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/example/example_app/page_objects/example_home_page.py#L30-L46 | train | Initializes and returns the login form component |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.