partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
QueueManager.connect
Creates connection to RabbitMQ server
zengine/tornado_server/ws_to_queue.py
def connect(self): """ Creates connection to RabbitMQ server """ if self.connecting: log.info('PikaClient: Already connecting to RabbitMQ') return log.info('PikaClient: Connecting to RabbitMQ') self.connecting = True self.connection = Tor...
def connect(self): """ Creates connection to RabbitMQ server """ if self.connecting: log.info('PikaClient: Already connecting to RabbitMQ') return log.info('PikaClient: Connecting to RabbitMQ') self.connecting = True self.connection = Tor...
[ "Creates", "connection", "to", "RabbitMQ", "server" ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/tornado_server/ws_to_queue.py#L73-L87
[ "def", "connect", "(", "self", ")", ":", "if", "self", ".", "connecting", ":", "log", ".", "info", "(", "'PikaClient: Already connecting to RabbitMQ'", ")", "return", "log", ".", "info", "(", "'PikaClient: Connecting to RabbitMQ'", ")", "self", ".", "connecting", ...
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
QueueManager.on_connected
AMQP connection callback. Creates input channel. Args: connection: AMQP connection
zengine/tornado_server/ws_to_queue.py
def on_connected(self, connection): """ AMQP connection callback. Creates input channel. Args: connection: AMQP connection """ log.info('PikaClient: connected to RabbitMQ') self.connected = True self.in_channel = self.connection.channel(self.o...
def on_connected(self, connection): """ AMQP connection callback. Creates input channel. Args: connection: AMQP connection """ log.info('PikaClient: connected to RabbitMQ') self.connected = True self.in_channel = self.connection.channel(self.o...
[ "AMQP", "connection", "callback", ".", "Creates", "input", "channel", "." ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/tornado_server/ws_to_queue.py#L89-L99
[ "def", "on_connected", "(", "self", ",", "connection", ")", ":", "log", ".", "info", "(", "'PikaClient: connected to RabbitMQ'", ")", "self", ".", "connected", "=", "True", "self", ".", "in_channel", "=", "self", ".", "connection", ".", "channel", "(", "self...
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
QueueManager.on_channel_open
Input channel creation callback Queue declaration done here Args: channel: input channel
zengine/tornado_server/ws_to_queue.py
def on_channel_open(self, channel): """ Input channel creation callback Queue declaration done here Args: channel: input channel """ self.in_channel.exchange_declare(exchange='input_exc', type='topic', durable=True) channel.queue_declare(callback=self...
def on_channel_open(self, channel): """ Input channel creation callback Queue declaration done here Args: channel: input channel """ self.in_channel.exchange_declare(exchange='input_exc', type='topic', durable=True) channel.queue_declare(callback=self...
[ "Input", "channel", "creation", "callback", "Queue", "declaration", "done", "here" ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/tornado_server/ws_to_queue.py#L101-L110
[ "def", "on_channel_open", "(", "self", ",", "channel", ")", ":", "self", ".", "in_channel", ".", "exchange_declare", "(", "exchange", "=", "'input_exc'", ",", "type", "=", "'topic'", ",", "durable", "=", "True", ")", "channel", ".", "queue_declare", "(", "...
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
QueueManager.on_input_queue_declare
Input queue declaration callback. Input Queue/Exchange binding done here Args: queue: input queue
zengine/tornado_server/ws_to_queue.py
def on_input_queue_declare(self, queue): """ Input queue declaration callback. Input Queue/Exchange binding done here Args: queue: input queue """ self.in_channel.queue_bind(callback=None, exchange='input_exc', ...
def on_input_queue_declare(self, queue): """ Input queue declaration callback. Input Queue/Exchange binding done here Args: queue: input queue """ self.in_channel.queue_bind(callback=None, exchange='input_exc', ...
[ "Input", "queue", "declaration", "callback", ".", "Input", "Queue", "/", "Exchange", "binding", "done", "here" ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/tornado_server/ws_to_queue.py#L112-L123
[ "def", "on_input_queue_declare", "(", "self", ",", "queue", ")", ":", "self", ".", "in_channel", ".", "queue_bind", "(", "callback", "=", "None", ",", "exchange", "=", "'input_exc'", ",", "queue", "=", "self", ".", "INPUT_QUEUE_NAME", ",", "routing_key", "="...
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
WsgiApp.wsgi_app
Incoming request handler. :param request: Werkzeug request object
alexandra/wsgi.py
def wsgi_app(self, request): """Incoming request handler. :param request: Werkzeug request object """ try: if request.method != 'POST': abort(400) try: # Python 2.7 compatibility data = request.data ...
def wsgi_app(self, request): """Incoming request handler. :param request: Werkzeug request object """ try: if request.method != 'POST': abort(400) try: # Python 2.7 compatibility data = request.data ...
[ "Incoming", "request", "handler", "." ]
erik/alexandra
python
https://github.com/erik/alexandra/blob/8bea94efa1af465254a553dc4dfea3fa552b18da/alexandra/wsgi.py#L38-L75
[ "def", "wsgi_app", "(", "self", ",", "request", ")", ":", "try", ":", "if", "request", ".", "method", "!=", "'POST'", ":", "abort", "(", "400", ")", "try", ":", "# Python 2.7 compatibility", "data", "=", "request", ".", "data", "if", "isinstance", "(", ...
8bea94efa1af465254a553dc4dfea3fa552b18da
train
WithMixin.close
close opened file :param force: force closing of externally opened file or buffer
CGRtools/files/_CGRrw.py
def close(self, force=False): """ close opened file :param force: force closing of externally opened file or buffer """ if self.__write: self.write = self.__write_adhoc self.__write = False if not self._is_buffer or force: self._file....
def close(self, force=False): """ close opened file :param force: force closing of externally opened file or buffer """ if self.__write: self.write = self.__write_adhoc self.__write = False if not self._is_buffer or force: self._file....
[ "close", "opened", "file" ]
cimm-kzn/CGRtools
python
https://github.com/cimm-kzn/CGRtools/blob/15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34/CGRtools/files/_CGRrw.py#L57-L68
[ "def", "close", "(", "self", ",", "force", "=", "False", ")", ":", "if", "self", ".", "__write", ":", "self", ".", "write", "=", "self", ".", "__write_adhoc", "self", ".", "__write", "=", "False", "if", "not", "self", ".", "_is_buffer", "or", "force"...
15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34
train
CGRread._convert_reaction
map unmapped atoms.
CGRtools/files/_CGRrw.py
def _convert_reaction(self, reaction): if not (reaction['reactants'] or reaction['products'] or reaction['reagents']): raise ValueError('empty reaction') maps = {'reactants': [], 'products': [], 'reagents': []} for i, tmp in maps.items(): for molecule in reaction[i]: ...
def _convert_reaction(self, reaction): if not (reaction['reactants'] or reaction['products'] or reaction['reagents']): raise ValueError('empty reaction') maps = {'reactants': [], 'products': [], 'reagents': []} for i, tmp in maps.items(): for molecule in reaction[i]: ...
[ "map", "unmapped", "atoms", "." ]
cimm-kzn/CGRtools
python
https://github.com/cimm-kzn/CGRtools/blob/15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34/CGRtools/files/_CGRrw.py#L88-L158
[ "def", "_convert_reaction", "(", "self", ",", "reaction", ")", ":", "if", "not", "(", "reaction", "[", "'reactants'", "]", "or", "reaction", "[", "'products'", "]", "or", "reaction", "[", "'reagents'", "]", ")", ":", "raise", "ValueError", "(", "'empty rea...
15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34
train
Aromatize.aromatize
convert structure to aromatic form :return: number of processed rings
CGRtools/algorithms/aromatics.py
def aromatize(self): """ convert structure to aromatic form :return: number of processed rings """ rings = [x for x in self.sssr if 4 < len(x) < 7] if not rings: return 0 total = 0 while True: c = self._quinonize(rings, 'order') ...
def aromatize(self): """ convert structure to aromatic form :return: number of processed rings """ rings = [x for x in self.sssr if 4 < len(x) < 7] if not rings: return 0 total = 0 while True: c = self._quinonize(rings, 'order') ...
[ "convert", "structure", "to", "aromatic", "form" ]
cimm-kzn/CGRtools
python
https://github.com/cimm-kzn/CGRtools/blob/15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34/CGRtools/algorithms/aromatics.py#L25-L49
[ "def", "aromatize", "(", "self", ")", ":", "rings", "=", "[", "x", "for", "x", "in", "self", ".", "sssr", "if", "4", "<", "len", "(", "x", ")", "<", "7", "]", "if", "not", "rings", ":", "return", "0", "total", "=", "0", "while", "True", ":", ...
15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34
train
Crawler.crawl_cmd
Runs the crawl job for n rounds :param seed_list: lines of seed URLs :param n: number of rounds :return: number of successful rounds
nutch/crawl.py
def crawl_cmd(self, seed_list, n): ''' Runs the crawl job for n rounds :param seed_list: lines of seed URLs :param n: number of rounds :return: number of successful rounds ''' print("Num Rounds "+str(n)) cc = self.proxy.Crawl(seed=seed_list, rounds=n) ...
def crawl_cmd(self, seed_list, n): ''' Runs the crawl job for n rounds :param seed_list: lines of seed URLs :param n: number of rounds :return: number of successful rounds ''' print("Num Rounds "+str(n)) cc = self.proxy.Crawl(seed=seed_list, rounds=n) ...
[ "Runs", "the", "crawl", "job", "for", "n", "rounds", ":", "param", "seed_list", ":", "lines", "of", "seed", "URLs", ":", "param", "n", ":", "number", "of", "rounds", ":", "return", ":", "number", "of", "successful", "rounds" ]
chrismattmann/nutch-python
python
https://github.com/chrismattmann/nutch-python/blob/07ae182e283b2f74ef062ddfa20a690a59ab6f5a/nutch/crawl.py#L38-L51
[ "def", "crawl_cmd", "(", "self", ",", "seed_list", ",", "n", ")", ":", "print", "(", "\"Num Rounds \"", "+", "str", "(", "n", ")", ")", "cc", "=", "self", ".", "proxy", ".", "Crawl", "(", "seed", "=", "seed_list", ",", "rounds", "=", "n", ")", "r...
07ae182e283b2f74ef062ddfa20a690a59ab6f5a
train
Crawler.load_xml_conf
Creates a new config from xml file. :param xml_file: path to xml file. Format : nutch-site.xml or nutch-default.xml :param id: :return: config object
nutch/crawl.py
def load_xml_conf(self, xml_file, id): ''' Creates a new config from xml file. :param xml_file: path to xml file. Format : nutch-site.xml or nutch-default.xml :param id: :return: config object ''' # converting nutch-site.xml to key:value pairs import xml....
def load_xml_conf(self, xml_file, id): ''' Creates a new config from xml file. :param xml_file: path to xml file. Format : nutch-site.xml or nutch-default.xml :param id: :return: config object ''' # converting nutch-site.xml to key:value pairs import xml....
[ "Creates", "a", "new", "config", "from", "xml", "file", ".", ":", "param", "xml_file", ":", "path", "to", "xml", "file", ".", "Format", ":", "nutch", "-", "site", ".", "xml", "or", "nutch", "-", "default", ".", "xml", ":", "param", "id", ":", ":", ...
chrismattmann/nutch-python
python
https://github.com/chrismattmann/nutch-python/blob/07ae182e283b2f74ef062ddfa20a690a59ab6f5a/nutch/crawl.py#L53-L67
[ "def", "load_xml_conf", "(", "self", ",", "xml_file", ",", "id", ")", ":", "# converting nutch-site.xml to key:value pairs", "import", "xml", ".", "etree", ".", "ElementTree", "as", "ET", "tree", "=", "ET", ".", "parse", "(", "xml_file", ")", "params", "=", ...
07ae182e283b2f74ef062ddfa20a690a59ab6f5a
train
Crawler.create_cmd
'create' sub-command :param args: cli arguments :return:
nutch/crawl.py
def create_cmd(self, args): ''' 'create' sub-command :param args: cli arguments :return: ''' cmd = args.get('cmd_create') if cmd == 'conf': conf_file = args['conf_file'] conf_id = args['id'] return self.load_xml_conf(conf_file, ...
def create_cmd(self, args): ''' 'create' sub-command :param args: cli arguments :return: ''' cmd = args.get('cmd_create') if cmd == 'conf': conf_file = args['conf_file'] conf_id = args['id'] return self.load_xml_conf(conf_file, ...
[ "create", "sub", "-", "command", ":", "param", "args", ":", "cli", "arguments", ":", "return", ":" ]
chrismattmann/nutch-python
python
https://github.com/chrismattmann/nutch-python/blob/07ae182e283b2f74ef062ddfa20a690a59ab6f5a/nutch/crawl.py#L70-L82
[ "def", "create_cmd", "(", "self", ",", "args", ")", ":", "cmd", "=", "args", ".", "get", "(", "'cmd_create'", ")", "if", "cmd", "==", "'conf'", ":", "conf_file", "=", "args", "[", "'conf_file'", "]", "conf_id", "=", "args", "[", "'id'", "]", "return"...
07ae182e283b2f74ef062ddfa20a690a59ab6f5a
train
MRVwrite.close
write close tag of MRV file and close opened file :param force: force closing of externally opened file or buffer
CGRtools/files/MRVrw.py
def close(self, *args, **kwargs): """ write close tag of MRV file and close opened file :param force: force closing of externally opened file or buffer """ if not self.__finalized: self._file.write('</cml>') self.__finalized = True super().close(*...
def close(self, *args, **kwargs): """ write close tag of MRV file and close opened file :param force: force closing of externally opened file or buffer """ if not self.__finalized: self._file.write('</cml>') self.__finalized = True super().close(*...
[ "write", "close", "tag", "of", "MRV", "file", "and", "close", "opened", "file" ]
cimm-kzn/CGRtools
python
https://github.com/cimm-kzn/CGRtools/blob/15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34/CGRtools/files/MRVrw.py#L283-L292
[ "def", "close", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "self", ".", "__finalized", ":", "self", ".", "_file", ".", "write", "(", "'</cml>'", ")", "self", ".", "__finalized", "=", "True", "super", "(", ")", ...
15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34
train
MRVwrite.write
write single molecule or reaction into file
CGRtools/files/MRVrw.py
def write(self, data): """ write single molecule or reaction into file """ self._file.write('<cml>') self.__write(data) self.write = self.__write
def write(self, data): """ write single molecule or reaction into file """ self._file.write('<cml>') self.__write(data) self.write = self.__write
[ "write", "single", "molecule", "or", "reaction", "into", "file" ]
cimm-kzn/CGRtools
python
https://github.com/cimm-kzn/CGRtools/blob/15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34/CGRtools/files/MRVrw.py#L294-L300
[ "def", "write", "(", "self", ",", "data", ")", ":", "self", ".", "_file", ".", "write", "(", "'<cml>'", ")", "self", ".", "__write", "(", "data", ")", "self", ".", "write", "=", "self", ".", "__write" ]
15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34
train
MDLread._load_cache
the method is implemented for the purpose of optimization, byte positions will not be re-read from a file that has already been used, if the content of the file has changed, and the name has been left the same, the old version of byte offsets will be loaded :return: list of byte offsets from exi...
CGRtools/files/_MDLrw.py
def _load_cache(self): """ the method is implemented for the purpose of optimization, byte positions will not be re-read from a file that has already been used, if the content of the file has changed, and the name has been left the same, the old version of byte offsets will be loaded ...
def _load_cache(self): """ the method is implemented for the purpose of optimization, byte positions will not be re-read from a file that has already been used, if the content of the file has changed, and the name has been left the same, the old version of byte offsets will be loaded ...
[ "the", "method", "is", "implemented", "for", "the", "purpose", "of", "optimization", "byte", "positions", "will", "not", "be", "re", "-", "read", "from", "a", "file", "that", "has", "already", "been", "used", "if", "the", "content", "of", "the", "file", ...
cimm-kzn/CGRtools
python
https://github.com/cimm-kzn/CGRtools/blob/15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34/CGRtools/files/_MDLrw.py#L442-L457
[ "def", "_load_cache", "(", "self", ")", ":", "try", ":", "with", "open", "(", "self", ".", "__cache_path", ",", "'rb'", ")", "as", "f", ":", "return", "load", "(", "f", ")", "except", "FileNotFoundError", ":", "return", "except", "IsADirectoryError", "as...
15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34
train
MDLread._dump_cache
_shifts dumps in /tmp directory after reboot it will drop
CGRtools/files/_MDLrw.py
def _dump_cache(self, _shifts): """ _shifts dumps in /tmp directory after reboot it will drop """ with open(self.__cache_path, 'wb') as f: dump(_shifts, f)
def _dump_cache(self, _shifts): """ _shifts dumps in /tmp directory after reboot it will drop """ with open(self.__cache_path, 'wb') as f: dump(_shifts, f)
[ "_shifts", "dumps", "in", "/", "tmp", "directory", "after", "reboot", "it", "will", "drop" ]
cimm-kzn/CGRtools
python
https://github.com/cimm-kzn/CGRtools/blob/15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34/CGRtools/files/_MDLrw.py#L463-L468
[ "def", "_dump_cache", "(", "self", ",", "_shifts", ")", ":", "with", "open", "(", "self", ".", "__cache_path", ",", "'wb'", ")", "as", "f", ":", "dump", "(", "_shifts", ",", "f", ")" ]
15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34
train
get_task_types
List task types for current user .. code-block:: python # request: { 'view': '_zops_get_task_types', } # response: { 'task_types': [ {'name': string, # wf ...
zengine/views/system.py
def get_task_types(current): """ List task types for current user .. code-block:: python # request: { 'view': '_zops_get_task_types', } # response: { 'task_types':...
def get_task_types(current): """ List task types for current user .. code-block:: python # request: { 'view': '_zops_get_task_types', } # response: { 'task_types':...
[ "List", "task", "types", "for", "current", "user" ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/views/system.py#L23-L46
[ "def", "get_task_types", "(", "current", ")", ":", "current", ".", "output", "[", "'task_types'", "]", "=", "[", "{", "'name'", ":", "bpmn_wf", ".", "name", ",", "'title'", ":", "bpmn_wf", ".", "title", "}", "for", "bpmn_wf", "in", "BPMNWorkflow", ".", ...
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
get_task_detail
Show task details .. code-block:: python # request: { 'view': '_zops_get_task_detail', 'key': key, } # response: { 'task_title': string, 'tas...
zengine/views/system.py
def get_task_detail(current): """ Show task details .. code-block:: python # request: { 'view': '_zops_get_task_detail', 'key': key, } # response: { ...
def get_task_detail(current): """ Show task details .. code-block:: python # request: { 'view': '_zops_get_task_detail', 'key': key, } # response: { ...
[ "Show", "task", "details" ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/views/system.py#L50-L72
[ "def", "get_task_detail", "(", "current", ")", ":", "task_inv", "=", "TaskInvitation", ".", "objects", ".", "get", "(", "current", ".", "input", "[", "'key'", "]", ")", "obj", "=", "task_inv", ".", "instance", ".", "get_object", "(", ")", "current", ".",...
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
get_task_actions
List task types for current user .. code-block:: python # request: { 'view': '_zops_get_task_actions', 'key': key, } # response: { 'key': key, ...
zengine/views/system.py
def get_task_actions(current): """ List task types for current user .. code-block:: python # request: { 'view': '_zops_get_task_actions', 'key': key, } # response: ...
def get_task_actions(current): """ List task types for current user .. code-block:: python # request: { 'view': '_zops_get_task_actions', 'key': key, } # response: ...
[ "List", "task", "types", "for", "current", "user" ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/views/system.py#L76-L103
[ "def", "get_task_actions", "(", "current", ")", ":", "task_inv", "=", "TaskInvitation", ".", "objects", ".", "get", "(", "current", ".", "input", "[", "'key'", "]", ")", "actions", "=", "[", "{", "\"title\"", ":", "__", "(", "u\"Assign Someone Else\"", ")"...
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
get_tasks
List task invitations of current user .. code-block:: python # request: { 'view': '_zops_get_tasks', 'state': string, # one of these: # "active", "future", "finished", "expired" 'inverted': boolean, ...
zengine/views/system.py
def get_tasks(current): """ List task invitations of current user .. code-block:: python # request: { 'view': '_zops_get_tasks', 'state': string, # one of these: # "active", "future", "finished", "expire...
def get_tasks(current): """ List task invitations of current user .. code-block:: python # request: { 'view': '_zops_get_tasks', 'state': string, # one of these: # "active", "future", "finished", "expire...
[ "List", "task", "invitations", "of", "current", "user" ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/views/system.py#L107-L197
[ "def", "get_tasks", "(", "current", ")", ":", "# TODO: Also return invitations for user's other roles", "# TODO: Handle automatic role switching", "STATE_DICT", "=", "{", "'active'", ":", "[", "20", ",", "30", "]", ",", "'future'", ":", "10", ",", "'finished'", ":", ...
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
reduce_memory_usage
reduce memory usage of the dataframe - convert runIDs to categorical - downcast ints and floats
nanoget/utils.py
def reduce_memory_usage(df): """reduce memory usage of the dataframe - convert runIDs to categorical - downcast ints and floats """ usage_pre = df.memory_usage(deep=True).sum() if "runIDs" in df: df.loc[:, "runIDs"] = df.loc[:, "runIDs"].astype("category") df_int = df.select_dtypes(...
def reduce_memory_usage(df): """reduce memory usage of the dataframe - convert runIDs to categorical - downcast ints and floats """ usage_pre = df.memory_usage(deep=True).sum() if "runIDs" in df: df.loc[:, "runIDs"] = df.loc[:, "runIDs"].astype("category") df_int = df.select_dtypes(...
[ "reduce", "memory", "usage", "of", "the", "dataframe" ]
wdecoster/nanoget
python
https://github.com/wdecoster/nanoget/blob/fb7306220e261849b96785fab02dd2f35a0e3b60/nanoget/utils.py#L7-L27
[ "def", "reduce_memory_usage", "(", "df", ")", ":", "usage_pre", "=", "df", ".", "memory_usage", "(", "deep", "=", "True", ")", ".", "sum", "(", ")", "if", "\"runIDs\"", "in", "df", ":", "df", ".", "loc", "[", ":", ",", "\"runIDs\"", "]", "=", "df",...
fb7306220e261849b96785fab02dd2f35a0e3b60
train
check_existance
Check if the file supplied as input exists.
nanoget/utils.py
def check_existance(f): """Check if the file supplied as input exists.""" if not opath.isfile(f): logging.error("Nanoget: File provided doesn't exist or the path is incorrect: {}".format(f)) sys.exit("File provided doesn't exist or the path is incorrect: {}".format(f))
def check_existance(f): """Check if the file supplied as input exists.""" if not opath.isfile(f): logging.error("Nanoget: File provided doesn't exist or the path is incorrect: {}".format(f)) sys.exit("File provided doesn't exist or the path is incorrect: {}".format(f))
[ "Check", "if", "the", "file", "supplied", "as", "input", "exists", "." ]
wdecoster/nanoget
python
https://github.com/wdecoster/nanoget/blob/fb7306220e261849b96785fab02dd2f35a0e3b60/nanoget/utils.py#L30-L34
[ "def", "check_existance", "(", "f", ")", ":", "if", "not", "opath", ".", "isfile", "(", "f", ")", ":", "logging", ".", "error", "(", "\"Nanoget: File provided doesn't exist or the path is incorrect: {}\"", ".", "format", "(", "f", ")", ")", "sys", ".", "exit",...
fb7306220e261849b96785fab02dd2f35a0e3b60
train
RoleSwitching.list_user_roles
Lists user roles as selectable except user's current role.
zengine/views/role_switching.py
def list_user_roles(self): """ Lists user roles as selectable except user's current role. """ _form = JsonForm(current=self.current, title=_(u"Switch Role")) _form.help_text = "Your current role: %s %s" % (self.current.role.unit.name, ...
def list_user_roles(self): """ Lists user roles as selectable except user's current role. """ _form = JsonForm(current=self.current, title=_(u"Switch Role")) _form.help_text = "Your current role: %s %s" % (self.current.role.unit.name, ...
[ "Lists", "user", "roles", "as", "selectable", "except", "user", "s", "current", "role", "." ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/views/role_switching.py#L22-L34
[ "def", "list_user_roles", "(", "self", ")", ":", "_form", "=", "JsonForm", "(", "current", "=", "self", ".", "current", ",", "title", "=", "_", "(", "u\"Switch Role\"", ")", ")", "_form", ".", "help_text", "=", "\"Your current role: %s %s\"", "%", "(", "se...
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
RoleSwitching.change_user_role
Changes user's role from current role to chosen role.
zengine/views/role_switching.py
def change_user_role(self): """ Changes user's role from current role to chosen role. """ # Get chosen role_key from user form. role_key = self.input['form']['role_options'] # Assign chosen switch role key to user's last_login_role_key field self.current.user.las...
def change_user_role(self): """ Changes user's role from current role to chosen role. """ # Get chosen role_key from user form. role_key = self.input['form']['role_options'] # Assign chosen switch role key to user's last_login_role_key field self.current.user.las...
[ "Changes", "user", "s", "role", "from", "current", "role", "to", "chosen", "role", "." ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/views/role_switching.py#L36-L50
[ "def", "change_user_role", "(", "self", ")", ":", "# Get chosen role_key from user form.", "role_key", "=", "self", ".", "input", "[", "'form'", "]", "[", "'role_options'", "]", "# Assign chosen switch role key to user's last_login_role_key field", "self", ".", "current", ...
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
RoleSwitching.get_user_switchable_roles
Returns user's role list except current role as a tuple (role.key, role.name) Returns: (list): list of tuples, user's role list except current role
zengine/views/role_switching.py
def get_user_switchable_roles(self): """ Returns user's role list except current role as a tuple (role.key, role.name) Returns: (list): list of tuples, user's role list except current role """ roles = [] for rs in self.current.user.role_set: ...
def get_user_switchable_roles(self): """ Returns user's role list except current role as a tuple (role.key, role.name) Returns: (list): list of tuples, user's role list except current role """ roles = [] for rs in self.current.user.role_set: ...
[ "Returns", "user", "s", "role", "list", "except", "current", "role", "as", "a", "tuple", "(", "role", ".", "key", "role", ".", "name", ")" ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/views/role_switching.py#L52-L67
[ "def", "get_user_switchable_roles", "(", "self", ")", ":", "roles", "=", "[", "]", "for", "rs", "in", "self", ".", "current", ".", "user", ".", "role_set", ":", "# rs.role != self.current.role is not True after python version 2.7.12", "if", "rs", ".", "role", ".",...
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
KibanaManager.put_object
Wrapper for es.index, determines metadata needed to index from obj. If you have a raw object json string you can hard code these: index is .kibana (as of kibana4); id can be A-Za-z0-9\- and must be unique; doc_type is either visualization, dashboard, search or for settings do...
kibana/manager.py
def put_object(self, obj): # TODO consider putting into a ES class self.pr_dbg('put_obj: %s' % self.json_dumps(obj)) """ Wrapper for es.index, determines metadata needed to index from obj. If you have a raw object json string you can hard code these: index is .kibana (as ...
def put_object(self, obj): # TODO consider putting into a ES class self.pr_dbg('put_obj: %s' % self.json_dumps(obj)) """ Wrapper for es.index, determines metadata needed to index from obj. If you have a raw object json string you can hard code these: index is .kibana (as ...
[ "Wrapper", "for", "es", ".", "index", "determines", "metadata", "needed", "to", "index", "from", "obj", ".", "If", "you", "have", "a", "raw", "object", "json", "string", "you", "can", "hard", "code", "these", ":", "index", "is", ".", "kibana", "(", "as...
rfarley3/Kibana
python
https://github.com/rfarley3/Kibana/blob/3df1e13be18edfb39ec173d8d2bbe9e90be61022/kibana/manager.py#L105-L134
[ "def", "put_object", "(", "self", ",", "obj", ")", ":", "# TODO consider putting into a ES class", "self", ".", "pr_dbg", "(", "'put_obj: %s'", "%", "self", ".", "json_dumps", "(", "obj", ")", ")", "if", "obj", "[", "'_index'", "]", "is", "None", "or", "ob...
3df1e13be18edfb39ec173d8d2bbe9e90be61022
train
KibanaManager.del_object
Debug deletes obj of obj[_type] with id of obj['_id']
kibana/manager.py
def del_object(self, obj): """Debug deletes obj of obj[_type] with id of obj['_id']""" if obj['_index'] is None or obj['_index'] == "": raise Exception("Invalid Object") if obj['_id'] is None or obj['_id'] == "": raise Exception("Invalid Object") if obj['_type'] i...
def del_object(self, obj): """Debug deletes obj of obj[_type] with id of obj['_id']""" if obj['_index'] is None or obj['_index'] == "": raise Exception("Invalid Object") if obj['_id'] is None or obj['_id'] == "": raise Exception("Invalid Object") if obj['_type'] i...
[ "Debug", "deletes", "obj", "of", "obj", "[", "_type", "]", "with", "id", "of", "obj", "[", "_id", "]" ]
rfarley3/Kibana
python
https://github.com/rfarley3/Kibana/blob/3df1e13be18edfb39ec173d8d2bbe9e90be61022/kibana/manager.py#L144-L155
[ "def", "del_object", "(", "self", ",", "obj", ")", ":", "if", "obj", "[", "'_index'", "]", "is", "None", "or", "obj", "[", "'_index'", "]", "==", "\"\"", ":", "raise", "Exception", "(", "\"Invalid Object\"", ")", "if", "obj", "[", "'_id'", "]", "is",...
3df1e13be18edfb39ec173d8d2bbe9e90be61022
train
KibanaManager.json_dumps
Serializer for consistency
kibana/manager.py
def json_dumps(self, obj): """Serializer for consistency""" return json.dumps(obj, sort_keys=True, indent=4, separators=(',', ': '))
def json_dumps(self, obj): """Serializer for consistency""" return json.dumps(obj, sort_keys=True, indent=4, separators=(',', ': '))
[ "Serializer", "for", "consistency" ]
rfarley3/Kibana
python
https://github.com/rfarley3/Kibana/blob/3df1e13be18edfb39ec173d8d2bbe9e90be61022/kibana/manager.py#L161-L163
[ "def", "json_dumps", "(", "self", ",", "obj", ")", ":", "return", "json", ".", "dumps", "(", "obj", ",", "sort_keys", "=", "True", ",", "indent", "=", "4", ",", "separators", "=", "(", "','", ",", "': '", ")", ")" ]
3df1e13be18edfb39ec173d8d2bbe9e90be61022
train
KibanaManager.safe_filename
Santize obj name into fname and verify doesn't already exist
kibana/manager.py
def safe_filename(self, otype, oid): """Santize obj name into fname and verify doesn't already exist""" permitted = set(['_', '-', '(', ')']) oid = ''.join([c for c in oid if c.isalnum() or c in permitted]) while oid.find('--') != -1: oid = oid.replace('--', '-') ext ...
def safe_filename(self, otype, oid): """Santize obj name into fname and verify doesn't already exist""" permitted = set(['_', '-', '(', ')']) oid = ''.join([c for c in oid if c.isalnum() or c in permitted]) while oid.find('--') != -1: oid = oid.replace('--', '-') ext ...
[ "Santize", "obj", "name", "into", "fname", "and", "verify", "doesn", "t", "already", "exist" ]
rfarley3/Kibana
python
https://github.com/rfarley3/Kibana/blob/3df1e13be18edfb39ec173d8d2bbe9e90be61022/kibana/manager.py#L165-L182
[ "def", "safe_filename", "(", "self", ",", "otype", ",", "oid", ")", ":", "permitted", "=", "set", "(", "[", "'_'", ",", "'-'", ",", "'('", ",", "')'", "]", ")", "oid", "=", "''", ".", "join", "(", "[", "c", "for", "c", "in", "oid", "if", "c",...
3df1e13be18edfb39ec173d8d2bbe9e90be61022
train
KibanaManager.write_object_to_file
Convert obj (dict) to json string and write to file
kibana/manager.py
def write_object_to_file(self, obj, path='.', filename=None): """Convert obj (dict) to json string and write to file""" output = self.json_dumps(obj) + '\n' if filename is None: filename = self.safe_filename(obj['_type'], obj['_id']) filename = os.path.join(path, filename) ...
def write_object_to_file(self, obj, path='.', filename=None): """Convert obj (dict) to json string and write to file""" output = self.json_dumps(obj) + '\n' if filename is None: filename = self.safe_filename(obj['_type'], obj['_id']) filename = os.path.join(path, filename) ...
[ "Convert", "obj", "(", "dict", ")", "to", "json", "string", "and", "write", "to", "file" ]
rfarley3/Kibana
python
https://github.com/rfarley3/Kibana/blob/3df1e13be18edfb39ec173d8d2bbe9e90be61022/kibana/manager.py#L184-L194
[ "def", "write_object_to_file", "(", "self", ",", "obj", ",", "path", "=", "'.'", ",", "filename", "=", "None", ")", ":", "output", "=", "self", ".", "json_dumps", "(", "obj", ")", "+", "'\\n'", "if", "filename", "is", "None", ":", "filename", "=", "s...
3df1e13be18edfb39ec173d8d2bbe9e90be61022
train
KibanaManager.write_pkg_to_file
Write a list of related objs to file
kibana/manager.py
def write_pkg_to_file(self, name, objects, path='.', filename=None): """Write a list of related objs to file""" # Kibana uses an array of docs, do the same # as opposed to a dict of docs pkg_objs = [] for _, obj in iteritems(objects): pkg_objs.append(obj) sort...
def write_pkg_to_file(self, name, objects, path='.', filename=None): """Write a list of related objs to file""" # Kibana uses an array of docs, do the same # as opposed to a dict of docs pkg_objs = [] for _, obj in iteritems(objects): pkg_objs.append(obj) sort...
[ "Write", "a", "list", "of", "related", "objs", "to", "file" ]
rfarley3/Kibana
python
https://github.com/rfarley3/Kibana/blob/3df1e13be18edfb39ec173d8d2bbe9e90be61022/kibana/manager.py#L200-L215
[ "def", "write_pkg_to_file", "(", "self", ",", "name", ",", "objects", ",", "path", "=", "'.'", ",", "filename", "=", "None", ")", ":", "# Kibana uses an array of docs, do the same", "# as opposed to a dict of docs", "pkg_objs", "=", "[", "]", "for", "_", ",", "o...
3df1e13be18edfb39ec173d8d2bbe9e90be61022
train
KibanaManager.get_objects
Return all objects of type (assumes < MAX_HITS)
kibana/manager.py
def get_objects(self, search_field, search_val): """Return all objects of type (assumes < MAX_HITS)""" query = ("{ size: " + str(self.max_hits) + ", " + "query: { filtered: { filter: { " + search_field + ": { value: \"" + search_val + "\"" + " } } } } }...
def get_objects(self, search_field, search_val): """Return all objects of type (assumes < MAX_HITS)""" query = ("{ size: " + str(self.max_hits) + ", " + "query: { filtered: { filter: { " + search_field + ": { value: \"" + search_val + "\"" + " } } } } }...
[ "Return", "all", "objects", "of", "type", "(", "assumes", "<", "MAX_HITS", ")" ]
rfarley3/Kibana
python
https://github.com/rfarley3/Kibana/blob/3df1e13be18edfb39ec173d8d2bbe9e90be61022/kibana/manager.py#L217-L237
[ "def", "get_objects", "(", "self", ",", "search_field", ",", "search_val", ")", ":", "query", "=", "(", "\"{ size: \"", "+", "str", "(", "self", ".", "max_hits", ")", "+", "\", \"", "+", "\"query: { filtered: { filter: { \"", "+", "search_field", "+", "\": { v...
3df1e13be18edfb39ec173d8d2bbe9e90be61022
train
KibanaManager.get_dashboard_full
Get DB and all objs needed to duplicate it
kibana/manager.py
def get_dashboard_full(self, db_name): """Get DB and all objs needed to duplicate it""" objects = {} dashboards = self.get_objects("type", "dashboard") vizs = self.get_objects("type", "visualization") searches = self.get_objects("type", "search") if db_name not in dashboa...
def get_dashboard_full(self, db_name): """Get DB and all objs needed to duplicate it""" objects = {} dashboards = self.get_objects("type", "dashboard") vizs = self.get_objects("type", "visualization") searches = self.get_objects("type", "search") if db_name not in dashboa...
[ "Get", "DB", "and", "all", "objs", "needed", "to", "duplicate", "it" ]
rfarley3/Kibana
python
https://github.com/rfarley3/Kibana/blob/3df1e13be18edfb39ec173d8d2bbe9e90be61022/kibana/manager.py#L255-L282
[ "def", "get_dashboard_full", "(", "self", ",", "db_name", ")", ":", "objects", "=", "{", "}", "dashboards", "=", "self", ".", "get_objects", "(", "\"type\"", ",", "\"dashboard\"", ")", "vizs", "=", "self", ".", "get_objects", "(", "\"type\"", ",", "\"visua...
3df1e13be18edfb39ec173d8d2bbe9e90be61022
train
CamundaProcessParser.parse_node
Overrides ProcessParser.parse_node Parses and attaches the inputOutput tags that created by Camunda Modeller Args: node: xml task node Returns: TaskSpec
zengine/lib/camunda_parser.py
def parse_node(self, node): """ Overrides ProcessParser.parse_node Parses and attaches the inputOutput tags that created by Camunda Modeller Args: node: xml task node Returns: TaskSpec """ spec = super(CamundaProcessParser, self).parse_no...
def parse_node(self, node): """ Overrides ProcessParser.parse_node Parses and attaches the inputOutput tags that created by Camunda Modeller Args: node: xml task node Returns: TaskSpec """ spec = super(CamundaProcessParser, self).parse_no...
[ "Overrides", "ProcessParser", ".", "parse_node", "Parses", "and", "attaches", "the", "inputOutput", "tags", "that", "created", "by", "Camunda", "Modeller" ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/lib/camunda_parser.py#L47-L64
[ "def", "parse_node", "(", "self", ",", "node", ")", ":", "spec", "=", "super", "(", "CamundaProcessParser", ",", "self", ")", ".", "parse_node", "(", "node", ")", "spec", ".", "data", "=", "self", ".", "_parse_input_data", "(", "node", ")", "spec", "."...
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
CamundaProcessParser._get_description
Tries to get WF description from 'collabration' or 'process' or 'pariticipant' Returns:
zengine/lib/camunda_parser.py
def _get_description(self): """ Tries to get WF description from 'collabration' or 'process' or 'pariticipant' Returns: """ ns = {'ns': '{%s}' % BPMN_MODEL_NS} desc = ( self.doc_xpath('.//{ns}collaboration/{ns}documentation'.format(**ns)) or self....
def _get_description(self): """ Tries to get WF description from 'collabration' or 'process' or 'pariticipant' Returns: """ ns = {'ns': '{%s}' % BPMN_MODEL_NS} desc = ( self.doc_xpath('.//{ns}collaboration/{ns}documentation'.format(**ns)) or self....
[ "Tries", "to", "get", "WF", "description", "from", "collabration", "or", "process", "or", "pariticipant", "Returns", ":" ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/lib/camunda_parser.py#L66-L79
[ "def", "_get_description", "(", "self", ")", ":", "ns", "=", "{", "'ns'", ":", "'{%s}'", "%", "BPMN_MODEL_NS", "}", "desc", "=", "(", "self", ".", "doc_xpath", "(", "'.//{ns}collaboration/{ns}documentation'", ".", "format", "(", "*", "*", "ns", ")", ")", ...
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
CamundaProcessParser.get_name
Tries to get WF name from 'process' or 'collobration' or 'pariticipant' Returns: str. WF name.
zengine/lib/camunda_parser.py
def get_name(self): """ Tries to get WF name from 'process' or 'collobration' or 'pariticipant' Returns: str. WF name. """ ns = {'ns': '{%s}' % BPMN_MODEL_NS} for path in ('.//{ns}process', './/{ns}collaboration', './...
def get_name(self): """ Tries to get WF name from 'process' or 'collobration' or 'pariticipant' Returns: str. WF name. """ ns = {'ns': '{%s}' % BPMN_MODEL_NS} for path in ('.//{ns}process', './/{ns}collaboration', './...
[ "Tries", "to", "get", "WF", "name", "from", "process", "or", "collobration", "or", "pariticipant" ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/lib/camunda_parser.py#L91-L107
[ "def", "get_name", "(", "self", ")", ":", "ns", "=", "{", "'ns'", ":", "'{%s}'", "%", "BPMN_MODEL_NS", "}", "for", "path", "in", "(", "'.//{ns}process'", ",", "'.//{ns}collaboration'", ",", "'.//{ns}collaboration/{ns}participant/'", ")", ":", "tag", "=", "self...
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
CamundaProcessParser._parse_input_data
Parses inputOutput part camunda modeller extensions. Args: node: SpiffWorkflow Node object. Returns: Data dict.
zengine/lib/camunda_parser.py
def _parse_input_data(self, node): """ Parses inputOutput part camunda modeller extensions. Args: node: SpiffWorkflow Node object. Returns: Data dict. """ data = DotDict() try: for nod in self._get_input_nodes(node): ...
def _parse_input_data(self, node): """ Parses inputOutput part camunda modeller extensions. Args: node: SpiffWorkflow Node object. Returns: Data dict. """ data = DotDict() try: for nod in self._get_input_nodes(node): ...
[ "Parses", "inputOutput", "part", "camunda", "modeller", "extensions", ".", "Args", ":", "node", ":", "SpiffWorkflow", "Node", "object", "." ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/lib/camunda_parser.py#L109-L124
[ "def", "_parse_input_data", "(", "self", ",", "node", ")", ":", "data", "=", "DotDict", "(", ")", "try", ":", "for", "nod", "in", "self", ".", "_get_input_nodes", "(", "node", ")", ":", "data", ".", "update", "(", "self", ".", "_parse_input_node", "(",...
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
CamundaProcessParser._get_lane_properties
Parses the given XML node Args: node (xml): XML node. .. code-block:: xml <bpmn2:lane id="Lane_8" name="Lane 8"> <bpmn2:extensionElements> <camunda:properties> <camunda:property value="foo,bar" name="perms"/> ...
zengine/lib/camunda_parser.py
def _get_lane_properties(self, node): """ Parses the given XML node Args: node (xml): XML node. .. code-block:: xml <bpmn2:lane id="Lane_8" name="Lane 8"> <bpmn2:extensionElements> <camunda:properties> ...
def _get_lane_properties(self, node): """ Parses the given XML node Args: node (xml): XML node. .. code-block:: xml <bpmn2:lane id="Lane_8" name="Lane 8"> <bpmn2:extensionElements> <camunda:properties> ...
[ "Parses", "the", "given", "XML", "node" ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/lib/camunda_parser.py#L136-L160
[ "def", "_get_lane_properties", "(", "self", ",", "node", ")", ":", "lane_name", "=", "self", ".", "get_lane", "(", "node", ".", "get", "(", "'id'", ")", ")", "lane_data", "=", "{", "'name'", ":", "lane_name", "}", "for", "a", "in", "self", ".", "xpat...
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
CamundaProcessParser._parse_input_node
:param node: xml node :return: dict
zengine/lib/camunda_parser.py
def _parse_input_node(cls, node): """ :param node: xml node :return: dict """ data = {} child = node.getchildren() if not child and node.get('name'): val = node.text elif child: # if tag = "{http://activiti.org/bpmn}script" then data_typ = 'sc...
def _parse_input_node(cls, node): """ :param node: xml node :return: dict """ data = {} child = node.getchildren() if not child and node.get('name'): val = node.text elif child: # if tag = "{http://activiti.org/bpmn}script" then data_typ = 'sc...
[ ":", "param", "node", ":", "xml", "node", ":", "return", ":", "dict" ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/lib/camunda_parser.py#L163-L176
[ "def", "_parse_input_node", "(", "cls", ",", "node", ")", ":", "data", "=", "{", "}", "child", "=", "node", ".", "getchildren", "(", ")", "if", "not", "child", "and", "node", ".", "get", "(", "'name'", ")", ":", "val", "=", "node", ".", "text", "...
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
InMemoryPackager.package_in_memory
Generates wf packages from workflow diagrams. Args: workflow_name: Name of wf workflow_files: Diagram file. Returns: Workflow package (file like) object
zengine/lib/camunda_parser.py
def package_in_memory(cls, workflow_name, workflow_files): """ Generates wf packages from workflow diagrams. Args: workflow_name: Name of wf workflow_files: Diagram file. Returns: Workflow package (file like) object """ s = StringIO...
def package_in_memory(cls, workflow_name, workflow_files): """ Generates wf packages from workflow diagrams. Args: workflow_name: Name of wf workflow_files: Diagram file. Returns: Workflow package (file like) object """ s = StringIO...
[ "Generates", "wf", "packages", "from", "workflow", "diagrams", "." ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/lib/camunda_parser.py#L210-L225
[ "def", "package_in_memory", "(", "cls", ",", "workflow_name", ",", "workflow_files", ")", ":", "s", "=", "StringIO", "(", ")", "p", "=", "cls", "(", "s", ",", "workflow_name", ",", "meta_data", "=", "[", "]", ")", "p", ".", "add_bpmn_files_by_glob", "(",...
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
CGRpreparer.compose
condense reaction container to CGR. see init for details about cgr_type :param data: ReactionContainer :return: CGRContainer
CGRtools/preparer.py
def compose(self, data): """ condense reaction container to CGR. see init for details about cgr_type :param data: ReactionContainer :return: CGRContainer """ g = self.__separate(data) if self.__cgr_type in (1, 2, 3, 4, 5, 6) else self.__condense(data) g.meta.upda...
def compose(self, data): """ condense reaction container to CGR. see init for details about cgr_type :param data: ReactionContainer :return: CGRContainer """ g = self.__separate(data) if self.__cgr_type in (1, 2, 3, 4, 5, 6) else self.__condense(data) g.meta.upda...
[ "condense", "reaction", "container", "to", "CGR", ".", "see", "init", "for", "details", "about", "cgr_type" ]
cimm-kzn/CGRtools
python
https://github.com/cimm-kzn/CGRtools/blob/15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34/CGRtools/preparer.py#L49-L58
[ "def", "compose", "(", "self", ",", "data", ")", ":", "g", "=", "self", ".", "__separate", "(", "data", ")", "if", "self", ".", "__cgr_type", "in", "(", "1", ",", "2", ",", "3", ",", "4", ",", "5", ",", "6", ")", "else", "self", ".", "__conde...
15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34
train
BaseContainer.add_atom
new atom addition
CGRtools/containers/common.py
def add_atom(self, atom, _map=None): """ new atom addition """ if _map is None: _map = max(self, default=0) + 1 elif _map in self._node: raise KeyError('atom with same number exists') attr_dict = self.node_attr_dict_factory() if isinstance...
def add_atom(self, atom, _map=None): """ new atom addition """ if _map is None: _map = max(self, default=0) + 1 elif _map in self._node: raise KeyError('atom with same number exists') attr_dict = self.node_attr_dict_factory() if isinstance...
[ "new", "atom", "addition" ]
cimm-kzn/CGRtools
python
https://github.com/cimm-kzn/CGRtools/blob/15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34/CGRtools/containers/common.py#L71-L91
[ "def", "add_atom", "(", "self", ",", "atom", ",", "_map", "=", "None", ")", ":", "if", "_map", "is", "None", ":", "_map", "=", "max", "(", "self", ",", "default", "=", "0", ")", "+", "1", "elif", "_map", "in", "self", ".", "_node", ":", "raise"...
15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34
train
BaseContainer.add_bond
implementation of bond addition
CGRtools/containers/common.py
def add_bond(self, atom1, atom2, bond): """ implementation of bond addition """ if atom1 == atom2: raise KeyError('atom loops impossible') if atom1 not in self._node or atom2 not in self._node: raise KeyError('atoms not found') if atom1 in self._ad...
def add_bond(self, atom1, atom2, bond): """ implementation of bond addition """ if atom1 == atom2: raise KeyError('atom loops impossible') if atom1 not in self._node or atom2 not in self._node: raise KeyError('atoms not found') if atom1 in self._ad...
[ "implementation", "of", "bond", "addition" ]
cimm-kzn/CGRtools
python
https://github.com/cimm-kzn/CGRtools/blob/15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34/CGRtools/containers/common.py#L93-L111
[ "def", "add_bond", "(", "self", ",", "atom1", ",", "atom2", ",", "bond", ")", ":", "if", "atom1", "==", "atom2", ":", "raise", "KeyError", "(", "'atom loops impossible'", ")", "if", "atom1", "not", "in", "self", ".", "_node", "or", "atom2", "not", "in"...
15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34
train
BaseContainer.delete_bond
implementation of bond removing
CGRtools/containers/common.py
def delete_bond(self, n, m): """ implementation of bond removing """ self.remove_edge(n, m) self.flush_cache()
def delete_bond(self, n, m): """ implementation of bond removing """ self.remove_edge(n, m) self.flush_cache()
[ "implementation", "of", "bond", "removing" ]
cimm-kzn/CGRtools
python
https://github.com/cimm-kzn/CGRtools/blob/15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34/CGRtools/containers/common.py#L120-L125
[ "def", "delete_bond", "(", "self", ",", "n", ",", "m", ")", ":", "self", ".", "remove_edge", "(", "n", ",", "m", ")", "self", ".", "flush_cache", "(", ")" ]
15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34
train
BaseContainer.environment
pairs of (bond, atom) connected to atom :param atom: number :return: list
CGRtools/containers/common.py
def environment(self, atom): """ pairs of (bond, atom) connected to atom :param atom: number :return: list """ return tuple((bond, self._node[n]) for n, bond in self._adj[atom].items())
def environment(self, atom): """ pairs of (bond, atom) connected to atom :param atom: number :return: list """ return tuple((bond, self._node[n]) for n, bond in self._adj[atom].items())
[ "pairs", "of", "(", "bond", "atom", ")", "connected", "to", "atom" ]
cimm-kzn/CGRtools
python
https://github.com/cimm-kzn/CGRtools/blob/15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34/CGRtools/containers/common.py#L128-L135
[ "def", "environment", "(", "self", ",", "atom", ")", ":", "return", "tuple", "(", "(", "bond", ",", "self", ".", "_node", "[", "n", "]", ")", "for", "n", ",", "bond", "in", "self", ".", "_adj", "[", "atom", "]", ".", "items", "(", ")", ")" ]
15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34
train
BaseContainer.substructure
create substructure containing atoms from nbunch list :param atoms: list of atoms numbers of substructure :param meta: if True metadata will be copied to substructure :param as_view: If True, the returned graph-view provides a read-only view of the original structure scaffold withou...
CGRtools/containers/common.py
def substructure(self, atoms, meta=False, as_view=True): """ create substructure containing atoms from nbunch list :param atoms: list of atoms numbers of substructure :param meta: if True metadata will be copied to substructure :param as_view: If True, the returned graph-view pr...
def substructure(self, atoms, meta=False, as_view=True): """ create substructure containing atoms from nbunch list :param atoms: list of atoms numbers of substructure :param meta: if True metadata will be copied to substructure :param as_view: If True, the returned graph-view pr...
[ "create", "substructure", "containing", "atoms", "from", "nbunch", "list" ]
cimm-kzn/CGRtools
python
https://github.com/cimm-kzn/CGRtools/blob/15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34/CGRtools/containers/common.py#L137-L153
[ "def", "substructure", "(", "self", ",", "atoms", ",", "meta", "=", "False", ",", "as_view", "=", "True", ")", ":", "s", "=", "self", ".", "subgraph", "(", "atoms", ")", "if", "as_view", ":", "s", ".", "add_atom", "=", "s", ".", "add_bond", "=", ...
15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34
train
BaseContainer.augmented_substructure
create substructure containing atoms and their neighbors :param atoms: list of core atoms in graph :param dante: if True return list of graphs containing atoms, atoms + first circle, atoms + 1st + 2nd, etc up to deep or while new nodes available :param deep: number of bonds between ...
CGRtools/containers/common.py
def augmented_substructure(self, atoms, dante=False, deep=1, meta=False, as_view=True): """ create substructure containing atoms and their neighbors :param atoms: list of core atoms in graph :param dante: if True return list of graphs containing atoms, atoms + first circle, atoms + 1st ...
def augmented_substructure(self, atoms, dante=False, deep=1, meta=False, as_view=True): """ create substructure containing atoms and their neighbors :param atoms: list of core atoms in graph :param dante: if True return list of graphs containing atoms, atoms + first circle, atoms + 1st ...
[ "create", "substructure", "containing", "atoms", "and", "their", "neighbors" ]
cimm-kzn/CGRtools
python
https://github.com/cimm-kzn/CGRtools/blob/15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34/CGRtools/containers/common.py#L155-L176
[ "def", "augmented_substructure", "(", "self", ",", "atoms", ",", "dante", "=", "False", ",", "deep", "=", "1", ",", "meta", "=", "False", ",", "as_view", "=", "True", ")", ":", "nodes", "=", "[", "set", "(", "atoms", ")", "]", "for", "i", "in", "...
15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34
train
BaseContainer.split
split disconnected structure to connected substructures :param meta: copy metadata to each substructure :return: list of substructures
CGRtools/containers/common.py
def split(self, meta=False): """ split disconnected structure to connected substructures :param meta: copy metadata to each substructure :return: list of substructures """ return [self.substructure(c, meta, False) for c in connected_components(self)]
def split(self, meta=False): """ split disconnected structure to connected substructures :param meta: copy metadata to each substructure :return: list of substructures """ return [self.substructure(c, meta, False) for c in connected_components(self)]
[ "split", "disconnected", "structure", "to", "connected", "substructures" ]
cimm-kzn/CGRtools
python
https://github.com/cimm-kzn/CGRtools/blob/15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34/CGRtools/containers/common.py#L182-L189
[ "def", "split", "(", "self", ",", "meta", "=", "False", ")", ":", "return", "[", "self", ".", "substructure", "(", "c", ",", "meta", ",", "False", ")", "for", "c", "in", "connected_components", "(", "self", ")", "]" ]
15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34
train
BaseContainer.bonds
iterate other all bonds
CGRtools/containers/common.py
def bonds(self): """ iterate other all bonds """ seen = set() for n, m_bond in self._adj.items(): seen.add(n) for m, bond in m_bond.items(): if m not in seen: yield n, m, bond
def bonds(self): """ iterate other all bonds """ seen = set() for n, m_bond in self._adj.items(): seen.add(n) for m, bond in m_bond.items(): if m not in seen: yield n, m, bond
[ "iterate", "other", "all", "bonds" ]
cimm-kzn/CGRtools
python
https://github.com/cimm-kzn/CGRtools/blob/15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34/CGRtools/containers/common.py#L218-L227
[ "def", "bonds", "(", "self", ")", ":", "seen", "=", "set", "(", ")", "for", "n", ",", "m_bond", "in", "self", ".", "_adj", ".", "items", "(", ")", ":", "seen", ".", "add", "(", "n", ")", "for", "m", ",", "bond", "in", "m_bond", ".", "items", ...
15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34
train
BaseContainer._get_subclass
need for cyclic import solving
CGRtools/containers/common.py
def _get_subclass(name): """ need for cyclic import solving """ return next(x for x in BaseContainer.__subclasses__() if x.__name__ == name)
def _get_subclass(name): """ need for cyclic import solving """ return next(x for x in BaseContainer.__subclasses__() if x.__name__ == name)
[ "need", "for", "cyclic", "import", "solving" ]
cimm-kzn/CGRtools
python
https://github.com/cimm-kzn/CGRtools/blob/15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34/CGRtools/containers/common.py#L230-L234
[ "def", "_get_subclass", "(", "name", ")", ":", "return", "next", "(", "x", "for", "x", "in", "BaseContainer", ".", "__subclasses__", "(", ")", "if", "x", ".", "__name__", "==", "name", ")" ]
15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34
train
_default_make_pool
Creates a urllib3.PoolManager object that has SSL verification enabled and uses the certifi certificates.
httplib2shim/__init__.py
def _default_make_pool(http, proxy_info): """Creates a urllib3.PoolManager object that has SSL verification enabled and uses the certifi certificates.""" if not http.ca_certs: http.ca_certs = _certifi_where_for_ssl_version() ssl_disabled = http.disable_ssl_certificate_validation cert_reqs...
def _default_make_pool(http, proxy_info): """Creates a urllib3.PoolManager object that has SSL verification enabled and uses the certifi certificates.""" if not http.ca_certs: http.ca_certs = _certifi_where_for_ssl_version() ssl_disabled = http.disable_ssl_certificate_validation cert_reqs...
[ "Creates", "a", "urllib3", ".", "PoolManager", "object", "that", "has", "SSL", "verification", "enabled", "and", "uses", "the", "certifi", "certificates", "." ]
GoogleCloudPlatform/httplib2shim
python
https://github.com/GoogleCloudPlatform/httplib2shim/blob/e034530c551f11cf5690ef78a24c66087976c310/httplib2shim/__init__.py#L35-L74
[ "def", "_default_make_pool", "(", "http", ",", "proxy_info", ")", ":", "if", "not", "http", ".", "ca_certs", ":", "http", ".", "ca_certs", "=", "_certifi_where_for_ssl_version", "(", ")", "ssl_disabled", "=", "http", ".", "disable_ssl_certificate_validation", "cer...
e034530c551f11cf5690ef78a24c66087976c310
train
patch
Monkey-patches httplib2.Http to be httplib2shim.Http. This effectively makes all clients of httplib2 use urlilb3. It's preferable to specify httplib2shim.Http explicitly where you can, but this can be useful in situations where you do not control the construction of the http object. Args: ...
httplib2shim/__init__.py
def patch(make_pool=_default_make_pool): """Monkey-patches httplib2.Http to be httplib2shim.Http. This effectively makes all clients of httplib2 use urlilb3. It's preferable to specify httplib2shim.Http explicitly where you can, but this can be useful in situations where you do not control the construc...
def patch(make_pool=_default_make_pool): """Monkey-patches httplib2.Http to be httplib2shim.Http. This effectively makes all clients of httplib2 use urlilb3. It's preferable to specify httplib2shim.Http explicitly where you can, but this can be useful in situations where you do not control the construc...
[ "Monkey", "-", "patches", "httplib2", ".", "Http", "to", "be", "httplib2shim", ".", "Http", "." ]
GoogleCloudPlatform/httplib2shim
python
https://github.com/GoogleCloudPlatform/httplib2shim/blob/e034530c551f11cf5690ef78a24c66087976c310/httplib2shim/__init__.py#L77-L93
[ "def", "patch", "(", "make_pool", "=", "_default_make_pool", ")", ":", "setattr", "(", "httplib2", ",", "'_HttpOriginal'", ",", "httplib2", ".", "Http", ")", "httplib2", ".", "Http", "=", "Http", "Http", ".", "_make_pool", "=", "make_pool" ]
e034530c551f11cf5690ef78a24c66087976c310
train
_is_ipv6
Checks if a given address is an IPv6 address.
httplib2shim/__init__.py
def _is_ipv6(addr): """Checks if a given address is an IPv6 address.""" try: socket.inet_pton(socket.AF_INET6, addr) return True except socket.error: return False
def _is_ipv6(addr): """Checks if a given address is an IPv6 address.""" try: socket.inet_pton(socket.AF_INET6, addr) return True except socket.error: return False
[ "Checks", "if", "a", "given", "address", "is", "an", "IPv6", "address", "." ]
GoogleCloudPlatform/httplib2shim
python
https://github.com/GoogleCloudPlatform/httplib2shim/blob/e034530c551f11cf5690ef78a24c66087976c310/httplib2shim/__init__.py#L180-L186
[ "def", "_is_ipv6", "(", "addr", ")", ":", "try", ":", "socket", ".", "inet_pton", "(", "socket", ".", "AF_INET6", ",", "addr", ")", "return", "True", "except", "socket", ".", "error", ":", "return", "False" ]
e034530c551f11cf5690ef78a24c66087976c310
train
_certifi_where_for_ssl_version
Gets the right location for certifi certifications for the current SSL version. Older versions of SSL don't support the stronger set of root certificates.
httplib2shim/__init__.py
def _certifi_where_for_ssl_version(): """Gets the right location for certifi certifications for the current SSL version. Older versions of SSL don't support the stronger set of root certificates. """ if not ssl: return if ssl.OPENSSL_VERSION_INFO < (1, 0, 2): warnings.warn( ...
def _certifi_where_for_ssl_version(): """Gets the right location for certifi certifications for the current SSL version. Older versions of SSL don't support the stronger set of root certificates. """ if not ssl: return if ssl.OPENSSL_VERSION_INFO < (1, 0, 2): warnings.warn( ...
[ "Gets", "the", "right", "location", "for", "certifi", "certifications", "for", "the", "current", "SSL", "version", "." ]
GoogleCloudPlatform/httplib2shim
python
https://github.com/GoogleCloudPlatform/httplib2shim/blob/e034530c551f11cf5690ef78a24c66087976c310/httplib2shim/__init__.py#L189-L204
[ "def", "_certifi_where_for_ssl_version", "(", ")", ":", "if", "not", "ssl", ":", "return", "if", "ssl", ".", "OPENSSL_VERSION_INFO", "<", "(", "1", ",", "0", ",", "2", ")", ":", "warnings", ".", "warn", "(", "'You are using an outdated version of OpenSSL that '"...
e034530c551f11cf5690ef78a24c66087976c310
train
_map_response
Maps a urllib3 response to a httplib/httplib2 Response.
httplib2shim/__init__.py
def _map_response(response, decode=False): """Maps a urllib3 response to a httplib/httplib2 Response.""" # This causes weird deepcopy errors, so it's commented out for now. # item._urllib3_response = response item = httplib2.Response(response.getheaders()) item.status = response.status item['sta...
def _map_response(response, decode=False): """Maps a urllib3 response to a httplib/httplib2 Response.""" # This causes weird deepcopy errors, so it's commented out for now. # item._urllib3_response = response item = httplib2.Response(response.getheaders()) item.status = response.status item['sta...
[ "Maps", "a", "urllib3", "response", "to", "a", "httplib", "/", "httplib2", "Response", "." ]
GoogleCloudPlatform/httplib2shim
python
https://github.com/GoogleCloudPlatform/httplib2shim/blob/e034530c551f11cf5690ef78a24c66087976c310/httplib2shim/__init__.py#L207-L224
[ "def", "_map_response", "(", "response", ",", "decode", "=", "False", ")", ":", "# This causes weird deepcopy errors, so it's commented out for now.", "# item._urllib3_response = response", "item", "=", "httplib2", ".", "Response", "(", "response", ".", "getheaders", "(", ...
e034530c551f11cf5690ef78a24c66087976c310
train
_map_exception
Maps an exception from urlib3 to httplib2.
httplib2shim/__init__.py
def _map_exception(e): """Maps an exception from urlib3 to httplib2.""" if isinstance(e, urllib3.exceptions.MaxRetryError): if not e.reason: return e e = e.reason message = e.args[0] if e.args else '' if isinstance(e, urllib3.exceptions.ResponseError): if 'too many re...
def _map_exception(e): """Maps an exception from urlib3 to httplib2.""" if isinstance(e, urllib3.exceptions.MaxRetryError): if not e.reason: return e e = e.reason message = e.args[0] if e.args else '' if isinstance(e, urllib3.exceptions.ResponseError): if 'too many re...
[ "Maps", "an", "exception", "from", "urlib3", "to", "httplib2", "." ]
GoogleCloudPlatform/httplib2shim
python
https://github.com/GoogleCloudPlatform/httplib2shim/blob/e034530c551f11cf5690ef78a24c66087976c310/httplib2shim/__init__.py#L227-L253
[ "def", "_map_exception", "(", "e", ")", ":", "if", "isinstance", "(", "e", ",", "urllib3", ".", "exceptions", ".", "MaxRetryError", ")", ":", "if", "not", "e", ".", "reason", ":", "return", "e", "e", "=", "e", ".", "reason", "message", "=", "e", "....
e034530c551f11cf5690ef78a24c66087976c310
train
run_workers
subprocess handler
zengine/wf_daemon.py
def run_workers(no_subprocess, watch_paths=None, is_background=False): """ subprocess handler """ import atexit, os, subprocess, signal if watch_paths: from watchdog.observers import Observer # from watchdog.observers.fsevents import FSEventsObserver as Observer # from watchd...
def run_workers(no_subprocess, watch_paths=None, is_background=False): """ subprocess handler """ import atexit, os, subprocess, signal if watch_paths: from watchdog.observers import Observer # from watchdog.observers.fsevents import FSEventsObserver as Observer # from watchd...
[ "subprocess", "handler" ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/wf_daemon.py#L235-L300
[ "def", "run_workers", "(", "no_subprocess", ",", "watch_paths", "=", "None", ",", "is_background", "=", "False", ")", ":", "import", "atexit", ",", "os", ",", "subprocess", ",", "signal", "if", "watch_paths", ":", "from", "watchdog", ".", "observers", "impor...
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
Worker.exit
Properly close the AMQP connections
zengine/wf_daemon.py
def exit(self, signal=None, frame=None): """ Properly close the AMQP connections """ self.input_channel.close() self.client_queue.close() self.connection.close() log.info("Worker exiting") sys.exit(0)
def exit(self, signal=None, frame=None): """ Properly close the AMQP connections """ self.input_channel.close() self.client_queue.close() self.connection.close() log.info("Worker exiting") sys.exit(0)
[ "Properly", "close", "the", "AMQP", "connections" ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/wf_daemon.py#L48-L56
[ "def", "exit", "(", "self", ",", "signal", "=", "None", ",", "frame", "=", "None", ")", ":", "self", ".", "input_channel", ".", "close", "(", ")", "self", ".", "client_queue", ".", "close", "(", ")", "self", ".", "connection", ".", "close", "(", ")...
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
Worker.connect
make amqp connection and create channels and queue binding
zengine/wf_daemon.py
def connect(self): """ make amqp connection and create channels and queue binding """ self.connection = pika.BlockingConnection(BLOCKING_MQ_PARAMS) self.client_queue = ClientQueue() self.input_channel = self.connection.channel() self.input_channel.exchange_declar...
def connect(self): """ make amqp connection and create channels and queue binding """ self.connection = pika.BlockingConnection(BLOCKING_MQ_PARAMS) self.client_queue = ClientQueue() self.input_channel = self.connection.channel() self.input_channel.exchange_declar...
[ "make", "amqp", "connection", "and", "create", "channels", "and", "queue", "binding" ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/wf_daemon.py#L58-L72
[ "def", "connect", "(", "self", ")", ":", "self", ".", "connection", "=", "pika", ".", "BlockingConnection", "(", "BLOCKING_MQ_PARAMS", ")", "self", ".", "client_queue", "=", "ClientQueue", "(", ")", "self", ".", "input_channel", "=", "self", ".", "connection...
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
Worker.clear_queue
clear outs all messages from INPUT_QUEUE_NAME
zengine/wf_daemon.py
def clear_queue(self): """ clear outs all messages from INPUT_QUEUE_NAME """ def remove_message(ch, method, properties, body): print("Removed message: %s" % body) self.input_channel.basic_consume(remove_message, queue=self.INPUT_QUEUE_NAME, no_ack=True) try: ...
def clear_queue(self): """ clear outs all messages from INPUT_QUEUE_NAME """ def remove_message(ch, method, properties, body): print("Removed message: %s" % body) self.input_channel.basic_consume(remove_message, queue=self.INPUT_QUEUE_NAME, no_ack=True) try: ...
[ "clear", "outs", "all", "messages", "from", "INPUT_QUEUE_NAME" ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/wf_daemon.py#L76-L87
[ "def", "clear_queue", "(", "self", ")", ":", "def", "remove_message", "(", "ch", ",", "method", ",", "properties", ",", "body", ")", ":", "print", "(", "\"Removed message: %s\"", "%", "body", ")", "self", ".", "input_channel", ".", "basic_consume", "(", "r...
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
Worker.run
actual consuming of incoming works starts here
zengine/wf_daemon.py
def run(self): """ actual consuming of incoming works starts here """ self.input_channel.basic_consume(self.handle_message, queue=self.INPUT_QUEUE_NAME, no_ack=True ...
def run(self): """ actual consuming of incoming works starts here """ self.input_channel.basic_consume(self.handle_message, queue=self.INPUT_QUEUE_NAME, no_ack=True ...
[ "actual", "consuming", "of", "incoming", "works", "starts", "here" ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/wf_daemon.py#L89-L101
[ "def", "run", "(", "self", ")", ":", "self", ".", "input_channel", ".", "basic_consume", "(", "self", ".", "handle_message", ",", "queue", "=", "self", ".", "INPUT_QUEUE_NAME", ",", "no_ack", "=", "True", ")", "try", ":", "self", ".", "input_channel", "....
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
Worker.handle_message
this is a pika.basic_consumer callback handles client inputs, runs appropriate workflows and views Args: ch: amqp channel method: amqp method properties: body: message body
zengine/wf_daemon.py
def handle_message(self, ch, method, properties, body): """ this is a pika.basic_consumer callback handles client inputs, runs appropriate workflows and views Args: ch: amqp channel method: amqp method properties: body: message body ...
def handle_message(self, ch, method, properties, body): """ this is a pika.basic_consumer callback handles client inputs, runs appropriate workflows and views Args: ch: amqp channel method: amqp method properties: body: message body ...
[ "this", "is", "a", "pika", ".", "basic_consumer", "callback", "handles", "client", "inputs", "runs", "appropriate", "workflows", "and", "views" ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/wf_daemon.py#L165-L224
[ "def", "handle_message", "(", "self", ",", "ch", ",", "method", ",", "properties", ",", "body", ")", ":", "input", "=", "{", "}", "headers", "=", "{", "}", "try", ":", "self", ".", "sessid", "=", "method", ".", "routing_key", "input", "=", "json_deco...
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
get_progress
Args: start (DateTime): start date finish (DateTime): finish date Returns:
zengine/models/workflow_manager.py
def get_progress(start, finish): """ Args: start (DateTime): start date finish (DateTime): finish date Returns: """ now = datetime.now() dif_time_start = start - now dif_time_finish = finish - now if dif_time_start.days < 0 and dif_time_finish.days < 0: return P...
def get_progress(start, finish): """ Args: start (DateTime): start date finish (DateTime): finish date Returns: """ now = datetime.now() dif_time_start = start - now dif_time_finish = finish - now if dif_time_start.days < 0 and dif_time_finish.days < 0: return P...
[ "Args", ":", "start", "(", "DateTime", ")", ":", "start", "date", "finish", "(", "DateTime", ")", ":", "finish", "date", "Returns", ":" ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/models/workflow_manager.py#L230-L249
[ "def", "get_progress", "(", "start", ",", "finish", ")", ":", "now", "=", "datetime", ".", "now", "(", ")", "dif_time_start", "=", "start", "-", "now", "dif_time_finish", "=", "finish", "-", "now", "if", "dif_time_start", ".", "days", "<", "0", "and", ...
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
sync_wf_cache
BG Job for storing wf state to DB
zengine/models/workflow_manager.py
def sync_wf_cache(current): """ BG Job for storing wf state to DB """ wf_cache = WFCache(current) wf_state = wf_cache.get() # unicode serialized json to dict, all values are unicode if 'role_id' in wf_state: # role_id inserted by engine, so it's a sign that we get it from cache not db ...
def sync_wf_cache(current): """ BG Job for storing wf state to DB """ wf_cache = WFCache(current) wf_state = wf_cache.get() # unicode serialized json to dict, all values are unicode if 'role_id' in wf_state: # role_id inserted by engine, so it's a sign that we get it from cache not db ...
[ "BG", "Job", "for", "storing", "wf", "state", "to", "DB" ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/models/workflow_manager.py#L759-L797
[ "def", "sync_wf_cache", "(", "current", ")", ":", "wf_cache", "=", "WFCache", "(", "current", ")", "wf_state", "=", "wf_cache", ".", "get", "(", ")", "# unicode serialized json to dict, all values are unicode", "if", "'role_id'", "in", "wf_state", ":", "# role_id in...
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
DiagramXML.get_or_create_by_content
if xml content updated, create a new entry for given wf name Args: name: name of wf content: xml content Returns (DiagramXML(), bool): A tuple with two members. (DiagramXML instance and True if it's new or False it's already exists
zengine/models/workflow_manager.py
def get_or_create_by_content(cls, name, content): """ if xml content updated, create a new entry for given wf name Args: name: name of wf content: xml content Returns (DiagramXML(), bool): A tuple with two members. (DiagramXML instance and True if it's ne...
def get_or_create_by_content(cls, name, content): """ if xml content updated, create a new entry for given wf name Args: name: name of wf content: xml content Returns (DiagramXML(), bool): A tuple with two members. (DiagramXML instance and True if it's ne...
[ "if", "xml", "content", "updated", "create", "a", "new", "entry", "for", "given", "wf", "name", "Args", ":", "name", ":", "name", "of", "wf", "content", ":", "xml", "content" ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/models/workflow_manager.py#L43-L63
[ "def", "get_or_create_by_content", "(", "cls", ",", "name", ",", "content", ")", ":", "new", "=", "False", "diagrams", "=", "cls", ".", "objects", ".", "filter", "(", "name", "=", "name", ")", "if", "diagrams", ":", "diagram", "=", "diagrams", "[", "0"...
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
BPMNParser.get_description
Tries to get WF description from 'collabration' or 'process' or 'pariticipant' Returns str: WF description
zengine/models/workflow_manager.py
def get_description(self): """ Tries to get WF description from 'collabration' or 'process' or 'pariticipant' Returns str: WF description """ paths = ['bpmn:collaboration/bpmn:participant/bpmn:documentation', 'bpmn:collaboration/bpmn:documentation', ...
def get_description(self): """ Tries to get WF description from 'collabration' or 'process' or 'pariticipant' Returns str: WF description """ paths = ['bpmn:collaboration/bpmn:participant/bpmn:documentation', 'bpmn:collaboration/bpmn:documentation', ...
[ "Tries", "to", "get", "WF", "description", "from", "collabration", "or", "process", "or", "pariticipant" ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/models/workflow_manager.py#L96-L109
[ "def", "get_description", "(", "self", ")", ":", "paths", "=", "[", "'bpmn:collaboration/bpmn:participant/bpmn:documentation'", ",", "'bpmn:collaboration/bpmn:documentation'", ",", "'bpmn:process/bpmn:documentation'", "]", "for", "path", "in", "paths", ":", "elm", "=", "s...
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
BPMNParser.get_name
Tries to get WF name from 'process' or 'collobration' or 'pariticipant' Returns: str. WF name.
zengine/models/workflow_manager.py
def get_name(self): """ Tries to get WF name from 'process' or 'collobration' or 'pariticipant' Returns: str. WF name. """ paths = ['bpmn:process', 'bpmn:collaboration/bpmn:participant/', 'bpmn:collaboration', ] ...
def get_name(self): """ Tries to get WF name from 'process' or 'collobration' or 'pariticipant' Returns: str. WF name. """ paths = ['bpmn:process', 'bpmn:collaboration/bpmn:participant/', 'bpmn:collaboration', ] ...
[ "Tries", "to", "get", "WF", "name", "from", "process", "or", "collobration", "or", "pariticipant" ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/models/workflow_manager.py#L111-L127
[ "def", "get_name", "(", "self", ")", ":", "paths", "=", "[", "'bpmn:process'", ",", "'bpmn:collaboration/bpmn:participant/'", ",", "'bpmn:collaboration'", ",", "]", "for", "path", "in", "paths", ":", "tag", "=", "self", ".", "root", ".", "find", "(", "path",...
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
BPMNWorkflow.set_xml
updates xml link if there aren't any running instances of this wf Args: diagram: XMLDiagram object
zengine/models/workflow_manager.py
def set_xml(self, diagram, force=False): """ updates xml link if there aren't any running instances of this wf Args: diagram: XMLDiagram object """ no_of_running = WFInstance.objects.filter(wf=self, finished=False, started=True).count() if no_of_running and no...
def set_xml(self, diagram, force=False): """ updates xml link if there aren't any running instances of this wf Args: diagram: XMLDiagram object """ no_of_running = WFInstance.objects.filter(wf=self, finished=False, started=True).count() if no_of_running and no...
[ "updates", "xml", "link", "if", "there", "aren", "t", "any", "running", "instances", "of", "this", "wf", "Args", ":", "diagram", ":", "XMLDiagram", "object" ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/models/workflow_manager.py#L184-L205
[ "def", "set_xml", "(", "self", ",", "diagram", ",", "force", "=", "False", ")", ":", "no_of_running", "=", "WFInstance", ".", "objects", ".", "filter", "(", "wf", "=", "self", ",", "finished", "=", "False", ",", "started", "=", "True", ")", ".", "cou...
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
Task.create_wf_instances
Creates wf instances. Args: roles (list): role list Returns: (list): wf instances
zengine/models/workflow_manager.py
def create_wf_instances(self, roles=None): """ Creates wf instances. Args: roles (list): role list Returns: (list): wf instances """ # if roles specified then create an instance for each role # else create only one instance if ro...
def create_wf_instances(self, roles=None): """ Creates wf instances. Args: roles (list): role list Returns: (list): wf instances """ # if roles specified then create an instance for each role # else create only one instance if ro...
[ "Creates", "wf", "instances", ".", "Args", ":", "roles", "(", "list", ")", ":", "role", "list" ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/models/workflow_manager.py#L286-L338
[ "def", "create_wf_instances", "(", "self", ",", "roles", "=", "None", ")", ":", "# if roles specified then create an instance for each role", "# else create only one instance", "if", "roles", ":", "wf_instances", "=", "[", "WFInstance", "(", "wf", "=", "self", ".", "w...
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
Task.create_tasks
will create a WFInstance per object and per TaskInvitation for each role and WFInstance
zengine/models/workflow_manager.py
def create_tasks(self): """ will create a WFInstance per object and per TaskInvitation for each role and WFInstance """ roles = self.get_roles() if self.task_type in ["A", "D"]: instances = self.create_wf_instances(roles=roles) self.create_task_in...
def create_tasks(self): """ will create a WFInstance per object and per TaskInvitation for each role and WFInstance """ roles = self.get_roles() if self.task_type in ["A", "D"]: instances = self.create_wf_instances(roles=roles) self.create_task_in...
[ "will", "create", "a", "WFInstance", "per", "object", "and", "per", "TaskInvitation", "for", "each", "role", "and", "WFInstance" ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/models/workflow_manager.py#L354-L367
[ "def", "create_tasks", "(", "self", ")", ":", "roles", "=", "self", ".", "get_roles", "(", ")", "if", "self", ".", "task_type", "in", "[", "\"A\"", ",", "\"D\"", "]", ":", "instances", "=", "self", ".", "create_wf_instances", "(", "roles", "=", "roles"...
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
Task.get_object_query_dict
returns objects keys according to self.object_query_code which can be json encoded queryset filter dict or key=value set in the following format: ```"key=val, key2 = val2 , key3= value with spaces"``` Returns: (dict): Queryset filtering dicqt
zengine/models/workflow_manager.py
def get_object_query_dict(self): """returns objects keys according to self.object_query_code which can be json encoded queryset filter dict or key=value set in the following format: ```"key=val, key2 = val2 , key3= value with spaces"``` Returns: (dict): Queryset filtering ...
def get_object_query_dict(self): """returns objects keys according to self.object_query_code which can be json encoded queryset filter dict or key=value set in the following format: ```"key=val, key2 = val2 , key3= value with spaces"``` Returns: (dict): Queryset filtering ...
[ "returns", "objects", "keys", "according", "to", "self", ".", "object_query_code", "which", "can", "be", "json", "encoded", "queryset", "filter", "dict", "or", "key", "=", "value", "set", "in", "the", "following", "format", ":", "key", "=", "val", "key2", ...
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/models/workflow_manager.py#L369-L383
[ "def", "get_object_query_dict", "(", "self", ")", ":", "if", "isinstance", "(", "self", ".", "object_query_code", ",", "dict", ")", ":", "# _DATE_ _DATETIME_", "return", "self", ".", "object_query_code", "else", ":", "# comma separated, key=value pairs. wrapping spaces ...
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
Task.get_object_keys
returns object keys according to task definition which can be explicitly selected one object (self.object_key) or result of a queryset filter. Returns: list of object keys
zengine/models/workflow_manager.py
def get_object_keys(self, wfi_role=None): """returns object keys according to task definition which can be explicitly selected one object (self.object_key) or result of a queryset filter. Returns: list of object keys """ if self.object_key: return...
def get_object_keys(self, wfi_role=None): """returns object keys according to task definition which can be explicitly selected one object (self.object_key) or result of a queryset filter. Returns: list of object keys """ if self.object_key: return...
[ "returns", "object", "keys", "according", "to", "task", "definition", "which", "can", "be", "explicitly", "selected", "one", "object", "(", "self", ".", "object_key", ")", "or", "result", "of", "a", "queryset", "filter", "." ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/models/workflow_manager.py#L385-L398
[ "def", "get_object_keys", "(", "self", ",", "wfi_role", "=", "None", ")", ":", "if", "self", ".", "object_key", ":", "return", "[", "self", ".", "object_key", "]", "if", "self", ".", "object_query_code", ":", "model", "=", "model_registry", ".", "get_model...
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
Task.get_model_objects
Fetches model objects by filtering with kwargs If wfi_role is specified, then we expect kwargs contains a filter value starting with role, e.g. {'user': 'role.program.user'} We replace this `role` key with role instance parameter `wfi_role` and try to get object that filter va...
zengine/models/workflow_manager.py
def get_model_objects(model, wfi_role=None, **kwargs): """ Fetches model objects by filtering with kwargs If wfi_role is specified, then we expect kwargs contains a filter value starting with role, e.g. {'user': 'role.program.user'} We replace this `role` key with role...
def get_model_objects(model, wfi_role=None, **kwargs): """ Fetches model objects by filtering with kwargs If wfi_role is specified, then we expect kwargs contains a filter value starting with role, e.g. {'user': 'role.program.user'} We replace this `role` key with role...
[ "Fetches", "model", "objects", "by", "filtering", "with", "kwargs" ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/models/workflow_manager.py#L401-L435
[ "def", "get_model_objects", "(", "model", ",", "wfi_role", "=", "None", ",", "*", "*", "kwargs", ")", ":", "query_dict", "=", "{", "}", "for", "k", ",", "v", "in", "kwargs", ".", "items", "(", ")", ":", "if", "isinstance", "(", "v", ",", "list", ...
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
Task.get_roles
Returns: Role instances according to task definition.
zengine/models/workflow_manager.py
def get_roles(self): """ Returns: Role instances according to task definition. """ if self.role.exist: # return explicitly selected role return [self.role] else: roles = [] if self.role_query_code: # use...
def get_roles(self): """ Returns: Role instances according to task definition. """ if self.role.exist: # return explicitly selected role return [self.role] else: roles = [] if self.role_query_code: # use...
[ "Returns", ":", "Role", "instances", "according", "to", "task", "definition", "." ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/models/workflow_manager.py#L437-L471
[ "def", "get_roles", "(", "self", ")", ":", "if", "self", ".", "role", ".", "exist", ":", "# return explicitly selected role", "return", "[", "self", ".", "role", "]", "else", ":", "roles", "=", "[", "]", "if", "self", ".", "role_query_code", ":", "# use...
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
Task.post_save
can be removed when a proper task manager admin interface implemented
zengine/models/workflow_manager.py
def post_save(self): """can be removed when a proper task manager admin interface implemented""" if self.run: self.run = False self.create_tasks() self.save()
def post_save(self): """can be removed when a proper task manager admin interface implemented""" if self.run: self.run = False self.create_tasks() self.save()
[ "can", "be", "removed", "when", "a", "proper", "task", "manager", "admin", "interface", "implemented" ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/models/workflow_manager.py#L553-L558
[ "def", "post_save", "(", "self", ")", ":", "if", "self", ".", "run", ":", "self", ".", "run", "=", "False", "self", ".", "create_tasks", "(", ")", "self", ".", "save", "(", ")" ]
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
TaskInvitation.delete_other_invitations
When one person use an invitation, we should delete other invitations
zengine/models/workflow_manager.py
def delete_other_invitations(self): """ When one person use an invitation, we should delete other invitations """ # TODO: Signal logged-in users to remove the task from their task list self.objects.filter(instance=self.instance).exclude(key=self.key).delete()
def delete_other_invitations(self): """ When one person use an invitation, we should delete other invitations """ # TODO: Signal logged-in users to remove the task from their task list self.objects.filter(instance=self.instance).exclude(key=self.key).delete()
[ "When", "one", "person", "use", "an", "invitation", "we", "should", "delete", "other", "invitations" ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/models/workflow_manager.py#L664-L669
[ "def", "delete_other_invitations", "(", "self", ")", ":", "# TODO: Signal logged-in users to remove the task from their task list", "self", ".", "objects", ".", "filter", "(", "instance", "=", "self", ".", "instance", ")", ".", "exclude", "(", "key", "=", "self", "....
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
WFCache.save
write wf state to DB through MQ >> Worker >> _zops_sync_wf_cache Args: wf_state dict: wf state
zengine/models/workflow_manager.py
def save(self, wf_state): """ write wf state to DB through MQ >> Worker >> _zops_sync_wf_cache Args: wf_state dict: wf state """ self.wf_state = wf_state self.wf_state['role_id'] = self.current.role_id self.set(self.wf_state) if self.wf_state[...
def save(self, wf_state): """ write wf state to DB through MQ >> Worker >> _zops_sync_wf_cache Args: wf_state dict: wf state """ self.wf_state = wf_state self.wf_state['role_id'] = self.current.role_id self.set(self.wf_state) if self.wf_state[...
[ "write", "wf", "state", "to", "DB", "through", "MQ", ">>", "Worker", ">>", "_zops_sync_wf_cache" ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/models/workflow_manager.py#L743-L755
[ "def", "save", "(", "self", ",", "wf_state", ")", ":", "self", ".", "wf_state", "=", "wf_state", "self", ".", "wf_state", "[", "'role_id'", "]", "=", "self", ".", "current", ".", "role_id", "self", ".", "set", "(", "self", ".", "wf_state", ")", "if",...
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
ClientQueue.send_to_default_exchange
Send messages through RabbitMQ's default exchange, which will be delivered through routing_key (sess_id). This method only used for un-authenticated users, i.e. login process. Args: sess_id string: Session id message dict: Message object.
zengine/client_queue.py
def send_to_default_exchange(self, sess_id, message=None): """ Send messages through RabbitMQ's default exchange, which will be delivered through routing_key (sess_id). This method only used for un-authenticated users, i.e. login process. Args: sess_id string: Sessi...
def send_to_default_exchange(self, sess_id, message=None): """ Send messages through RabbitMQ's default exchange, which will be delivered through routing_key (sess_id). This method only used for un-authenticated users, i.e. login process. Args: sess_id string: Sessi...
[ "Send", "messages", "through", "RabbitMQ", "s", "default", "exchange", "which", "will", "be", "delivered", "through", "routing_key", "(", "sess_id", ")", "." ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/client_queue.py#L59-L73
[ "def", "send_to_default_exchange", "(", "self", ",", "sess_id", ",", "message", "=", "None", ")", ":", "msg", "=", "json", ".", "dumps", "(", "message", ",", "cls", "=", "ZEngineJSONEncoder", ")", "log", ".", "debug", "(", "\"Sending following message to %s qu...
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
ClientQueue.send_to_prv_exchange
Send messages through logged in users private exchange. Args: user_id string: User key message dict: Message object
zengine/client_queue.py
def send_to_prv_exchange(self, user_id, message=None): """ Send messages through logged in users private exchange. Args: user_id string: User key message dict: Message object """ exchange = 'prv_%s' % user_id.lower() msg = json.dumps(message, cls...
def send_to_prv_exchange(self, user_id, message=None): """ Send messages through logged in users private exchange. Args: user_id string: User key message dict: Message object """ exchange = 'prv_%s' % user_id.lower() msg = json.dumps(message, cls...
[ "Send", "messages", "through", "logged", "in", "users", "private", "exchange", "." ]
zetaops/zengine
python
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/client_queue.py#L75-L87
[ "def", "send_to_prv_exchange", "(", "self", ",", "user_id", ",", "message", "=", "None", ")", ":", "exchange", "=", "'prv_%s'", "%", "user_id", ".", "lower", "(", ")", "msg", "=", "json", ".", "dumps", "(", "message", ",", "cls", "=", "ZEngineJSONEncoder...
b5bc32d3b37bca799f8985be916f04528ac79e4a
train
Compose.compose
compose 2 graphs to CGR :param other: Molecule or CGR Container :return: CGRContainer
CGRtools/algorithms/compose.py
def compose(self, other): """ compose 2 graphs to CGR :param other: Molecule or CGR Container :return: CGRContainer """ if not isinstance(other, Compose): raise TypeError('CGRContainer or MoleculeContainer [sub]class expected') cgr = self._get_subcla...
def compose(self, other): """ compose 2 graphs to CGR :param other: Molecule or CGR Container :return: CGRContainer """ if not isinstance(other, Compose): raise TypeError('CGRContainer or MoleculeContainer [sub]class expected') cgr = self._get_subcla...
[ "compose", "2", "graphs", "to", "CGR" ]
cimm-kzn/CGRtools
python
https://github.com/cimm-kzn/CGRtools/blob/15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34/CGRtools/algorithms/compose.py#L30-L172
[ "def", "compose", "(", "self", ",", "other", ")", ":", "if", "not", "isinstance", "(", "other", ",", "Compose", ")", ":", "raise", "TypeError", "(", "'CGRContainer or MoleculeContainer [sub]class expected'", ")", "cgr", "=", "self", ".", "_get_subclass", "(", ...
15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34
train
CGRCompose.decompose
decompose CGR to pair of Molecules, which represents reactants and products state of reaction :return: tuple of two molecules
CGRtools/algorithms/compose.py
def decompose(self): """ decompose CGR to pair of Molecules, which represents reactants and products state of reaction :return: tuple of two molecules """ mc = self._get_subclass('MoleculeContainer') reactants = mc() products = mc() for n, atom in self.a...
def decompose(self): """ decompose CGR to pair of Molecules, which represents reactants and products state of reaction :return: tuple of two molecules """ mc = self._get_subclass('MoleculeContainer') reactants = mc() products = mc() for n, atom in self.a...
[ "decompose", "CGR", "to", "pair", "of", "Molecules", "which", "represents", "reactants", "and", "products", "state", "of", "reaction" ]
cimm-kzn/CGRtools
python
https://github.com/cimm-kzn/CGRtools/blob/15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34/CGRtools/algorithms/compose.py#L182-L201
[ "def", "decompose", "(", "self", ")", ":", "mc", "=", "self", ".", "_get_subclass", "(", "'MoleculeContainer'", ")", "reactants", "=", "mc", "(", ")", "products", "=", "mc", "(", ")", "for", "n", ",", "atom", "in", "self", ".", "atoms", "(", ")", "...
15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34
train
CycleTimeQueries.cycle_data
Get data from JIRA for cycle/flow times and story points size change. Build a numerically indexed data frame with the following 'fixed' columns: `key`, 'url', 'issue_type', `summary`, `status`, and `resolution` from JIRA, as well as the value of any fields set in the `fields` dict in `s...
jira_metrics_extract/cycletime.py
def cycle_data(self, verbose=False, result_cycle=None, result_size=None, result_edges=None,changelog=True): """Get data from JIRA for cycle/flow times and story points size change. Build a numerically indexed data frame with the following 'fixed' columns: `key`, 'url', 'issue_type', `summary`, ...
def cycle_data(self, verbose=False, result_cycle=None, result_size=None, result_edges=None,changelog=True): """Get data from JIRA for cycle/flow times and story points size change. Build a numerically indexed data frame with the following 'fixed' columns: `key`, 'url', 'issue_type', `summary`, ...
[ "Get", "data", "from", "JIRA", "for", "cycle", "/", "flow", "times", "and", "story", "points", "size", "change", "." ]
rnwolf/jira-metrics-extract
python
https://github.com/rnwolf/jira-metrics-extract/blob/56443211b3e1200f3def79173a21e0232332ae17/jira_metrics_extract/cycletime.py#L86-L357
[ "def", "cycle_data", "(", "self", ",", "verbose", "=", "False", ",", "result_cycle", "=", "None", ",", "result_size", "=", "None", ",", "result_edges", "=", "None", ",", "changelog", "=", "True", ")", ":", "cycle_names", "=", "[", "s", "[", "'name'", "...
56443211b3e1200f3def79173a21e0232332ae17
train
CycleTimeQueries.size_history
Return the a DataFrame, indexed by day, with columns containing story size for each issue. In addition, columns are soted by Jira Issue key. First by Project and then by id number.
jira_metrics_extract/cycletime.py
def size_history(self,size_data): """Return the a DataFrame, indexed by day, with columns containing story size for each issue. In addition, columns are soted by Jira Issue key. First by Project and then by id number. """ def my_merge(df1, df2): # http://stackoverfl...
def size_history(self,size_data): """Return the a DataFrame, indexed by day, with columns containing story size for each issue. In addition, columns are soted by Jira Issue key. First by Project and then by id number. """ def my_merge(df1, df2): # http://stackoverfl...
[ "Return", "the", "a", "DataFrame", "indexed", "by", "day", "with", "columns", "containing", "story", "size", "for", "each", "issue", "." ]
rnwolf/jira-metrics-extract
python
https://github.com/rnwolf/jira-metrics-extract/blob/56443211b3e1200f3def79173a21e0232332ae17/jira_metrics_extract/cycletime.py#L359-L407
[ "def", "size_history", "(", "self", ",", "size_data", ")", ":", "def", "my_merge", "(", "df1", ",", "df2", ")", ":", "# http://stackoverflow.com/questions/34411495/pandas-merge-several-dataframes", "res", "=", "pd", ".", "merge", "(", "df1", ",", "df2", ",", "ho...
56443211b3e1200f3def79173a21e0232332ae17
train
CycleTimeQueries.cfd
Return the data to build a cumulative flow diagram: a DataFrame, indexed by day, with columns containing cumulative counts for each of the items in the configured cycle. In addition, a column called `cycle_time` contains the approximate average cycle time of that day based on the first ...
jira_metrics_extract/cycletime.py
def cfd(self, cycle_data,size_history= None, pointscolumn= None, stacked = True ): """Return the data to build a cumulative flow diagram: a DataFrame, indexed by day, with columns containing cumulative counts for each of the items in the configured cycle. In addition, a column called `c...
def cfd(self, cycle_data,size_history= None, pointscolumn= None, stacked = True ): """Return the data to build a cumulative flow diagram: a DataFrame, indexed by day, with columns containing cumulative counts for each of the items in the configured cycle. In addition, a column called `c...
[ "Return", "the", "data", "to", "build", "a", "cumulative", "flow", "diagram", ":", "a", "DataFrame", "indexed", "by", "day", "with", "columns", "containing", "cumulative", "counts", "for", "each", "of", "the", "items", "in", "the", "configured", "cycle", "."...
rnwolf/jira-metrics-extract
python
https://github.com/rnwolf/jira-metrics-extract/blob/56443211b3e1200f3def79173a21e0232332ae17/jira_metrics_extract/cycletime.py#L410-L641
[ "def", "cfd", "(", "self", ",", "cycle_data", ",", "size_history", "=", "None", ",", "pointscolumn", "=", "None", ",", "stacked", "=", "True", ")", ":", "# Define helper function", "def", "cumulativeColumnStates", "(", "df", ",", "stacked", ")", ":", "\"\"\"...
56443211b3e1200f3def79173a21e0232332ae17
train
CycleTimeQueries.histogram
Return histogram data for the cycle times in `cycle_data`. Returns a dictionary with keys `bin_values` and `bin_edges` of numpy arrays
jira_metrics_extract/cycletime.py
def histogram(self, cycle_data, bins=10): """Return histogram data for the cycle times in `cycle_data`. Returns a dictionary with keys `bin_values` and `bin_edges` of numpy arrays """ values, edges = np.histogram(cycle_data['cycle_time'].astype('timedelta64[D]').dropna(), bins=bins) ...
def histogram(self, cycle_data, bins=10): """Return histogram data for the cycle times in `cycle_data`. Returns a dictionary with keys `bin_values` and `bin_edges` of numpy arrays """ values, edges = np.histogram(cycle_data['cycle_time'].astype('timedelta64[D]').dropna(), bins=bins) ...
[ "Return", "histogram", "data", "for", "the", "cycle", "times", "in", "cycle_data", ".", "Returns", "a", "dictionary", "with", "keys", "bin_values", "and", "bin_edges", "of", "numpy", "arrays" ]
rnwolf/jira-metrics-extract
python
https://github.com/rnwolf/jira-metrics-extract/blob/56443211b3e1200f3def79173a21e0232332ae17/jira_metrics_extract/cycletime.py#L644-L656
[ "def", "histogram", "(", "self", ",", "cycle_data", ",", "bins", "=", "10", ")", ":", "values", ",", "edges", "=", "np", ".", "histogram", "(", "cycle_data", "[", "'cycle_time'", "]", ".", "astype", "(", "'timedelta64[D]'", ")", ".", "dropna", "(", ")"...
56443211b3e1200f3def79173a21e0232332ae17
train
CycleTimeQueries.throughput_data
Return a data frame with columns `completed_timestamp` of the given frequency, either `count`, where count is the number of items 'sum', where sum is the sum of value specified by pointscolumn. Expected to be 'StoryPoints' completed at that timestamp (e.g. daily).
jira_metrics_extract/cycletime.py
def throughput_data(self, cycle_data, frequency='1D',pointscolumn= None): """Return a data frame with columns `completed_timestamp` of the given frequency, either `count`, where count is the number of items 'sum', where sum is the sum of value specified by pointscolumn. Expected to be 'S...
def throughput_data(self, cycle_data, frequency='1D',pointscolumn= None): """Return a data frame with columns `completed_timestamp` of the given frequency, either `count`, where count is the number of items 'sum', where sum is the sum of value specified by pointscolumn. Expected to be 'S...
[ "Return", "a", "data", "frame", "with", "columns", "completed_timestamp", "of", "the", "given", "frequency", "either", "count", "where", "count", "is", "the", "number", "of", "items", "sum", "where", "sum", "is", "the", "sum", "of", "value", "specified", "by...
rnwolf/jira-metrics-extract
python
https://github.com/rnwolf/jira-metrics-extract/blob/56443211b3e1200f3def79173a21e0232332ae17/jira_metrics_extract/cycletime.py#L658-L679
[ "def", "throughput_data", "(", "self", ",", "cycle_data", ",", "frequency", "=", "'1D'", ",", "pointscolumn", "=", "None", ")", ":", "if", "len", "(", "cycle_data", ")", "<", "1", ":", "return", "None", "# Note completed items yet, return None", "if", "pointsc...
56443211b3e1200f3def79173a21e0232332ae17
train
CycleTimeQueries.scatterplot
Return scatterplot data for the cycle times in `cycle_data`. Returns a data frame containing only those items in `cycle_data` where values are set for `completed_timestamp` and `cycle_time`, and with those two columns as the first two, both normalised to whole days, and with `completed_t...
jira_metrics_extract/cycletime.py
def scatterplot(self, cycle_data): """Return scatterplot data for the cycle times in `cycle_data`. Returns a data frame containing only those items in `cycle_data` where values are set for `completed_timestamp` and `cycle_time`, and with those two columns as the first two, both normalise...
def scatterplot(self, cycle_data): """Return scatterplot data for the cycle times in `cycle_data`. Returns a data frame containing only those items in `cycle_data` where values are set for `completed_timestamp` and `cycle_time`, and with those two columns as the first two, both normalise...
[ "Return", "scatterplot", "data", "for", "the", "cycle", "times", "in", "cycle_data", ".", "Returns", "a", "data", "frame", "containing", "only", "those", "items", "in", "cycle_data", "where", "values", "are", "set", "for", "completed_timestamp", "and", "cycle_ti...
rnwolf/jira-metrics-extract
python
https://github.com/rnwolf/jira-metrics-extract/blob/56443211b3e1200f3def79173a21e0232332ae17/jira_metrics_extract/cycletime.py#L681-L703
[ "def", "scatterplot", "(", "self", ",", "cycle_data", ")", ":", "columns", "=", "list", "(", "cycle_data", ".", "columns", ")", "columns", ".", "remove", "(", "'cycle_time'", ")", "columns", ".", "remove", "(", "'completed_timestamp'", ")", "columns", "=", ...
56443211b3e1200f3def79173a21e0232332ae17
train
NSQSender._is_ready
Is NSQ running and have space to receive messages?
logagg/nsqsender.py
def _is_ready(self, topic_name): ''' Is NSQ running and have space to receive messages? ''' url = 'http://%s/stats?format=json&topic=%s' % (self.nsqd_http_address, topic_name) #Cheacking for ephmeral channels if '#' in topic_name: topic_name, tag =topic_name.s...
def _is_ready(self, topic_name): ''' Is NSQ running and have space to receive messages? ''' url = 'http://%s/stats?format=json&topic=%s' % (self.nsqd_http_address, topic_name) #Cheacking for ephmeral channels if '#' in topic_name: topic_name, tag =topic_name.s...
[ "Is", "NSQ", "running", "and", "have", "space", "to", "receive", "messages?" ]
deep-compute/logagg
python
https://github.com/deep-compute/logagg/blob/7863bc1b5ddf3e67c4d4b55746799304180589a0/logagg/nsqsender.py#L39-L74
[ "def", "_is_ready", "(", "self", ",", "topic_name", ")", ":", "url", "=", "'http://%s/stats?format=json&topic=%s'", "%", "(", "self", ".", "nsqd_http_address", ",", "topic_name", ")", "#Cheacking for ephmeral channels", "if", "'#'", "in", "topic_name", ":", "topic_n...
7863bc1b5ddf3e67c4d4b55746799304180589a0
train
QueryContainer._matcher
QueryContainer < MoleculeContainer QueryContainer < QueryContainer[more general] QueryContainer < QueryCGRContainer[more general]
CGRtools/containers/query.py
def _matcher(self, other): """ QueryContainer < MoleculeContainer QueryContainer < QueryContainer[more general] QueryContainer < QueryCGRContainer[more general] """ if isinstance(other, MoleculeContainer): return GraphMatcher(other, self, lambda x, y: y == x, ...
def _matcher(self, other): """ QueryContainer < MoleculeContainer QueryContainer < QueryContainer[more general] QueryContainer < QueryCGRContainer[more general] """ if isinstance(other, MoleculeContainer): return GraphMatcher(other, self, lambda x, y: y == x, ...
[ "QueryContainer", "<", "MoleculeContainer", "QueryContainer", "<", "QueryContainer", "[", "more", "general", "]", "QueryContainer", "<", "QueryCGRContainer", "[", "more", "general", "]" ]
cimm-kzn/CGRtools
python
https://github.com/cimm-kzn/CGRtools/blob/15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34/CGRtools/containers/query.py#L31-L41
[ "def", "_matcher", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "MoleculeContainer", ")", ":", "return", "GraphMatcher", "(", "other", ",", "self", ",", "lambda", "x", ",", "y", ":", "y", "==", "x", ",", "lambda", "x", ...
15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34
train
QueryCGRContainer._matcher
QueryCGRContainer < CGRContainer QueryContainer < QueryCGRContainer[more general]
CGRtools/containers/query.py
def _matcher(self, other): """ QueryCGRContainer < CGRContainer QueryContainer < QueryCGRContainer[more general] """ if isinstance(other, CGRContainer): return GraphMatcher(other, self, lambda x, y: y == x, lambda x, y: y == x) elif isinstance(other, QueryCGRC...
def _matcher(self, other): """ QueryCGRContainer < CGRContainer QueryContainer < QueryCGRContainer[more general] """ if isinstance(other, CGRContainer): return GraphMatcher(other, self, lambda x, y: y == x, lambda x, y: y == x) elif isinstance(other, QueryCGRC...
[ "QueryCGRContainer", "<", "CGRContainer", "QueryContainer", "<", "QueryCGRContainer", "[", "more", "general", "]" ]
cimm-kzn/CGRtools
python
https://github.com/cimm-kzn/CGRtools/blob/15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34/CGRtools/containers/query.py#L48-L57
[ "def", "_matcher", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "CGRContainer", ")", ":", "return", "GraphMatcher", "(", "other", ",", "self", ",", "lambda", "x", ",", "y", ":", "y", "==", "x", ",", "lambda", "x", ","...
15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34
train
Calculate2D.calculate2d
recalculate 2d coordinates. currently rings can be calculated badly. :param scale: rescale calculated positions. :param force: ignore existing coordinates of atoms
CGRtools/algorithms/calculate2d.py
def calculate2d(self, force=False, scale=1): """ recalculate 2d coordinates. currently rings can be calculated badly. :param scale: rescale calculated positions. :param force: ignore existing coordinates of atoms """ dist = {} # length forces for n, m_bon...
def calculate2d(self, force=False, scale=1): """ recalculate 2d coordinates. currently rings can be calculated badly. :param scale: rescale calculated positions. :param force: ignore existing coordinates of atoms """ dist = {} # length forces for n, m_bon...
[ "recalculate", "2d", "coordinates", ".", "currently", "rings", "can", "be", "calculated", "badly", "." ]
cimm-kzn/CGRtools
python
https://github.com/cimm-kzn/CGRtools/blob/15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34/CGRtools/algorithms/calculate2d.py#L24-L79
[ "def", "calculate2d", "(", "self", ",", "force", "=", "False", ",", "scale", "=", "1", ")", ":", "dist", "=", "{", "}", "# length forces", "for", "n", ",", "m_bond", "in", "self", ".", "_adj", ".", "items", "(", ")", ":", "dist", "[", "n", "]", ...
15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34
train
Knight.possible_moves
Finds all possible knight moves :type: position Board :rtype: list
chess_py/pieces/knight.py
def possible_moves(self, position): """ Finds all possible knight moves :type: position Board :rtype: list """ for direction in [0, 1, 2, 3]: angles = self._rotate_direction_ninety_degrees(direction) for angle in angles: try: ...
def possible_moves(self, position): """ Finds all possible knight moves :type: position Board :rtype: list """ for direction in [0, 1, 2, 3]: angles = self._rotate_direction_ninety_degrees(direction) for angle in angles: try: ...
[ "Finds", "all", "possible", "knight", "moves", ":", "type", ":", "position", "Board", ":", "rtype", ":", "list" ]
LordDarkula/chess_py
python
https://github.com/LordDarkula/chess_py/blob/14bebc2f8c49ae25c59375cc83d0b38d8ff7281d/chess_py/pieces/knight.py#L57-L81
[ "def", "possible_moves", "(", "self", ",", "position", ")", ":", "for", "direction", "in", "[", "0", ",", "1", ",", "2", ",", "3", "]", ":", "angles", "=", "self", ".", "_rotate_direction_ninety_degrees", "(", "direction", ")", "for", "angle", "in", "a...
14bebc2f8c49ae25c59375cc83d0b38d8ff7281d
train
CGRContainer.centers_list
get a list of lists of atoms of reaction centers
CGRtools/containers/cgr.py
def centers_list(self): """ get a list of lists of atoms of reaction centers """ center = set() adj = defaultdict(set) for n, atom in self.atoms(): if atom._reactant != atom._product: center.add(n) for n, m, bond in self.bonds(): i...
def centers_list(self): """ get a list of lists of atoms of reaction centers """ center = set() adj = defaultdict(set) for n, atom in self.atoms(): if atom._reactant != atom._product: center.add(n) for n, m, bond in self.bonds(): i...
[ "get", "a", "list", "of", "lists", "of", "atoms", "of", "reaction", "centers" ]
cimm-kzn/CGRtools
python
https://github.com/cimm-kzn/CGRtools/blob/15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34/CGRtools/containers/cgr.py#L37-L63
[ "def", "centers_list", "(", "self", ")", ":", "center", "=", "set", "(", ")", "adj", "=", "defaultdict", "(", "set", ")", "for", "n", ",", "atom", "in", "self", ".", "atoms", "(", ")", ":", "if", "atom", ".", "_reactant", "!=", "atom", ".", "_pro...
15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34
train
CGRContainer.center_atoms
get list of atoms of reaction center (atoms with dynamic: bonds, charges, radicals).
CGRtools/containers/cgr.py
def center_atoms(self): """ get list of atoms of reaction center (atoms with dynamic: bonds, charges, radicals). """ nodes = set() for n, atom in self.atoms(): if atom._reactant != atom._product: nodes.add(n) for n, m, bond in self.bonds(): ...
def center_atoms(self): """ get list of atoms of reaction center (atoms with dynamic: bonds, charges, radicals). """ nodes = set() for n, atom in self.atoms(): if atom._reactant != atom._product: nodes.add(n) for n, m, bond in self.bonds(): ...
[ "get", "list", "of", "atoms", "of", "reaction", "center", "(", "atoms", "with", "dynamic", ":", "bonds", "charges", "radicals", ")", "." ]
cimm-kzn/CGRtools
python
https://github.com/cimm-kzn/CGRtools/blob/15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34/CGRtools/containers/cgr.py#L66-L79
[ "def", "center_atoms", "(", "self", ")", ":", "nodes", "=", "set", "(", ")", "for", "n", ",", "atom", "in", "self", ".", "atoms", "(", ")", ":", "if", "atom", ".", "_reactant", "!=", "atom", ".", "_product", ":", "nodes", ".", "add", "(", "n", ...
15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34
train
CGRContainer.center_bonds
get list of bonds of reaction center (bonds with dynamic orders).
CGRtools/containers/cgr.py
def center_bonds(self): """ get list of bonds of reaction center (bonds with dynamic orders). """ return [(n, m) for n, m, bond in self.bonds() if bond._reactant != bond._product]
def center_bonds(self): """ get list of bonds of reaction center (bonds with dynamic orders). """ return [(n, m) for n, m, bond in self.bonds() if bond._reactant != bond._product]
[ "get", "list", "of", "bonds", "of", "reaction", "center", "(", "bonds", "with", "dynamic", "orders", ")", "." ]
cimm-kzn/CGRtools
python
https://github.com/cimm-kzn/CGRtools/blob/15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34/CGRtools/containers/cgr.py#L82-L85
[ "def", "center_bonds", "(", "self", ")", ":", "return", "[", "(", "n", ",", "m", ")", "for", "n", ",", "m", ",", "bond", "in", "self", ".", "bonds", "(", ")", "if", "bond", ".", "_reactant", "!=", "bond", ".", "_product", "]" ]
15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34
train
CGRContainer.reset_query_marks
set or reset hyb and neighbors marks to atoms.
CGRtools/containers/cgr.py
def reset_query_marks(self): """ set or reset hyb and neighbors marks to atoms. """ for i, atom in self.atoms(): neighbors = 0 hybridization = 1 p_neighbors = 0 p_hybridization = 1 # hyb 1- sp3; 2- sp2; 3- sp1; 4- aromatic ...
def reset_query_marks(self): """ set or reset hyb and neighbors marks to atoms. """ for i, atom in self.atoms(): neighbors = 0 hybridization = 1 p_neighbors = 0 p_hybridization = 1 # hyb 1- sp3; 2- sp2; 3- sp1; 4- aromatic ...
[ "set", "or", "reset", "hyb", "and", "neighbors", "marks", "to", "atoms", "." ]
cimm-kzn/CGRtools
python
https://github.com/cimm-kzn/CGRtools/blob/15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34/CGRtools/containers/cgr.py#L87-L134
[ "def", "reset_query_marks", "(", "self", ")", ":", "for", "i", ",", "atom", "in", "self", ".", "atoms", "(", ")", ":", "neighbors", "=", "0", "hybridization", "=", "1", "p_neighbors", "=", "0", "p_hybridization", "=", "1", "# hyb 1- sp3; 2- sp2; 3- sp1; 4- a...
15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34
train
CGRContainer.substructure
create substructure containing atoms from nbunch list :param atoms: list of atoms numbers of substructure :param meta: if True metadata will be copied to substructure :param as_view: If True, the returned graph-view provides a read-only view of the original structure scaffold withou...
CGRtools/containers/cgr.py
def substructure(self, atoms, meta=False, as_view=True): """ create substructure containing atoms from nbunch list :param atoms: list of atoms numbers of substructure :param meta: if True metadata will be copied to substructure :param as_view: If True, the returned graph-view pr...
def substructure(self, atoms, meta=False, as_view=True): """ create substructure containing atoms from nbunch list :param atoms: list of atoms numbers of substructure :param meta: if True metadata will be copied to substructure :param as_view: If True, the returned graph-view pr...
[ "create", "substructure", "containing", "atoms", "from", "nbunch", "list" ]
cimm-kzn/CGRtools
python
https://github.com/cimm-kzn/CGRtools/blob/15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34/CGRtools/containers/cgr.py#L136-L148
[ "def", "substructure", "(", "self", ",", "atoms", ",", "meta", "=", "False", ",", "as_view", "=", "True", ")", ":", "s", "=", "super", "(", ")", ".", "substructure", "(", "atoms", ",", "meta", ",", "as_view", ")", "if", "as_view", ":", "s", ".", ...
15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34
train
CGRContainer._matcher
CGRContainer < CGRContainer
CGRtools/containers/cgr.py
def _matcher(self, other): """ CGRContainer < CGRContainer """ if isinstance(other, CGRContainer): return GraphMatcher(other, self, lambda x, y: x == y, lambda x, y: x == y) raise TypeError('only cgr-cgr possible')
def _matcher(self, other): """ CGRContainer < CGRContainer """ if isinstance(other, CGRContainer): return GraphMatcher(other, self, lambda x, y: x == y, lambda x, y: x == y) raise TypeError('only cgr-cgr possible')
[ "CGRContainer", "<", "CGRContainer" ]
cimm-kzn/CGRtools
python
https://github.com/cimm-kzn/CGRtools/blob/15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34/CGRtools/containers/cgr.py#L150-L156
[ "def", "_matcher", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "CGRContainer", ")", ":", "return", "GraphMatcher", "(", "other", ",", "self", ",", "lambda", "x", ",", "y", ":", "x", "==", "y", ",", "lambda", "x", ","...
15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34
train
CGRContainer.__plain_bfs
modified NX fast BFS node generator
CGRtools/containers/cgr.py
def __plain_bfs(adj, source): """modified NX fast BFS node generator""" seen = set() nextlevel = {source} while nextlevel: thislevel = nextlevel nextlevel = set() for v in thislevel: if v not in seen: yield v ...
def __plain_bfs(adj, source): """modified NX fast BFS node generator""" seen = set() nextlevel = {source} while nextlevel: thislevel = nextlevel nextlevel = set() for v in thislevel: if v not in seen: yield v ...
[ "modified", "NX", "fast", "BFS", "node", "generator" ]
cimm-kzn/CGRtools
python
https://github.com/cimm-kzn/CGRtools/blob/15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34/CGRtools/containers/cgr.py#L159-L170
[ "def", "__plain_bfs", "(", "adj", ",", "source", ")", ":", "seen", "=", "set", "(", ")", "nextlevel", "=", "{", "source", "}", "while", "nextlevel", ":", "thislevel", "=", "nextlevel", "nextlevel", "=", "set", "(", ")", "for", "v", "in", "thislevel", ...
15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34
train
DefaultOptions.token
Returns authorization token provided by Cocaine. The real meaning of the token is determined by its type. For example OAUTH2 token will have "bearer" type. :return: A tuple of token type and body.
cocaine/detail/defaults.py
def token(self): """ Returns authorization token provided by Cocaine. The real meaning of the token is determined by its type. For example OAUTH2 token will have "bearer" type. :return: A tuple of token type and body. """ if self._token is None: toke...
def token(self): """ Returns authorization token provided by Cocaine. The real meaning of the token is determined by its type. For example OAUTH2 token will have "bearer" type. :return: A tuple of token type and body. """ if self._token is None: toke...
[ "Returns", "authorization", "token", "provided", "by", "Cocaine", "." ]
cocaine/cocaine-framework-python
python
https://github.com/cocaine/cocaine-framework-python/blob/d8a30074b6338bac4389eb996e00d404338115e4/cocaine/detail/defaults.py#L116-L129
[ "def", "token", "(", "self", ")", ":", "if", "self", ".", "_token", "is", "None", ":", "token_type", "=", "os", ".", "getenv", "(", "TOKEN_TYPE_KEY", ",", "''", ")", "token_body", "=", "os", ".", "getenv", "(", "TOKEN_BODY_KEY", ",", "''", ")", "self...
d8a30074b6338bac4389eb996e00d404338115e4
train
Logger._send
Send a message lazy formatted with args. External log attributes can be passed via named attribute `extra`, like in logging from the standart library. Note: * Attrs must be dict, otherwise the whole message would be skipped. * The key field in an attr is converted to str...
cocaine/detail/logger.py
def _send(self): """ Send a message lazy formatted with args. External log attributes can be passed via named attribute `extra`, like in logging from the standart library. Note: * Attrs must be dict, otherwise the whole message would be skipped. * The key field i...
def _send(self): """ Send a message lazy formatted with args. External log attributes can be passed via named attribute `extra`, like in logging from the standart library. Note: * Attrs must be dict, otherwise the whole message would be skipped. * The key field i...
[ "Send", "a", "message", "lazy", "formatted", "with", "args", ".", "External", "log", "attributes", "can", "be", "passed", "via", "named", "attribute", "extra", "like", "in", "logging", "from", "the", "standart", "library", "." ]
cocaine/cocaine-framework-python
python
https://github.com/cocaine/cocaine-framework-python/blob/d8a30074b6338bac4389eb996e00d404338115e4/cocaine/detail/logger.py#L147-L186
[ "def", "_send", "(", "self", ")", ":", "buff", "=", "BytesIO", "(", ")", "while", "True", ":", "msgs", "=", "list", "(", ")", "try", ":", "msg", "=", "yield", "self", ".", "queue", ".", "get", "(", ")", "# we need to connect first, as we issue verbosity ...
d8a30074b6338bac4389eb996e00d404338115e4