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
zetaops/zengine
zengine/views/base.py
BaseView.set_current
def set_current(self, current): """ Creates some aliases for attributes of ``current``. Args: current: :attr:`~zengine.engine.WFCurrent` object. """ self.current = current self.input = current.input # self.req = current.request # self.resp = c...
python
def set_current(self, current): """ Creates some aliases for attributes of ``current``. Args: current: :attr:`~zengine.engine.WFCurrent` object. """ self.current = current self.input = current.input # self.req = current.request # self.resp = c...
[ "def", "set_current", "(", "self", ",", "current", ")", ":", "self", ".", "current", "=", "current", "self", ".", "input", "=", "current", ".", "input", "# self.req = current.request", "# self.resp = current.response", "self", ".", "output", "=", "current", ".",...
Creates some aliases for attributes of ``current``. Args: current: :attr:`~zengine.engine.WFCurrent` object.
[ "Creates", "some", "aliases", "for", "attributes", "of", "current", "." ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/views/base.py#L35-L52
train
zetaops/zengine
zengine/views/base.py
BaseView.form_out
def form_out(self, _form=None): """ Renders form. Applies form modifiers, then writes result to response payload. If supplied, given form object instance will be used instead of view's default ObjectForm. Args: _form (:py:attr:`~zengine.forms.json_form.JsonF...
python
def form_out(self, _form=None): """ Renders form. Applies form modifiers, then writes result to response payload. If supplied, given form object instance will be used instead of view's default ObjectForm. Args: _form (:py:attr:`~zengine.forms.json_form.JsonF...
[ "def", "form_out", "(", "self", ",", "_form", "=", "None", ")", ":", "_form", "=", "_form", "or", "self", ".", "object_form", "self", ".", "output", "[", "'forms'", "]", "=", "_form", ".", "serialize", "(", ")", "self", ".", "_add_meta_props", "(", "...
Renders form. Applies form modifiers, then writes result to response payload. If supplied, given form object instance will be used instead of view's default ObjectForm. Args: _form (:py:attr:`~zengine.forms.json_form.JsonForm`): Form object to override `self.o...
[ "Renders", "form", ".", "Applies", "form", "modifiers", "then", "writes", "result", "to", "response", "payload", ".", "If", "supplied", "given", "form", "object", "instance", "will", "be", "used", "instead", "of", "view", "s", "default", "ObjectForm", "." ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/views/base.py#L86-L103
train
zetaops/zengine
zengine/views/base.py
BaseView.set_client_cmd
def set_client_cmd(self, *args): """ Adds given cmd(s) to ``self.output['client_cmd']`` Args: *args: Client commands. """ self.client_cmd.update(args) self.output['client_cmd'] = list(self.client_cmd)
python
def set_client_cmd(self, *args): """ Adds given cmd(s) to ``self.output['client_cmd']`` Args: *args: Client commands. """ self.client_cmd.update(args) self.output['client_cmd'] = list(self.client_cmd)
[ "def", "set_client_cmd", "(", "self", ",", "*", "args", ")", ":", "self", ".", "client_cmd", ".", "update", "(", "args", ")", "self", ".", "output", "[", "'client_cmd'", "]", "=", "list", "(", "self", ".", "client_cmd", ")" ]
Adds given cmd(s) to ``self.output['client_cmd']`` Args: *args: Client commands.
[ "Adds", "given", "cmd", "(", "s", ")", "to", "self", ".", "output", "[", "client_cmd", "]" ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/views/base.py#L117-L125
train
zetaops/zengine
zengine/management_commands.py
UpdatePermissions.run
def run(self): """ Creates new permissions. """ from pyoko.lib.utils import get_object_from_path from zengine.config import settings model = get_object_from_path(settings.PERMISSION_MODEL) perm_provider = get_object_from_path(settings.PERMISSION_PROVIDER) ...
python
def run(self): """ Creates new permissions. """ from pyoko.lib.utils import get_object_from_path from zengine.config import settings model = get_object_from_path(settings.PERMISSION_MODEL) perm_provider = get_object_from_path(settings.PERMISSION_PROVIDER) ...
[ "def", "run", "(", "self", ")", ":", "from", "pyoko", ".", "lib", ".", "utils", "import", "get_object_from_path", "from", "zengine", ".", "config", "import", "settings", "model", "=", "get_object_from_path", "(", "settings", ".", "PERMISSION_MODEL", ")", "perm...
Creates new permissions.
[ "Creates", "new", "permissions", "." ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/management_commands.py#L44-L92
train
zetaops/zengine
zengine/management_commands.py
CreateUser.run
def run(self): """ Creates user, encrypts password. """ from zengine.models import User user = User(username=self.manager.args.username, superuser=self.manager.args.super) user.set_password(self.manager.args.password) user.save() print("New user created wi...
python
def run(self): """ Creates user, encrypts password. """ from zengine.models import User user = User(username=self.manager.args.username, superuser=self.manager.args.super) user.set_password(self.manager.args.password) user.save() print("New user created wi...
[ "def", "run", "(", "self", ")", ":", "from", "zengine", ".", "models", "import", "User", "user", "=", "User", "(", "username", "=", "self", ".", "manager", ".", "args", ".", "username", ",", "superuser", "=", "self", ".", "manager", ".", "args", ".",...
Creates user, encrypts password.
[ "Creates", "user", "encrypts", "password", "." ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/management_commands.py#L110-L118
train
zetaops/zengine
zengine/management_commands.py
RunServer.run
def run(self): """ Starts a development server for the zengine application """ print("Development server started on http://%s:%s. \n\nPress Ctrl+C to stop\n" % ( self.manager.args.addr, self.manager.args.port) ) if self.manager.args.server_ty...
python
def run(self): """ Starts a development server for the zengine application """ print("Development server started on http://%s:%s. \n\nPress Ctrl+C to stop\n" % ( self.manager.args.addr, self.manager.args.port) ) if self.manager.args.server_ty...
[ "def", "run", "(", "self", ")", ":", "print", "(", "\"Development server started on http://%s:%s. \\n\\nPress Ctrl+C to stop\\n\"", "%", "(", "self", ".", "manager", ".", "args", ".", "addr", ",", "self", ".", "manager", ".", "args", ".", "port", ")", ")", "if...
Starts a development server for the zengine application
[ "Starts", "a", "development", "server", "for", "the", "zengine", "application" ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/management_commands.py#L139-L150
train
zetaops/zengine
zengine/management_commands.py
RunServer.run_with_tornado
def run_with_tornado(self): """ runs the tornado/websockets based test server """ from zengine.tornado_server.server import runserver runserver(self.manager.args.addr, int(self.manager.args.port))
python
def run_with_tornado(self): """ runs the tornado/websockets based test server """ from zengine.tornado_server.server import runserver runserver(self.manager.args.addr, int(self.manager.args.port))
[ "def", "run_with_tornado", "(", "self", ")", ":", "from", "zengine", ".", "tornado_server", ".", "server", "import", "runserver", "runserver", "(", "self", ".", "manager", ".", "args", ".", "addr", ",", "int", "(", "self", ".", "manager", ".", "args", "....
runs the tornado/websockets based test server
[ "runs", "the", "tornado", "/", "websockets", "based", "test", "server" ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/management_commands.py#L152-L157
train
zetaops/zengine
zengine/management_commands.py
RunServer.run_with_falcon
def run_with_falcon(self): """ runs the falcon/http based test server """ from wsgiref import simple_server from zengine.server import app httpd = simple_server.make_server(self.manager.args.addr, int(self.manager.args.port), app) httpd.serve_forever()
python
def run_with_falcon(self): """ runs the falcon/http based test server """ from wsgiref import simple_server from zengine.server import app httpd = simple_server.make_server(self.manager.args.addr, int(self.manager.args.port), app) httpd.serve_forever()
[ "def", "run_with_falcon", "(", "self", ")", ":", "from", "wsgiref", "import", "simple_server", "from", "zengine", ".", "server", "import", "app", "httpd", "=", "simple_server", ".", "make_server", "(", "self", ".", "manager", ".", "args", ".", "addr", ",", ...
runs the falcon/http based test server
[ "runs", "the", "falcon", "/", "http", "based", "test", "server" ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/management_commands.py#L159-L166
train
zetaops/zengine
zengine/management_commands.py
RunWorker.run
def run(self): """ Starts a development server for the zengine application """ from zengine.wf_daemon import run_workers, Worker worker_count = int(self.manager.args.workers or 1) if not self.manager.args.daemonize: print("Starting worker(s)") if wor...
python
def run(self): """ Starts a development server for the zengine application """ from zengine.wf_daemon import run_workers, Worker worker_count = int(self.manager.args.workers or 1) if not self.manager.args.daemonize: print("Starting worker(s)") if wor...
[ "def", "run", "(", "self", ")", ":", "from", "zengine", ".", "wf_daemon", "import", "run_workers", ",", "Worker", "worker_count", "=", "int", "(", "self", ".", "manager", ".", "args", ".", "workers", "or", "1", ")", "if", "not", "self", ".", "manager",...
Starts a development server for the zengine application
[ "Starts", "a", "development", "server", "for", "the", "zengine", "application" ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/management_commands.py#L187-L203
train
zetaops/zengine
zengine/management_commands.py
ExtractTranslations._prepare_domain
def _prepare_domain(mapping): """Prepare a helper dictionary for the domain to temporarily hold some information.""" # Parse the domain-directory mapping try: domain, dir = mapping.split(':') except ValueError: print("Please provide the sources in the form of '<do...
python
def _prepare_domain(mapping): """Prepare a helper dictionary for the domain to temporarily hold some information.""" # Parse the domain-directory mapping try: domain, dir = mapping.split(':') except ValueError: print("Please provide the sources in the form of '<do...
[ "def", "_prepare_domain", "(", "mapping", ")", ":", "# Parse the domain-directory mapping", "try", ":", "domain", ",", "dir", "=", "mapping", ".", "split", "(", "':'", ")", "except", "ValueError", ":", "print", "(", "\"Please provide the sources in the form of '<domai...
Prepare a helper dictionary for the domain to temporarily hold some information.
[ "Prepare", "a", "helper", "dictionary", "for", "the", "domain", "to", "temporarily", "hold", "some", "information", "." ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/management_commands.py#L227-L248
train
zetaops/zengine
zengine/management_commands.py
ExtractTranslations._validate_domains
def _validate_domains(domains): """Check that all domains specified in the settings was provided in the options.""" missing = set(settings.TRANSLATION_DOMAINS.keys()) - set(domains.keys()) if missing: print('The following domains have been set in the configuration, ' ...
python
def _validate_domains(domains): """Check that all domains specified in the settings was provided in the options.""" missing = set(settings.TRANSLATION_DOMAINS.keys()) - set(domains.keys()) if missing: print('The following domains have been set in the configuration, ' ...
[ "def", "_validate_domains", "(", "domains", ")", ":", "missing", "=", "set", "(", "settings", ".", "TRANSLATION_DOMAINS", ".", "keys", "(", ")", ")", "-", "set", "(", "domains", ".", "keys", "(", ")", ")", "if", "missing", ":", "print", "(", "'The foll...
Check that all domains specified in the settings was provided in the options.
[ "Check", "that", "all", "domains", "specified", "in", "the", "settings", "was", "provided", "in", "the", "options", "." ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/management_commands.py#L251-L258
train
zetaops/zengine
zengine/management_commands.py
ExtractTranslations._extract_translations
def _extract_translations(self, domains): """Extract the translations into `.pot` files""" for domain, options in domains.items(): # Create the extractor extractor = babel_frontend.extract_messages() extractor.initialize_options() # The temporary location ...
python
def _extract_translations(self, domains): """Extract the translations into `.pot` files""" for domain, options in domains.items(): # Create the extractor extractor = babel_frontend.extract_messages() extractor.initialize_options() # The temporary location ...
[ "def", "_extract_translations", "(", "self", ",", "domains", ")", ":", "for", "domain", ",", "options", "in", "domains", ".", "items", "(", ")", ":", "# Create the extractor", "extractor", "=", "babel_frontend", ".", "extract_messages", "(", ")", "extractor", ...
Extract the translations into `.pot` files
[ "Extract", "the", "translations", "into", ".", "pot", "files" ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/management_commands.py#L260-L286
train
zetaops/zengine
zengine/management_commands.py
ExtractTranslations._init_update_po_files
def _init_update_po_files(self, domains): """Update or initialize the `.po` translation files""" for language in settings.TRANSLATIONS: for domain, options in domains.items(): if language == options['default']: continue # Default language of the domain doesn't need translati...
python
def _init_update_po_files(self, domains): """Update or initialize the `.po` translation files""" for language in settings.TRANSLATIONS: for domain, options in domains.items(): if language == options['default']: continue # Default language of the domain doesn't need translati...
[ "def", "_init_update_po_files", "(", "self", ",", "domains", ")", ":", "for", "language", "in", "settings", ".", "TRANSLATIONS", ":", "for", "domain", ",", "options", "in", "domains", ".", "items", "(", ")", ":", "if", "language", "==", "options", "[", "...
Update or initialize the `.po` translation files
[ "Update", "or", "initialize", "the", ".", "po", "translation", "files" ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/management_commands.py#L288-L298
train
zetaops/zengine
zengine/management_commands.py
ExtractTranslations._cleanup
def _cleanup(self, domains): """Remove the temporary '.pot' files that were created for the domains.""" for option in domains.values(): try: os.remove(option['pot']) except (IOError, OSError): # It is not a problem if we can't actually remove the t...
python
def _cleanup(self, domains): """Remove the temporary '.pot' files that were created for the domains.""" for option in domains.values(): try: os.remove(option['pot']) except (IOError, OSError): # It is not a problem if we can't actually remove the t...
[ "def", "_cleanup", "(", "self", ",", "domains", ")", ":", "for", "option", "in", "domains", ".", "values", "(", ")", ":", "try", ":", "os", ".", "remove", "(", "option", "[", "'pot'", "]", ")", "except", "(", "IOError", ",", "OSError", ")", ":", ...
Remove the temporary '.pot' files that were created for the domains.
[ "Remove", "the", "temporary", ".", "pot", "files", "that", "were", "created", "for", "the", "domains", "." ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/management_commands.py#L312-L319
train
zetaops/zengine
zengine/management_commands.py
LoadDiagrams.run
def run(self): """ read workflows, checks if it's updated, tries to update if there aren't any running instances of that wf """ from zengine.lib.cache import WFSpecNames if self.manager.args.clear: self._clear_models() return if self.mana...
python
def run(self): """ read workflows, checks if it's updated, tries to update if there aren't any running instances of that wf """ from zengine.lib.cache import WFSpecNames if self.manager.args.clear: self._clear_models() return if self.mana...
[ "def", "run", "(", "self", ")", ":", "from", "zengine", ".", "lib", ".", "cache", "import", "WFSpecNames", "if", "self", ".", "manager", ".", "args", ".", "clear", ":", "self", ".", "_clear_models", "(", ")", "return", "if", "self", ".", "manager", "...
read workflows, checks if it's updated, tries to update if there aren't any running instances of that wf
[ "read", "workflows", "checks", "if", "it", "s", "updated", "tries", "to", "update", "if", "there", "aren", "t", "any", "running", "instances", "of", "that", "wf" ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/management_commands.py#L450-L472
train
zetaops/zengine
zengine/management_commands.py
LoadDiagrams.get_wf_from_path
def get_wf_from_path(self, path): """ load xml from given path Args: path: diagram path Returns: """ with open(path) as fp: content = fp.read() return [(os.path.basename(os.path.splitext(path)[0]), content), ]
python
def get_wf_from_path(self, path): """ load xml from given path Args: path: diagram path Returns: """ with open(path) as fp: content = fp.read() return [(os.path.basename(os.path.splitext(path)[0]), content), ]
[ "def", "get_wf_from_path", "(", "self", ",", "path", ")", ":", "with", "open", "(", "path", ")", "as", "fp", ":", "content", "=", "fp", ".", "read", "(", ")", "return", "[", "(", "os", ".", "path", ".", "basename", "(", "os", ".", "path", ".", ...
load xml from given path Args: path: diagram path Returns:
[ "load", "xml", "from", "given", "path", "Args", ":", "path", ":", "diagram", "path" ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/management_commands.py#L515-L526
train
zetaops/zengine
zengine/management_commands.py
LoadDiagrams.get_workflows
def get_workflows(self): """ Scans and loads all wf found under WORKFLOW_PACKAGES_PATHS Yields: XML content of diagram file """ for pth in settings.WORKFLOW_PACKAGES_PATHS: for f in glob.glob("%s/*.bpmn" % pth): with open(f) as fp: ...
python
def get_workflows(self): """ Scans and loads all wf found under WORKFLOW_PACKAGES_PATHS Yields: XML content of diagram file """ for pth in settings.WORKFLOW_PACKAGES_PATHS: for f in glob.glob("%s/*.bpmn" % pth): with open(f) as fp: ...
[ "def", "get_workflows", "(", "self", ")", ":", "for", "pth", "in", "settings", ".", "WORKFLOW_PACKAGES_PATHS", ":", "for", "f", "in", "glob", ".", "glob", "(", "\"%s/*.bpmn\"", "%", "pth", ")", ":", "with", "open", "(", "f", ")", "as", "fp", ":", "yi...
Scans and loads all wf found under WORKFLOW_PACKAGES_PATHS Yields: XML content of diagram file
[ "Scans", "and", "loads", "all", "wf", "found", "under", "WORKFLOW_PACKAGES_PATHS" ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/management_commands.py#L528-L538
train
zetaops/zengine
zengine/management_commands.py
CheckList.check_migration_and_solr
def check_migration_and_solr(self): """ The model or models are checked for migrations that need to be done. Solr is also checked. """ from pyoko.db.schema_update import SchemaUpdater from socket import error as socket_error from pyoko.conf import settings...
python
def check_migration_and_solr(self): """ The model or models are checked for migrations that need to be done. Solr is also checked. """ from pyoko.db.schema_update import SchemaUpdater from socket import error as socket_error from pyoko.conf import settings...
[ "def", "check_migration_and_solr", "(", "self", ")", ":", "from", "pyoko", ".", "db", ".", "schema_update", "import", "SchemaUpdater", "from", "socket", "import", "error", "as", "socket_error", "from", "pyoko", ".", "conf", "import", "settings", "from", "importl...
The model or models are checked for migrations that need to be done. Solr is also checked.
[ "The", "model", "or", "models", "are", "checked", "for", "migrations", "that", "need", "to", "be", "done", ".", "Solr", "is", "also", "checked", "." ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/management_commands.py#L563-L583
train
zetaops/zengine
zengine/management_commands.py
CheckList.check_redis
def check_redis(): """ Redis checks the connection It displays on the screen whether or not you have a connection. """ from pyoko.db.connection import cache from redis.exceptions import ConnectionError try: cache.ping() print(Check...
python
def check_redis(): """ Redis checks the connection It displays on the screen whether or not you have a connection. """ from pyoko.db.connection import cache from redis.exceptions import ConnectionError try: cache.ping() print(Check...
[ "def", "check_redis", "(", ")", ":", "from", "pyoko", ".", "db", ".", "connection", "import", "cache", "from", "redis", ".", "exceptions", "import", "ConnectionError", "try", ":", "cache", ".", "ping", "(", ")", "print", "(", "CheckList", ".", "OKGREEN", ...
Redis checks the connection It displays on the screen whether or not you have a connection.
[ "Redis", "checks", "the", "connection", "It", "displays", "on", "the", "screen", "whether", "or", "not", "you", "have", "a", "connection", "." ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/management_commands.py#L586-L599
train
zetaops/zengine
zengine/management_commands.py
CheckList.check_riak
def check_riak(): """ Riak checks the connection It displays on the screen whether or not you have a connection. """ from pyoko.db.connection import client from socket import error as socket_error try: if client.ping(): print(_...
python
def check_riak(): """ Riak checks the connection It displays on the screen whether or not you have a connection. """ from pyoko.db.connection import client from socket import error as socket_error try: if client.ping(): print(_...
[ "def", "check_riak", "(", ")", ":", "from", "pyoko", ".", "db", ".", "connection", "import", "client", "from", "socket", "import", "error", "as", "socket_error", "try", ":", "if", "client", ".", "ping", "(", ")", ":", "print", "(", "__", "(", "u\"{0}Ri...
Riak checks the connection It displays on the screen whether or not you have a connection.
[ "Riak", "checks", "the", "connection", "It", "displays", "on", "the", "screen", "whether", "or", "not", "you", "have", "a", "connection", "." ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/management_commands.py#L602-L617
train
zetaops/zengine
zengine/management_commands.py
CheckList.check_mq_connection
def check_mq_connection(self): """ RabbitMQ checks the connection It displays on the screen whether or not you have a connection. """ import pika from zengine.client_queue import BLOCKING_MQ_PARAMS from pika.exceptions import ProbableAuthenticationError, Connectio...
python
def check_mq_connection(self): """ RabbitMQ checks the connection It displays on the screen whether or not you have a connection. """ import pika from zengine.client_queue import BLOCKING_MQ_PARAMS from pika.exceptions import ProbableAuthenticationError, Connectio...
[ "def", "check_mq_connection", "(", "self", ")", ":", "import", "pika", "from", "zengine", ".", "client_queue", "import", "BLOCKING_MQ_PARAMS", "from", "pika", ".", "exceptions", "import", "ProbableAuthenticationError", ",", "ConnectionClosed", "try", ":", "connection"...
RabbitMQ checks the connection It displays on the screen whether or not you have a connection.
[ "RabbitMQ", "checks", "the", "connection", "It", "displays", "on", "the", "screen", "whether", "or", "not", "you", "have", "a", "connection", "." ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/management_commands.py#L619-L639
train
zetaops/zengine
zengine/management_commands.py
CheckList.check_encoding_and_env
def check_encoding_and_env(): """ It brings the environment variables to the screen. The user checks to see if they are using the correct variables. """ import sys import os if sys.getfilesystemencoding() in ['utf-8', 'UTF-8']: print(__(u"{0}File syste...
python
def check_encoding_and_env(): """ It brings the environment variables to the screen. The user checks to see if they are using the correct variables. """ import sys import os if sys.getfilesystemencoding() in ['utf-8', 'UTF-8']: print(__(u"{0}File syste...
[ "def", "check_encoding_and_env", "(", ")", ":", "import", "sys", "import", "os", "if", "sys", ".", "getfilesystemencoding", "(", ")", "in", "[", "'utf-8'", ",", "'UTF-8'", "]", ":", "print", "(", "__", "(", "u\"{0}File system encoding correct{1}\"", ")", ".", ...
It brings the environment variables to the screen. The user checks to see if they are using the correct variables.
[ "It", "brings", "the", "environment", "variables", "to", "the", "screen", ".", "The", "user", "checks", "to", "see", "if", "they", "are", "using", "the", "correct", "variables", "." ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/management_commands.py#L642-L662
train
LordDarkula/chess_py
chess_py/game/game_state.py
no_moves
def no_moves(position): """ Finds if the game is over. :type: position: Board :rtype: bool """ return position.no_moves(color.white) \ or position.no_moves(color.black)
python
def no_moves(position): """ Finds if the game is over. :type: position: Board :rtype: bool """ return position.no_moves(color.white) \ or position.no_moves(color.black)
[ "def", "no_moves", "(", "position", ")", ":", "return", "position", ".", "no_moves", "(", "color", ".", "white", ")", "or", "position", ".", "no_moves", "(", "color", ".", "black", ")" ]
Finds if the game is over. :type: position: Board :rtype: bool
[ "Finds", "if", "the", "game", "is", "over", "." ]
14bebc2f8c49ae25c59375cc83d0b38d8ff7281d
https://github.com/LordDarkula/chess_py/blob/14bebc2f8c49ae25c59375cc83d0b38d8ff7281d/chess_py/game/game_state.py#L13-L21
train
LordDarkula/chess_py
chess_py/game/game_state.py
is_checkmate
def is_checkmate(position, input_color): """ Finds if particular King is checkmated. :type: position: Board :type: input_color: Color :rtype: bool """ return position.no_moves(input_color) and \ position.get_king(input_color).in_check(position)
python
def is_checkmate(position, input_color): """ Finds if particular King is checkmated. :type: position: Board :type: input_color: Color :rtype: bool """ return position.no_moves(input_color) and \ position.get_king(input_color).in_check(position)
[ "def", "is_checkmate", "(", "position", ",", "input_color", ")", ":", "return", "position", ".", "no_moves", "(", "input_color", ")", "and", "position", ".", "get_king", "(", "input_color", ")", ".", "in_check", "(", "position", ")" ]
Finds if particular King is checkmated. :type: position: Board :type: input_color: Color :rtype: bool
[ "Finds", "if", "particular", "King", "is", "checkmated", "." ]
14bebc2f8c49ae25c59375cc83d0b38d8ff7281d
https://github.com/LordDarkula/chess_py/blob/14bebc2f8c49ae25c59375cc83d0b38d8ff7281d/chess_py/game/game_state.py#L24-L33
train
zetaops/zengine
zengine/messaging/views.py
_paginate
def _paginate(self, current_page, query_set, per_page=10): """ Handles pagination of object listings. Args: current_page int: Current page number query_set (:class:`QuerySet<pyoko:pyoko.db.queryset.QuerySet>`): Object listing queryset. per_page int: ...
python
def _paginate(self, current_page, query_set, per_page=10): """ Handles pagination of object listings. Args: current_page int: Current page number query_set (:class:`QuerySet<pyoko:pyoko.db.queryset.QuerySet>`): Object listing queryset. per_page int: ...
[ "def", "_paginate", "(", "self", ",", "current_page", ",", "query_set", ",", "per_page", "=", "10", ")", ":", "total_objects", "=", "query_set", ".", "count", "(", ")", "total_pages", "=", "int", "(", "total_objects", "/", "per_page", "or", "1", ")", "# ...
Handles pagination of object listings. Args: current_page int: Current page number query_set (:class:`QuerySet<pyoko:pyoko.db.queryset.QuerySet>`): Object listing queryset. per_page int: Objects per page. Returns: QuerySet object, pagination ...
[ "Handles", "pagination", "of", "object", "listings", "." ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/views.py#L72-L97
train
zetaops/zengine
zengine/messaging/views.py
create_message
def create_message(current): """ Creates a message for the given channel. .. code-block:: python # request: { 'view':'_zops_create_message', 'message': { 'channel': key, # of channel 'body': string, # message text., ...
python
def create_message(current): """ Creates a message for the given channel. .. code-block:: python # request: { 'view':'_zops_create_message', 'message': { 'channel': key, # of channel 'body': string, # message text., ...
[ "def", "create_message", "(", "current", ")", ":", "msg", "=", "current", ".", "input", "[", "'message'", "]", "msg_obj", "=", "Channel", ".", "add_message", "(", "msg", "[", "'channel'", "]", ",", "body", "=", "msg", "[", "'body'", "]", ",", "typ", ...
Creates a message for the given channel. .. code-block:: python # request: { 'view':'_zops_create_message', 'message': { 'channel': key, # of channel 'body': string, # message text., 'type': int, # zengine.messa...
[ "Creates", "a", "message", "for", "the", "given", "channel", "." ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/views.py#L100-L139
train
zetaops/zengine
zengine/messaging/views.py
show_channel
def show_channel(current, waited=False): """ Initial display of channel content. Returns channel description, members, no of members, last 20 messages etc. .. code-block:: python # request: { 'view':'_zops_show_channel', 'key': key, } ...
python
def show_channel(current, waited=False): """ Initial display of channel content. Returns channel description, members, no of members, last 20 messages etc. .. code-block:: python # request: { 'view':'_zops_show_channel', 'key': key, } ...
[ "def", "show_channel", "(", "current", ",", "waited", "=", "False", ")", ":", "ch", "=", "Channel", "(", "current", ")", ".", "objects", ".", "get", "(", "current", ".", "input", "[", "'key'", "]", ")", "sbs", "=", "ch", ".", "get_subscription_for_user...
Initial display of channel content. Returns channel description, members, no of members, last 20 messages etc. .. code-block:: python # request: { 'view':'_zops_show_channel', 'key': key, } # response: { 'chann...
[ "Initial", "display", "of", "channel", "content", ".", "Returns", "channel", "description", "members", "no", "of", "members", "last", "20", "messages", "etc", "." ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/views.py#L142-L189
train
zetaops/zengine
zengine/messaging/views.py
channel_history
def channel_history(current): """ Get old messages for a channel. 20 messages per request .. code-block:: python # request: { 'view':'_zops_channel_history, 'channel_key': key, 'timestamp': datetime, # timestamp data of o...
python
def channel_history(current): """ Get old messages for a channel. 20 messages per request .. code-block:: python # request: { 'view':'_zops_channel_history, 'channel_key': key, 'timestamp': datetime, # timestamp data of o...
[ "def", "channel_history", "(", "current", ")", ":", "current", ".", "output", "=", "{", "'status'", ":", "'OK'", ",", "'code'", ":", "201", ",", "'messages'", ":", "[", "]", "}", "for", "msg", "in", "list", "(", "Message", ".", "objects", ".", "filte...
Get old messages for a channel. 20 messages per request .. code-block:: python # request: { 'view':'_zops_channel_history, 'channel_key': key, 'timestamp': datetime, # timestamp data of oldest shown message } ...
[ "Get", "old", "messages", "for", "a", "channel", ".", "20", "messages", "per", "request" ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/views.py#L192-L224
train
zetaops/zengine
zengine/messaging/views.py
report_last_seen_message
def report_last_seen_message(current): """ Push timestamp of latest message of an ACTIVE channel. This view should be called with timestamp of latest message; - When user opens (clicks on) a channel. - Periodically (eg: setInterval for 15secs) while user staying in a channel. .. code-block:: ...
python
def report_last_seen_message(current): """ Push timestamp of latest message of an ACTIVE channel. This view should be called with timestamp of latest message; - When user opens (clicks on) a channel. - Periodically (eg: setInterval for 15secs) while user staying in a channel. .. code-block:: ...
[ "def", "report_last_seen_message", "(", "current", ")", ":", "sbs", "=", "Subscriber", "(", "current", ")", ".", "objects", ".", "filter", "(", "channel_id", "=", "current", ".", "input", "[", "'channel_key'", "]", ",", "user_id", "=", "current", ".", "use...
Push timestamp of latest message of an ACTIVE channel. This view should be called with timestamp of latest message; - When user opens (clicks on) a channel. - Periodically (eg: setInterval for 15secs) while user staying in a channel. .. code-block:: python # request: { ...
[ "Push", "timestamp", "of", "latest", "message", "of", "an", "ACTIVE", "channel", "." ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/views.py#L227-L258
train
zetaops/zengine
zengine/messaging/views.py
list_channels
def list_channels(current): """ List channel memberships of current user .. code-block:: python # request: { 'view':'_zops_list_channels', } # response: { 'channels': [ {...
python
def list_channels(current): """ List channel memberships of current user .. code-block:: python # request: { 'view':'_zops_list_channels', } # response: { 'channels': [ {...
[ "def", "list_channels", "(", "current", ")", ":", "current", ".", "output", "=", "{", "'status'", ":", "'OK'", ",", "'code'", ":", "200", ",", "'channels'", ":", "[", "]", "}", "for", "sbs", "in", "current", ".", "user", ".", "subscriptions", ".", "o...
List channel memberships of current user .. code-block:: python # request: { 'view':'_zops_list_channels', } # response: { 'channels': [ {'name': string, # name of channel ...
[ "List", "channel", "memberships", "of", "current", "user" ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/views.py#L261-L302
train
zetaops/zengine
zengine/messaging/views.py
unread_count
def unread_count(current): """ Number of unread messages for current user .. code-block:: python # request: { 'view':'_zops_unread_count', } # response: { 'status': 'OK', 'co...
python
def unread_count(current): """ Number of unread messages for current user .. code-block:: python # request: { 'view':'_zops_unread_count', } # response: { 'status': 'OK', 'co...
[ "def", "unread_count", "(", "current", ")", ":", "unread_ntf", "=", "0", "unread_msg", "=", "0", "for", "sbs", "in", "current", ".", "user", ".", "subscriptions", ".", "objects", ".", "filter", "(", "is_visible", "=", "True", ")", ":", "try", ":", "if"...
Number of unread messages for current user .. code-block:: python # request: { 'view':'_zops_unread_count', } # response: { 'status': 'OK', 'code': 200, 'notifications': ...
[ "Number", "of", "unread", "messages", "for", "current", "user" ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/views.py#L305-L342
train
zetaops/zengine
zengine/messaging/views.py
get_notifications
def get_notifications(current): """ Returns last N notifications for current user .. code-block:: python # request: { 'view':'_zops_unread_messages', 'amount': int, # Optional, defaults to 8 } # response: ...
python
def get_notifications(current): """ Returns last N notifications for current user .. code-block:: python # request: { 'view':'_zops_unread_messages', 'amount': int, # Optional, defaults to 8 } # response: ...
[ "def", "get_notifications", "(", "current", ")", ":", "current", ".", "output", "=", "{", "'status'", ":", "'OK'", ",", "'code'", ":", "200", ",", "'notifications'", ":", "[", "]", ",", "}", "amount", "=", "current", ".", "input", ".", "get", "(", "'...
Returns last N notifications for current user .. code-block:: python # request: { 'view':'_zops_unread_messages', 'amount': int, # Optional, defaults to 8 } # response: { 'status': 'OK',...
[ "Returns", "last", "N", "notifications", "for", "current", "user" ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/views.py#L345-L394
train
zetaops/zengine
zengine/messaging/views.py
create_channel
def create_channel(current): """ Create a public channel. Can be a broadcast channel or normal chat room. Chat room and broadcast distinction will be made at user subscription phase. .. code-block:: python # request: { 'view':'_zops_create_chan...
python
def create_channel(current): """ Create a public channel. Can be a broadcast channel or normal chat room. Chat room and broadcast distinction will be made at user subscription phase. .. code-block:: python # request: { 'view':'_zops_create_chan...
[ "def", "create_channel", "(", "current", ")", ":", "channel", "=", "Channel", "(", "name", "=", "current", ".", "input", "[", "'name'", "]", ",", "description", "=", "current", ".", "input", "[", "'description'", "]", ",", "owner", "=", "current", ".", ...
Create a public channel. Can be a broadcast channel or normal chat room. Chat room and broadcast distinction will be made at user subscription phase. .. code-block:: python # request: { 'view':'_zops_create_channel', 'name': string, ...
[ "Create", "a", "public", "channel", ".", "Can", "be", "a", "broadcast", "channel", "or", "normal", "chat", "room", "." ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/views.py#L397-L442
train
zetaops/zengine
zengine/messaging/views.py
add_members
def add_members(current): """ Subscribe member(s) to a channel .. code-block:: python # request: { 'view':'_zops_add_members', 'channel_key': key, 'read_only': boolean, # true if this is a Broadcast channel, ...
python
def add_members(current): """ Subscribe member(s) to a channel .. code-block:: python # request: { 'view':'_zops_add_members', 'channel_key': key, 'read_only': boolean, # true if this is a Broadcast channel, ...
[ "def", "add_members", "(", "current", ")", ":", "newly_added", ",", "existing", "=", "[", "]", ",", "[", "]", "read_only", "=", "current", ".", "input", "[", "'read_only'", "]", "for", "member_key", "in", "current", ".", "input", "[", "'members'", "]", ...
Subscribe member(s) to a channel .. code-block:: python # request: { 'view':'_zops_add_members', 'channel_key': key, 'read_only': boolean, # true if this is a Broadcast channel, # false if it's a...
[ "Subscribe", "member", "(", "s", ")", "to", "a", "channel" ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/views.py#L445-L484
train
zetaops/zengine
zengine/messaging/views.py
add_unit_to_channel
def add_unit_to_channel(current): """ Subscribe users of a given unit to given channel JSON API: .. code-block:: python # request: { 'view':'_zops_add_unit_to_channel', 'unit_key': key, 'ch...
python
def add_unit_to_channel(current): """ Subscribe users of a given unit to given channel JSON API: .. code-block:: python # request: { 'view':'_zops_add_unit_to_channel', 'unit_key': key, 'ch...
[ "def", "add_unit_to_channel", "(", "current", ")", ":", "read_only", "=", "current", ".", "input", "[", "'read_only'", "]", "newly_added", ",", "existing", "=", "[", "]", ",", "[", "]", "for", "member_key", "in", "UnitModel", ".", "get_user_keys", "(", "cu...
Subscribe users of a given unit to given channel JSON API: .. code-block:: python # request: { 'view':'_zops_add_unit_to_channel', 'unit_key': key, 'channel_key': key, 'read_only': ...
[ "Subscribe", "users", "of", "a", "given", "unit", "to", "given", "channel" ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/views.py#L487-L528
train
zetaops/zengine
zengine/messaging/views.py
search_user
def search_user(current): """ Search users for adding to a public room or creating one to one direct messaging .. code-block:: python # request: { 'view':'_zops_search_user', 'query': string, } # res...
python
def search_user(current): """ Search users for adding to a public room or creating one to one direct messaging .. code-block:: python # request: { 'view':'_zops_search_user', 'query': string, } # res...
[ "def", "search_user", "(", "current", ")", ":", "current", ".", "output", "=", "{", "'results'", ":", "[", "]", ",", "'status'", ":", "'OK'", ",", "'code'", ":", "201", "}", "qs", "=", "UserModel", "(", "current", ")", ".", "objects", ".", "exclude",...
Search users for adding to a public room or creating one to one direct messaging .. code-block:: python # request: { 'view':'_zops_search_user', 'query': string, } # response: { '...
[ "Search", "users", "for", "adding", "to", "a", "public", "room", "or", "creating", "one", "to", "one", "direct", "messaging" ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/views.py#L531-L563
train
zetaops/zengine
zengine/messaging/views.py
search_unit
def search_unit(current): """ Search on units for subscribing it's users to a channel .. code-block:: python # request: { 'view':'_zops_search_unit', 'query': string, } # response: { ...
python
def search_unit(current): """ Search on units for subscribing it's users to a channel .. code-block:: python # request: { 'view':'_zops_search_unit', 'query': string, } # response: { ...
[ "def", "search_unit", "(", "current", ")", ":", "current", ".", "output", "=", "{", "'results'", ":", "[", "]", ",", "'status'", ":", "'OK'", ",", "'code'", ":", "201", "}", "for", "user", "in", "UnitModel", "(", "current", ")", ".", "objects", ".", ...
Search on units for subscribing it's users to a channel .. code-block:: python # request: { 'view':'_zops_search_unit', 'query': string, } # response: { 'results': [('name', 'key'), ], ...
[ "Search", "on", "units", "for", "subscribing", "it", "s", "users", "to", "a", "channel" ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/views.py#L566-L592
train
zetaops/zengine
zengine/messaging/views.py
create_direct_channel
def create_direct_channel(current): """ Create a One-To-One channel between current and selected user. .. code-block:: python # request: { 'view':'_zops_create_direct_channel', 'user_key': key, } # response: { 'des...
python
def create_direct_channel(current): """ Create a One-To-One channel between current and selected user. .. code-block:: python # request: { 'view':'_zops_create_direct_channel', 'user_key': key, } # response: { 'des...
[ "def", "create_direct_channel", "(", "current", ")", ":", "channel", ",", "sub_name", "=", "Channel", ".", "get_or_create_direct_channel", "(", "current", ".", "user_id", ",", "current", ".", "input", "[", "'user_key'", "]", ")", "current", ".", "input", "[", ...
Create a One-To-One channel between current and selected user. .. code-block:: python # request: { 'view':'_zops_create_direct_channel', 'user_key': key, } # response: { 'description': string, 'no_of_members': ...
[ "Create", "a", "One", "-", "To", "-", "One", "channel", "between", "current", "and", "selected", "user", "." ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/views.py#L595-L631
train
zetaops/zengine
zengine/messaging/views.py
find_message
def find_message(current): """ Search in messages. If "channel_key" given, search will be limited to that channel, otherwise search will be performed on all of user's subscribed channels. .. code-block:: python # request: { 'view':'_zops_search_...
python
def find_message(current): """ Search in messages. If "channel_key" given, search will be limited to that channel, otherwise search will be performed on all of user's subscribed channels. .. code-block:: python # request: { 'view':'_zops_search_...
[ "def", "find_message", "(", "current", ")", ":", "current", ".", "output", "=", "{", "'results'", ":", "[", "]", ",", "'status'", ":", "'OK'", ",", "'code'", ":", "201", "}", "query_set", "=", "Message", "(", "current", ")", ".", "objects", ".", "sea...
Search in messages. If "channel_key" given, search will be limited to that channel, otherwise search will be performed on all of user's subscribed channels. .. code-block:: python # request: { 'view':'_zops_search_unit, 'channel_key': key, ...
[ "Search", "in", "messages", ".", "If", "channel_key", "given", "search", "will", "be", "limited", "to", "that", "channel", "otherwise", "search", "will", "be", "performed", "on", "all", "of", "user", "s", "subscribed", "channels", "." ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/views.py#L634-L679
train
zetaops/zengine
zengine/messaging/views.py
delete_channel
def delete_channel(current): """ Delete a channel .. code-block:: python # request: { 'view':'_zops_delete_channel, 'channel_key': key, } # response: { 'status': 'OK', ...
python
def delete_channel(current): """ Delete a channel .. code-block:: python # request: { 'view':'_zops_delete_channel, 'channel_key': key, } # response: { 'status': 'OK', ...
[ "def", "delete_channel", "(", "current", ")", ":", "ch_key", "=", "current", ".", "input", "[", "'channel_key'", "]", "ch", "=", "Channel", "(", "current", ")", ".", "objects", ".", "get", "(", "owner_id", "=", "current", ".", "user_id", ",", "key", "=...
Delete a channel .. code-block:: python # request: { 'view':'_zops_delete_channel, 'channel_key': key, } # response: { 'status': 'OK', 'code': 200 }
[ "Delete", "a", "channel" ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/views.py#L682-L706
train
zetaops/zengine
zengine/messaging/views.py
edit_channel
def edit_channel(current): """ Update channel name or description .. code-block:: python # request: { 'view':'_zops_edit_channel, 'channel_key': key, 'name': string, 'description': string, ...
python
def edit_channel(current): """ Update channel name or description .. code-block:: python # request: { 'view':'_zops_edit_channel, 'channel_key': key, 'name': string, 'description': string, ...
[ "def", "edit_channel", "(", "current", ")", ":", "ch", "=", "Channel", "(", "current", ")", ".", "objects", ".", "get", "(", "owner_id", "=", "current", ".", "user_id", ",", "key", "=", "current", ".", "input", "[", "'channel_key'", "]", ")", "ch", "...
Update channel name or description .. code-block:: python # request: { 'view':'_zops_edit_channel, 'channel_key': key, 'name': string, 'description': string, } # response: ...
[ "Update", "channel", "name", "or", "description" ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/views.py#L709-L737
train
zetaops/zengine
zengine/messaging/views.py
pin_channel
def pin_channel(current): """ Pin a channel to top of channel list .. code-block:: python # request: { 'view':'_zops_pin_channel, 'channel_key': key, } # response: { 'status':...
python
def pin_channel(current): """ Pin a channel to top of channel list .. code-block:: python # request: { 'view':'_zops_pin_channel, 'channel_key': key, } # response: { 'status':...
[ "def", "pin_channel", "(", "current", ")", ":", "try", ":", "Subscriber", "(", "current", ")", ".", "objects", ".", "filter", "(", "user_id", "=", "current", ".", "user_id", ",", "channel_id", "=", "current", ".", "input", "[", "'channel_key'", "]", ")",...
Pin a channel to top of channel list .. code-block:: python # request: { 'view':'_zops_pin_channel, 'channel_key': key, } # response: { 'status': 'OK', 'code': 200 ...
[ "Pin", "a", "channel", "to", "top", "of", "channel", "list" ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/views.py#L740-L764
train
zetaops/zengine
zengine/messaging/views.py
delete_message
def delete_message(current): """ Delete a message .. code-block:: python # request: { 'view':'_zops_delete_message, 'message_key': key, } # response: { 'key': key, ...
python
def delete_message(current): """ Delete a message .. code-block:: python # request: { 'view':'_zops_delete_message, 'message_key': key, } # response: { 'key': key, ...
[ "def", "delete_message", "(", "current", ")", ":", "try", ":", "Message", "(", "current", ")", ".", "objects", ".", "get", "(", "sender_id", "=", "current", ".", "user_id", ",", "key", "=", "current", ".", "input", "[", "'key'", "]", ")", ".", "delet...
Delete a message .. code-block:: python # request: { 'view':'_zops_delete_message, 'message_key': key, } # response: { 'key': key, 'status': 'OK', 'code': ...
[ "Delete", "a", "message" ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/views.py#L767-L791
train
zetaops/zengine
zengine/messaging/views.py
edit_message
def edit_message(current): """ Edit a message a user own. .. code-block:: python # request: { 'view':'_zops_edit_message', 'message': { 'body': string, # message text 'key': key } } # response: ...
python
def edit_message(current): """ Edit a message a user own. .. code-block:: python # request: { 'view':'_zops_edit_message', 'message': { 'body': string, # message text 'key': key } } # response: ...
[ "def", "edit_message", "(", "current", ")", ":", "current", ".", "output", "=", "{", "'status'", ":", "'OK'", ",", "'code'", ":", "200", "}", "in_msg", "=", "current", ".", "input", "[", "'message'", "]", "try", ":", "msg", "=", "Message", "(", "curr...
Edit a message a user own. .. code-block:: python # request: { 'view':'_zops_edit_message', 'message': { 'body': string, # message text 'key': key } } # response: { 'status': string,...
[ "Edit", "a", "message", "a", "user", "own", "." ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/views.py#L794-L822
train
zetaops/zengine
zengine/messaging/views.py
flag_message
def flag_message(current): """ Flag inappropriate messages .. code-block:: python # request: { 'view':'_zops_flag_message', 'message_key': key, } # response: { ' 'status': 'Created', 'code': 201, ...
python
def flag_message(current): """ Flag inappropriate messages .. code-block:: python # request: { 'view':'_zops_flag_message', 'message_key': key, } # response: { ' 'status': 'Created', 'code': 201, ...
[ "def", "flag_message", "(", "current", ")", ":", "current", ".", "output", "=", "{", "'status'", ":", "'Created'", ",", "'code'", ":", "201", "}", "FlaggedMessage", ".", "objects", ".", "get_or_create", "(", "user_id", "=", "current", ".", "user_id", ",", ...
Flag inappropriate messages .. code-block:: python # request: { 'view':'_zops_flag_message', 'message_key': key, } # response: { ' 'status': 'Created', 'code': 201, }
[ "Flag", "inappropriate", "messages" ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/views.py#L825-L846
train
zetaops/zengine
zengine/messaging/views.py
unflag_message
def unflag_message(current): """ remove flag of a message .. code-block:: python # request: { 'view':'_zops_flag_message', 'key': key, } # response: { ' 'status': 'OK', 'code': 200, } "...
python
def unflag_message(current): """ remove flag of a message .. code-block:: python # request: { 'view':'_zops_flag_message', 'key': key, } # response: { ' 'status': 'OK', 'code': 200, } "...
[ "def", "unflag_message", "(", "current", ")", ":", "current", ".", "output", "=", "{", "'status'", ":", "'OK'", ",", "'code'", ":", "200", "}", "FlaggedMessage", "(", "current", ")", ".", "objects", ".", "filter", "(", "user_id", "=", "current", ".", "...
remove flag of a message .. code-block:: python # request: { 'view':'_zops_flag_message', 'key': key, } # response: { ' 'status': 'OK', 'code': 200, }
[ "remove", "flag", "of", "a", "message" ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/views.py#L849-L871
train
zetaops/zengine
zengine/messaging/views.py
get_message_actions
def get_message_actions(current): """ Returns applicable actions for current user for given message key .. code-block:: python # request: { 'view':'_zops_get_message_actions', 'key': key, } # response: { 'actions':[('name_stri...
python
def get_message_actions(current): """ Returns applicable actions for current user for given message key .. code-block:: python # request: { 'view':'_zops_get_message_actions', 'key': key, } # response: { 'actions':[('name_stri...
[ "def", "get_message_actions", "(", "current", ")", ":", "current", ".", "output", "=", "{", "'status'", ":", "'OK'", ",", "'code'", ":", "200", ",", "'actions'", ":", "Message", ".", "objects", ".", "get", "(", "current", ".", "input", "[", "'key'", "]...
Returns applicable actions for current user for given message key .. code-block:: python # request: { 'view':'_zops_get_message_actions', 'key': key, } # response: { 'actions':[('name_string', 'cmd_string'),] 'status': str...
[ "Returns", "applicable", "actions", "for", "current", "user", "for", "given", "message", "key" ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/views.py#L874-L896
train
zetaops/zengine
zengine/messaging/views.py
add_to_favorites
def add_to_favorites(current): """ Favorite a message .. code-block:: python # request: { 'view':'_zops_add_to_favorites, 'key': key, } # response: { 'status': 'Created', 'code': 201 'favorit...
python
def add_to_favorites(current): """ Favorite a message .. code-block:: python # request: { 'view':'_zops_add_to_favorites, 'key': key, } # response: { 'status': 'Created', 'code': 201 'favorit...
[ "def", "add_to_favorites", "(", "current", ")", ":", "msg", "=", "Message", ".", "objects", ".", "get", "(", "current", ".", "input", "[", "'key'", "]", ")", "current", ".", "output", "=", "{", "'status'", ":", "'Created'", ",", "'code'", ":", "201", ...
Favorite a message .. code-block:: python # request: { 'view':'_zops_add_to_favorites, 'key': key, } # response: { 'status': 'Created', 'code': 201 'favorite_key': key }
[ "Favorite", "a", "message" ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/views.py#L899-L922
train
zetaops/zengine
zengine/messaging/views.py
remove_from_favorites
def remove_from_favorites(current): """ Remove a message from favorites .. code-block:: python # request: { 'view':'_zops_remove_from_favorites, 'key': key, } # response: { 'status': 'OK', 'code': 200 ...
python
def remove_from_favorites(current): """ Remove a message from favorites .. code-block:: python # request: { 'view':'_zops_remove_from_favorites, 'key': key, } # response: { 'status': 'OK', 'code': 200 ...
[ "def", "remove_from_favorites", "(", "current", ")", ":", "try", ":", "current", ".", "output", "=", "{", "'status'", ":", "'OK'", ",", "'code'", ":", "200", "}", "Favorite", "(", "current", ")", ".", "objects", ".", "get", "(", "user_id", "=", "curren...
Remove a message from favorites .. code-block:: python # request: { 'view':'_zops_remove_from_favorites, 'key': key, } # response: { 'status': 'OK', 'code': 200 }
[ "Remove", "a", "message", "from", "favorites" ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/views.py#L925-L949
train
zetaops/zengine
zengine/messaging/views.py
list_favorites
def list_favorites(current): """ List user's favorites. If "channel_key" given, will return favorites belong to that channel. .. code-block:: python # request: { 'view':'_zops_list_favorites, 'channel_key': key, } # response: {...
python
def list_favorites(current): """ List user's favorites. If "channel_key" given, will return favorites belong to that channel. .. code-block:: python # request: { 'view':'_zops_list_favorites, 'channel_key': key, } # response: {...
[ "def", "list_favorites", "(", "current", ")", ":", "current", ".", "output", "=", "{", "'status'", ":", "'OK'", ",", "'code'", ":", "200", ",", "'favorites'", ":", "[", "]", "}", "query_set", "=", "Favorite", "(", "current", ")", ".", "objects", ".", ...
List user's favorites. If "channel_key" given, will return favorites belong to that channel. .. code-block:: python # request: { 'view':'_zops_list_favorites, 'channel_key': key, } # response: { 'status': 'OK', ...
[ "List", "user", "s", "favorites", ".", "If", "channel_key", "given", "will", "return", "favorites", "belong", "to", "that", "channel", "." ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/views.py#L952-L987
train
zetaops/zengine
zengine/messaging/model.py
Channel.get_or_create_direct_channel
def get_or_create_direct_channel(cls, initiator_key, receiver_key): """ Creates a direct messaging channel between two user Args: initiator: User, who want's to make first contact receiver: User, other party Returns: (Channel, receiver_name) ...
python
def get_or_create_direct_channel(cls, initiator_key, receiver_key): """ Creates a direct messaging channel between two user Args: initiator: User, who want's to make first contact receiver: User, other party Returns: (Channel, receiver_name) ...
[ "def", "get_or_create_direct_channel", "(", "cls", ",", "initiator_key", ",", "receiver_key", ")", ":", "existing", "=", "cls", ".", "objects", ".", "OR", "(", ")", ".", "filter", "(", "code_name", "=", "'%s_%s'", "%", "(", "initiator_key", ",", "receiver_ke...
Creates a direct messaging channel between two user Args: initiator: User, who want's to make first contact receiver: User, other party Returns: (Channel, receiver_name)
[ "Creates", "a", "direct", "messaging", "channel", "between", "two", "user" ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/model.py#L75-L102
train
zetaops/zengine
zengine/messaging/model.py
Channel.create_exchange
def create_exchange(self): """ Creates MQ exchange for this channel Needs to be defined only once. """ mq_channel = self._connect_mq() mq_channel.exchange_declare(exchange=self.code_name, exchange_type='fanout', ...
python
def create_exchange(self): """ Creates MQ exchange for this channel Needs to be defined only once. """ mq_channel = self._connect_mq() mq_channel.exchange_declare(exchange=self.code_name, exchange_type='fanout', ...
[ "def", "create_exchange", "(", "self", ")", ":", "mq_channel", "=", "self", ".", "_connect_mq", "(", ")", "mq_channel", ".", "exchange_declare", "(", "exchange", "=", "self", ".", "code_name", ",", "exchange_type", "=", "'fanout'", ",", "durable", "=", "True...
Creates MQ exchange for this channel Needs to be defined only once.
[ "Creates", "MQ", "exchange", "for", "this", "channel", "Needs", "to", "be", "defined", "only", "once", "." ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/model.py#L135-L143
train
zetaops/zengine
zengine/messaging/model.py
Channel.delete_exchange
def delete_exchange(self): """ Deletes MQ exchange for this channel Needs to be defined only once. """ mq_channel = self._connect_mq() mq_channel.exchange_delete(exchange=self.code_name)
python
def delete_exchange(self): """ Deletes MQ exchange for this channel Needs to be defined only once. """ mq_channel = self._connect_mq() mq_channel.exchange_delete(exchange=self.code_name)
[ "def", "delete_exchange", "(", "self", ")", ":", "mq_channel", "=", "self", ".", "_connect_mq", "(", ")", "mq_channel", ".", "exchange_delete", "(", "exchange", "=", "self", ".", "code_name", ")" ]
Deletes MQ exchange for this channel Needs to be defined only once.
[ "Deletes", "MQ", "exchange", "for", "this", "channel", "Needs", "to", "be", "defined", "only", "once", "." ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/model.py#L145-L151
train
zetaops/zengine
zengine/messaging/model.py
Subscriber.get_channel_listing
def get_channel_listing(self): """ serialized form for channel listing """ return {'name': self.name, 'key': self.channel.key, 'type': self.channel.typ, 'read_only': self.read_only, 'is_online': self.is_online(), ...
python
def get_channel_listing(self): """ serialized form for channel listing """ return {'name': self.name, 'key': self.channel.key, 'type': self.channel.typ, 'read_only': self.read_only, 'is_online': self.is_online(), ...
[ "def", "get_channel_listing", "(", "self", ")", ":", "return", "{", "'name'", ":", "self", ".", "name", ",", "'key'", ":", "self", ".", "channel", ".", "key", ",", "'type'", ":", "self", ".", "channel", ".", "typ", ",", "'read_only'", ":", "self", "....
serialized form for channel listing
[ "serialized", "form", "for", "channel", "listing" ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/model.py#L214-L225
train
zetaops/zengine
zengine/messaging/model.py
Subscriber.create_exchange
def create_exchange(self): """ Creates user's private exchange Actually user's private channel needed to be defined only once, and this should be happened when user first created. But since this has a little performance cost, to be safe we always call it before binding t...
python
def create_exchange(self): """ Creates user's private exchange Actually user's private channel needed to be defined only once, and this should be happened when user first created. But since this has a little performance cost, to be safe we always call it before binding t...
[ "def", "create_exchange", "(", "self", ")", ":", "channel", "=", "self", ".", "_connect_mq", "(", ")", "channel", ".", "exchange_declare", "(", "exchange", "=", "self", ".", "user", ".", "prv_exchange", ",", "exchange_type", "=", "'fanout'", ",", "durable", ...
Creates user's private exchange Actually user's private channel needed to be defined only once, and this should be happened when user first created. But since this has a little performance cost, to be safe we always call it before binding to the channel we currently subscribe
[ "Creates", "user", "s", "private", "exchange" ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/model.py#L264-L276
train
zetaops/zengine
zengine/messaging/model.py
Subscriber.bind_to_channel
def bind_to_channel(self): """ Binds (subscribes) users private exchange to channel exchange Automatically called at creation of subscription record. """ if self.channel.code_name != self.user.prv_exchange: channel = self._connect_mq() channel.exchange_bin...
python
def bind_to_channel(self): """ Binds (subscribes) users private exchange to channel exchange Automatically called at creation of subscription record. """ if self.channel.code_name != self.user.prv_exchange: channel = self._connect_mq() channel.exchange_bin...
[ "def", "bind_to_channel", "(", "self", ")", ":", "if", "self", ".", "channel", ".", "code_name", "!=", "self", ".", "user", ".", "prv_exchange", ":", "channel", "=", "self", ".", "_connect_mq", "(", ")", "channel", ".", "exchange_bind", "(", "source", "=...
Binds (subscribes) users private exchange to channel exchange Automatically called at creation of subscription record.
[ "Binds", "(", "subscribes", ")", "users", "private", "exchange", "to", "channel", "exchange", "Automatically", "called", "at", "creation", "of", "subscription", "record", "." ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/model.py#L282-L289
train
zetaops/zengine
zengine/messaging/model.py
Message.serialize
def serialize(self, user=None): """ Serializes message for given user. Note: Should be called before first save(). Otherwise "is_update" will get wrong value. Args: user: User object Returns: Dict. JSON serialization ready dictionary object ...
python
def serialize(self, user=None): """ Serializes message for given user. Note: Should be called before first save(). Otherwise "is_update" will get wrong value. Args: user: User object Returns: Dict. JSON serialization ready dictionary object ...
[ "def", "serialize", "(", "self", ",", "user", "=", "None", ")", ":", "return", "{", "'content'", ":", "self", ".", "body", ",", "'type'", ":", "self", ".", "typ", ",", "'updated_at'", ":", "self", ".", "updated_at", ",", "'timestamp'", ":", "self", "...
Serializes message for given user. Note: Should be called before first save(). Otherwise "is_update" will get wrong value. Args: user: User object Returns: Dict. JSON serialization ready dictionary object
[ "Serializes", "message", "for", "given", "user", "." ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/model.py#L370-L398
train
zetaops/zengine
zengine/messaging/model.py
Message._republish
def _republish(self): """ Re-publishes updated message """ mq_channel = self.channel._connect_mq() mq_channel.basic_publish(exchange=self.channel.key, routing_key='', body=json.dumps(self.serialize()))
python
def _republish(self): """ Re-publishes updated message """ mq_channel = self.channel._connect_mq() mq_channel.basic_publish(exchange=self.channel.key, routing_key='', body=json.dumps(self.serialize()))
[ "def", "_republish", "(", "self", ")", ":", "mq_channel", "=", "self", ".", "channel", ".", "_connect_mq", "(", ")", "mq_channel", ".", "basic_publish", "(", "exchange", "=", "self", ".", "channel", ".", "key", ",", "routing_key", "=", "''", ",", "body",...
Re-publishes updated message
[ "Re", "-", "publishes", "updated", "message" ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/model.py#L404-L410
train
chrismattmann/nutch-python
nutch/nutch.py
defaultCrawlId
def defaultCrawlId(): """ Provide a reasonable default crawl name using the user name and date """ timestamp = datetime.now().isoformat().replace(':', '_') user = getuser() return '_'.join(('crawl', user, timestamp))
python
def defaultCrawlId(): """ Provide a reasonable default crawl name using the user name and date """ timestamp = datetime.now().isoformat().replace(':', '_') user = getuser() return '_'.join(('crawl', user, timestamp))
[ "def", "defaultCrawlId", "(", ")", ":", "timestamp", "=", "datetime", ".", "now", "(", ")", ".", "isoformat", "(", ")", ".", "replace", "(", "':'", ",", "'_'", ")", "user", "=", "getuser", "(", ")", "return", "'_'", ".", "join", "(", "(", "'crawl'"...
Provide a reasonable default crawl name using the user name and date
[ "Provide", "a", "reasonable", "default", "crawl", "name", "using", "the", "user", "name", "and", "date" ]
07ae182e283b2f74ef062ddfa20a690a59ab6f5a
https://github.com/chrismattmann/nutch-python/blob/07ae182e283b2f74ef062ddfa20a690a59ab6f5a/nutch/nutch.py#L91-L98
train
chrismattmann/nutch-python
nutch/nutch.py
main
def main(argv=None): """Run Nutch command using REST API.""" global Verbose, Mock if argv is None: argv = sys.argv if len(argv) < 5: die('Bad args') try: opts, argv = getopt.getopt(argv[1:], 'hs:p:mv', ['help', 'server=', 'port=', 'mock', 'verbose']) except getopt.Geto...
python
def main(argv=None): """Run Nutch command using REST API.""" global Verbose, Mock if argv is None: argv = sys.argv if len(argv) < 5: die('Bad args') try: opts, argv = getopt.getopt(argv[1:], 'hs:p:mv', ['help', 'server=', 'port=', 'mock', 'verbose']) except getopt.Geto...
[ "def", "main", "(", "argv", "=", "None", ")", ":", "global", "Verbose", ",", "Mock", "if", "argv", "is", "None", ":", "argv", "=", "sys", ".", "argv", "if", "len", "(", "argv", ")", "<", "5", ":", "die", "(", "'Bad args'", ")", "try", ":", "opt...
Run Nutch command using REST API.
[ "Run", "Nutch", "command", "using", "REST", "API", "." ]
07ae182e283b2f74ef062ddfa20a690a59ab6f5a
https://github.com/chrismattmann/nutch-python/blob/07ae182e283b2f74ef062ddfa20a690a59ab6f5a/nutch/nutch.py#L716-L749
train
chrismattmann/nutch-python
nutch/nutch.py
Server.call
def call(self, verb, servicePath, data=None, headers=None, forceText=False, sendJson=True): """Call the Nutch Server, do some error checking, and return the response. :param verb: One of nutch.RequestVerbs :param servicePath: path component of URL to append to endpoint, e.g. '/config' :...
python
def call(self, verb, servicePath, data=None, headers=None, forceText=False, sendJson=True): """Call the Nutch Server, do some error checking, and return the response. :param verb: One of nutch.RequestVerbs :param servicePath: path component of URL to append to endpoint, e.g. '/config' :...
[ "def", "call", "(", "self", ",", "verb", ",", "servicePath", ",", "data", "=", "None", ",", "headers", "=", "None", ",", "forceText", "=", "False", ",", "sendJson", "=", "True", ")", ":", "default_data", "=", "{", "}", "if", "sendJson", "else", "\"\"...
Call the Nutch Server, do some error checking, and return the response. :param verb: One of nutch.RequestVerbs :param servicePath: path component of URL to append to endpoint, e.g. '/config' :param data: Data to attach to this request :param headers: headers to attach to this request, d...
[ "Call", "the", "Nutch", "Server", "do", "some", "error", "checking", "and", "return", "the", "response", "." ]
07ae182e283b2f74ef062ddfa20a690a59ab6f5a
https://github.com/chrismattmann/nutch-python/blob/07ae182e283b2f74ef062ddfa20a690a59ab6f5a/nutch/nutch.py#L117-L170
train
chrismattmann/nutch-python
nutch/nutch.py
ConfigClient.create
def create(self, cid, configData): """ Create a new named (cid) configuration from a parameter dictionary (config_data). """ configArgs = {'configId': cid, 'params': configData, 'force': True} cid = self.server.call('post', "/config/create", configArgs, forceText=True, headers=Te...
python
def create(self, cid, configData): """ Create a new named (cid) configuration from a parameter dictionary (config_data). """ configArgs = {'configId': cid, 'params': configData, 'force': True} cid = self.server.call('post', "/config/create", configArgs, forceText=True, headers=Te...
[ "def", "create", "(", "self", ",", "cid", ",", "configData", ")", ":", "configArgs", "=", "{", "'configId'", ":", "cid", ",", "'params'", ":", "configData", ",", "'force'", ":", "True", "}", "cid", "=", "self", ".", "server", ".", "call", "(", "'post...
Create a new named (cid) configuration from a parameter dictionary (config_data).
[ "Create", "a", "new", "named", "(", "cid", ")", "configuration", "from", "a", "parameter", "dictionary", "(", "config_data", ")", "." ]
07ae182e283b2f74ef062ddfa20a690a59ab6f5a
https://github.com/chrismattmann/nutch-python/blob/07ae182e283b2f74ef062ddfa20a690a59ab6f5a/nutch/nutch.py#L278-L285
train
chrismattmann/nutch-python
nutch/nutch.py
JobClient.list
def list(self, allJobs=False): """ Return list of jobs at this endpoint. Call get(allJobs=True) to see all jobs, not just the ones managed by this Client """ jobs = self.server.call('get', '/job') return [Job(job['id'], self.server) for job in jobs if allJobs or self._...
python
def list(self, allJobs=False): """ Return list of jobs at this endpoint. Call get(allJobs=True) to see all jobs, not just the ones managed by this Client """ jobs = self.server.call('get', '/job') return [Job(job['id'], self.server) for job in jobs if allJobs or self._...
[ "def", "list", "(", "self", ",", "allJobs", "=", "False", ")", ":", "jobs", "=", "self", ".", "server", ".", "call", "(", "'get'", ",", "'/job'", ")", "return", "[", "Job", "(", "job", "[", "'id'", "]", ",", "self", ".", "server", ")", "for", "...
Return list of jobs at this endpoint. Call get(allJobs=True) to see all jobs, not just the ones managed by this Client
[ "Return", "list", "of", "jobs", "at", "this", "endpoint", "." ]
07ae182e283b2f74ef062ddfa20a690a59ab6f5a
https://github.com/chrismattmann/nutch-python/blob/07ae182e283b2f74ef062ddfa20a690a59ab6f5a/nutch/nutch.py#L337-L346
train
chrismattmann/nutch-python
nutch/nutch.py
JobClient.create
def create(self, command, **args): """ Create a job given a command :param command: Nutch command, one of nutch.LegalJobs :param args: Additional arguments to pass to the job :return: The created Job """ command = command.upper() if command not in LegalJo...
python
def create(self, command, **args): """ Create a job given a command :param command: Nutch command, one of nutch.LegalJobs :param args: Additional arguments to pass to the job :return: The created Job """ command = command.upper() if command not in LegalJo...
[ "def", "create", "(", "self", ",", "command", ",", "*", "*", "args", ")", ":", "command", "=", "command", ".", "upper", "(", ")", "if", "command", "not", "in", "LegalJobs", ":", "warn", "(", "'Nutch command must be one of: %s'", "%", "', '", ".", "join",...
Create a job given a command :param command: Nutch command, one of nutch.LegalJobs :param args: Additional arguments to pass to the job :return: The created Job
[ "Create", "a", "job", "given", "a", "command", ":", "param", "command", ":", "Nutch", "command", "one", "of", "nutch", ".", "LegalJobs", ":", "param", "args", ":", "Additional", "arguments", "to", "pass", "to", "the", "job", ":", "return", ":", "The", ...
07ae182e283b2f74ef062ddfa20a690a59ab6f5a
https://github.com/chrismattmann/nutch-python/blob/07ae182e283b2f74ef062ddfa20a690a59ab6f5a/nutch/nutch.py#L348-L370
train
chrismattmann/nutch-python
nutch/nutch.py
JobClient.inject
def inject(self, seed=None, urlDir=None, **args): """ :param seed: A Seed object (this or urlDir must be specified) :param urlDir: The directory on the server containing the seed list (this or urlDir must be specified) :param args: Extra arguments for the job :return: a created J...
python
def inject(self, seed=None, urlDir=None, **args): """ :param seed: A Seed object (this or urlDir must be specified) :param urlDir: The directory on the server containing the seed list (this or urlDir must be specified) :param args: Extra arguments for the job :return: a created J...
[ "def", "inject", "(", "self", ",", "seed", "=", "None", ",", "urlDir", "=", "None", ",", "*", "*", "args", ")", ":", "if", "seed", ":", "if", "urlDir", "and", "urlDir", "!=", "seed", ".", "seedPath", ":", "raise", "NutchException", "(", "\"Can't spec...
:param seed: A Seed object (this or urlDir must be specified) :param urlDir: The directory on the server containing the seed list (this or urlDir must be specified) :param args: Extra arguments for the job :return: a created Job object
[ ":", "param", "seed", ":", "A", "Seed", "object", "(", "this", "or", "urlDir", "must", "be", "specified", ")", ":", "param", "urlDir", ":", "The", "directory", "on", "the", "server", "containing", "the", "seed", "list", "(", "this", "or", "urlDir", "mu...
07ae182e283b2f74ef062ddfa20a690a59ab6f5a
https://github.com/chrismattmann/nutch-python/blob/07ae182e283b2f74ef062ddfa20a690a59ab6f5a/nutch/nutch.py#L374-L391
train
chrismattmann/nutch-python
nutch/nutch.py
SeedClient.create
def create(self, sid, seedList): """ Create a new named (sid) Seed from a list of seed URLs :param sid: the name to assign to the new seed list :param seedList: the list of seeds to use :return: the created Seed object """ seedUrl = lambda uid, url: {"id": uid, ...
python
def create(self, sid, seedList): """ Create a new named (sid) Seed from a list of seed URLs :param sid: the name to assign to the new seed list :param seedList: the list of seeds to use :return: the created Seed object """ seedUrl = lambda uid, url: {"id": uid, ...
[ "def", "create", "(", "self", ",", "sid", ",", "seedList", ")", ":", "seedUrl", "=", "lambda", "uid", ",", "url", ":", "{", "\"id\"", ":", "uid", ",", "\"url\"", ":", "url", "}", "if", "not", "isinstance", "(", "seedList", ",", "tuple", ")", ":", ...
Create a new named (sid) Seed from a list of seed URLs :param sid: the name to assign to the new seed list :param seedList: the list of seeds to use :return: the created Seed object
[ "Create", "a", "new", "named", "(", "sid", ")", "Seed", "from", "a", "list", "of", "seed", "URLs" ]
07ae182e283b2f74ef062ddfa20a690a59ab6f5a
https://github.com/chrismattmann/nutch-python/blob/07ae182e283b2f74ef062ddfa20a690a59ab6f5a/nutch/nutch.py#L419-L442
train
chrismattmann/nutch-python
nutch/nutch.py
SeedClient.createFromFile
def createFromFile(self, sid, filename): """ Create a new named (sid) Seed from a file containing URLs It's assumed URLs are whitespace seperated. :param sid: the name to assign to the new seed list :param filename: the name of the file that contains URLs :return: the cr...
python
def createFromFile(self, sid, filename): """ Create a new named (sid) Seed from a file containing URLs It's assumed URLs are whitespace seperated. :param sid: the name to assign to the new seed list :param filename: the name of the file that contains URLs :return: the cr...
[ "def", "createFromFile", "(", "self", ",", "sid", ",", "filename", ")", ":", "urls", "=", "[", "]", "with", "open", "(", "filename", ")", "as", "f", ":", "for", "line", "in", "f", ":", "for", "url", "in", "line", ".", "split", "(", ")", ":", "u...
Create a new named (sid) Seed from a file containing URLs It's assumed URLs are whitespace seperated. :param sid: the name to assign to the new seed list :param filename: the name of the file that contains URLs :return: the created Seed object
[ "Create", "a", "new", "named", "(", "sid", ")", "Seed", "from", "a", "file", "containing", "URLs", "It", "s", "assumed", "URLs", "are", "whitespace", "seperated", "." ]
07ae182e283b2f74ef062ddfa20a690a59ab6f5a
https://github.com/chrismattmann/nutch-python/blob/07ae182e283b2f74ef062ddfa20a690a59ab6f5a/nutch/nutch.py#L444-L460
train
chrismattmann/nutch-python
nutch/nutch.py
CrawlClient._nextJob
def _nextJob(self, job, nextRound=True): """ Given a completed job, start the next job in the round, or return None :param nextRound: whether to start jobs from the next round if the current round is completed. :return: the newly started Job, or None if no job was started """ ...
python
def _nextJob(self, job, nextRound=True): """ Given a completed job, start the next job in the round, or return None :param nextRound: whether to start jobs from the next round if the current round is completed. :return: the newly started Job, or None if no job was started """ ...
[ "def", "_nextJob", "(", "self", ",", "job", ",", "nextRound", "=", "True", ")", ":", "jobInfo", "=", "job", ".", "info", "(", ")", "assert", "jobInfo", "[", "'state'", "]", "==", "'FINISHED'", "roundEnd", "=", "False", "if", "jobInfo", "[", "'type'", ...
Given a completed job, start the next job in the round, or return None :param nextRound: whether to start jobs from the next round if the current round is completed. :return: the newly started Job, or None if no job was started
[ "Given", "a", "completed", "job", "start", "the", "next", "job", "in", "the", "round", "or", "return", "None" ]
07ae182e283b2f74ef062ddfa20a690a59ab6f5a
https://github.com/chrismattmann/nutch-python/blob/07ae182e283b2f74ef062ddfa20a690a59ab6f5a/nutch/nutch.py#L492-L533
train
chrismattmann/nutch-python
nutch/nutch.py
CrawlClient.progress
def progress(self, nextRound=True): """ Check the status of the current job, activate the next job if it's finished, and return the active job If the current job has failed, a NutchCrawlException will be raised with no jobs attached. :param nextRound: whether to start jobs from the nex...
python
def progress(self, nextRound=True): """ Check the status of the current job, activate the next job if it's finished, and return the active job If the current job has failed, a NutchCrawlException will be raised with no jobs attached. :param nextRound: whether to start jobs from the nex...
[ "def", "progress", "(", "self", ",", "nextRound", "=", "True", ")", ":", "currentJob", "=", "self", ".", "currentJob", "if", "currentJob", "is", "None", ":", "return", "currentJob", "jobInfo", "=", "currentJob", ".", "info", "(", ")", "if", "jobInfo", "[...
Check the status of the current job, activate the next job if it's finished, and return the active job If the current job has failed, a NutchCrawlException will be raised with no jobs attached. :param nextRound: whether to start jobs from the next round if the current job/round is completed. :...
[ "Check", "the", "status", "of", "the", "current", "job", "activate", "the", "next", "job", "if", "it", "s", "finished", "and", "return", "the", "active", "job" ]
07ae182e283b2f74ef062ddfa20a690a59ab6f5a
https://github.com/chrismattmann/nutch-python/blob/07ae182e283b2f74ef062ddfa20a690a59ab6f5a/nutch/nutch.py#L535-L560
train
chrismattmann/nutch-python
nutch/nutch.py
CrawlClient.nextRound
def nextRound(self): """ Execute all jobs in the current round and return when they have finished. If a job fails, a NutchCrawlException will be raised, with all completed jobs from this round attached to the exception. :return: a list of all completed Jobs """ ...
python
def nextRound(self): """ Execute all jobs in the current round and return when they have finished. If a job fails, a NutchCrawlException will be raised, with all completed jobs from this round attached to the exception. :return: a list of all completed Jobs """ ...
[ "def", "nextRound", "(", "self", ")", ":", "finishedJobs", "=", "[", "]", "if", "self", ".", "currentJob", "is", "None", ":", "self", ".", "currentJob", "=", "self", ".", "jobClient", ".", "create", "(", "'GENERATE'", ")", "activeJob", "=", "self", "."...
Execute all jobs in the current round and return when they have finished. If a job fails, a NutchCrawlException will be raised, with all completed jobs from this round attached to the exception. :return: a list of all completed Jobs
[ "Execute", "all", "jobs", "in", "the", "current", "round", "and", "return", "when", "they", "have", "finished", "." ]
07ae182e283b2f74ef062ddfa20a690a59ab6f5a
https://github.com/chrismattmann/nutch-python/blob/07ae182e283b2f74ef062ddfa20a690a59ab6f5a/nutch/nutch.py#L573-L595
train
chrismattmann/nutch-python
nutch/nutch.py
CrawlClient.waitAll
def waitAll(self): """ Execute all queued rounds and return when they have finished. If a job fails, a NutchCrawlException will be raised, with all completed jobs attached to the exception :return: a list of jobs completed for each round, organized by round (list-of-lists) ...
python
def waitAll(self): """ Execute all queued rounds and return when they have finished. If a job fails, a NutchCrawlException will be raised, with all completed jobs attached to the exception :return: a list of jobs completed for each round, organized by round (list-of-lists) ...
[ "def", "waitAll", "(", "self", ")", ":", "finishedRounds", "=", "[", "self", ".", "nextRound", "(", ")", "]", "while", "self", ".", "currentRound", "<", "self", ".", "totalRounds", ":", "finishedRounds", ".", "append", "(", "self", ".", "nextRound", "(",...
Execute all queued rounds and return when they have finished. If a job fails, a NutchCrawlException will be raised, with all completed jobs attached to the exception :return: a list of jobs completed for each round, organized by round (list-of-lists)
[ "Execute", "all", "queued", "rounds", "and", "return", "when", "they", "have", "finished", "." ]
07ae182e283b2f74ef062ddfa20a690a59ab6f5a
https://github.com/chrismattmann/nutch-python/blob/07ae182e283b2f74ef062ddfa20a690a59ab6f5a/nutch/nutch.py#L597-L612
train
chrismattmann/nutch-python
nutch/nutch.py
Nutch.Jobs
def Jobs(self, crawlId=None): """ Create a JobClient for listing and creating jobs. The JobClient inherits the confId from the Nutch client. :param crawlId: crawlIds to use for this client. If not provided, will be generated by nutch.defaultCrawlId() :return: a JobClie...
python
def Jobs(self, crawlId=None): """ Create a JobClient for listing and creating jobs. The JobClient inherits the confId from the Nutch client. :param crawlId: crawlIds to use for this client. If not provided, will be generated by nutch.defaultCrawlId() :return: a JobClie...
[ "def", "Jobs", "(", "self", ",", "crawlId", "=", "None", ")", ":", "crawlId", "=", "crawlId", "if", "crawlId", "else", "defaultCrawlId", "(", ")", "return", "JobClient", "(", "self", ".", "server", ",", "crawlId", ",", "self", ".", "confId", ")" ]
Create a JobClient for listing and creating jobs. The JobClient inherits the confId from the Nutch client. :param crawlId: crawlIds to use for this client. If not provided, will be generated by nutch.defaultCrawlId() :return: a JobClient
[ "Create", "a", "JobClient", "for", "listing", "and", "creating", "jobs", ".", "The", "JobClient", "inherits", "the", "confId", "from", "the", "Nutch", "client", "." ]
07ae182e283b2f74ef062ddfa20a690a59ab6f5a
https://github.com/chrismattmann/nutch-python/blob/07ae182e283b2f74ef062ddfa20a690a59ab6f5a/nutch/nutch.py#L656-L666
train
chrismattmann/nutch-python
nutch/nutch.py
Nutch.Crawl
def Crawl(self, seed, seedClient=None, jobClient=None, rounds=1, index=True): """ Launch a crawl using the given seed :param seed: Type (Seed or SeedList) - used for crawl :param seedClient: if a SeedList is given, the SeedClient to upload, if None a default will be created :para...
python
def Crawl(self, seed, seedClient=None, jobClient=None, rounds=1, index=True): """ Launch a crawl using the given seed :param seed: Type (Seed or SeedList) - used for crawl :param seedClient: if a SeedList is given, the SeedClient to upload, if None a default will be created :para...
[ "def", "Crawl", "(", "self", ",", "seed", ",", "seedClient", "=", "None", ",", "jobClient", "=", "None", ",", "rounds", "=", "1", ",", "index", "=", "True", ")", ":", "if", "seedClient", "is", "None", ":", "seedClient", "=", "self", ".", "Seeds", "...
Launch a crawl using the given seed :param seed: Type (Seed or SeedList) - used for crawl :param seedClient: if a SeedList is given, the SeedClient to upload, if None a default will be created :param jobClient: the JobClient to be used, if None a default will be created :param rounds: th...
[ "Launch", "a", "crawl", "using", "the", "given", "seed", ":", "param", "seed", ":", "Type", "(", "Seed", "or", "SeedList", ")", "-", "used", "for", "crawl", ":", "param", "seedClient", ":", "if", "a", "SeedList", "is", "given", "the", "SeedClient", "to...
07ae182e283b2f74ef062ddfa20a690a59ab6f5a
https://github.com/chrismattmann/nutch-python/blob/07ae182e283b2f74ef062ddfa20a690a59ab6f5a/nutch/nutch.py#L677-L693
train
deep-compute/logagg
logagg/formatters.py
haproxy
def haproxy(line): #TODO Handle all message formats ''' >>> import pprint >>> input_line1 = 'Apr 24 00:00:02 node haproxy[12298]: 1.1.1.1:48660 [24/Apr/2019:00:00:02.358] pre-staging~ pre-staging_doc/pre-staging_active 261/0/2/8/271 200 2406 - - ---- 4/4/0/1/0 0/0 {AAAAAA:AAAAA_AAAAA:AAAAA_AAAAA_AAAAA:3...
python
def haproxy(line): #TODO Handle all message formats ''' >>> import pprint >>> input_line1 = 'Apr 24 00:00:02 node haproxy[12298]: 1.1.1.1:48660 [24/Apr/2019:00:00:02.358] pre-staging~ pre-staging_doc/pre-staging_active 261/0/2/8/271 200 2406 - - ---- 4/4/0/1/0 0/0 {AAAAAA:AAAAA_AAAAA:AAAAA_AAAAA_AAAAA:3...
[ "def", "haproxy", "(", "line", ")", ":", "#TODO Handle all message formats", "_line", "=", "line", ".", "strip", "(", ")", ".", "split", "(", ")", "log", "=", "{", "}", "log", "[", "'client_server'", "]", "=", "_line", "[", "5", "]", ".", "split", "(...
>>> import pprint >>> input_line1 = 'Apr 24 00:00:02 node haproxy[12298]: 1.1.1.1:48660 [24/Apr/2019:00:00:02.358] pre-staging~ pre-staging_doc/pre-staging_active 261/0/2/8/271 200 2406 - - ---- 4/4/0/1/0 0/0 {AAAAAA:AAAAA_AAAAA:AAAAA_AAAAA_AAAAA:300A||| user@mail.net:sdasdasdasdsdasAHDivsjd=|user@mail.net|2018} "G...
[ ">>>", "import", "pprint", ">>>", "input_line1", "=", "Apr", "24", "00", ":", "00", ":", "02", "node", "haproxy", "[", "12298", "]", ":", "1", ".", "1", ".", "1", ".", "1", ":", "48660", "[", "24", "/", "Apr", "/", "2019", ":", "00", ":", "00...
7863bc1b5ddf3e67c4d4b55746799304180589a0
https://github.com/deep-compute/logagg/blob/7863bc1b5ddf3e67c4d4b55746799304180589a0/logagg/formatters.py#L19-L94
train
deep-compute/logagg
logagg/formatters.py
nginx_access
def nginx_access(line): ''' >>> import pprint >>> input_line1 = '{ \ "remote_addr": "127.0.0.1","remote_user": "-","timestamp": "1515144699.201", \ "request": "GET / HTTP/1.1","status": "200","request_time": "0.000", \ "body_bytes_sent": "396","htt...
python
def nginx_access(line): ''' >>> import pprint >>> input_line1 = '{ \ "remote_addr": "127.0.0.1","remote_user": "-","timestamp": "1515144699.201", \ "request": "GET / HTTP/1.1","status": "200","request_time": "0.000", \ "body_bytes_sent": "396","htt...
[ "def", "nginx_access", "(", "line", ")", ":", "#TODO Handle nginx error logs", "log", "=", "json", ".", "loads", "(", "line", ")", "timestamp_iso", "=", "datetime", ".", "datetime", ".", "utcfromtimestamp", "(", "float", "(", "log", "[", "'timestamp'", "]", ...
>>> import pprint >>> input_line1 = '{ \ "remote_addr": "127.0.0.1","remote_user": "-","timestamp": "1515144699.201", \ "request": "GET / HTTP/1.1","status": "200","request_time": "0.000", \ "body_bytes_sent": "396","http_referer": "-","http_user_agent": "...
[ ">>>", "import", "pprint", ">>>", "input_line1", "=", "{", "\\", "remote_addr", ":", "127", ".", "0", ".", "0", ".", "1", "remote_user", ":", "-", "timestamp", ":", "1515144699", ".", "201", "\\", "request", ":", "GET", "/", "HTTP", "/", "1", ".", ...
7863bc1b5ddf3e67c4d4b55746799304180589a0
https://github.com/deep-compute/logagg/blob/7863bc1b5ddf3e67c4d4b55746799304180589a0/logagg/formatters.py#L96-L160
train
deep-compute/logagg
logagg/formatters.py
mongodb
def mongodb(line): ''' >>> import pprint >>> input_line1 = '2017-08-17T07:56:33.489+0200 I REPL [signalProcessingThread] shutting down replication subsystems' >>> output_line1 = mongodb(input_line1) >>> pprint.pprint(output_line1) {'data': {'component': 'REPL', 'context': '[sig...
python
def mongodb(line): ''' >>> import pprint >>> input_line1 = '2017-08-17T07:56:33.489+0200 I REPL [signalProcessingThread] shutting down replication subsystems' >>> output_line1 = mongodb(input_line1) >>> pprint.pprint(output_line1) {'data': {'component': 'REPL', 'context': '[sig...
[ "def", "mongodb", "(", "line", ")", ":", "keys", "=", "[", "'timestamp'", ",", "'severity'", ",", "'component'", ",", "'context'", ",", "'message'", "]", "values", "=", "re", ".", "split", "(", "r'\\s+'", ",", "line", ",", "maxsplit", "=", "4", ")", ...
>>> import pprint >>> input_line1 = '2017-08-17T07:56:33.489+0200 I REPL [signalProcessingThread] shutting down replication subsystems' >>> output_line1 = mongodb(input_line1) >>> pprint.pprint(output_line1) {'data': {'component': 'REPL', 'context': '[signalProcessingThread]', ...
[ ">>>", "import", "pprint", ">>>", "input_line1", "=", "2017", "-", "08", "-", "17T07", ":", "56", ":", "33", ".", "489", "+", "0200", "I", "REPL", "[", "signalProcessingThread", "]", "shutting", "down", "replication", "subsystems", ">>>", "output_line1", "...
7863bc1b5ddf3e67c4d4b55746799304180589a0
https://github.com/deep-compute/logagg/blob/7863bc1b5ddf3e67c4d4b55746799304180589a0/logagg/formatters.py#L162-L196
train
deep-compute/logagg
logagg/formatters.py
django
def django(line): ''' >>> import pprint >>> input_line1 = '[23/Aug/2017 11:35:25] INFO [app.middleware_log_req:50]View func called:{"exception": null,"processing_time": 0.00011801719665527344, "url": "<url>",host": "localhost", "user": "testing", "post_contents": "", "method": "POST" }' >>> output_line1...
python
def django(line): ''' >>> import pprint >>> input_line1 = '[23/Aug/2017 11:35:25] INFO [app.middleware_log_req:50]View func called:{"exception": null,"processing_time": 0.00011801719665527344, "url": "<url>",host": "localhost", "user": "testing", "post_contents": "", "method": "POST" }' >>> output_line1...
[ "def", "django", "(", "line", ")", ":", "#TODO we need to handle case2 logs", "data", "=", "{", "}", "log", "=", "re", ".", "findall", "(", "r'^(\\[\\d+/\\w+/\\d+ \\d+:\\d+:\\d+\\].*)'", ",", "line", ")", "if", "len", "(", "log", ")", "==", "1", ":", "data",...
>>> import pprint >>> input_line1 = '[23/Aug/2017 11:35:25] INFO [app.middleware_log_req:50]View func called:{"exception": null,"processing_time": 0.00011801719665527344, "url": "<url>",host": "localhost", "user": "testing", "post_contents": "", "method": "POST" }' >>> output_line1 = django(input_line1) >>>...
[ ">>>", "import", "pprint", ">>>", "input_line1", "=", "[", "23", "/", "Aug", "/", "2017", "11", ":", "35", ":", "25", "]", "INFO", "[", "app", ".", "middleware_log_req", ":", "50", "]", "View", "func", "called", ":", "{", "exception", ":", "null", ...
7863bc1b5ddf3e67c4d4b55746799304180589a0
https://github.com/deep-compute/logagg/blob/7863bc1b5ddf3e67c4d4b55746799304180589a0/logagg/formatters.py#L199-L271
train
deep-compute/logagg
logagg/formatters.py
basescript
def basescript(line): ''' >>> import pprint >>> input_line = '{"level": "warning", "timestamp": "2018-02-07T06:37:00.297610Z", "event": "exited via keyboard interrupt", "type": "log", "id": "20180207T063700_4d03fe800bd111e89ecb96000007bc65", "_": {"ln": 58, "file": "/usr/local/lib/python2.7/dist-packages/ba...
python
def basescript(line): ''' >>> import pprint >>> input_line = '{"level": "warning", "timestamp": "2018-02-07T06:37:00.297610Z", "event": "exited via keyboard interrupt", "type": "log", "id": "20180207T063700_4d03fe800bd111e89ecb96000007bc65", "_": {"ln": 58, "file": "/usr/local/lib/python2.7/dist-packages/ba...
[ "def", "basescript", "(", "line", ")", ":", "log", "=", "json", ".", "loads", "(", "line", ")", "return", "dict", "(", "timestamp", "=", "log", "[", "'timestamp'", "]", ",", "data", "=", "log", ",", "id", "=", "log", "[", "'id'", "]", ",", "type"...
>>> import pprint >>> input_line = '{"level": "warning", "timestamp": "2018-02-07T06:37:00.297610Z", "event": "exited via keyboard interrupt", "type": "log", "id": "20180207T063700_4d03fe800bd111e89ecb96000007bc65", "_": {"ln": 58, "file": "/usr/local/lib/python2.7/dist-packages/basescript/basescript.py", "name": "...
[ ">>>", "import", "pprint", ">>>", "input_line", "=", "{", "level", ":", "warning", "timestamp", ":", "2018", "-", "02", "-", "07T06", ":", "37", ":", "00", ".", "297610Z", "event", ":", "exited", "via", "keyboard", "interrupt", "type", ":", "log", "id"...
7863bc1b5ddf3e67c4d4b55746799304180589a0
https://github.com/deep-compute/logagg/blob/7863bc1b5ddf3e67c4d4b55746799304180589a0/logagg/formatters.py#L273-L304
train
deep-compute/logagg
logagg/formatters.py
elasticsearch
def elasticsearch(line): ''' >>> import pprint >>> input_line = '[2017-08-30T06:27:19,158] [WARN ][o.e.m.j.JvmGcMonitorService] [Glsuj_2] [gc][296816] overhead, spent [1.2s] collecting in the last [1.3s]' >>> output_line = elasticsearch(input_line) >>> pprint.pprint(output_line) {'data': {'garba...
python
def elasticsearch(line): ''' >>> import pprint >>> input_line = '[2017-08-30T06:27:19,158] [WARN ][o.e.m.j.JvmGcMonitorService] [Glsuj_2] [gc][296816] overhead, spent [1.2s] collecting in the last [1.3s]' >>> output_line = elasticsearch(input_line) >>> pprint.pprint(output_line) {'data': {'garba...
[ "def", "elasticsearch", "(", "line", ")", ":", "# TODO we need to handle case2 logs", "elasticsearch_log", "=", "line", "actuallog", "=", "re", ".", "findall", "(", "r'(\\[\\d+\\-+\\d+\\d+\\-+\\d+\\w+\\d+:\\d+:\\d+,+\\d\\d\\d+\\].*)'", ",", "elasticsearch_log", ")", "if", "...
>>> import pprint >>> input_line = '[2017-08-30T06:27:19,158] [WARN ][o.e.m.j.JvmGcMonitorService] [Glsuj_2] [gc][296816] overhead, spent [1.2s] collecting in the last [1.3s]' >>> output_line = elasticsearch(input_line) >>> pprint.pprint(output_line) {'data': {'garbage_collector': 'gc', 'g...
[ ">>>", "import", "pprint", ">>>", "input_line", "=", "[", "2017", "-", "08", "-", "30T06", ":", "27", ":", "19", "158", "]", "[", "WARN", "]", "[", "o", ".", "e", ".", "m", ".", "j", ".", "JvmGcMonitorService", "]", "[", "Glsuj_2", "]", "[", "g...
7863bc1b5ddf3e67c4d4b55746799304180589a0
https://github.com/deep-compute/logagg/blob/7863bc1b5ddf3e67c4d4b55746799304180589a0/logagg/formatters.py#L306-L370
train
deep-compute/logagg
logagg/formatters.py
elasticsearch_ispartial_log
def elasticsearch_ispartial_log(line): ''' >>> line1 = ' [2018-04-03T00:22:38,048][DEBUG][o.e.c.u.c.QueueResizingEsThreadPoolExecutor] [search17/search]: there were [2000] tasks in [809ms], avg task time [28.4micros], EWMA task execution [790nanos], [35165.36 tasks/s], optimal queue is [35165], current capacit...
python
def elasticsearch_ispartial_log(line): ''' >>> line1 = ' [2018-04-03T00:22:38,048][DEBUG][o.e.c.u.c.QueueResizingEsThreadPoolExecutor] [search17/search]: there were [2000] tasks in [809ms], avg task time [28.4micros], EWMA task execution [790nanos], [35165.36 tasks/s], optimal queue is [35165], current capacit...
[ "def", "elasticsearch_ispartial_log", "(", "line", ")", ":", "match_result", "=", "[", "]", "for", "p", "in", "LOG_BEGIN_PATTERN", ":", "if", "re", ".", "match", "(", "p", ",", "line", ")", "!=", "None", ":", "return", "False", "return", "True" ]
>>> line1 = ' [2018-04-03T00:22:38,048][DEBUG][o.e.c.u.c.QueueResizingEsThreadPoolExecutor] [search17/search]: there were [2000] tasks in [809ms], avg task time [28.4micros], EWMA task execution [790nanos], [35165.36 tasks/s], optimal queue is [35165], current capacity [1000]' >>> line2 = ' org.elasticsearch.Reso...
[ ">>>", "line1", "=", "[", "2018", "-", "04", "-", "03T00", ":", "22", ":", "38", "048", "]", "[", "DEBUG", "]", "[", "o", ".", "e", ".", "c", ".", "u", ".", "c", ".", "QueueResizingEsThreadPoolExecutor", "]", "[", "search17", "/", "search", "]", ...
7863bc1b5ddf3e67c4d4b55746799304180589a0
https://github.com/deep-compute/logagg/blob/7863bc1b5ddf3e67c4d4b55746799304180589a0/logagg/formatters.py#L374-L391
train
erik/alexandra
alexandra/session.py
Session.get
def get(self, attr, default=None): """Get an attribute defined by this session""" attrs = self.body.get('attributes') or {} return attrs.get(attr, default)
python
def get(self, attr, default=None): """Get an attribute defined by this session""" attrs = self.body.get('attributes') or {} return attrs.get(attr, default)
[ "def", "get", "(", "self", ",", "attr", ",", "default", "=", "None", ")", ":", "attrs", "=", "self", ".", "body", ".", "get", "(", "'attributes'", ")", "or", "{", "}", "return", "attrs", ".", "get", "(", "attr", ",", "default", ")" ]
Get an attribute defined by this session
[ "Get", "an", "attribute", "defined", "by", "this", "session" ]
8bea94efa1af465254a553dc4dfea3fa552b18da
https://github.com/erik/alexandra/blob/8bea94efa1af465254a553dc4dfea3fa552b18da/alexandra/session.py#L38-L42
train
zetaops/zengine
zengine/lib/catalog_data.py
CatalogData.get_all
def get_all(self, cat): """ if data can't found in cache then it will be fetched from db, parsed and stored to cache for each lang_code. :param cat: cat of catalog data :return: """ return self._get_from_local_cache(cat) or self._get_from_cache(cat) or self._get...
python
def get_all(self, cat): """ if data can't found in cache then it will be fetched from db, parsed and stored to cache for each lang_code. :param cat: cat of catalog data :return: """ return self._get_from_local_cache(cat) or self._get_from_cache(cat) or self._get...
[ "def", "get_all", "(", "self", ",", "cat", ")", ":", "return", "self", ".", "_get_from_local_cache", "(", "cat", ")", "or", "self", ".", "_get_from_cache", "(", "cat", ")", "or", "self", ".", "_get_from_db", "(", "cat", ")" ]
if data can't found in cache then it will be fetched from db, parsed and stored to cache for each lang_code. :param cat: cat of catalog data :return:
[ "if", "data", "can", "t", "found", "in", "cache", "then", "it", "will", "be", "fetched", "from", "db", "parsed", "and", "stored", "to", "cache", "for", "each", "lang_code", "." ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/lib/catalog_data.py#L58-L66
train
zetaops/zengine
zengine/lib/catalog_data.py
CatalogData._fill_get_item_cache
def _fill_get_item_cache(self, catalog, key): """ get from redis, cache locally then return :param catalog: catalog name :param key: :return: """ lang = self._get_lang() keylist = self.get_all(catalog) self.ITEM_CACHE[lang][catalog] = dict([(i['va...
python
def _fill_get_item_cache(self, catalog, key): """ get from redis, cache locally then return :param catalog: catalog name :param key: :return: """ lang = self._get_lang() keylist = self.get_all(catalog) self.ITEM_CACHE[lang][catalog] = dict([(i['va...
[ "def", "_fill_get_item_cache", "(", "self", ",", "catalog", ",", "key", ")", ":", "lang", "=", "self", ".", "_get_lang", "(", ")", "keylist", "=", "self", ".", "get_all", "(", "catalog", ")", "self", ".", "ITEM_CACHE", "[", "lang", "]", "[", "catalog",...
get from redis, cache locally then return :param catalog: catalog name :param key: :return:
[ "get", "from", "redis", "cache", "locally", "then", "return" ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/lib/catalog_data.py#L88-L99
train
erik/alexandra
alexandra/app.py
Application.run
def run(self, host, port, debug=True, validate_requests=True): """Utility method to quickly get a server up and running. :param debug: turns on Werkzeug debugger, code reloading, and full logging. :param validate_requests: whether or not to ensure that requests are sent ...
python
def run(self, host, port, debug=True, validate_requests=True): """Utility method to quickly get a server up and running. :param debug: turns on Werkzeug debugger, code reloading, and full logging. :param validate_requests: whether or not to ensure that requests are sent ...
[ "def", "run", "(", "self", ",", "host", ",", "port", ",", "debug", "=", "True", ",", "validate_requests", "=", "True", ")", ":", "if", "debug", ":", "# Turn on all alexandra log output", "logging", ".", "basicConfig", "(", "level", "=", "logging", ".", "DE...
Utility method to quickly get a server up and running. :param debug: turns on Werkzeug debugger, code reloading, and full logging. :param validate_requests: whether or not to ensure that requests are sent by Amazon. This can be usefulfor manually testing the server.
[ "Utility", "method", "to", "quickly", "get", "a", "server", "up", "and", "running", "." ]
8bea94efa1af465254a553dc4dfea3fa552b18da
https://github.com/erik/alexandra/blob/8bea94efa1af465254a553dc4dfea3fa552b18da/alexandra/app.py#L26-L40
train
erik/alexandra
alexandra/app.py
Application.dispatch_request
def dispatch_request(self, body): """Given a parsed JSON request object, call the correct Intent, Launch, or SessionEnded function. This function is called after request parsing and validaion and will raise a `ValueError` if an unknown request type comes in. :param body: JSON o...
python
def dispatch_request(self, body): """Given a parsed JSON request object, call the correct Intent, Launch, or SessionEnded function. This function is called after request parsing and validaion and will raise a `ValueError` if an unknown request type comes in. :param body: JSON o...
[ "def", "dispatch_request", "(", "self", ",", "body", ")", ":", "req_type", "=", "body", ".", "get", "(", "'request'", ",", "{", "}", ")", ".", "get", "(", "'type'", ")", "session_obj", "=", "body", ".", "get", "(", "'session'", ")", "session", "=", ...
Given a parsed JSON request object, call the correct Intent, Launch, or SessionEnded function. This function is called after request parsing and validaion and will raise a `ValueError` if an unknown request type comes in. :param body: JSON object loaded from incoming request's POST dat...
[ "Given", "a", "parsed", "JSON", "request", "object", "call", "the", "correct", "Intent", "Launch", "or", "SessionEnded", "function", "." ]
8bea94efa1af465254a553dc4dfea3fa552b18da
https://github.com/erik/alexandra/blob/8bea94efa1af465254a553dc4dfea3fa552b18da/alexandra/app.py#L42-L81
train
erik/alexandra
alexandra/app.py
Application.intent
def intent(self, intent_name): """Decorator to register a handler for the given intent. The decorated function can either take 0 or 2 arguments. If two are specified, it will be provided a dictionary of `{slot_name: value}` and a :py:class:`alexandra.session.Session` instance. ...
python
def intent(self, intent_name): """Decorator to register a handler for the given intent. The decorated function can either take 0 or 2 arguments. If two are specified, it will be provided a dictionary of `{slot_name: value}` and a :py:class:`alexandra.session.Session` instance. ...
[ "def", "intent", "(", "self", ",", "intent_name", ")", ":", "# nested decorator so we can have params.", "def", "_decorator", "(", "func", ")", ":", "arity", "=", "func", ".", "__code__", ".", "co_argcount", "if", "arity", "not", "in", "[", "0", ",", "2", ...
Decorator to register a handler for the given intent. The decorated function can either take 0 or 2 arguments. If two are specified, it will be provided a dictionary of `{slot_name: value}` and a :py:class:`alexandra.session.Session` instance. If no session was provided in the request,...
[ "Decorator", "to", "register", "a", "handler", "for", "the", "given", "intent", "." ]
8bea94efa1af465254a553dc4dfea3fa552b18da
https://github.com/erik/alexandra/blob/8bea94efa1af465254a553dc4dfea3fa552b18da/alexandra/app.py#L96-L125
train
zetaops/zengine
zengine/messaging/lib.py
BaseUser.set_password
def set_password(self, raw_password): """ Kullanıcı şifresini encrypt ederek set eder. Args: raw_password (str) """ self.password = pbkdf2_sha512.encrypt(raw_password, rounds=10000, salt_size=10)
python
def set_password(self, raw_password): """ Kullanıcı şifresini encrypt ederek set eder. Args: raw_password (str) """ self.password = pbkdf2_sha512.encrypt(raw_password, rounds=10000, salt_size=10)
[ "def", "set_password", "(", "self", ",", "raw_password", ")", ":", "self", ".", "password", "=", "pbkdf2_sha512", ".", "encrypt", "(", "raw_password", ",", "rounds", "=", "10000", ",", "salt_size", "=", "10", ")" ]
Kullanıcı şifresini encrypt ederek set eder. Args: raw_password (str)
[ "Kullanıcı", "şifresini", "encrypt", "ederek", "set", "eder", "." ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/lib.py#L56-L64
train
zetaops/zengine
zengine/messaging/lib.py
BaseUser.encrypt_password
def encrypt_password(self): """ encrypt password if not already encrypted """ if self.password and not self.password.startswith('$pbkdf2'): self.set_password(self.password)
python
def encrypt_password(self): """ encrypt password if not already encrypted """ if self.password and not self.password.startswith('$pbkdf2'): self.set_password(self.password)
[ "def", "encrypt_password", "(", "self", ")", ":", "if", "self", ".", "password", "and", "not", "self", ".", "password", ".", "startswith", "(", "'$pbkdf2'", ")", ":", "self", ".", "set_password", "(", "self", ".", "password", ")" ]
encrypt password if not already encrypted
[ "encrypt", "password", "if", "not", "already", "encrypted" ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/lib.py#L89-L92
train
zetaops/zengine
zengine/messaging/lib.py
BaseUser.send_notification
def send_notification(self, title, message, typ=1, url=None, sender=None): """ sends message to users private mq exchange Args: title: message: sender: url: typ: """ self.created_channels.channel.add_message( ...
python
def send_notification(self, title, message, typ=1, url=None, sender=None): """ sends message to users private mq exchange Args: title: message: sender: url: typ: """ self.created_channels.channel.add_message( ...
[ "def", "send_notification", "(", "self", ",", "title", ",", "message", ",", "typ", "=", "1", ",", "url", "=", "None", ",", "sender", "=", "None", ")", ":", "self", ".", "created_channels", ".", "channel", ".", "add_message", "(", "channel_key", "=", "s...
sends message to users private mq exchange Args: title: message: sender: url: typ:
[ "sends", "message", "to", "users", "private", "mq", "exchange", "Args", ":", "title", ":", "message", ":", "sender", ":", "url", ":", "typ", ":" ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/lib.py#L161-L179
train
zetaops/zengine
zengine/messaging/lib.py
BaseUser.send_client_cmd
def send_client_cmd(self, data, cmd=None, via_queue=None): """ Send arbitrary cmd and data to client if queue name passed by "via_queue" parameter, that queue will be used instead of users private exchange. Args: data: dict cmd: string via_que...
python
def send_client_cmd(self, data, cmd=None, via_queue=None): """ Send arbitrary cmd and data to client if queue name passed by "via_queue" parameter, that queue will be used instead of users private exchange. Args: data: dict cmd: string via_que...
[ "def", "send_client_cmd", "(", "self", ",", "data", ",", "cmd", "=", "None", ",", "via_queue", "=", "None", ")", ":", "mq_channel", "=", "self", ".", "_connect_mq", "(", ")", "if", "cmd", ":", "data", "[", "'cmd'", "]", "=", "cmd", "if", "via_queue",...
Send arbitrary cmd and data to client if queue name passed by "via_queue" parameter, that queue will be used instead of users private exchange. Args: data: dict cmd: string via_queue: queue name,
[ "Send", "arbitrary", "cmd", "and", "data", "to", "client" ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/lib.py#L181-L202
train
cimm-kzn/CGRtools
CGRtools/files/RDFrw.py
RDFread.seek
def seek(self, offset): """ shifts on a given number of record in the original file :param offset: number of record """ if self._shifts: if 0 <= offset < len(self._shifts): current_pos = self._file.tell() new_pos = self._shifts[offset] ...
python
def seek(self, offset): """ shifts on a given number of record in the original file :param offset: number of record """ if self._shifts: if 0 <= offset < len(self._shifts): current_pos = self._file.tell() new_pos = self._shifts[offset] ...
[ "def", "seek", "(", "self", ",", "offset", ")", ":", "if", "self", ".", "_shifts", ":", "if", "0", "<=", "offset", "<", "len", "(", "self", ".", "_shifts", ")", ":", "current_pos", "=", "self", ".", "_file", ".", "tell", "(", ")", "new_pos", "=",...
shifts on a given number of record in the original file :param offset: number of record
[ "shifts", "on", "a", "given", "number", "of", "record", "in", "the", "original", "file", ":", "param", "offset", ":", "number", "of", "record" ]
15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34
https://github.com/cimm-kzn/CGRtools/blob/15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34/CGRtools/files/RDFrw.py#L68-L94
train
cimm-kzn/CGRtools
CGRtools/files/RDFrw.py
RDFread.tell
def tell(self): """ :return: number of records processed from the original file """ if self._shifts: t = self._file.tell() if t == self._shifts[0]: return 0 elif t == self._shifts[-1]: return len(self._shifts) - 1 ...
python
def tell(self): """ :return: number of records processed from the original file """ if self._shifts: t = self._file.tell() if t == self._shifts[0]: return 0 elif t == self._shifts[-1]: return len(self._shifts) - 1 ...
[ "def", "tell", "(", "self", ")", ":", "if", "self", ".", "_shifts", ":", "t", "=", "self", ".", "_file", ".", "tell", "(", ")", "if", "t", "==", "self", ".", "_shifts", "[", "0", "]", ":", "return", "0", "elif", "t", "==", "self", ".", "_shif...
:return: number of records processed from the original file
[ ":", "return", ":", "number", "of", "records", "processed", "from", "the", "original", "file" ]
15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34
https://github.com/cimm-kzn/CGRtools/blob/15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34/CGRtools/files/RDFrw.py#L96-L110
train
zetaops/zengine
zengine/views/task_manager_actions.py
TaskManagerActionsView.assign_yourself
def assign_yourself(self): """ Assigning the workflow to itself. The selected job is checked to see if there is an assigned role. If it does not have a role assigned to it, it takes the job to itself and displays a message that the process is successful. ...
python
def assign_yourself(self): """ Assigning the workflow to itself. The selected job is checked to see if there is an assigned role. If it does not have a role assigned to it, it takes the job to itself and displays a message that the process is successful. ...
[ "def", "assign_yourself", "(", "self", ")", ":", "task_invitation", "=", "TaskInvitation", ".", "objects", ".", "get", "(", "self", ".", "task_invitation_key", ")", "wfi", "=", "task_invitation", ".", "instance", "if", "not", "wfi", ".", "current_actor", ".", ...
Assigning the workflow to itself. The selected job is checked to see if there is an assigned role. If it does not have a role assigned to it, it takes the job to itself and displays a message that the process is successful. If there is a role assigned to it, it does not d...
[ "Assigning", "the", "workflow", "to", "itself", ".", "The", "selected", "job", "is", "checked", "to", "see", "if", "there", "is", "an", "assigned", "role", ".", "If", "it", "does", "not", "have", "a", "role", "assigned", "to", "it", "it", "takes", "the...
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/views/task_manager_actions.py#L29-L60
train
zetaops/zengine
zengine/views/task_manager_actions.py
TaskManagerActionsView.select_role
def select_role(self): """ The workflow method to be assigned to the person with the same role and unit as the user. .. code-block:: python # request: { 'task_inv_key': string, } """ roles = [(m.key,...
python
def select_role(self): """ The workflow method to be assigned to the person with the same role and unit as the user. .. code-block:: python # request: { 'task_inv_key': string, } """ roles = [(m.key,...
[ "def", "select_role", "(", "self", ")", ":", "roles", "=", "[", "(", "m", ".", "key", ",", "m", ".", "__unicode__", "(", ")", ")", "for", "m", "in", "RoleModel", ".", "objects", ".", "filter", "(", "abstract_role", "=", "self", ".", "current", ".",...
The workflow method to be assigned to the person with the same role and unit as the user. .. code-block:: python # request: { 'task_inv_key': string, }
[ "The", "workflow", "method", "to", "be", "assigned", "to", "the", "person", "with", "the", "same", "role", "and", "unit", "as", "the", "user", ".", "..", "code", "-", "block", "::", "python" ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/views/task_manager_actions.py#L65-L90
train
zetaops/zengine
zengine/views/task_manager_actions.py
TaskManagerActionsView.send_workflow
def send_workflow(self): """ With the workflow instance and the task invitation is assigned a role. """ task_invitation = TaskInvitation.objects.get(self.task_invitation_key) wfi = task_invitation.instance select_role = self.input['form']['select_role'] if wfi.cur...
python
def send_workflow(self): """ With the workflow instance and the task invitation is assigned a role. """ task_invitation = TaskInvitation.objects.get(self.task_invitation_key) wfi = task_invitation.instance select_role = self.input['form']['select_role'] if wfi.cur...
[ "def", "send_workflow", "(", "self", ")", ":", "task_invitation", "=", "TaskInvitation", ".", "objects", ".", "get", "(", "self", ".", "task_invitation_key", ")", "wfi", "=", "task_invitation", ".", "instance", "select_role", "=", "self", ".", "input", "[", ...
With the workflow instance and the task invitation is assigned a role.
[ "With", "the", "workflow", "instance", "and", "the", "task", "invitation", "is", "assigned", "a", "role", "." ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/views/task_manager_actions.py#L92-L112
train
zetaops/zengine
zengine/views/task_manager_actions.py
TaskManagerActionsView.select_postponed_date
def select_postponed_date(self): """ The time intervals at which the workflow is to be extended are determined. .. code-block:: python # request: { 'task_inv_key': string, } """ _form = forms.Jso...
python
def select_postponed_date(self): """ The time intervals at which the workflow is to be extended are determined. .. code-block:: python # request: { 'task_inv_key': string, } """ _form = forms.Jso...
[ "def", "select_postponed_date", "(", "self", ")", ":", "_form", "=", "forms", ".", "JsonForm", "(", "title", "=", "\"Postponed Workflow\"", ")", "_form", ".", "start_date", "=", "fields", ".", "DateTime", "(", "\"Start Date\"", ")", "_form", ".", "finish_date"...
The time intervals at which the workflow is to be extended are determined. .. code-block:: python # request: { 'task_inv_key': string, }
[ "The", "time", "intervals", "at", "which", "the", "workflow", "is", "to", "be", "extended", "are", "determined", ".", "..", "code", "-", "block", "::", "python" ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/views/task_manager_actions.py#L117-L133
train
zetaops/zengine
zengine/views/task_manager_actions.py
TaskManagerActionsView.save_date
def save_date(self): """ Invitations with the same workflow status are deleted. Workflow instance and invitation roles change. """ task_invitation = TaskInvitation.objects.get(self.task_invitation_key) wfi = task_invitation.instance if wfi.current_actor.e...
python
def save_date(self): """ Invitations with the same workflow status are deleted. Workflow instance and invitation roles change. """ task_invitation = TaskInvitation.objects.get(self.task_invitation_key) wfi = task_invitation.instance if wfi.current_actor.e...
[ "def", "save_date", "(", "self", ")", ":", "task_invitation", "=", "TaskInvitation", ".", "objects", ".", "get", "(", "self", ".", "task_invitation_key", ")", "wfi", "=", "task_invitation", ".", "instance", "if", "wfi", ".", "current_actor", ".", "exist", "a...
Invitations with the same workflow status are deleted. Workflow instance and invitation roles change.
[ "Invitations", "with", "the", "same", "workflow", "status", "are", "deleted", ".", "Workflow", "instance", "and", "invitation", "roles", "change", "." ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/views/task_manager_actions.py#L135-L162
train
zetaops/zengine
zengine/views/task_manager_actions.py
TaskManagerActionsView.suspend
def suspend(self): """ If there is a role assigned to the workflow and it is the same as the user, it can drop the workflow. If it does not exist, it can not do anything. .. code-block:: python # request: { 'task_inv_ke...
python
def suspend(self): """ If there is a role assigned to the workflow and it is the same as the user, it can drop the workflow. If it does not exist, it can not do anything. .. code-block:: python # request: { 'task_inv_ke...
[ "def", "suspend", "(", "self", ")", ":", "task_invitation", "=", "TaskInvitation", ".", "objects", ".", "get", "(", "self", ".", "task_invitation_key", ")", "wfi", "=", "task_invitation", ".", "instance", "if", "wfi", ".", "current_actor", ".", "exist", "and...
If there is a role assigned to the workflow and it is the same as the user, it can drop the workflow. If it does not exist, it can not do anything. .. code-block:: python # request: { 'task_inv_key': string, }
[ "If", "there", "is", "a", "role", "assigned", "to", "the", "workflow", "and", "it", "is", "the", "same", "as", "the", "user", "it", "can", "drop", "the", "workflow", ".", "If", "it", "does", "not", "exist", "it", "can", "not", "do", "anything", "." ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/views/task_manager_actions.py#L167-L200
train
LordDarkula/chess_py
chess_py/pieces/pawn.py
Pawn.on_home_row
def on_home_row(self, location=None): """ Finds out if the piece is on the home row. :return: bool for whether piece is on home row or not """ location = location or self.location return (self.color == color.white and location.rank == 1) or \ (self.color =...
python
def on_home_row(self, location=None): """ Finds out if the piece is on the home row. :return: bool for whether piece is on home row or not """ location = location or self.location return (self.color == color.white and location.rank == 1) or \ (self.color =...
[ "def", "on_home_row", "(", "self", ",", "location", "=", "None", ")", ":", "location", "=", "location", "or", "self", ".", "location", "return", "(", "self", ".", "color", "==", "color", ".", "white", "and", "location", ".", "rank", "==", "1", ")", "...
Finds out if the piece is on the home row. :return: bool for whether piece is on home row or not
[ "Finds", "out", "if", "the", "piece", "is", "on", "the", "home", "row", "." ]
14bebc2f8c49ae25c59375cc83d0b38d8ff7281d
https://github.com/LordDarkula/chess_py/blob/14bebc2f8c49ae25c59375cc83d0b38d8ff7281d/chess_py/pieces/pawn.py#L51-L59
train
LordDarkula/chess_py
chess_py/pieces/pawn.py
Pawn.would_move_be_promotion
def would_move_be_promotion(self, location=None): """ Finds if move from current get_location would result in promotion :type: location: Location :rtype: bool """ location = location or self.location return (location.rank == 1 and self.color == color.black) or \ ...
python
def would_move_be_promotion(self, location=None): """ Finds if move from current get_location would result in promotion :type: location: Location :rtype: bool """ location = location or self.location return (location.rank == 1 and self.color == color.black) or \ ...
[ "def", "would_move_be_promotion", "(", "self", ",", "location", "=", "None", ")", ":", "location", "=", "location", "or", "self", ".", "location", "return", "(", "location", ".", "rank", "==", "1", "and", "self", ".", "color", "==", "color", ".", "black"...
Finds if move from current get_location would result in promotion :type: location: Location :rtype: bool
[ "Finds", "if", "move", "from", "current", "get_location", "would", "result", "in", "promotion" ]
14bebc2f8c49ae25c59375cc83d0b38d8ff7281d
https://github.com/LordDarkula/chess_py/blob/14bebc2f8c49ae25c59375cc83d0b38d8ff7281d/chess_py/pieces/pawn.py#L61-L70
train