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
1 value
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Shapeways/coyote_framework
coyote_framework/util/apps/objects.py
objectify
def objectify(dictionary, name='Object'): """Converts a dictionary into a named tuple (shallow) """ o = namedtuple(name, dictionary.keys())(*dictionary.values()) return o
python
def objectify(dictionary, name='Object'): """Converts a dictionary into a named tuple (shallow) """ o = namedtuple(name, dictionary.keys())(*dictionary.values()) return o
[ "def", "objectify", "(", "dictionary", ",", "name", "=", "'Object'", ")", ":", "o", "=", "namedtuple", "(", "name", ",", "dictionary", ".", "keys", "(", ")", ")", "(", "*", "dictionary", ".", "values", "(", ")", ")", "return", "o" ]
Converts a dictionary into a named tuple (shallow)
[ "Converts", "a", "dictionary", "into", "a", "named", "tuple", "(", "shallow", ")" ]
cb29899b984a21d56bf65d0b1d907073948fe16c
https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/util/apps/objects.py#L6-L12
train
Shapeways/coyote_framework
coyote_framework/mixins/filesystem.py
create_directory
def create_directory(directory): """Creates a directory if it does not exist (in a thread-safe way) @param directory: The directory to create @return: The directory specified """ try: os.makedirs(directory) except OSError, e: if e.errno == errno.EEXIST and os.path.isdir(director...
python
def create_directory(directory): """Creates a directory if it does not exist (in a thread-safe way) @param directory: The directory to create @return: The directory specified """ try: os.makedirs(directory) except OSError, e: if e.errno == errno.EEXIST and os.path.isdir(director...
[ "def", "create_directory", "(", "directory", ")", ":", "try", ":", "os", ".", "makedirs", "(", "directory", ")", "except", "OSError", ",", "e", ":", "if", "e", ".", "errno", "==", "errno", ".", "EEXIST", "and", "os", ".", "path", ".", "isdir", "(", ...
Creates a directory if it does not exist (in a thread-safe way) @param directory: The directory to create @return: The directory specified
[ "Creates", "a", "directory", "if", "it", "does", "not", "exist", "(", "in", "a", "thread", "-", "safe", "way", ")" ]
cb29899b984a21d56bf65d0b1d907073948fe16c
https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/mixins/filesystem.py#L7-L19
train
Shapeways/coyote_framework
coyote_framework/database/coyote_db.py
CoyoteDb.__add_query_comment
def __add_query_comment(sql): """ Adds a comment line to the query to be executed containing the line number of the calling function. This is useful for debugging slow queries, as the comment will show in the slow query log @type sql: str @param sql: sql needing comment...
python
def __add_query_comment(sql): """ Adds a comment line to the query to be executed containing the line number of the calling function. This is useful for debugging slow queries, as the comment will show in the slow query log @type sql: str @param sql: sql needing comment...
[ "def", "__add_query_comment", "(", "sql", ")", ":", "# Inspect the call stack for the originating call", "file_name", "=", "''", "line_number", "=", "''", "caller_frames", "=", "inspect", ".", "getouterframes", "(", "inspect", ".", "currentframe", "(", ")", ")", "fo...
Adds a comment line to the query to be executed containing the line number of the calling function. This is useful for debugging slow queries, as the comment will show in the slow query log @type sql: str @param sql: sql needing comment @return:
[ "Adds", "a", "comment", "line", "to", "the", "query", "to", "be", "executed", "containing", "the", "line", "number", "of", "the", "calling", "function", ".", "This", "is", "useful", "for", "debugging", "slow", "queries", "as", "the", "comment", "will", "sh...
cb29899b984a21d56bf65d0b1d907073948fe16c
https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/database/coyote_db.py#L74-L95
train
Shapeways/coyote_framework
coyote_framework/database/coyote_db.py
CoyoteDb.get_single_instance
def get_single_instance(sql, class_type, *args, **kwargs): """Returns an instance of class_type populated with attributes from the DB record; throws an error if no records are found @param sql: Sql statement to execute @param class_type: The type of class to instantiate and populate wit...
python
def get_single_instance(sql, class_type, *args, **kwargs): """Returns an instance of class_type populated with attributes from the DB record; throws an error if no records are found @param sql: Sql statement to execute @param class_type: The type of class to instantiate and populate wit...
[ "def", "get_single_instance", "(", "sql", ",", "class_type", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "record", "=", "CoyoteDb", ".", "get_single_record", "(", "sql", ",", "*", "args", ",", "*", "*", "kwargs", ")", "try", ":", "instance", ...
Returns an instance of class_type populated with attributes from the DB record; throws an error if no records are found @param sql: Sql statement to execute @param class_type: The type of class to instantiate and populate with DB record @return: Return an instance with attributes set to...
[ "Returns", "an", "instance", "of", "class_type", "populated", "with", "attributes", "from", "the", "DB", "record", ";", "throws", "an", "error", "if", "no", "records", "are", "found" ]
cb29899b984a21d56bf65d0b1d907073948fe16c
https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/database/coyote_db.py#L109-L126
train
Shapeways/coyote_framework
coyote_framework/database/coyote_db.py
CoyoteDb.get_all_instances
def get_all_instances(sql, class_type, *args, **kwargs): """Returns a list of instances of class_type populated with attributes from the DB record @param sql: Sql statement to execute @param class_type: The type of class to instantiate and populate with DB record @return: Return a list ...
python
def get_all_instances(sql, class_type, *args, **kwargs): """Returns a list of instances of class_type populated with attributes from the DB record @param sql: Sql statement to execute @param class_type: The type of class to instantiate and populate with DB record @return: Return a list ...
[ "def", "get_all_instances", "(", "sql", ",", "class_type", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "records", "=", "CoyoteDb", ".", "get_all_records", "(", "sql", ",", "*", "args", ",", "*", "*", "kwargs", ")", "instances", "=", "[", "Co...
Returns a list of instances of class_type populated with attributes from the DB record @param sql: Sql statement to execute @param class_type: The type of class to instantiate and populate with DB record @return: Return a list of instances with attributes set to values from DB
[ "Returns", "a", "list", "of", "instances", "of", "class_type", "populated", "with", "attributes", "from", "the", "DB", "record" ]
cb29899b984a21d56bf65d0b1d907073948fe16c
https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/database/coyote_db.py#L129-L141
train
Shapeways/coyote_framework
coyote_framework/database/coyote_db.py
CoyoteDb.escape_dictionary
def escape_dictionary(dictionary, datetime_format='%Y-%m-%d %H:%M:%S'): """Escape dictionary values with keys as column names and values column values @type dictionary: dict @param dictionary: Key-values """ for k, v in dictionary.iteritems(): if isinstance(v, dateti...
python
def escape_dictionary(dictionary, datetime_format='%Y-%m-%d %H:%M:%S'): """Escape dictionary values with keys as column names and values column values @type dictionary: dict @param dictionary: Key-values """ for k, v in dictionary.iteritems(): if isinstance(v, dateti...
[ "def", "escape_dictionary", "(", "dictionary", ",", "datetime_format", "=", "'%Y-%m-%d %H:%M:%S'", ")", ":", "for", "k", ",", "v", "in", "dictionary", ".", "iteritems", "(", ")", ":", "if", "isinstance", "(", "v", ",", "datetime", ".", "datetime", ")", ":"...
Escape dictionary values with keys as column names and values column values @type dictionary: dict @param dictionary: Key-values
[ "Escape", "dictionary", "values", "with", "keys", "as", "column", "names", "and", "values", "column", "values" ]
cb29899b984a21d56bf65d0b1d907073948fe16c
https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/database/coyote_db.py#L144-L167
train
Shapeways/coyote_framework
coyote_framework/database/coyote_db.py
CoyoteDb.get_insert_fields_and_values_from_dict
def get_insert_fields_and_values_from_dict(dictionary, datetime_format='%Y-%m-%d %H:%M:%S', db_escape=True): """Formats a dictionary to strings of fields and values for insert statements @param dictionary: The dictionary whose keys and values are to be inserted @param db_escape: If true, will d...
python
def get_insert_fields_and_values_from_dict(dictionary, datetime_format='%Y-%m-%d %H:%M:%S', db_escape=True): """Formats a dictionary to strings of fields and values for insert statements @param dictionary: The dictionary whose keys and values are to be inserted @param db_escape: If true, will d...
[ "def", "get_insert_fields_and_values_from_dict", "(", "dictionary", ",", "datetime_format", "=", "'%Y-%m-%d %H:%M:%S'", ",", "db_escape", "=", "True", ")", ":", "if", "db_escape", ":", "CoyoteDb", ".", "escape_dictionary", "(", "dictionary", ",", "datetime_format", "=...
Formats a dictionary to strings of fields and values for insert statements @param dictionary: The dictionary whose keys and values are to be inserted @param db_escape: If true, will db escape values @return: Tuple of strings containing string fields and values, e.g. ('user_id, username', '5, "p...
[ "Formats", "a", "dictionary", "to", "strings", "of", "fields", "and", "values", "for", "insert", "statements" ]
cb29899b984a21d56bf65d0b1d907073948fe16c
https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/database/coyote_db.py#L170-L183
train
Shapeways/coyote_framework
coyote_framework/database/coyote_db.py
CoyoteDb.get_kwargs
def get_kwargs(**kwargs): """This method should be used in query functions where user can query on any number of fields >>> def get_instances(entity_id=NOTSET, my_field=NOTSET): >>> kwargs = CoyoteDb.get_kwargs(entity_id=entity_id, my_field=my_field) """ d = dict() ...
python
def get_kwargs(**kwargs): """This method should be used in query functions where user can query on any number of fields >>> def get_instances(entity_id=NOTSET, my_field=NOTSET): >>> kwargs = CoyoteDb.get_kwargs(entity_id=entity_id, my_field=my_field) """ d = dict() ...
[ "def", "get_kwargs", "(", "*", "*", "kwargs", ")", ":", "d", "=", "dict", "(", ")", "for", "k", ",", "v", "in", "kwargs", ".", "iteritems", "(", ")", ":", "if", "v", "is", "not", "NOTSET", ":", "d", "[", "k", "]", "=", "v", "return", "d" ]
This method should be used in query functions where user can query on any number of fields >>> def get_instances(entity_id=NOTSET, my_field=NOTSET): >>> kwargs = CoyoteDb.get_kwargs(entity_id=entity_id, my_field=my_field)
[ "This", "method", "should", "be", "used", "in", "query", "functions", "where", "user", "can", "query", "on", "any", "number", "of", "fields" ]
cb29899b984a21d56bf65d0b1d907073948fe16c
https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/database/coyote_db.py#L186-L196
train
Shapeways/coyote_framework
coyote_framework/database/coyote_db.py
CoyoteDb.get_update_clause_from_dict
def get_update_clause_from_dict(dictionary, datetime_format='%Y-%m-%d %H:%M:%S'): """Builds the update values clause of an update statement based on the dictionary representation of an instance""" items = [] CoyoteDb.escape_dictionary(dictionary, datetime_format=datetime_format) ...
python
def get_update_clause_from_dict(dictionary, datetime_format='%Y-%m-%d %H:%M:%S'): """Builds the update values clause of an update statement based on the dictionary representation of an instance""" items = [] CoyoteDb.escape_dictionary(dictionary, datetime_format=datetime_format) ...
[ "def", "get_update_clause_from_dict", "(", "dictionary", ",", "datetime_format", "=", "'%Y-%m-%d %H:%M:%S'", ")", ":", "items", "=", "[", "]", "CoyoteDb", ".", "escape_dictionary", "(", "dictionary", ",", "datetime_format", "=", "datetime_format", ")", "for", "k", ...
Builds the update values clause of an update statement based on the dictionary representation of an instance
[ "Builds", "the", "update", "values", "clause", "of", "an", "update", "statement", "based", "on", "the", "dictionary", "representation", "of", "an", "instance" ]
cb29899b984a21d56bf65d0b1d907073948fe16c
https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/database/coyote_db.py#L199-L209
train
Shapeways/coyote_framework
coyote_framework/database/coyote_db.py
CoyoteDb.get_where_clause_from_dict
def get_where_clause_from_dict(dictionary, join_operator='AND'): """Builds a where clause from a dictionary """ CoyoteDb.escape_dictionary(dictionary) clause = join_operator.join( (' {k} is {v} ' if str(v).lower() == 'null' else ' {k} = {v} ').format(k=k, v=v) # IS should be...
python
def get_where_clause_from_dict(dictionary, join_operator='AND'): """Builds a where clause from a dictionary """ CoyoteDb.escape_dictionary(dictionary) clause = join_operator.join( (' {k} is {v} ' if str(v).lower() == 'null' else ' {k} = {v} ').format(k=k, v=v) # IS should be...
[ "def", "get_where_clause_from_dict", "(", "dictionary", ",", "join_operator", "=", "'AND'", ")", ":", "CoyoteDb", ".", "escape_dictionary", "(", "dictionary", ")", "clause", "=", "join_operator", ".", "join", "(", "(", "' {k} is {v} '", "if", "str", "(", "v", ...
Builds a where clause from a dictionary
[ "Builds", "a", "where", "clause", "from", "a", "dictionary" ]
cb29899b984a21d56bf65d0b1d907073948fe16c
https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/database/coyote_db.py#L212-L219
train
Shapeways/coyote_framework
coyote_framework/database/coyote_db.py
CoyoteDb.get_dictionary_representation_of_object_attributes
def get_dictionary_representation_of_object_attributes(obj, omit_null_fields=False): """Returns a dictionary of object's attributes, ignoring methods @param obj: The object to represent as dict @param omit_null_fields: If true, will not include fields in the dictionary that are null @re...
python
def get_dictionary_representation_of_object_attributes(obj, omit_null_fields=False): """Returns a dictionary of object's attributes, ignoring methods @param obj: The object to represent as dict @param omit_null_fields: If true, will not include fields in the dictionary that are null @re...
[ "def", "get_dictionary_representation_of_object_attributes", "(", "obj", ",", "omit_null_fields", "=", "False", ")", ":", "obj_dictionary", "=", "obj", ".", "__dict__", "obj_dictionary_temp", "=", "obj_dictionary", ".", "copy", "(", ")", "for", "k", ",", "v", "in"...
Returns a dictionary of object's attributes, ignoring methods @param obj: The object to represent as dict @param omit_null_fields: If true, will not include fields in the dictionary that are null @return: Dictionary of the object's attributes
[ "Returns", "a", "dictionary", "of", "object", "s", "attributes", "ignoring", "methods" ]
cb29899b984a21d56bf65d0b1d907073948fe16c
https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/database/coyote_db.py#L222-L239
train
Shapeways/coyote_framework
coyote_framework/database/coyote_db.py
CoyoteDb.get_object_from_dictionary_representation
def get_object_from_dictionary_representation(dictionary, class_type): """Instantiates a new class (that takes no init params) and populates its attributes with a dictionary @type dictionary: dict @param dictionary: Dictionary representation of the object @param class_type: type ...
python
def get_object_from_dictionary_representation(dictionary, class_type): """Instantiates a new class (that takes no init params) and populates its attributes with a dictionary @type dictionary: dict @param dictionary: Dictionary representation of the object @param class_type: type ...
[ "def", "get_object_from_dictionary_representation", "(", "dictionary", ",", "class_type", ")", ":", "assert", "inspect", ".", "isclass", "(", "class_type", ")", ",", "'Cannot instantiate an object that is not a class'", "instance", "=", "class_type", "(", ")", "CoyoteDb",...
Instantiates a new class (that takes no init params) and populates its attributes with a dictionary @type dictionary: dict @param dictionary: Dictionary representation of the object @param class_type: type @return: None
[ "Instantiates", "a", "new", "class", "(", "that", "takes", "no", "init", "params", ")", "and", "populates", "its", "attributes", "with", "a", "dictionary" ]
cb29899b984a21d56bf65d0b1d907073948fe16c
https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/database/coyote_db.py#L242-L256
train
Shapeways/coyote_framework
coyote_framework/database/coyote_db.py
CoyoteDb.build_where_clause
def build_where_clause(mappings, operator='AND'): """Constructs the where clause based on a dictionary of values >>> build_where_clause({'id': 456, 'name': 'myrecord'}, operator='OR') >>> 'WHERE id = 456 OR name = "myrecord" ' """ where_clause_mappings = {} where_clause...
python
def build_where_clause(mappings, operator='AND'): """Constructs the where clause based on a dictionary of values >>> build_where_clause({'id': 456, 'name': 'myrecord'}, operator='OR') >>> 'WHERE id = 456 OR name = "myrecord" ' """ where_clause_mappings = {} where_clause...
[ "def", "build_where_clause", "(", "mappings", ",", "operator", "=", "'AND'", ")", ":", "where_clause_mappings", "=", "{", "}", "where_clause_mappings", ".", "update", "(", "mappings", ")", "where_clause", "=", "'WHERE '", "+", "' {} '", ".", "format", "(", "op...
Constructs the where clause based on a dictionary of values >>> build_where_clause({'id': 456, 'name': 'myrecord'}, operator='OR') >>> 'WHERE id = 456 OR name = "myrecord" '
[ "Constructs", "the", "where", "clause", "based", "on", "a", "dictionary", "of", "values" ]
cb29899b984a21d56bf65d0b1d907073948fe16c
https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/database/coyote_db.py#L259-L273
train
Shapeways/coyote_framework
coyote_framework/database/coyote_db.py
CoyoteDb.execute
def execute(*args, **kwargs): """Executes the sql statement, but does not commit. Returns the cursor to commit @return: DB and cursor instance following sql execution """ # Inspect the call stack for the originating call args = CoyoteDb.__add_query_comment(args[0]) db =...
python
def execute(*args, **kwargs): """Executes the sql statement, but does not commit. Returns the cursor to commit @return: DB and cursor instance following sql execution """ # Inspect the call stack for the originating call args = CoyoteDb.__add_query_comment(args[0]) db =...
[ "def", "execute", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# Inspect the call stack for the originating call", "args", "=", "CoyoteDb", ".", "__add_query_comment", "(", "args", "[", "0", "]", ")", "db", "=", "CoyoteDb", ".", "__get_db_write_instance...
Executes the sql statement, but does not commit. Returns the cursor to commit @return: DB and cursor instance following sql execution
[ "Executes", "the", "sql", "statement", "but", "does", "not", "commit", ".", "Returns", "the", "cursor", "to", "commit" ]
cb29899b984a21d56bf65d0b1d907073948fe16c
https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/database/coyote_db.py#L276-L293
train
Shapeways/coyote_framework
coyote_framework/database/coyote_db.py
CoyoteDb.execute_read_only
def execute_read_only(*args, **kwargs): # TODO: consolidate with execute """Executes the sql statement, but does not commit. Returns the cursor to commit @return: DB and cursor instance following sql execution """ # Inspect the call stack for the originating call args =...
python
def execute_read_only(*args, **kwargs): # TODO: consolidate with execute """Executes the sql statement, but does not commit. Returns the cursor to commit @return: DB and cursor instance following sql execution """ # Inspect the call stack for the originating call args =...
[ "def", "execute_read_only", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# TODO: consolidate with execute", "# Inspect the call stack for the originating call", "args", "=", "CoyoteDb", ".", "__add_query_comment", "(", "args", "[", "0", "]", ")", "# Execute t...
Executes the sql statement, but does not commit. Returns the cursor to commit @return: DB and cursor instance following sql execution
[ "Executes", "the", "sql", "statement", "but", "does", "not", "commit", ".", "Returns", "the", "cursor", "to", "commit" ]
cb29899b984a21d56bf65d0b1d907073948fe16c
https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/database/coyote_db.py#L296-L313
train
Shapeways/coyote_framework
coyote_framework/database/coyote_db.py
CoyoteDb.execute_and_commit
def execute_and_commit(*args, **kwargs): """Executes and commits the sql statement @return: None """ db, cursor = CoyoteDb.execute(*args, **kwargs) db.commit() return cursor
python
def execute_and_commit(*args, **kwargs): """Executes and commits the sql statement @return: None """ db, cursor = CoyoteDb.execute(*args, **kwargs) db.commit() return cursor
[ "def", "execute_and_commit", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "db", ",", "cursor", "=", "CoyoteDb", ".", "execute", "(", "*", "args", ",", "*", "*", "kwargs", ")", "db", ".", "commit", "(", ")", "return", "cursor" ]
Executes and commits the sql statement @return: None
[ "Executes", "and", "commits", "the", "sql", "statement" ]
cb29899b984a21d56bf65d0b1d907073948fe16c
https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/database/coyote_db.py#L316-L323
train
Shapeways/coyote_framework
coyote_framework/database/coyote_db.py
CoyoteDb.insert_instance
def insert_instance(instance, table, **kwargs): """Inserts an object's values into a given table, will not populate Nonetype values @param instance: Instance of an object to insert @param table: Table in which to insert instance values @return: ID of the last inserted row """ ...
python
def insert_instance(instance, table, **kwargs): """Inserts an object's values into a given table, will not populate Nonetype values @param instance: Instance of an object to insert @param table: Table in which to insert instance values @return: ID of the last inserted row """ ...
[ "def", "insert_instance", "(", "instance", ",", "table", ",", "*", "*", "kwargs", ")", ":", "instancedict", "=", "instance", ".", "__dict__", ".", "copy", "(", ")", "instancedictclone", "=", "instancedict", ".", "copy", "(", ")", "# Remove all Nonetype values"...
Inserts an object's values into a given table, will not populate Nonetype values @param instance: Instance of an object to insert @param table: Table in which to insert instance values @return: ID of the last inserted row
[ "Inserts", "an", "object", "s", "values", "into", "a", "given", "table", "will", "not", "populate", "Nonetype", "values" ]
cb29899b984a21d56bf65d0b1d907073948fe16c
https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/database/coyote_db.py#L343-L366
train
Shapeways/coyote_framework
coyote_framework/database/coyote_db.py
CoyoteDb.update
def update(sql, *args, **kwargs): """Updates and commits with an insert sql statement, returns the record, but with a small chance of a race condition @param sql: sql to execute @return: The last row inserted """ assert "update" in sql.lower(), 'This function requires an...
python
def update(sql, *args, **kwargs): """Updates and commits with an insert sql statement, returns the record, but with a small chance of a race condition @param sql: sql to execute @return: The last row inserted """ assert "update" in sql.lower(), 'This function requires an...
[ "def", "update", "(", "sql", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "assert", "\"update\"", "in", "sql", ".", "lower", "(", ")", ",", "'This function requires an update statement, provided: {}'", ".", "format", "(", "sql", ")", "cursor", "=", ...
Updates and commits with an insert sql statement, returns the record, but with a small chance of a race condition @param sql: sql to execute @return: The last row inserted
[ "Updates", "and", "commits", "with", "an", "insert", "sql", "statement", "returns", "the", "record", "but", "with", "a", "small", "chance", "of", "a", "race", "condition" ]
cb29899b984a21d56bf65d0b1d907073948fe16c
https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/database/coyote_db.py#L369-L382
train
Shapeways/coyote_framework
coyote_framework/database/coyote_db.py
CoyoteDb.delete
def delete(sql, *args, **kwargs): """Deletes and commits with an insert sql statement""" assert "delete" in sql.lower(), 'This function requires a delete statement, provided: {}'.format(sql) CoyoteDb.execute_and_commit(sql, *args, **kwargs)
python
def delete(sql, *args, **kwargs): """Deletes and commits with an insert sql statement""" assert "delete" in sql.lower(), 'This function requires a delete statement, provided: {}'.format(sql) CoyoteDb.execute_and_commit(sql, *args, **kwargs)
[ "def", "delete", "(", "sql", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "assert", "\"delete\"", "in", "sql", ".", "lower", "(", ")", ",", "'This function requires a delete statement, provided: {}'", ".", "format", "(", "sql", ")", "CoyoteDb", ".", ...
Deletes and commits with an insert sql statement
[ "Deletes", "and", "commits", "with", "an", "insert", "sql", "statement" ]
cb29899b984a21d56bf65d0b1d907073948fe16c
https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/database/coyote_db.py#L385-L388
train
Shapeways/coyote_framework
coyote_framework/database/coyote_db.py
CoyoteDb.update_object_from_dictionary_representation
def update_object_from_dictionary_representation(dictionary, instance): """Given a dictionary and an object instance, will set all object attributes equal to the dictionary's keys and values. Assumes dictionary does not have any keys for which object does not have attributes @type dictionary: d...
python
def update_object_from_dictionary_representation(dictionary, instance): """Given a dictionary and an object instance, will set all object attributes equal to the dictionary's keys and values. Assumes dictionary does not have any keys for which object does not have attributes @type dictionary: d...
[ "def", "update_object_from_dictionary_representation", "(", "dictionary", ",", "instance", ")", ":", "for", "key", ",", "value", "in", "dictionary", ".", "iteritems", "(", ")", ":", "if", "hasattr", "(", "instance", ",", "key", ")", ":", "setattr", "(", "ins...
Given a dictionary and an object instance, will set all object attributes equal to the dictionary's keys and values. Assumes dictionary does not have any keys for which object does not have attributes @type dictionary: dict @param dictionary: Dictionary representation of the object @par...
[ "Given", "a", "dictionary", "and", "an", "object", "instance", "will", "set", "all", "object", "attributes", "equal", "to", "the", "dictionary", "s", "keys", "and", "values", ".", "Assumes", "dictionary", "does", "not", "have", "any", "keys", "for", "which",...
cb29899b984a21d56bf65d0b1d907073948fe16c
https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/database/coyote_db.py#L391-L404
train
Shapeways/coyote_framework
coyote_framework/database/coyote_db.py
CoyoteDb.format_time
def format_time(time): """Formats a time to be Shapeways database-compatible @param time: Datetime or string object to format @rtype: str @return: Time formatted as a string """ # Handle time typing try: time = time.isoformat() except Attribut...
python
def format_time(time): """Formats a time to be Shapeways database-compatible @param time: Datetime or string object to format @rtype: str @return: Time formatted as a string """ # Handle time typing try: time = time.isoformat() except Attribut...
[ "def", "format_time", "(", "time", ")", ":", "# Handle time typing", "try", ":", "time", "=", "time", ".", "isoformat", "(", ")", "except", "AttributeError", ":", "# Not a datetime object", "time", "=", "str", "(", "time", ")", "time", "=", "parser", ".", ...
Formats a time to be Shapeways database-compatible @param time: Datetime or string object to format @rtype: str @return: Time formatted as a string
[ "Formats", "a", "time", "to", "be", "Shapeways", "database", "-", "compatible" ]
cb29899b984a21d56bf65d0b1d907073948fe16c
https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/database/coyote_db.py#L407-L421
train
Shapeways/coyote_framework
coyote_framework/database/coyote_db.py
CoyoteDb.format_date
def format_date(date): """Formats a date to be Shapeways database-compatible @param date: Datetime or string object to format @rtype: str @return: Date formatted as a string """ # Handle time typing try: date = date.isoformat() except Attribut...
python
def format_date(date): """Formats a date to be Shapeways database-compatible @param date: Datetime or string object to format @rtype: str @return: Date formatted as a string """ # Handle time typing try: date = date.isoformat() except Attribut...
[ "def", "format_date", "(", "date", ")", ":", "# Handle time typing", "try", ":", "date", "=", "date", ".", "isoformat", "(", ")", "except", "AttributeError", ":", "# Not a datetime object", "date", "=", "str", "(", "date", ")", "date", "=", "parser", ".", ...
Formats a date to be Shapeways database-compatible @param date: Datetime or string object to format @rtype: str @return: Date formatted as a string
[ "Formats", "a", "date", "to", "be", "Shapeways", "database", "-", "compatible" ]
cb29899b984a21d56bf65d0b1d907073948fe16c
https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/database/coyote_db.py#L424-L438
train
Shapeways/coyote_framework
coyote_framework/webdriver/webdriverwrapper/WebDriverWrapper.py
WebDriverWrapper.visit
def visit(self, url=''): """ Driver gets the provided url in the browser, returns True if successful url -- An absolute or relative url stored as a string """ def _visit(url): if len(url) > 0 and url[0] == '/': # url's first character is a forward sla...
python
def visit(self, url=''): """ Driver gets the provided url in the browser, returns True if successful url -- An absolute or relative url stored as a string """ def _visit(url): if len(url) > 0 and url[0] == '/': # url's first character is a forward sla...
[ "def", "visit", "(", "self", ",", "url", "=", "''", ")", ":", "def", "_visit", "(", "url", ")", ":", "if", "len", "(", "url", ")", ">", "0", "and", "url", "[", "0", "]", "==", "'/'", ":", "# url's first character is a forward slash; treat as relative pat...
Driver gets the provided url in the browser, returns True if successful url -- An absolute or relative url stored as a string
[ "Driver", "gets", "the", "provided", "url", "in", "the", "browser", "returns", "True", "if", "successful" ]
cb29899b984a21d56bf65d0b1d907073948fe16c
https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/WebDriverWrapper.py#L201-L224
train
Shapeways/coyote_framework
coyote_framework/webdriver/webdriverwrapper/WebDriverWrapper.py
WebDriverWrapper.is_alert_present
def is_alert_present(self): """Tests if an alert is present @return: True if alert is present, False otherwise """ current_frame = None try: current_frame = self.driver.current_window_handle a = self.driver.switch_to_alert() a.text exc...
python
def is_alert_present(self): """Tests if an alert is present @return: True if alert is present, False otherwise """ current_frame = None try: current_frame = self.driver.current_window_handle a = self.driver.switch_to_alert() a.text exc...
[ "def", "is_alert_present", "(", "self", ")", ":", "current_frame", "=", "None", "try", ":", "current_frame", "=", "self", ".", "driver", ".", "current_window_handle", "a", "=", "self", ".", "driver", ".", "switch_to_alert", "(", ")", "a", ".", "text", "exc...
Tests if an alert is present @return: True if alert is present, False otherwise
[ "Tests", "if", "an", "alert", "is", "present" ]
cb29899b984a21d56bf65d0b1d907073948fe16c
https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/WebDriverWrapper.py#L258-L277
train
Shapeways/coyote_framework
coyote_framework/webdriver/webdriverwrapper/WebDriverWrapper.py
WebDriverWrapper.find
def find(self, locator, find_all=False, search_object=None, force_find=False, exclude_invisible=False): """ Attempts to locate an element, trying the number of times specified by the driver wrapper; Will throw a WebDriverWrapperException if no element is found @type locator: we...
python
def find(self, locator, find_all=False, search_object=None, force_find=False, exclude_invisible=False): """ Attempts to locate an element, trying the number of times specified by the driver wrapper; Will throw a WebDriverWrapperException if no element is found @type locator: we...
[ "def", "find", "(", "self", ",", "locator", ",", "find_all", "=", "False", ",", "search_object", "=", "None", ",", "force_find", "=", "False", ",", "exclude_invisible", "=", "False", ")", ":", "search_object", "=", "self", ".", "driver", "if", "search_obje...
Attempts to locate an element, trying the number of times specified by the driver wrapper; Will throw a WebDriverWrapperException if no element is found @type locator: webdriverwrapper.support.locator.Locator @param locator: the locator or css string used to query the element ...
[ "Attempts", "to", "locate", "an", "element", "trying", "the", "number", "of", "times", "specified", "by", "the", "driver", "wrapper", ";", "Will", "throw", "a", "WebDriverWrapperException", "if", "no", "element", "is", "found" ]
cb29899b984a21d56bf65d0b1d907073948fe16c
https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/WebDriverWrapper.py#L318-L387
train