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
valid
init_logging
Initialise the logging by adding an observer to the global log publisher. :param str log_level: The minimum log level to log messages for.
marathon_acme/cli.py
def init_logging(log_level): """ Initialise the logging by adding an observer to the global log publisher. :param str log_level: The minimum log level to log messages for. """ log_level_filter = LogLevelFilterPredicate( LogLevel.levelWithName(log_level)) log_level_filter.setLogLevelForN...
def init_logging(log_level): """ Initialise the logging by adding an observer to the global log publisher. :param str log_level: The minimum log level to log messages for. """ log_level_filter = LogLevelFilterPredicate( LogLevel.levelWithName(log_level)) log_level_filter.setLogLevelForN...
[ "Initialise", "the", "logging", "by", "adding", "an", "observer", "to", "the", "global", "log", "publisher", "." ]
praekeltfoundation/marathon-acme
python
https://github.com/praekeltfoundation/marathon-acme/blob/b1b71e3dde0ba30e575089280658bd32890e3325/marathon_acme/cli.py#L271-L283
[ "def", "init_logging", "(", "log_level", ")", ":", "log_level_filter", "=", "LogLevelFilterPredicate", "(", "LogLevel", ".", "levelWithName", "(", "log_level", ")", ")", "log_level_filter", ".", "setLogLevelForNamespace", "(", "'twisted.web.client._HTTP11ClientFactory'", ...
b1b71e3dde0ba30e575089280658bd32890e3325
valid
_parse_field_value
Parse the field and value from a line.
marathon_acme/sse_protocol.py
def _parse_field_value(line): """ Parse the field and value from a line. """ if line.startswith(':'): # Ignore the line return None, None if ':' not in line: # Treat the entire line as the field, use empty string as value return line, '' # Else field is before the ':' a...
def _parse_field_value(line): """ Parse the field and value from a line. """ if line.startswith(':'): # Ignore the line return None, None if ':' not in line: # Treat the entire line as the field, use empty string as value return line, '' # Else field is before the ':' a...
[ "Parse", "the", "field", "and", "value", "from", "a", "line", "." ]
praekeltfoundation/marathon-acme
python
https://github.com/praekeltfoundation/marathon-acme/blob/b1b71e3dde0ba30e575089280658bd32890e3325/marathon_acme/sse_protocol.py#L196-L212
[ "def", "_parse_field_value", "(", "line", ")", ":", "if", "line", ".", "startswith", "(", "':'", ")", ":", "# Ignore the line", "return", "None", ",", "None", "if", "':'", "not", "in", "line", ":", "# Treat the entire line as the field, use empty string as value", ...
b1b71e3dde0ba30e575089280658bd32890e3325
valid
SseProtocol._abortConnection
We need a way to close the connection when an event line is too long or if we time out waiting for an event. This is normally done by calling :meth:`~twisted.internet.interfaces.ITransport.loseConnection`` or :meth:`~twisted.internet.interfaces.ITCPTransport.abortConnection`, but newer v...
marathon_acme/sse_protocol.py
def _abortConnection(self): """ We need a way to close the connection when an event line is too long or if we time out waiting for an event. This is normally done by calling :meth:`~twisted.internet.interfaces.ITransport.loseConnection`` or :meth:`~twisted.internet.interfaces.ITC...
def _abortConnection(self): """ We need a way to close the connection when an event line is too long or if we time out waiting for an event. This is normally done by calling :meth:`~twisted.internet.interfaces.ITransport.loseConnection`` or :meth:`~twisted.internet.interfaces.ITC...
[ "We", "need", "a", "way", "to", "close", "the", "connection", "when", "an", "event", "line", "is", "too", "long", "or", "if", "we", "time", "out", "waiting", "for", "an", "event", ".", "This", "is", "normally", "done", "by", "calling", ":", "meth", "...
praekeltfoundation/marathon-acme
python
https://github.com/praekeltfoundation/marathon-acme/blob/b1b71e3dde0ba30e575089280658bd32890e3325/marathon_acme/sse_protocol.py#L51-L85
[ "def", "_abortConnection", "(", "self", ")", ":", "transport", "=", "self", ".", "transport", "if", "isinstance", "(", "transport", ",", "TransportProxyProducer", ")", ":", "transport", "=", "transport", ".", "_producer", "if", "hasattr", "(", "transport", ","...
b1b71e3dde0ba30e575089280658bd32890e3325
valid
SseProtocol.dataReceived
Translates bytes into lines, and calls lineReceived. Copied from ``twisted.protocols.basic.LineOnlyReceiver`` but using str.splitlines() to split on ``\r\n``, ``\n``, and ``\r``.
marathon_acme/sse_protocol.py
def dataReceived(self, data): """ Translates bytes into lines, and calls lineReceived. Copied from ``twisted.protocols.basic.LineOnlyReceiver`` but using str.splitlines() to split on ``\r\n``, ``\n``, and ``\r``. """ self.resetTimeout() lines = (self._buffer + da...
def dataReceived(self, data): """ Translates bytes into lines, and calls lineReceived. Copied from ``twisted.protocols.basic.LineOnlyReceiver`` but using str.splitlines() to split on ``\r\n``, ``\n``, and ``\r``. """ self.resetTimeout() lines = (self._buffer + da...
[ "Translates", "bytes", "into", "lines", "and", "calls", "lineReceived", "." ]
praekeltfoundation/marathon-acme
python
https://github.com/praekeltfoundation/marathon-acme/blob/b1b71e3dde0ba30e575089280658bd32890e3325/marathon_acme/sse_protocol.py#L99-L132
[ "def", "dataReceived", "(", "self", ",", "data", ")", ":", "self", ".", "resetTimeout", "(", ")", "lines", "=", "(", "self", ".", "_buffer", "+", "data", ")", ".", "splitlines", "(", ")", "# str.splitlines() doesn't split the string after a trailing newline", "#...
b1b71e3dde0ba30e575089280658bd32890e3325
valid
SseProtocol._handle_field_value
Handle the field, value pair.
marathon_acme/sse_protocol.py
def _handle_field_value(self, field, value): """ Handle the field, value pair. """ if field == 'event': self._event = value elif field == 'data': self._data_lines.append(value) elif field == 'id': # Not implemented pass elif field =...
def _handle_field_value(self, field, value): """ Handle the field, value pair. """ if field == 'event': self._event = value elif field == 'data': self._data_lines.append(value) elif field == 'id': # Not implemented pass elif field =...
[ "Handle", "the", "field", "value", "pair", "." ]
praekeltfoundation/marathon-acme
python
https://github.com/praekeltfoundation/marathon-acme/blob/b1b71e3dde0ba30e575089280658bd32890e3325/marathon_acme/sse_protocol.py#L149-L160
[ "def", "_handle_field_value", "(", "self", ",", "field", ",", "value", ")", ":", "if", "field", "==", "'event'", ":", "self", ".", "_event", "=", "value", "elif", "field", "==", "'data'", ":", "self", ".", "_data_lines", ".", "append", "(", "value", ")...
b1b71e3dde0ba30e575089280658bd32890e3325
valid
SseProtocol._dispatch_event
Dispatch the event to the handler.
marathon_acme/sse_protocol.py
def _dispatch_event(self): """ Dispatch the event to the handler. """ data = self._prepare_data() if data is not None: self._handler(self._event, data) self._reset_event_data()
def _dispatch_event(self): """ Dispatch the event to the handler. """ data = self._prepare_data() if data is not None: self._handler(self._event, data) self._reset_event_data()
[ "Dispatch", "the", "event", "to", "the", "handler", "." ]
praekeltfoundation/marathon-acme
python
https://github.com/praekeltfoundation/marathon-acme/blob/b1b71e3dde0ba30e575089280658bd32890e3325/marathon_acme/sse_protocol.py#L163-L171
[ "def", "_dispatch_event", "(", "self", ")", ":", "data", "=", "self", ".", "_prepare_data", "(", ")", "if", "data", "is", "not", "None", ":", "self", ".", "_handler", "(", "self", ".", "_event", ",", "data", ")", "self", ".", "_reset_event_data", "(", ...
b1b71e3dde0ba30e575089280658bd32890e3325
valid
MarathonAcme.listen_events
Start listening for events from Marathon, running a sync when we first successfully subscribe and triggering a sync on API request events.
marathon_acme/service.py
def listen_events(self, reconnects=0): """ Start listening for events from Marathon, running a sync when we first successfully subscribe and triggering a sync on API request events. """ self.log.info('Listening for events from Marathon...') self._attached = False ...
def listen_events(self, reconnects=0): """ Start listening for events from Marathon, running a sync when we first successfully subscribe and triggering a sync on API request events. """ self.log.info('Listening for events from Marathon...') self._attached = False ...
[ "Start", "listening", "for", "events", "from", "Marathon", "running", "a", "sync", "when", "we", "first", "successfully", "subscribe", "and", "triggering", "a", "sync", "on", "API", "request", "events", "." ]
praekeltfoundation/marathon-acme
python
https://github.com/praekeltfoundation/marathon-acme/blob/b1b71e3dde0ba30e575089280658bd32890e3325/marathon_acme/service.py#L84-L110
[ "def", "listen_events", "(", "self", ",", "reconnects", "=", "0", ")", ":", "self", ".", "log", ".", "info", "(", "'Listening for events from Marathon...'", ")", "self", ".", "_attached", "=", "False", "def", "on_finished", "(", "result", ",", "reconnects", ...
b1b71e3dde0ba30e575089280658bd32890e3325
valid
MarathonAcme.sync
Fetch the list of apps from Marathon, find the domains that require certificates, and issue certificates for any domains that don't already have a certificate.
marathon_acme/service.py
def sync(self): """ Fetch the list of apps from Marathon, find the domains that require certificates, and issue certificates for any domains that don't already have a certificate. """ self.log.info('Starting a sync...') def log_success(result): self.l...
def sync(self): """ Fetch the list of apps from Marathon, find the domains that require certificates, and issue certificates for any domains that don't already have a certificate. """ self.log.info('Starting a sync...') def log_success(result): self.l...
[ "Fetch", "the", "list", "of", "apps", "from", "Marathon", "find", "the", "domains", "that", "require", "certificates", "and", "issue", "certificates", "for", "any", "domains", "that", "don", "t", "already", "have", "a", "certificate", "." ]
praekeltfoundation/marathon-acme
python
https://github.com/praekeltfoundation/marathon-acme/blob/b1b71e3dde0ba30e575089280658bd32890e3325/marathon_acme/service.py#L135-L155
[ "def", "sync", "(", "self", ")", ":", "self", ".", "log", ".", "info", "(", "'Starting a sync...'", ")", "def", "log_success", "(", "result", ")", ":", "self", ".", "log", ".", "info", "(", "'Sync completed successfully'", ")", "return", "result", "def", ...
b1b71e3dde0ba30e575089280658bd32890e3325
valid
MarathonAcme._issue_cert
Issue a certificate for the given domain.
marathon_acme/service.py
def _issue_cert(self, domain): """ Issue a certificate for the given domain. """ def errback(failure): # Don't fail on some of the errors we could get from the ACME # server, rather just log an error so that we can continue with # other domains. ...
def _issue_cert(self, domain): """ Issue a certificate for the given domain. """ def errback(failure): # Don't fail on some of the errors we could get from the ACME # server, rather just log an error so that we can continue with # other domains. ...
[ "Issue", "a", "certificate", "for", "the", "given", "domain", "." ]
praekeltfoundation/marathon-acme
python
https://github.com/praekeltfoundation/marathon-acme/blob/b1b71e3dde0ba30e575089280658bd32890e3325/marathon_acme/service.py#L218-L242
[ "def", "_issue_cert", "(", "self", ",", "domain", ")", ":", "def", "errback", "(", "failure", ")", ":", "# Don't fail on some of the errors we could get from the ACME", "# server, rather just log an error so that we can continue with", "# other domains.", "failure", ".", "trap"...
b1b71e3dde0ba30e575089280658bd32890e3325
valid
warn_if_detached
Warn if self / cls is detached.
modularodm/storedobject.py
def warn_if_detached(func): """ Warn if self / cls is detached. """ @wraps(func) def wrapped(this, *args, **kwargs): # Check for _detached in __dict__ instead of using hasattr # to avoid infinite loop in __getattr__ if '_detached' in this.__dict__ and this._detached: warn...
def warn_if_detached(func): """ Warn if self / cls is detached. """ @wraps(func) def wrapped(this, *args, **kwargs): # Check for _detached in __dict__ instead of using hasattr # to avoid infinite loop in __getattr__ if '_detached' in this.__dict__ and this._detached: warn...
[ "Warn", "if", "self", "/", "cls", "is", "detached", "." ]
cos-archives/modular-odm
python
https://github.com/cos-archives/modular-odm/blob/8a34891892b8af69b21fdc46701c91763a5c1cf9/modularodm/storedobject.py#L87-L96
[ "def", "warn_if_detached", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "wrapped", "(", "this", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# Check for _detached in __dict__ instead of using hasattr", "# to avoid infinite loop in __getattr...
8a34891892b8af69b21fdc46701c91763a5c1cf9
valid
has_storage
Ensure that self/cls contains a Storage backend.
modularodm/storedobject.py
def has_storage(func): """ Ensure that self/cls contains a Storage backend. """ @wraps(func) def wrapped(*args, **kwargs): me = args[0] if not hasattr(me, '_storage') or \ not me._storage: raise exceptions.ImproperConfigurationError( 'No storage ba...
def has_storage(func): """ Ensure that self/cls contains a Storage backend. """ @wraps(func) def wrapped(*args, **kwargs): me = args[0] if not hasattr(me, '_storage') or \ not me._storage: raise exceptions.ImproperConfigurationError( 'No storage ba...
[ "Ensure", "that", "self", "/", "cls", "contains", "a", "Storage", "backend", "." ]
cos-archives/modular-odm
python
https://github.com/cos-archives/modular-odm/blob/8a34891892b8af69b21fdc46701c91763a5c1cf9/modularodm/storedobject.py#L99-L111
[ "def", "has_storage", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "wrapped", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "me", "=", "args", "[", "0", "]", "if", "not", "hasattr", "(", "me", ",", "'_storage'", ")", "or...
8a34891892b8af69b21fdc46701c91763a5c1cf9
valid
rm_fwd_refs
When removing an object, other objects with references to the current object should remove those references. This function identifies objects with forward references to the current object, then removes those references. :param obj: Object to which forward references should be removed
modularodm/storedobject.py
def rm_fwd_refs(obj): """When removing an object, other objects with references to the current object should remove those references. This function identifies objects with forward references to the current object, then removes those references. :param obj: Object to which forward references should ...
def rm_fwd_refs(obj): """When removing an object, other objects with references to the current object should remove those references. This function identifies objects with forward references to the current object, then removes those references. :param obj: Object to which forward references should ...
[ "When", "removing", "an", "object", "other", "objects", "with", "references", "to", "the", "current", "object", "should", "remove", "those", "references", ".", "This", "function", "identifies", "objects", "with", "forward", "references", "to", "the", "current", ...
cos-archives/modular-odm
python
https://github.com/cos-archives/modular-odm/blob/8a34891892b8af69b21fdc46701c91763a5c1cf9/modularodm/storedobject.py#L1239-L1268
[ "def", "rm_fwd_refs", "(", "obj", ")", ":", "for", "stack", ",", "key", "in", "obj", ".", "_backrefs_flat", ":", "# Unpack stack", "backref_key", ",", "parent_schema_name", ",", "parent_field_name", "=", "stack", "# Get parent info", "parent_schema", "=", "obj", ...
8a34891892b8af69b21fdc46701c91763a5c1cf9
valid
rm_back_refs
When removing an object with foreign fields, back-references from other objects to the current object should be deleted. This function identifies foreign fields of the specified object whose values are not None and which specify back-reference keys, then removes back-references from linked objects to th...
modularodm/storedobject.py
def rm_back_refs(obj): """When removing an object with foreign fields, back-references from other objects to the current object should be deleted. This function identifies foreign fields of the specified object whose values are not None and which specify back-reference keys, then removes back-references...
def rm_back_refs(obj): """When removing an object with foreign fields, back-references from other objects to the current object should be deleted. This function identifies foreign fields of the specified object whose values are not None and which specify back-reference keys, then removes back-references...
[ "When", "removing", "an", "object", "with", "foreign", "fields", "back", "-", "references", "from", "other", "objects", "to", "the", "current", "object", "should", "be", "deleted", ".", "This", "function", "identifies", "foreign", "fields", "of", "the", "speci...
cos-archives/modular-odm
python
https://github.com/cos-archives/modular-odm/blob/8a34891892b8af69b21fdc46701c91763a5c1cf9/modularodm/storedobject.py#L1317-L1333
[ "def", "rm_back_refs", "(", "obj", ")", ":", "for", "ref", "in", "_collect_refs", "(", "obj", ")", ":", "ref", "[", "'value'", "]", ".", "_remove_backref", "(", "ref", "[", "'field_instance'", "]", ".", "_backref_field_name", ",", "obj", ",", "ref", "[",...
8a34891892b8af69b21fdc46701c91763a5c1cf9
valid
ensure_backrefs
Ensure that all forward references on the provided object have the appropriate backreferences. :param StoredObject obj: Database record :param list fields: Optional list of field names to check
modularodm/storedobject.py
def ensure_backrefs(obj, fields=None): """Ensure that all forward references on the provided object have the appropriate backreferences. :param StoredObject obj: Database record :param list fields: Optional list of field names to check """ for ref in _collect_refs(obj, fields): updated...
def ensure_backrefs(obj, fields=None): """Ensure that all forward references on the provided object have the appropriate backreferences. :param StoredObject obj: Database record :param list fields: Optional list of field names to check """ for ref in _collect_refs(obj, fields): updated...
[ "Ensure", "that", "all", "forward", "references", "on", "the", "provided", "object", "have", "the", "appropriate", "backreferences", "." ]
cos-archives/modular-odm
python
https://github.com/cos-archives/modular-odm/blob/8a34891892b8af69b21fdc46701c91763a5c1cf9/modularodm/storedobject.py#L1335-L1353
[ "def", "ensure_backrefs", "(", "obj", ",", "fields", "=", "None", ")", ":", "for", "ref", "in", "_collect_refs", "(", "obj", ",", "fields", ")", ":", "updated", "=", "ref", "[", "'value'", "]", ".", "_update_backref", "(", "ref", "[", "'field_instance'",...
8a34891892b8af69b21fdc46701c91763a5c1cf9
valid
PickleStorage._remove_by_pk
Retrieve value from store. :param key: Key
modularodm/storage/picklestorage.py
def _remove_by_pk(self, key, flush=True): """Retrieve value from store. :param key: Key """ try: del self.store[key] except Exception as error: pass if flush: self.flush()
def _remove_by_pk(self, key, flush=True): """Retrieve value from store. :param key: Key """ try: del self.store[key] except Exception as error: pass if flush: self.flush()
[ "Retrieve", "value", "from", "store", "." ]
cos-archives/modular-odm
python
https://github.com/cos-archives/modular-odm/blob/8a34891892b8af69b21fdc46701c91763a5c1cf9/modularodm/storage/picklestorage.py#L194-L205
[ "def", "_remove_by_pk", "(", "self", ",", "key", ",", "flush", "=", "True", ")", ":", "try", ":", "del", "self", ".", "store", "[", "key", "]", "except", "Exception", "as", "error", ":", "pass", "if", "flush", ":", "self", ".", "flush", "(", ")" ]
8a34891892b8af69b21fdc46701c91763a5c1cf9
valid
eventhandler
Decorator. Marks a function as a receiver for the specified slack event(s). * events - String or list of events to handle
slackminion/bot.py
def eventhandler(*args, **kwargs): """ Decorator. Marks a function as a receiver for the specified slack event(s). * events - String or list of events to handle """ def wrapper(func): if isinstance(kwargs['events'], basestring): kwargs['events'] = [kwargs['events']] fu...
def eventhandler(*args, **kwargs): """ Decorator. Marks a function as a receiver for the specified slack event(s). * events - String or list of events to handle """ def wrapper(func): if isinstance(kwargs['events'], basestring): kwargs['events'] = [kwargs['events']] fu...
[ "Decorator", ".", "Marks", "a", "function", "as", "a", "receiver", "for", "the", "specified", "slack", "event", "(", "s", ")", "." ]
arcticfoxnv/slackminion
python
https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/bot.py#L12-L26
[ "def", "eventhandler", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "def", "wrapper", "(", "func", ")", ":", "if", "isinstance", "(", "kwargs", "[", "'events'", "]", ",", "basestring", ")", ":", "kwargs", "[", "'events'", "]", "=", "[", "kw...
62ea77aba5ac5ba582793e578a379a76f7d26cdb
valid
Bot.start
Initializes the bot, plugins, and everything.
slackminion/bot.py
def start(self): """Initializes the bot, plugins, and everything.""" self.bot_start_time = datetime.now() self.webserver = Webserver(self.config['webserver']['host'], self.config['webserver']['port']) self.plugins.load() self.plugins.load_state() self._find_event_handlers...
def start(self): """Initializes the bot, plugins, and everything.""" self.bot_start_time = datetime.now() self.webserver = Webserver(self.config['webserver']['host'], self.config['webserver']['port']) self.plugins.load() self.plugins.load_state() self._find_event_handlers...
[ "Initializes", "the", "bot", "plugins", "and", "everything", "." ]
arcticfoxnv/slackminion
python
https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/bot.py#L58-L76
[ "def", "start", "(", "self", ")", ":", "self", ".", "bot_start_time", "=", "datetime", ".", "now", "(", ")", "self", ".", "webserver", "=", "Webserver", "(", "self", ".", "config", "[", "'webserver'", "]", "[", "'host'", "]", ",", "self", ".", "confi...
62ea77aba5ac5ba582793e578a379a76f7d26cdb
valid
Bot.run
Connects to slack and enters the main loop. * start - If True, rtm.start API is used. Else rtm.connect API is used For more info, refer to https://python-slackclient.readthedocs.io/en/latest/real_time_messaging.html#rtm-start-vs-rtm-connect
slackminion/bot.py
def run(self, start=True): """ Connects to slack and enters the main loop. * start - If True, rtm.start API is used. Else rtm.connect API is used For more info, refer to https://python-slackclient.readthedocs.io/en/latest/real_time_messaging.html#rtm-start-vs-rtm-connect ...
def run(self, start=True): """ Connects to slack and enters the main loop. * start - If True, rtm.start API is used. Else rtm.connect API is used For more info, refer to https://python-slackclient.readthedocs.io/en/latest/real_time_messaging.html#rtm-start-vs-rtm-connect ...
[ "Connects", "to", "slack", "and", "enters", "the", "main", "loop", "." ]
arcticfoxnv/slackminion
python
https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/bot.py#L85-L137
[ "def", "run", "(", "self", ",", "start", "=", "True", ")", ":", "# Fail out if setup wasn't run", "if", "not", "self", ".", "is_setup", ":", "raise", "NotSetupError", "# Start the web server", "self", ".", "webserver", ".", "start", "(", ")", "first_connect", ...
62ea77aba5ac5ba582793e578a379a76f7d26cdb
valid
Bot.stop
Does cleanup of bot and plugins.
slackminion/bot.py
def stop(self): """Does cleanup of bot and plugins.""" if self.webserver is not None: self.webserver.stop() if not self.test_mode: self.plugins.save_state()
def stop(self): """Does cleanup of bot and plugins.""" if self.webserver is not None: self.webserver.stop() if not self.test_mode: self.plugins.save_state()
[ "Does", "cleanup", "of", "bot", "and", "plugins", "." ]
arcticfoxnv/slackminion
python
https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/bot.py#L139-L144
[ "def", "stop", "(", "self", ")", ":", "if", "self", ".", "webserver", "is", "not", "None", ":", "self", ".", "webserver", ".", "stop", "(", ")", "if", "not", "self", ".", "test_mode", ":", "self", ".", "plugins", ".", "save_state", "(", ")" ]
62ea77aba5ac5ba582793e578a379a76f7d26cdb
valid
Bot.send_message
Sends a message to the specified channel * channel - The channel to send to. This can be a SlackChannel object, a channel id, or a channel name (without the #) * text - String to send * thread - reply to the thread. See https://api.slack.com/docs/message-threading#threads_party ...
slackminion/bot.py
def send_message(self, channel, text, thread=None, reply_broadcast=None): """ Sends a message to the specified channel * channel - The channel to send to. This can be a SlackChannel object, a channel id, or a channel name (without the #) * text - String to send * thread...
def send_message(self, channel, text, thread=None, reply_broadcast=None): """ Sends a message to the specified channel * channel - The channel to send to. This can be a SlackChannel object, a channel id, or a channel name (without the #) * text - String to send * thread...
[ "Sends", "a", "message", "to", "the", "specified", "channel" ]
arcticfoxnv/slackminion
python
https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/bot.py#L146-L160
[ "def", "send_message", "(", "self", ",", "channel", ",", "text", ",", "thread", "=", "None", ",", "reply_broadcast", "=", "None", ")", ":", "# This doesn't want the # in the channel name", "if", "isinstance", "(", "channel", ",", "SlackRoomIMBase", ")", ":", "ch...
62ea77aba5ac5ba582793e578a379a76f7d26cdb
valid
Bot.send_im
Sends a message to a user as an IM * user - The user to send to. This can be a SlackUser object, a user id, or the username (without the @) * text - String to send
slackminion/bot.py
def send_im(self, user, text): """ Sends a message to a user as an IM * user - The user to send to. This can be a SlackUser object, a user id, or the username (without the @) * text - String to send """ if isinstance(user, SlackUser): user = user.id ...
def send_im(self, user, text): """ Sends a message to a user as an IM * user - The user to send to. This can be a SlackUser object, a user id, or the username (without the @) * text - String to send """ if isinstance(user, SlackUser): user = user.id ...
[ "Sends", "a", "message", "to", "a", "user", "as", "an", "IM" ]
arcticfoxnv/slackminion
python
https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/bot.py#L162-L174
[ "def", "send_im", "(", "self", ",", "user", ",", "text", ")", ":", "if", "isinstance", "(", "user", ",", "SlackUser", ")", ":", "user", "=", "user", ".", "id", "channelid", "=", "self", ".", "_find_im_channel", "(", "user", ")", "else", ":", "channel...
62ea77aba5ac5ba582793e578a379a76f7d26cdb
valid
MarkovTextGenerator.token_is_correct
Подходит ли токен, для генерации текста. Допускаются русские слова, знаки препинания и символы начала и конца.
MarkovTextGenerator/markov_text_generator.py
def token_is_correct(self, token): """ Подходит ли токен, для генерации текста. Допускаются русские слова, знаки препинания и символы начала и конца. """ if self.is_rus_word(token): return True elif self.ONLY_MARKS.search(token): return True ...
def token_is_correct(self, token): """ Подходит ли токен, для генерации текста. Допускаются русские слова, знаки препинания и символы начала и конца. """ if self.is_rus_word(token): return True elif self.ONLY_MARKS.search(token): return True ...
[ "Подходит", "ли", "токен", "для", "генерации", "текста", ".", "Допускаются", "русские", "слова", "знаки", "препинания", "и", "символы", "начала", "и", "конца", "." ]
NyashniyVladya/MarkovTextGenerator
python
https://github.com/NyashniyVladya/MarkovTextGenerator/blob/3d90e02a507939709773ef01c7ff3ec68b2b8d4b/MarkovTextGenerator/markov_text_generator.py#L84-L97
[ "def", "token_is_correct", "(", "self", ",", "token", ")", ":", "if", "self", ".", "is_rus_word", "(", "token", ")", ":", "return", "True", "elif", "self", ".", "ONLY_MARKS", ".", "search", "(", "token", ")", ":", "return", "True", "elif", "self", ".",...
3d90e02a507939709773ef01c7ff3ec68b2b8d4b
valid
MarkovTextGenerator.get_optimal_variant
Возвращает оптимальный вариант, из выборки.
MarkovTextGenerator/markov_text_generator.py
def get_optimal_variant(self, variants, start_words, **kwargs): """ Возвращает оптимальный вариант, из выборки. """ if not start_words: return (choice(variants), {}) _variants = [] _weights = [] for tok in frozenset(variants): if not self...
def get_optimal_variant(self, variants, start_words, **kwargs): """ Возвращает оптимальный вариант, из выборки. """ if not start_words: return (choice(variants), {}) _variants = [] _weights = [] for tok in frozenset(variants): if not self...
[ "Возвращает", "оптимальный", "вариант", "из", "выборки", "." ]
NyashniyVladya/MarkovTextGenerator
python
https://github.com/NyashniyVladya/MarkovTextGenerator/blob/3d90e02a507939709773ef01c7ff3ec68b2b8d4b/MarkovTextGenerator/markov_text_generator.py#L105-L129
[ "def", "get_optimal_variant", "(", "self", ",", "variants", ",", "start_words", ",", "*", "*", "kwargs", ")", ":", "if", "not", "start_words", ":", "return", "(", "choice", "(", "variants", ")", ",", "{", "}", ")", "_variants", "=", "[", "]", "_weights...
3d90e02a507939709773ef01c7ff3ec68b2b8d4b
valid
MarkovTextGenerator.start_generation
Генерирует предложение. :start_words: Попытаться начать предложение с этих слов.
MarkovTextGenerator/markov_text_generator.py
def start_generation(self, *start_words, **kwargs): """ Генерирует предложение. :start_words: Попытаться начать предложение с этих слов. """ out_text = "" _need_capialize = True for token in self._get_generate_tokens(*start_words, **kwargs): if token i...
def start_generation(self, *start_words, **kwargs): """ Генерирует предложение. :start_words: Попытаться начать предложение с этих слов. """ out_text = "" _need_capialize = True for token in self._get_generate_tokens(*start_words, **kwargs): if token i...
[ "Генерирует", "предложение", ".", ":", "start_words", ":", "Попытаться", "начать", "предложение", "с", "этих", "слов", "." ]
NyashniyVladya/MarkovTextGenerator
python
https://github.com/NyashniyVladya/MarkovTextGenerator/blob/3d90e02a507939709773ef01c7ff3ec68b2b8d4b/MarkovTextGenerator/markov_text_generator.py#L165-L183
[ "def", "start_generation", "(", "self", ",", "*", "start_words", ",", "*", "*", "kwargs", ")", ":", "out_text", "=", "\"\"", "_need_capialize", "=", "True", "for", "token", "in", "self", ".", "_get_generate_tokens", "(", "*", "start_words", ",", "*", "*", ...
3d90e02a507939709773ef01c7ff3ec68b2b8d4b
valid
MarkovTextGenerator.get_start_array
Генерирует начало предложения. :start_words: Попытаться начать предложение с этих слов.
MarkovTextGenerator/markov_text_generator.py
def get_start_array(self, *start_words, **kwargs): """ Генерирует начало предложения. :start_words: Попытаться начать предложение с этих слов. """ if not self.start_arrays: raise MarkovTextExcept("Не с чего начинать генерацию.") if not start_words: ...
def get_start_array(self, *start_words, **kwargs): """ Генерирует начало предложения. :start_words: Попытаться начать предложение с этих слов. """ if not self.start_arrays: raise MarkovTextExcept("Не с чего начинать генерацию.") if not start_words: ...
[ "Генерирует", "начало", "предложения", ".", ":", "start_words", ":", "Попытаться", "начать", "предложение", "с", "этих", "слов", "." ]
NyashniyVladya/MarkovTextGenerator
python
https://github.com/NyashniyVladya/MarkovTextGenerator/blob/3d90e02a507939709773ef01c7ff3ec68b2b8d4b/MarkovTextGenerator/markov_text_generator.py#L185-L211
[ "def", "get_start_array", "(", "self", ",", "*", "start_words", ",", "*", "*", "kwargs", ")", ":", "if", "not", "self", ".", "start_arrays", ":", "raise", "MarkovTextExcept", "(", "\"Не с чего начинать генерацию.\")", "", "if", "not", "start_words", ":", "retu...
3d90e02a507939709773ef01c7ff3ec68b2b8d4b
valid
MarkovTextGenerator.create_base
Метод создаёт базовый словарь, на основе массива токенов. Вызывается из метода обновления.
MarkovTextGenerator/markov_text_generator.py
def create_base(self): """ Метод создаёт базовый словарь, на основе массива токенов. Вызывается из метода обновления. """ self.base_dict = {} _start_arrays = [] for tokens, word in self.chain_generator(): self.base_dict.setdefault(tokens, []).append(wo...
def create_base(self): """ Метод создаёт базовый словарь, на основе массива токенов. Вызывается из метода обновления. """ self.base_dict = {} _start_arrays = [] for tokens, word in self.chain_generator(): self.base_dict.setdefault(tokens, []).append(wo...
[ "Метод", "создаёт", "базовый", "словарь", "на", "основе", "массива", "токенов", ".", "Вызывается", "из", "метода", "обновления", "." ]
NyashniyVladya/MarkovTextGenerator
python
https://github.com/NyashniyVladya/MarkovTextGenerator/blob/3d90e02a507939709773ef01c7ff3ec68b2b8d4b/MarkovTextGenerator/markov_text_generator.py#L213-L227
[ "def", "create_base", "(", "self", ")", ":", "self", ".", "base_dict", "=", "{", "}", "_start_arrays", "=", "[", "]", "for", "tokens", ",", "word", "in", "self", ".", "chain_generator", "(", ")", ":", "self", ".", "base_dict", ".", "setdefault", "(", ...
3d90e02a507939709773ef01c7ff3ec68b2b8d4b
valid
MarkovTextGenerator.chain_generator
Возвращает генератор, формата: (("токен", ...), "вариант") Где количество токенов определяет переменная объекта chain_order.
MarkovTextGenerator/markov_text_generator.py
def chain_generator(self): """ Возвращает генератор, формата: (("токен", ...), "вариант") Где количество токенов определяет переменная объекта chain_order. """ n_chain = self.chain_order if n_chain < 1: raise MarkovTextExcept( "...
def chain_generator(self): """ Возвращает генератор, формата: (("токен", ...), "вариант") Где количество токенов определяет переменная объекта chain_order. """ n_chain = self.chain_order if n_chain < 1: raise MarkovTextExcept( "...
[ "Возвращает", "генератор", "формата", ":", "((", "токен", "...", ")", "вариант", ")", "Где", "количество", "токенов", "определяет", "переменная", "объекта", "chain_order", "." ]
NyashniyVladya/MarkovTextGenerator
python
https://github.com/NyashniyVladya/MarkovTextGenerator/blob/3d90e02a507939709773ef01c7ff3ec68b2b8d4b/MarkovTextGenerator/markov_text_generator.py#L229-L246
[ "def", "chain_generator", "(", "self", ")", ":", "n_chain", "=", "self", ".", "chain_order", "if", "n_chain", "<", "1", ":", "raise", "MarkovTextExcept", "(", "\"Цепь не может быть {0}-порядка.\".format(n_chain)", "", "", "", "", "", ")", "n_chain", "+=", "1",...
3d90e02a507939709773ef01c7ff3ec68b2b8d4b
valid
MarkovTextGenerator.set_vocabulary
Получает вокабулар из функции get_vocabulary и делает его активным.
MarkovTextGenerator/markov_text_generator.py
def set_vocabulary(self, peer_id, from_dialogue=None, update=False): """ Получает вокабулар из функции get_vocabulary и делает его активным. """ self.tokens_array = self.get_vocabulary( peer_id, from_dialogue, update ) self.create_base...
def set_vocabulary(self, peer_id, from_dialogue=None, update=False): """ Получает вокабулар из функции get_vocabulary и делает его активным. """ self.tokens_array = self.get_vocabulary( peer_id, from_dialogue, update ) self.create_base...
[ "Получает", "вокабулар", "из", "функции", "get_vocabulary", "и", "делает", "его", "активным", "." ]
NyashniyVladya/MarkovTextGenerator
python
https://github.com/NyashniyVladya/MarkovTextGenerator/blob/3d90e02a507939709773ef01c7ff3ec68b2b8d4b/MarkovTextGenerator/markov_text_generator.py#L248-L258
[ "def", "set_vocabulary", "(", "self", ",", "peer_id", ",", "from_dialogue", "=", "None", ",", "update", "=", "False", ")", ":", "self", ".", "tokens_array", "=", "self", ".", "get_vocabulary", "(", "peer_id", ",", "from_dialogue", ",", "update", ")", "self...
3d90e02a507939709773ef01c7ff3ec68b2b8d4b
valid
MarkovTextGenerator.create_dump
Сохраняет текущую базу на жёсткий диск. :name: Имя файла, без расширения.
MarkovTextGenerator/markov_text_generator.py
def create_dump(self, name=None): """ Сохраняет текущую базу на жёсткий диск. :name: Имя файла, без расширения. """ name = name or "vocabularDump" backup_dump_file = os_join( self.temp_folder, "{0}.backup".format(name) ) dump_file =...
def create_dump(self, name=None): """ Сохраняет текущую базу на жёсткий диск. :name: Имя файла, без расширения. """ name = name or "vocabularDump" backup_dump_file = os_join( self.temp_folder, "{0}.backup".format(name) ) dump_file =...
[ "Сохраняет", "текущую", "базу", "на", "жёсткий", "диск", ".", ":", "name", ":", "Имя", "файла", "без", "расширения", "." ]
NyashniyVladya/MarkovTextGenerator
python
https://github.com/NyashniyVladya/MarkovTextGenerator/blob/3d90e02a507939709773ef01c7ff3ec68b2b8d4b/MarkovTextGenerator/markov_text_generator.py#L260-L277
[ "def", "create_dump", "(", "self", ",", "name", "=", "None", ")", ":", "name", "=", "name", "or", "\"vocabularDump\"", "backup_dump_file", "=", "os_join", "(", "self", ".", "temp_folder", ",", "\"{0}.backup\"", ".", "format", "(", "name", ")", ")", "dump_f...
3d90e02a507939709773ef01c7ff3ec68b2b8d4b
valid
MarkovTextGenerator.load_dump
Загружает базу с жёсткого диска. Текущая база заменяется. :name: Имя файла, без расширения.
MarkovTextGenerator/markov_text_generator.py
def load_dump(self, name=None): """ Загружает базу с жёсткого диска. Текущая база заменяется. :name: Имя файла, без расширения. """ name = name or "vocabularDump" dump_file = os_join( self.temp_folder, "{0}.json".format(name) ) ...
def load_dump(self, name=None): """ Загружает базу с жёсткого диска. Текущая база заменяется. :name: Имя файла, без расширения. """ name = name or "vocabularDump" dump_file = os_join( self.temp_folder, "{0}.json".format(name) ) ...
[ "Загружает", "базу", "с", "жёсткого", "диска", ".", "Текущая", "база", "заменяется", ".", ":", "name", ":", "Имя", "файла", "без", "расширения", "." ]
NyashniyVladya/MarkovTextGenerator
python
https://github.com/NyashniyVladya/MarkovTextGenerator/blob/3d90e02a507939709773ef01c7ff3ec68b2b8d4b/MarkovTextGenerator/markov_text_generator.py#L279-L294
[ "def", "load_dump", "(", "self", ",", "name", "=", "None", ")", ":", "name", "=", "name", "or", "\"vocabularDump\"", "dump_file", "=", "os_join", "(", "self", ".", "temp_folder", ",", "\"{0}.json\"", ".", "format", "(", "name", ")", ")", "if", "not", "...
3d90e02a507939709773ef01c7ff3ec68b2b8d4b
valid
MarkovTextGenerator.get_vocabulary
Возвращает запас слов, на основе переписок ВК. Для имитации речи конкретного человека. Работает только с импортом объекта "Владя-бота". :target: Объект собседника. Источник переписки. :user: Объект юзера, чью речь имитируем. Если None, то вся переписк...
MarkovTextGenerator/markov_text_generator.py
def get_vocabulary(self, target, user=None, update=False): """ Возвращает запас слов, на основе переписок ВК. Для имитации речи конкретного человека. Работает только с импортом объекта "Владя-бота". :target: Объект собседника. Источник переписки. :user: ...
def get_vocabulary(self, target, user=None, update=False): """ Возвращает запас слов, на основе переписок ВК. Для имитации речи конкретного человека. Работает только с импортом объекта "Владя-бота". :target: Объект собседника. Источник переписки. :user: ...
[ "Возвращает", "запас", "слов", "на", "основе", "переписок", "ВК", ".", "Для", "имитации", "речи", "конкретного", "человека", ".", "Работает", "только", "с", "импортом", "объекта", "Владя", "-", "бота", "." ]
NyashniyVladya/MarkovTextGenerator
python
https://github.com/NyashniyVladya/MarkovTextGenerator/blob/3d90e02a507939709773ef01c7ff3ec68b2b8d4b/MarkovTextGenerator/markov_text_generator.py#L296-L340
[ "def", "get_vocabulary", "(", "self", ",", "target", ",", "user", "=", "None", ",", "update", "=", "False", ")", ":", "if", "not", "self", ".", "vk_object", ":", "raise", "MarkovTextExcept", "(", "\"Объект бота не задан.\")", "", "json_name", "=", "\"{0}{1}_...
3d90e02a507939709773ef01c7ff3ec68b2b8d4b
valid
MarkovTextGenerator.update
Принимает текст, или путь к файлу и обновляет существующую базу.
MarkovTextGenerator/markov_text_generator.py
def update(self, data, fromfile=True): """ Принимает текст, или путь к файлу и обновляет существующую базу. """ func = (self._parse_from_file if fromfile else self._parse_from_text) new_data = tuple(func(data)) if new_data: self.tokens_array += new_data ...
def update(self, data, fromfile=True): """ Принимает текст, или путь к файлу и обновляет существующую базу. """ func = (self._parse_from_file if fromfile else self._parse_from_text) new_data = tuple(func(data)) if new_data: self.tokens_array += new_data ...
[ "Принимает", "текст", "или", "путь", "к", "файлу", "и", "обновляет", "существующую", "базу", "." ]
NyashniyVladya/MarkovTextGenerator
python
https://github.com/NyashniyVladya/MarkovTextGenerator/blob/3d90e02a507939709773ef01c7ff3ec68b2b8d4b/MarkovTextGenerator/markov_text_generator.py#L342-L350
[ "def", "update", "(", "self", ",", "data", ",", "fromfile", "=", "True", ")", ":", "func", "=", "(", "self", ".", "_parse_from_file", "if", "fromfile", "else", "self", ".", "_parse_from_text", ")", "new_data", "=", "tuple", "(", "func", "(", "data", ")...
3d90e02a507939709773ef01c7ff3ec68b2b8d4b
valid
MarkovTextGenerator._parse_from_text
Возвращает генератор токенов, из текста.
MarkovTextGenerator/markov_text_generator.py
def _parse_from_text(self, text): """ Возвращает генератор токенов, из текста. """ if not isinstance(text, str): raise MarkovTextExcept("Передан не текст.") text = text.strip().lower() need_start_token = True token = "$" # На случай, если переданная с...
def _parse_from_text(self, text): """ Возвращает генератор токенов, из текста. """ if not isinstance(text, str): raise MarkovTextExcept("Передан не текст.") text = text.strip().lower() need_start_token = True token = "$" # На случай, если переданная с...
[ "Возвращает", "генератор", "токенов", "из", "текста", "." ]
NyashniyVladya/MarkovTextGenerator
python
https://github.com/NyashniyVladya/MarkovTextGenerator/blob/3d90e02a507939709773ef01c7ff3ec68b2b8d4b/MarkovTextGenerator/markov_text_generator.py#L361-L380
[ "def", "_parse_from_text", "(", "self", ",", "text", ")", ":", "if", "not", "isinstance", "(", "text", ",", "str", ")", ":", "raise", "MarkovTextExcept", "(", "\"Передан не текст.\")", "", "text", "=", "text", ".", "strip", "(", ")", ".", "lower", "(", ...
3d90e02a507939709773ef01c7ff3ec68b2b8d4b
valid
MarkovTextGenerator._parse_from_file
см. описание _parse_from_text. Только на вход подаётся не текст, а путь к файлу.
MarkovTextGenerator/markov_text_generator.py
def _parse_from_file(self, file_path): """ см. описание _parse_from_text. Только на вход подаётся не текст, а путь к файлу. """ file_path = abspath(file_path) if not isfile(file_path): raise MarkovTextExcept("Передан не файл.") with open(file_path, "rb...
def _parse_from_file(self, file_path): """ см. описание _parse_from_text. Только на вход подаётся не текст, а путь к файлу. """ file_path = abspath(file_path) if not isfile(file_path): raise MarkovTextExcept("Передан не файл.") with open(file_path, "rb...
[ "см", ".", "описание", "_parse_from_text", ".", "Только", "на", "вход", "подаётся", "не", "текст", "а", "путь", "к", "файлу", "." ]
NyashniyVladya/MarkovTextGenerator
python
https://github.com/NyashniyVladya/MarkovTextGenerator/blob/3d90e02a507939709773ef01c7ff3ec68b2b8d4b/MarkovTextGenerator/markov_text_generator.py#L382-L395
[ "def", "_parse_from_file", "(", "self", ",", "file_path", ")", ":", "file_path", "=", "abspath", "(", "file_path", ")", "if", "not", "isfile", "(", "file_path", ")", ":", "raise", "MarkovTextExcept", "(", "\"Передан не файл.\")", "", "with", "open", "(", "fi...
3d90e02a507939709773ef01c7ff3ec68b2b8d4b
valid
MessageDispatcher.push
Takes a SlackEvent, parses it for a command, and runs against registered plugin
slackminion/dispatcher.py
def push(self, message): """ Takes a SlackEvent, parses it for a command, and runs against registered plugin """ if self._ignore_event(message): return None, None args = self._parse_message(message) self.log.debug("Searching for command using chunks: %s", args...
def push(self, message): """ Takes a SlackEvent, parses it for a command, and runs against registered plugin """ if self._ignore_event(message): return None, None args = self._parse_message(message) self.log.debug("Searching for command using chunks: %s", args...
[ "Takes", "a", "SlackEvent", "parses", "it", "for", "a", "command", "and", "runs", "against", "registered", "plugin" ]
arcticfoxnv/slackminion
python
https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/dispatcher.py#L51-L75
[ "def", "push", "(", "self", ",", "message", ")", ":", "if", "self", ".", "_ignore_event", "(", "message", ")", ":", "return", "None", ",", "None", "args", "=", "self", ".", "_parse_message", "(", "message", ")", "self", ".", "log", ".", "debug", "(",...
62ea77aba5ac5ba582793e578a379a76f7d26cdb
valid
MessageDispatcher._ignore_event
message_replied event is not truly a message event and does not have a message.text don't process such events commands may not be idempotent, so ignore message_changed events.
slackminion/dispatcher.py
def _ignore_event(self, message): """ message_replied event is not truly a message event and does not have a message.text don't process such events commands may not be idempotent, so ignore message_changed events. """ if hasattr(message, 'subtype') and message.subtype in...
def _ignore_event(self, message): """ message_replied event is not truly a message event and does not have a message.text don't process such events commands may not be idempotent, so ignore message_changed events. """ if hasattr(message, 'subtype') and message.subtype in...
[ "message_replied", "event", "is", "not", "truly", "a", "message", "event", "and", "does", "not", "have", "a", "message", ".", "text", "don", "t", "process", "such", "events" ]
arcticfoxnv/slackminion
python
https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/dispatcher.py#L77-L86
[ "def", "_ignore_event", "(", "self", ",", "message", ")", ":", "if", "hasattr", "(", "message", ",", "'subtype'", ")", "and", "message", ".", "subtype", "in", "self", ".", "ignored_events", ":", "return", "True", "return", "False" ]
62ea77aba5ac5ba582793e578a379a76f7d26cdb
valid
MessageDispatcher.register_plugin
Registers a plugin and commands with the dispatcher for push()
slackminion/dispatcher.py
def register_plugin(self, plugin): """Registers a plugin and commands with the dispatcher for push()""" self.log.info("Registering plugin %s", type(plugin).__name__) self._register_commands(plugin) plugin.on_load()
def register_plugin(self, plugin): """Registers a plugin and commands with the dispatcher for push()""" self.log.info("Registering plugin %s", type(plugin).__name__) self._register_commands(plugin) plugin.on_load()
[ "Registers", "a", "plugin", "and", "commands", "with", "the", "dispatcher", "for", "push", "()" ]
arcticfoxnv/slackminion
python
https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/dispatcher.py#L92-L96
[ "def", "register_plugin", "(", "self", ",", "plugin", ")", ":", "self", ".", "log", ".", "info", "(", "\"Registering plugin %s\"", ",", "type", "(", "plugin", ")", ".", "__name__", ")", "self", ".", "_register_commands", "(", "plugin", ")", "plugin", ".", ...
62ea77aba5ac5ba582793e578a379a76f7d26cdb
valid
AuthManager.acl_show
Show current allow and deny blocks for the given acl.
slackminion/plugins/core/acl.py
def acl_show(self, msg, args): """Show current allow and deny blocks for the given acl.""" name = args[0] if len(args) > 0 else None if name is None: return "%s: The following ACLs are defined: %s" % (msg.user, ', '.join(self._acl.keys())) if name not in self._acl: ...
def acl_show(self, msg, args): """Show current allow and deny blocks for the given acl.""" name = args[0] if len(args) > 0 else None if name is None: return "%s: The following ACLs are defined: %s" % (msg.user, ', '.join(self._acl.keys())) if name not in self._acl: ...
[ "Show", "current", "allow", "and", "deny", "blocks", "for", "the", "given", "acl", "." ]
arcticfoxnv/slackminion
python
https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/plugins/core/acl.py#L112-L125
[ "def", "acl_show", "(", "self", ",", "msg", ",", "args", ")", ":", "name", "=", "args", "[", "0", "]", "if", "len", "(", "args", ")", ">", "0", "else", "None", "if", "name", "is", "None", ":", "return", "\"%s: The following ACLs are defined: %s\"", "%"...
62ea77aba5ac5ba582793e578a379a76f7d26cdb
valid
AuthManager.add_user_to_allow
Add a user to the given acl allow block.
slackminion/plugins/core/acl.py
def add_user_to_allow(self, name, user): """Add a user to the given acl allow block.""" # Clear user from both allow and deny before adding if not self.remove_user_from_acl(name, user): return False if name not in self._acl: return False self._acl[name]...
def add_user_to_allow(self, name, user): """Add a user to the given acl allow block.""" # Clear user from both allow and deny before adding if not self.remove_user_from_acl(name, user): return False if name not in self._acl: return False self._acl[name]...
[ "Add", "a", "user", "to", "the", "given", "acl", "allow", "block", "." ]
arcticfoxnv/slackminion
python
https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/plugins/core/acl.py#L127-L138
[ "def", "add_user_to_allow", "(", "self", ",", "name", ",", "user", ")", ":", "# Clear user from both allow and deny before adding", "if", "not", "self", ".", "remove_user_from_acl", "(", "name", ",", "user", ")", ":", "return", "False", "if", "name", "not", "in"...
62ea77aba5ac5ba582793e578a379a76f7d26cdb
valid
AuthManager.remove_user_from_acl
Remove a user from the given acl (both allow and deny).
slackminion/plugins/core/acl.py
def remove_user_from_acl(self, name, user): """Remove a user from the given acl (both allow and deny).""" if name not in self._acl: return False if user in self._acl[name]['allow']: self._acl[name]['allow'].remove(user) if user in self._acl[name]['deny']: ...
def remove_user_from_acl(self, name, user): """Remove a user from the given acl (both allow and deny).""" if name not in self._acl: return False if user in self._acl[name]['allow']: self._acl[name]['allow'].remove(user) if user in self._acl[name]['deny']: ...
[ "Remove", "a", "user", "from", "the", "given", "acl", "(", "both", "allow", "and", "deny", ")", "." ]
arcticfoxnv/slackminion
python
https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/plugins/core/acl.py#L151-L159
[ "def", "remove_user_from_acl", "(", "self", ",", "name", ",", "user", ")", ":", "if", "name", "not", "in", "self", ".", "_acl", ":", "return", "False", "if", "user", "in", "self", ".", "_acl", "[", "name", "]", "[", "'allow'", "]", ":", "self", "."...
62ea77aba5ac5ba582793e578a379a76f7d26cdb
valid
AuthManager.create_acl
Create a new acl.
slackminion/plugins/core/acl.py
def create_acl(self, name): """Create a new acl.""" if name in self._acl: return False self._acl[name] = { 'allow': [], 'deny': [] } return True
def create_acl(self, name): """Create a new acl.""" if name in self._acl: return False self._acl[name] = { 'allow': [], 'deny': [] } return True
[ "Create", "a", "new", "acl", "." ]
arcticfoxnv/slackminion
python
https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/plugins/core/acl.py#L161-L170
[ "def", "create_acl", "(", "self", ",", "name", ")", ":", "if", "name", "in", "self", ".", "_acl", ":", "return", "False", "self", ".", "_acl", "[", "name", "]", "=", "{", "'allow'", ":", "[", "]", ",", "'deny'", ":", "[", "]", "}", "return", "T...
62ea77aba5ac5ba582793e578a379a76f7d26cdb
valid
AuthManager.delete_acl
Delete an acl.
slackminion/plugins/core/acl.py
def delete_acl(self, name): """Delete an acl.""" if name not in self._acl: return False del self._acl[name] return True
def delete_acl(self, name): """Delete an acl.""" if name not in self._acl: return False del self._acl[name] return True
[ "Delete", "an", "acl", "." ]
arcticfoxnv/slackminion
python
https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/plugins/core/acl.py#L172-L178
[ "def", "delete_acl", "(", "self", ",", "name", ")", ":", "if", "name", "not", "in", "self", ".", "_acl", ":", "return", "False", "del", "self", ".", "_acl", "[", "name", "]", "return", "True" ]
62ea77aba5ac5ba582793e578a379a76f7d26cdb
valid
mongo
Run the mongod process.
tasks.py
def mongo(daemon=False, port=20771): '''Run the mongod process. ''' cmd = "mongod --port {0}".format(port) if daemon: cmd += " --fork" run(cmd)
def mongo(daemon=False, port=20771): '''Run the mongod process. ''' cmd = "mongod --port {0}".format(port) if daemon: cmd += " --fork" run(cmd)
[ "Run", "the", "mongod", "process", "." ]
cos-archives/modular-odm
python
https://github.com/cos-archives/modular-odm/blob/8a34891892b8af69b21fdc46701c91763a5c1cf9/tasks.py#L9-L15
[ "def", "mongo", "(", "daemon", "=", "False", ",", "port", "=", "20771", ")", ":", "cmd", "=", "\"mongod --port {0}\"", ".", "format", "(", "port", ")", "if", "daemon", ":", "cmd", "+=", "\" --fork\"", "run", "(", "cmd", ")" ]
8a34891892b8af69b21fdc46701c91763a5c1cf9
valid
proxy_factory
Create a proxy to a class instance stored in ``proxies``. :param class BaseSchema: Base schema (e.g. ``StoredObject``) :param str label: Name of class variable to set :param class ProxiedClass: Class to get or create :param function get_key: Extension-specific key function; may return e.g. the ...
modularodm/ext/concurrency.py
def proxy_factory(BaseSchema, label, ProxiedClass, get_key): """Create a proxy to a class instance stored in ``proxies``. :param class BaseSchema: Base schema (e.g. ``StoredObject``) :param str label: Name of class variable to set :param class ProxiedClass: Class to get or create :param function ge...
def proxy_factory(BaseSchema, label, ProxiedClass, get_key): """Create a proxy to a class instance stored in ``proxies``. :param class BaseSchema: Base schema (e.g. ``StoredObject``) :param str label: Name of class variable to set :param class ProxiedClass: Class to get or create :param function ge...
[ "Create", "a", "proxy", "to", "a", "class", "instance", "stored", "in", "proxies", "." ]
cos-archives/modular-odm
python
https://github.com/cos-archives/modular-odm/blob/8a34891892b8af69b21fdc46701c91763a5c1cf9/modularodm/ext/concurrency.py#L28-L45
[ "def", "proxy_factory", "(", "BaseSchema", ",", "label", ",", "ProxiedClass", ",", "get_key", ")", ":", "def", "local", "(", ")", ":", "key", "=", "get_key", "(", ")", "try", ":", "return", "proxies", "[", "BaseSchema", "]", "[", "label", "]", "[", "...
8a34891892b8af69b21fdc46701c91763a5c1cf9
valid
with_proxies
Class decorator factory; adds proxy class variables to target class. :param dict proxy_map: Mapping between class variable labels and proxied classes :param function get_key: Extension-specific key function; may return e.g. the current Flask request
modularodm/ext/concurrency.py
def with_proxies(proxy_map, get_key): """Class decorator factory; adds proxy class variables to target class. :param dict proxy_map: Mapping between class variable labels and proxied classes :param function get_key: Extension-specific key function; may return e.g. the current Flask request ...
def with_proxies(proxy_map, get_key): """Class decorator factory; adds proxy class variables to target class. :param dict proxy_map: Mapping between class variable labels and proxied classes :param function get_key: Extension-specific key function; may return e.g. the current Flask request ...
[ "Class", "decorator", "factory", ";", "adds", "proxy", "class", "variables", "to", "target", "class", "." ]
cos-archives/modular-odm
python
https://github.com/cos-archives/modular-odm/blob/8a34891892b8af69b21fdc46701c91763a5c1cf9/modularodm/ext/concurrency.py#L48-L62
[ "def", "with_proxies", "(", "proxy_map", ",", "get_key", ")", ":", "def", "wrapper", "(", "cls", ")", ":", "for", "label", ",", "ProxiedClass", "in", "six", ".", "iteritems", "(", "proxy_map", ")", ":", "proxy", "=", "proxy_factory", "(", "cls", ",", "...
8a34891892b8af69b21fdc46701c91763a5c1cf9
valid
ForeignField._to_primary_key
Return primary key; if value is StoredObject, verify that it is loaded.
modularodm/fields/foreignfield.py
def _to_primary_key(self, value): """ Return primary key; if value is StoredObject, verify that it is loaded. """ if value is None: return None if isinstance(value, self.base_class): if not value._is_loaded: raise exceptions.Databa...
def _to_primary_key(self, value): """ Return primary key; if value is StoredObject, verify that it is loaded. """ if value is None: return None if isinstance(value, self.base_class): if not value._is_loaded: raise exceptions.Databa...
[ "Return", "primary", "key", ";", "if", "value", "is", "StoredObject", "verify", "that", "it", "is", "loaded", "." ]
cos-archives/modular-odm
python
https://github.com/cos-archives/modular-odm/blob/8a34891892b8af69b21fdc46701c91763a5c1cf9/modularodm/fields/foreignfield.py#L45-L58
[ "def", "_to_primary_key", "(", "self", ",", "value", ")", ":", "if", "value", "is", "None", ":", "return", "None", "if", "isinstance", "(", "value", ",", "self", ".", "base_class", ")", ":", "if", "not", "value", ".", "_is_loaded", ":", "raise", "excep...
8a34891892b8af69b21fdc46701c91763a5c1cf9
valid
set_nested
Assign to a nested dictionary. :param dict data: Dictionary to mutate :param value: Value to set :param list *keys: List of nested keys >>> data = {} >>> set_nested(data, 'hi', 'k0', 'k1', 'k2') >>> data {'k0': {'k1': {'k2': 'hi'}}}
modularodm/cache.py
def set_nested(data, value, *keys): """Assign to a nested dictionary. :param dict data: Dictionary to mutate :param value: Value to set :param list *keys: List of nested keys >>> data = {} >>> set_nested(data, 'hi', 'k0', 'k1', 'k2') >>> data {'k0': {'k1': {'k2': 'hi'}}} """ i...
def set_nested(data, value, *keys): """Assign to a nested dictionary. :param dict data: Dictionary to mutate :param value: Value to set :param list *keys: List of nested keys >>> data = {} >>> set_nested(data, 'hi', 'k0', 'k1', 'k2') >>> data {'k0': {'k1': {'k2': 'hi'}}} """ i...
[ "Assign", "to", "a", "nested", "dictionary", "." ]
cos-archives/modular-odm
python
https://github.com/cos-archives/modular-odm/blob/8a34891892b8af69b21fdc46701c91763a5c1cf9/modularodm/cache.py#L3-L21
[ "def", "set_nested", "(", "data", ",", "value", ",", "*", "keys", ")", ":", "if", "len", "(", "keys", ")", "==", "1", ":", "data", "[", "keys", "[", "0", "]", "]", "=", "value", "else", ":", "if", "keys", "[", "0", "]", "not", "in", "data", ...
8a34891892b8af69b21fdc46701c91763a5c1cf9
valid
UserManager.get_by_username
Retrieve user by username
slackminion/plugins/core/user.py
def get_by_username(self, username): """Retrieve user by username""" res = filter(lambda x: x.username == username, self.users.values()) if len(res) > 0: return res[0] return None
def get_by_username(self, username): """Retrieve user by username""" res = filter(lambda x: x.username == username, self.users.values()) if len(res) > 0: return res[0] return None
[ "Retrieve", "user", "by", "username" ]
arcticfoxnv/slackminion
python
https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/plugins/core/user.py#L31-L36
[ "def", "get_by_username", "(", "self", ",", "username", ")", ":", "res", "=", "filter", "(", "lambda", "x", ":", "x", ".", "username", "==", "username", ",", "self", ".", "users", ".", "values", "(", ")", ")", "if", "len", "(", "res", ")", ">", "...
62ea77aba5ac5ba582793e578a379a76f7d26cdb
valid
UserManager.set
Adds a user object to the user manager user - a SlackUser object
slackminion/plugins/core/user.py
def set(self, user): """ Adds a user object to the user manager user - a SlackUser object """ self.log.info("Loading user information for %s/%s", user.id, user.username) self.load_user_info(user) self.log.info("Loading user rights for %s/%s", user.id, user.usern...
def set(self, user): """ Adds a user object to the user manager user - a SlackUser object """ self.log.info("Loading user information for %s/%s", user.id, user.username) self.load_user_info(user) self.log.info("Loading user rights for %s/%s", user.id, user.usern...
[ "Adds", "a", "user", "object", "to", "the", "user", "manager" ]
arcticfoxnv/slackminion
python
https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/plugins/core/user.py#L38-L51
[ "def", "set", "(", "self", ",", "user", ")", ":", "self", ".", "log", ".", "info", "(", "\"Loading user information for %s/%s\"", ",", "user", ".", "id", ",", "user", ".", "username", ")", "self", ".", "load_user_info", "(", "user", ")", "self", ".", "...
62ea77aba5ac5ba582793e578a379a76f7d26cdb
valid
UserManager.load_user_rights
Sets permissions on user object
slackminion/plugins/core/user.py
def load_user_rights(self, user): """Sets permissions on user object""" if user.username in self.admins: user.is_admin = True elif not hasattr(user, 'is_admin'): user.is_admin = False
def load_user_rights(self, user): """Sets permissions on user object""" if user.username in self.admins: user.is_admin = True elif not hasattr(user, 'is_admin'): user.is_admin = False
[ "Sets", "permissions", "on", "user", "object" ]
arcticfoxnv/slackminion
python
https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/plugins/core/user.py#L62-L67
[ "def", "load_user_rights", "(", "self", ",", "user", ")", ":", "if", "user", ".", "username", "in", "self", ".", "admins", ":", "user", ".", "is_admin", "=", "True", "elif", "not", "hasattr", "(", "user", ",", "'is_admin'", ")", ":", "user", ".", "is...
62ea77aba5ac5ba582793e578a379a76f7d26cdb
valid
BasePlugin.send_message
Used to send a message to the specified channel. * channel - can be a channel or user * text - message to send
slackminion/plugin/base.py
def send_message(self, channel, text): """ Used to send a message to the specified channel. * channel - can be a channel or user * text - message to send """ if isinstance(channel, SlackIM) or isinstance(channel, SlackUser): self._bot.send_im(channel, text) ...
def send_message(self, channel, text): """ Used to send a message to the specified channel. * channel - can be a channel or user * text - message to send """ if isinstance(channel, SlackIM) or isinstance(channel, SlackUser): self._bot.send_im(channel, text) ...
[ "Used", "to", "send", "a", "message", "to", "the", "specified", "channel", "." ]
arcticfoxnv/slackminion
python
https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/plugin/base.py#L44-L63
[ "def", "send_message", "(", "self", ",", "channel", ",", "text", ")", ":", "if", "isinstance", "(", "channel", ",", "SlackIM", ")", "or", "isinstance", "(", "channel", ",", "SlackUser", ")", ":", "self", ".", "_bot", ".", "send_im", "(", "channel", ","...
62ea77aba5ac5ba582793e578a379a76f7d26cdb
valid
BasePlugin.start_timer
Schedules a function to be called after some period of time. * duration - time in seconds to wait before firing * func - function to be called * args - arguments to pass to the function
slackminion/plugin/base.py
def start_timer(self, duration, func, *args): """ Schedules a function to be called after some period of time. * duration - time in seconds to wait before firing * func - function to be called * args - arguments to pass to the function """ t = threading.Timer(dur...
def start_timer(self, duration, func, *args): """ Schedules a function to be called after some period of time. * duration - time in seconds to wait before firing * func - function to be called * args - arguments to pass to the function """ t = threading.Timer(dur...
[ "Schedules", "a", "function", "to", "be", "called", "after", "some", "period", "of", "time", "." ]
arcticfoxnv/slackminion
python
https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/plugin/base.py#L65-L76
[ "def", "start_timer", "(", "self", ",", "duration", ",", "func", ",", "*", "args", ")", ":", "t", "=", "threading", ".", "Timer", "(", "duration", ",", "self", ".", "_timer_callback", ",", "(", "func", ",", "args", ")", ")", "self", ".", "_timer_call...
62ea77aba5ac5ba582793e578a379a76f7d26cdb
valid
BasePlugin.stop_timer
Stops a timer if it hasn't fired yet * func - the function passed in start_timer
slackminion/plugin/base.py
def stop_timer(self, func): """ Stops a timer if it hasn't fired yet * func - the function passed in start_timer """ if func in self._timer_callbacks: t = self._timer_callbacks[func] t.cancel() del self._timer_callbacks[func]
def stop_timer(self, func): """ Stops a timer if it hasn't fired yet * func - the function passed in start_timer """ if func in self._timer_callbacks: t = self._timer_callbacks[func] t.cancel() del self._timer_callbacks[func]
[ "Stops", "a", "timer", "if", "it", "hasn", "t", "fired", "yet" ]
arcticfoxnv/slackminion
python
https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/plugin/base.py#L78-L87
[ "def", "stop_timer", "(", "self", ",", "func", ")", ":", "if", "func", "in", "self", ".", "_timer_callbacks", ":", "t", "=", "self", ".", "_timer_callbacks", "[", "func", "]", "t", ".", "cancel", "(", ")", "del", "self", ".", "_timer_callbacks", "[", ...
62ea77aba5ac5ba582793e578a379a76f7d26cdb
valid
BasePlugin.get_user
Utility function to query slack for a particular user :param username: The username of the user to lookup :return: SlackUser object or None
slackminion/plugin/base.py
def get_user(self, username): """ Utility function to query slack for a particular user :param username: The username of the user to lookup :return: SlackUser object or None """ if hasattr(self._bot, 'user_manager'): user = self._bot.user_manager.get_by_usern...
def get_user(self, username): """ Utility function to query slack for a particular user :param username: The username of the user to lookup :return: SlackUser object or None """ if hasattr(self._bot, 'user_manager'): user = self._bot.user_manager.get_by_usern...
[ "Utility", "function", "to", "query", "slack", "for", "a", "particular", "user" ]
arcticfoxnv/slackminion
python
https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/plugin/base.py#L93-L107
[ "def", "get_user", "(", "self", ",", "username", ")", ":", "if", "hasattr", "(", "self", ".", "_bot", ",", "'user_manager'", ")", ":", "user", "=", "self", ".", "_bot", ".", "user_manager", ".", "get_by_username", "(", "username", ")", "if", "user", ":...
62ea77aba5ac5ba582793e578a379a76f7d26cdb
valid
print_res
Print translate result in a better format Args: data(str): result
baidu/baidu.py
def print_res(data): """ Print translate result in a better format Args: data(str): result """ print('===================================') main_part = data['data'] print(main_part['word_name']) symbols = main_part['symbols'][0] print("美式音标:[" + symbols['ph_am'] + "]") print(...
def print_res(data): """ Print translate result in a better format Args: data(str): result """ print('===================================') main_part = data['data'] print(main_part['word_name']) symbols = main_part['symbols'][0] print("美式音标:[" + symbols['ph_am'] + "]") print(...
[ "Print", "translate", "result", "in", "a", "better", "format", "Args", ":", "data", "(", "str", ")", ":", "result" ]
OldPanda/Baidu-Translator
python
https://github.com/OldPanda/Baidu-Translator/blob/f99ebeb1e3e3ba63a6eb1c95eb4562f9176e252c/baidu/baidu.py#L28-L45
[ "def", "print_res", "(", "data", ")", ":", "print", "(", "'==================================='", ")", "main_part", "=", "data", "[", "'data'", "]", "print", "(", "main_part", "[", "'word_name'", "]", ")", "symbols", "=", "main_part", "[", "'symbols'", "]", ...
f99ebeb1e3e3ba63a6eb1c95eb4562f9176e252c
valid
cmd
Decorator to mark plugin functions as commands in the form of !<cmd_name> * admin_only - indicates only users in bot_admin are allowed to execute (only used if AuthManager is loaded) * acl - indicates which ACL to perform permission checks against (only used if AuthManager is loaded) * aliases - register f...
slackminion/plugin/__init__.py
def cmd(admin_only=False, acl='*', aliases=None, while_ignored=False, *args, **kwargs): """ Decorator to mark plugin functions as commands in the form of !<cmd_name> * admin_only - indicates only users in bot_admin are allowed to execute (only used if AuthManager is loaded) * acl - indicates which ACL ...
def cmd(admin_only=False, acl='*', aliases=None, while_ignored=False, *args, **kwargs): """ Decorator to mark plugin functions as commands in the form of !<cmd_name> * admin_only - indicates only users in bot_admin are allowed to execute (only used if AuthManager is loaded) * acl - indicates which ACL ...
[ "Decorator", "to", "mark", "plugin", "functions", "as", "commands", "in", "the", "form", "of", "!<cmd_name", ">" ]
arcticfoxnv/slackminion
python
https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/plugin/__init__.py#L5-L23
[ "def", "cmd", "(", "admin_only", "=", "False", ",", "acl", "=", "'*'", ",", "aliases", "=", "None", ",", "while_ignored", "=", "False", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "def", "wrapper", "(", "func", ")", ":", "func", ".", "is...
62ea77aba5ac5ba582793e578a379a76f7d26cdb
valid
webhook
Decorator to mark plugin functions as entry points for web calls * route - web route to register, uses Flask syntax * method - GET/POST, defaults to POST
slackminion/plugin/__init__.py
def webhook(*args, **kwargs): """ Decorator to mark plugin functions as entry points for web calls * route - web route to register, uses Flask syntax * method - GET/POST, defaults to POST """ def wrapper(func): func.is_webhook = True func.route = args[0] func.form_params...
def webhook(*args, **kwargs): """ Decorator to mark plugin functions as entry points for web calls * route - web route to register, uses Flask syntax * method - GET/POST, defaults to POST """ def wrapper(func): func.is_webhook = True func.route = args[0] func.form_params...
[ "Decorator", "to", "mark", "plugin", "functions", "as", "entry", "points", "for", "web", "calls" ]
arcticfoxnv/slackminion
python
https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/plugin/__init__.py#L26-L39
[ "def", "webhook", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "def", "wrapper", "(", "func", ")", ":", "func", ".", "is_webhook", "=", "True", "func", ".", "route", "=", "args", "[", "0", "]", "func", ".", "form_params", "=", "kwargs", "...
62ea77aba5ac5ba582793e578a379a76f7d26cdb
valid
Field._get_underlying_data
Return data from raw data store, rather than overridden __get__ methods. Should NOT be overwritten.
modularodm/fields/field.py
def _get_underlying_data(self, instance): """Return data from raw data store, rather than overridden __get__ methods. Should NOT be overwritten. """ self._touch(instance) return self.data.get(instance, None)
def _get_underlying_data(self, instance): """Return data from raw data store, rather than overridden __get__ methods. Should NOT be overwritten. """ self._touch(instance) return self.data.get(instance, None)
[ "Return", "data", "from", "raw", "data", "store", "rather", "than", "overridden", "__get__", "methods", ".", "Should", "NOT", "be", "overwritten", "." ]
cos-archives/modular-odm
python
https://github.com/cos-archives/modular-odm/blob/8a34891892b8af69b21fdc46701c91763a5c1cf9/modularodm/fields/field.py#L218-L223
[ "def", "_get_underlying_data", "(", "self", ",", "instance", ")", ":", "self", ".", "_touch", "(", "instance", ")", "return", "self", ".", "data", ".", "get", "(", "instance", ",", "None", ")" ]
8a34891892b8af69b21fdc46701c91763a5c1cf9
valid
freeze
Cast value to its frozen counterpart.
modularodm/frozen.py
def freeze(value): """ Cast value to its frozen counterpart. """ if isinstance(value, list): return FrozenList(*value) if isinstance(value, dict): return FrozenDict(**value) return value
def freeze(value): """ Cast value to its frozen counterpart. """ if isinstance(value, list): return FrozenList(*value) if isinstance(value, dict): return FrozenDict(**value) return value
[ "Cast", "value", "to", "its", "frozen", "counterpart", "." ]
cos-archives/modular-odm
python
https://github.com/cos-archives/modular-odm/blob/8a34891892b8af69b21fdc46701c91763a5c1cf9/modularodm/frozen.py#L4-L10
[ "def", "freeze", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "list", ")", ":", "return", "FrozenList", "(", "*", "value", ")", "if", "isinstance", "(", "value", ",", "dict", ")", ":", "return", "FrozenDict", "(", "*", "*", "value",...
8a34891892b8af69b21fdc46701c91763a5c1cf9
valid
Core.help
Displays help for each command
slackminion/plugins/core/core.py
def help(self, msg, args): """Displays help for each command""" output = [] if len(args) == 0: commands = sorted(self._bot.dispatcher.commands.items(), key=itemgetter(0)) commands = filter(lambda x: x[1].is_subcmd is False, commands) # Filter commands if auth ...
def help(self, msg, args): """Displays help for each command""" output = [] if len(args) == 0: commands = sorted(self._bot.dispatcher.commands.items(), key=itemgetter(0)) commands = filter(lambda x: x[1].is_subcmd is False, commands) # Filter commands if auth ...
[ "Displays", "help", "for", "each", "command" ]
arcticfoxnv/slackminion
python
https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/plugins/core/core.py#L30-L44
[ "def", "help", "(", "self", ",", "msg", ",", "args", ")", ":", "output", "=", "[", "]", "if", "len", "(", "args", ")", "==", "0", ":", "commands", "=", "sorted", "(", "self", ".", "_bot", ".", "dispatcher", ".", "commands", ".", "items", "(", "...
62ea77aba5ac5ba582793e578a379a76f7d26cdb
valid
Core.save
Causes the bot to write its current state to backend.
slackminion/plugins/core/core.py
def save(self, msg, args): """Causes the bot to write its current state to backend.""" self.send_message(msg.channel, "Saving current state...") self._bot.plugins.save_state() self.send_message(msg.channel, "Done.")
def save(self, msg, args): """Causes the bot to write its current state to backend.""" self.send_message(msg.channel, "Saving current state...") self._bot.plugins.save_state() self.send_message(msg.channel, "Done.")
[ "Causes", "the", "bot", "to", "write", "its", "current", "state", "to", "backend", "." ]
arcticfoxnv/slackminion
python
https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/plugins/core/core.py#L68-L72
[ "def", "save", "(", "self", ",", "msg", ",", "args", ")", ":", "self", ".", "send_message", "(", "msg", ".", "channel", ",", "\"Saving current state...\"", ")", "self", ".", "_bot", ".", "plugins", ".", "save_state", "(", ")", "self", ".", "send_message"...
62ea77aba5ac5ba582793e578a379a76f7d26cdb
valid
Core.shutdown
Causes the bot to gracefully shutdown.
slackminion/plugins/core/core.py
def shutdown(self, msg, args): """Causes the bot to gracefully shutdown.""" self.log.info("Received shutdown from %s", msg.user.username) self._bot.runnable = False return "Shutting down..."
def shutdown(self, msg, args): """Causes the bot to gracefully shutdown.""" self.log.info("Received shutdown from %s", msg.user.username) self._bot.runnable = False return "Shutting down..."
[ "Causes", "the", "bot", "to", "gracefully", "shutdown", "." ]
arcticfoxnv/slackminion
python
https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/plugins/core/core.py#L75-L79
[ "def", "shutdown", "(", "self", ",", "msg", ",", "args", ")", ":", "self", ".", "log", ".", "info", "(", "\"Received shutdown from %s\"", ",", "msg", ".", "user", ".", "username", ")", "self", ".", "_bot", ".", "runnable", "=", "False", "return", "\"Sh...
62ea77aba5ac5ba582793e578a379a76f7d26cdb
valid
Core.whoami
Prints information about the user and bot version.
slackminion/plugins/core/core.py
def whoami(self, msg, args): """Prints information about the user and bot version.""" output = ["Hello %s" % msg.user] if hasattr(self._bot.dispatcher, 'auth_manager') and msg.user.is_admin is True: output.append("You are a *bot admin*.") output.append("Bot version: %s-%s" % ...
def whoami(self, msg, args): """Prints information about the user and bot version.""" output = ["Hello %s" % msg.user] if hasattr(self._bot.dispatcher, 'auth_manager') and msg.user.is_admin is True: output.append("You are a *bot admin*.") output.append("Bot version: %s-%s" % ...
[ "Prints", "information", "about", "the", "user", "and", "bot", "version", "." ]
arcticfoxnv/slackminion
python
https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/plugins/core/core.py#L82-L88
[ "def", "whoami", "(", "self", ",", "msg", ",", "args", ")", ":", "output", "=", "[", "\"Hello %s\"", "%", "msg", ".", "user", "]", "if", "hasattr", "(", "self", ".", "_bot", ".", "dispatcher", ",", "'auth_manager'", ")", "and", "msg", ".", "user", ...
62ea77aba5ac5ba582793e578a379a76f7d26cdb
valid
Core.sleep
Causes the bot to ignore all messages from the channel. Usage: !sleep [channel name] - ignore the specified channel (or current if none specified)
slackminion/plugins/core/core.py
def sleep(self, channel): """Causes the bot to ignore all messages from the channel. Usage: !sleep [channel name] - ignore the specified channel (or current if none specified) """ self.log.info('Sleeping in %s', channel) self._bot.dispatcher.ignore(channel) self....
def sleep(self, channel): """Causes the bot to ignore all messages from the channel. Usage: !sleep [channel name] - ignore the specified channel (or current if none specified) """ self.log.info('Sleeping in %s', channel) self._bot.dispatcher.ignore(channel) self....
[ "Causes", "the", "bot", "to", "ignore", "all", "messages", "from", "the", "channel", "." ]
arcticfoxnv/slackminion
python
https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/plugins/core/core.py#L92-L100
[ "def", "sleep", "(", "self", ",", "channel", ")", ":", "self", ".", "log", ".", "info", "(", "'Sleeping in %s'", ",", "channel", ")", "self", ".", "_bot", ".", "dispatcher", ".", "ignore", "(", "channel", ")", "self", ".", "send_message", "(", "channel...
62ea77aba5ac5ba582793e578a379a76f7d26cdb
valid
Core.wake
Causes the bot to resume operation in the channel. Usage: !wake [channel name] - unignore the specified channel (or current if none specified)
slackminion/plugins/core/core.py
def wake(self, channel): """Causes the bot to resume operation in the channel. Usage: !wake [channel name] - unignore the specified channel (or current if none specified) """ self.log.info('Waking up in %s', channel) self._bot.dispatcher.unignore(channel) self.se...
def wake(self, channel): """Causes the bot to resume operation in the channel. Usage: !wake [channel name] - unignore the specified channel (or current if none specified) """ self.log.info('Waking up in %s', channel) self._bot.dispatcher.unignore(channel) self.se...
[ "Causes", "the", "bot", "to", "resume", "operation", "in", "the", "channel", "." ]
arcticfoxnv/slackminion
python
https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/plugins/core/core.py#L104-L112
[ "def", "wake", "(", "self", ",", "channel", ")", ":", "self", ".", "log", ".", "info", "(", "'Waking up in %s'", ",", "channel", ")", "self", ".", "_bot", ".", "dispatcher", ".", "unignore", "(", "channel", ")", "self", ".", "send_message", "(", "chann...
62ea77aba5ac5ba582793e578a379a76f7d26cdb
valid
ClientExtension._arg_name
--shish-kabob it
a10_neutronclient/client_extension.py
def _arg_name(self, name, types, prefix="--"): if 'type:a10_nullable' in types: return self._arg_name(name, types['type:a10_nullable'], prefix) if 'type:a10_list' in types: return self._arg_name(name, types['type:a10_list'], prefix) if 'type:a10_reference' in types: ...
def _arg_name(self, name, types, prefix="--"): if 'type:a10_nullable' in types: return self._arg_name(name, types['type:a10_nullable'], prefix) if 'type:a10_list' in types: return self._arg_name(name, types['type:a10_list'], prefix) if 'type:a10_reference' in types: ...
[ "--", "shish", "-", "kabob", "it" ]
a10networks/a10-neutronclient
python
https://github.com/a10networks/a10-neutronclient/blob/caeaa76183c9de68fa066caed4a408067d9a1826/a10_neutronclient/client_extension.py#L28-L40
[ "def", "_arg_name", "(", "self", ",", "name", ",", "types", ",", "prefix", "=", "\"--\"", ")", ":", "if", "'type:a10_nullable'", "in", "types", ":", "return", "self", ".", "_arg_name", "(", "name", ",", "types", "[", "'type:a10_nullable'", "]", ",", "pre...
caeaa76183c9de68fa066caed4a408067d9a1826
valid
_sort_by
High order function for sort methods.
pathlib_mate/mate_path_filters.py
def _sort_by(key): """ High order function for sort methods. """ @staticmethod def sort_by(p_list, reverse=False): return sorted( p_list, key=lambda p: getattr(p, key), reverse=reverse, ) return sort_by
def _sort_by(key): """ High order function for sort methods. """ @staticmethod def sort_by(p_list, reverse=False): return sorted( p_list, key=lambda p: getattr(p, key), reverse=reverse, ) return sort_by
[ "High", "order", "function", "for", "sort", "methods", "." ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_path_filters.py#L18-L31
[ "def", "_sort_by", "(", "key", ")", ":", "@", "staticmethod", "def", "sort_by", "(", "p_list", ",", "reverse", "=", "False", ")", ":", "return", "sorted", "(", "p_list", ",", "key", "=", "lambda", "p", ":", "getattr", "(", "p", ",", "key", ")", ","...
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
PathFilters.select
Select path by criterion. :param filters: a lambda function that take a `pathlib.Path` as input, boolean as a output. :param recursive: include files in subfolder or not. **中文文档** 根据filters中定义的条件选择路径。
pathlib_mate/mate_path_filters.py
def select(self, filters=all_true, recursive=True): """Select path by criterion. :param filters: a lambda function that take a `pathlib.Path` as input, boolean as a output. :param recursive: include files in subfolder or not. **中文文档** 根据filters中定义的条件选择路径。 """...
def select(self, filters=all_true, recursive=True): """Select path by criterion. :param filters: a lambda function that take a `pathlib.Path` as input, boolean as a output. :param recursive: include files in subfolder or not. **中文文档** 根据filters中定义的条件选择路径。 """...
[ "Select", "path", "by", "criterion", "." ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_path_filters.py#L65-L85
[ "def", "select", "(", "self", ",", "filters", "=", "all_true", ",", "recursive", "=", "True", ")", ":", "self", ".", "assert_is_dir_and_exists", "(", ")", "if", "recursive", ":", "for", "p", "in", "self", ".", "glob", "(", "\"**/*\"", ")", ":", "if", ...
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
PathFilters.select_file
Select file path by criterion. **中文文档** 根据filters中定义的条件选择文件。
pathlib_mate/mate_path_filters.py
def select_file(self, filters=all_true, recursive=True): """Select file path by criterion. **中文文档** 根据filters中定义的条件选择文件。 """ for p in self.select(filters, recursive): if p.is_file(): yield p
def select_file(self, filters=all_true, recursive=True): """Select file path by criterion. **中文文档** 根据filters中定义的条件选择文件。 """ for p in self.select(filters, recursive): if p.is_file(): yield p
[ "Select", "file", "path", "by", "criterion", "." ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_path_filters.py#L87-L96
[ "def", "select_file", "(", "self", ",", "filters", "=", "all_true", ",", "recursive", "=", "True", ")", ":", "for", "p", "in", "self", ".", "select", "(", "filters", ",", "recursive", ")", ":", "if", "p", ".", "is_file", "(", ")", ":", "yield", "p"...
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
PathFilters.select_dir
Select dir path by criterion. **中文文档** 根据filters中定义的条件选择文件夹。
pathlib_mate/mate_path_filters.py
def select_dir(self, filters=all_true, recursive=True): """Select dir path by criterion. **中文文档** 根据filters中定义的条件选择文件夹。 """ for p in self.select(filters, recursive): if p.is_dir(): yield p
def select_dir(self, filters=all_true, recursive=True): """Select dir path by criterion. **中文文档** 根据filters中定义的条件选择文件夹。 """ for p in self.select(filters, recursive): if p.is_dir(): yield p
[ "Select", "dir", "path", "by", "criterion", "." ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_path_filters.py#L98-L107
[ "def", "select_dir", "(", "self", ",", "filters", "=", "all_true", ",", "recursive", "=", "True", ")", ":", "for", "p", "in", "self", ".", "select", "(", "filters", ",", "recursive", ")", ":", "if", "p", ".", "is_dir", "(", ")", ":", "yield", "p" ]
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
PathFilters.n_file
Count how many files in this directory. Including file in sub folder.
pathlib_mate/mate_path_filters.py
def n_file(self): """ Count how many files in this directory. Including file in sub folder. """ self.assert_is_dir_and_exists() n = 0 for _ in self.select_file(recursive=True): n += 1 return n
def n_file(self): """ Count how many files in this directory. Including file in sub folder. """ self.assert_is_dir_and_exists() n = 0 for _ in self.select_file(recursive=True): n += 1 return n
[ "Count", "how", "many", "files", "in", "this", "directory", ".", "Including", "file", "in", "sub", "folder", "." ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_path_filters.py#L110-L118
[ "def", "n_file", "(", "self", ")", ":", "self", ".", "assert_is_dir_and_exists", "(", ")", "n", "=", "0", "for", "_", "in", "self", ".", "select_file", "(", "recursive", "=", "True", ")", ":", "n", "+=", "1", "return", "n" ]
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
PathFilters.n_dir
Count how many folders in this directory. Including folder in sub folder.
pathlib_mate/mate_path_filters.py
def n_dir(self): """ Count how many folders in this directory. Including folder in sub folder. """ self.assert_is_dir_and_exists() n = 0 for _ in self.select_dir(recursive=True): n += 1 return n
def n_dir(self): """ Count how many folders in this directory. Including folder in sub folder. """ self.assert_is_dir_and_exists() n = 0 for _ in self.select_dir(recursive=True): n += 1 return n
[ "Count", "how", "many", "folders", "in", "this", "directory", ".", "Including", "folder", "in", "sub", "folder", "." ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_path_filters.py#L121-L129
[ "def", "n_dir", "(", "self", ")", ":", "self", ".", "assert_is_dir_and_exists", "(", ")", "n", "=", "0", "for", "_", "in", "self", ".", "select_dir", "(", "recursive", "=", "True", ")", ":", "n", "+=", "1", "return", "n" ]
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
PathFilters.n_subfile
Count how many files in this directory (doesn't include files in sub folders).
pathlib_mate/mate_path_filters.py
def n_subfile(self): """ Count how many files in this directory (doesn't include files in sub folders). """ self.assert_is_dir_and_exists() n = 0 for _ in self.select_file(recursive=False): n += 1 return n
def n_subfile(self): """ Count how many files in this directory (doesn't include files in sub folders). """ self.assert_is_dir_and_exists() n = 0 for _ in self.select_file(recursive=False): n += 1 return n
[ "Count", "how", "many", "files", "in", "this", "directory", "(", "doesn", "t", "include", "files", "in", "sub", "folders", ")", "." ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_path_filters.py#L132-L141
[ "def", "n_subfile", "(", "self", ")", ":", "self", ".", "assert_is_dir_and_exists", "(", ")", "n", "=", "0", "for", "_", "in", "self", ".", "select_file", "(", "recursive", "=", "False", ")", ":", "n", "+=", "1", "return", "n" ]
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
PathFilters.n_subdir
Count how many folders in this directory (doesn't include folder in sub folders).
pathlib_mate/mate_path_filters.py
def n_subdir(self): """ Count how many folders in this directory (doesn't include folder in sub folders). """ self.assert_is_dir_and_exists() n = 0 for _ in self.select_dir(recursive=False): n += 1 return n
def n_subdir(self): """ Count how many folders in this directory (doesn't include folder in sub folders). """ self.assert_is_dir_and_exists() n = 0 for _ in self.select_dir(recursive=False): n += 1 return n
[ "Count", "how", "many", "folders", "in", "this", "directory", "(", "doesn", "t", "include", "folder", "in", "sub", "folders", ")", "." ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_path_filters.py#L144-L153
[ "def", "n_subdir", "(", "self", ")", ":", "self", ".", "assert_is_dir_and_exists", "(", ")", "n", "=", "0", "for", "_", "in", "self", ".", "select_dir", "(", "recursive", "=", "False", ")", ":", "n", "+=", "1", "return", "n" ]
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
PathFilters.select_by_ext
Select file path by extension. :param ext: **中文文档** 选择与预定义的若干个扩展名匹配的文件。
pathlib_mate/mate_path_filters.py
def select_by_ext(self, ext, recursive=True): """ Select file path by extension. :param ext: **中文文档** 选择与预定义的若干个扩展名匹配的文件。 """ ext = [ext.strip().lower() for ext in ensure_list(ext)] def filters(p): return p.suffix.lower() in ext return self.se...
def select_by_ext(self, ext, recursive=True): """ Select file path by extension. :param ext: **中文文档** 选择与预定义的若干个扩展名匹配的文件。 """ ext = [ext.strip().lower() for ext in ensure_list(ext)] def filters(p): return p.suffix.lower() in ext return self.se...
[ "Select", "file", "path", "by", "extension", "." ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_path_filters.py#L156-L170
[ "def", "select_by_ext", "(", "self", ",", "ext", ",", "recursive", "=", "True", ")", ":", "ext", "=", "[", "ext", ".", "strip", "(", ")", ".", "lower", "(", ")", "for", "ext", "in", "ensure_list", "(", "ext", ")", "]", "def", "filters", "(", "p",...
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
PathFilters.select_by_pattern_in_fname
Select file path by text pattern in file name. **中文文档** 选择文件名中包含指定子字符串的文件。
pathlib_mate/mate_path_filters.py
def select_by_pattern_in_fname(self, pattern, recursive=True, case_sensitive=False): """ Select file path by text pattern in file name. **中文文档** 选择文件名中包含指定子字符串的文件。 """ ...
def select_by_pattern_in_fname(self, pattern, recursive=True, case_sensitive=False): """ Select file path by text pattern in file name. **中文文档** 选择文件名中包含指定子字符串的文件。 """ ...
[ "Select", "file", "path", "by", "text", "pattern", "in", "file", "name", "." ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_path_filters.py#L172-L192
[ "def", "select_by_pattern_in_fname", "(", "self", ",", "pattern", ",", "recursive", "=", "True", ",", "case_sensitive", "=", "False", ")", ":", "if", "case_sensitive", ":", "def", "filters", "(", "p", ")", ":", "return", "pattern", "in", "p", ".", "fname",...
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
PathFilters.select_by_pattern_in_abspath
Select file path by text pattern in absolute path. **中文文档** 选择绝对路径中包含指定子字符串的文件。
pathlib_mate/mate_path_filters.py
def select_by_pattern_in_abspath(self, pattern, recursive=True, case_sensitive=False): """ Select file path by text pattern in absolute path. **中文文档** 选择绝对路径中包含指定子字符串的文件。 ...
def select_by_pattern_in_abspath(self, pattern, recursive=True, case_sensitive=False): """ Select file path by text pattern in absolute path. **中文文档** 选择绝对路径中包含指定子字符串的文件。 ...
[ "Select", "file", "path", "by", "text", "pattern", "in", "absolute", "path", "." ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_path_filters.py#L194-L214
[ "def", "select_by_pattern_in_abspath", "(", "self", ",", "pattern", ",", "recursive", "=", "True", ",", "case_sensitive", "=", "False", ")", ":", "if", "case_sensitive", ":", "def", "filters", "(", "p", ")", ":", "return", "pattern", "in", "p", ".", "abspa...
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
PathFilters.select_by_size
Select file path by size. **中文文档** 选择所有文件大小在一定范围内的文件。
pathlib_mate/mate_path_filters.py
def select_by_size(self, min_size=0, max_size=1 << 40, recursive=True): """ Select file path by size. **中文文档** 选择所有文件大小在一定范围内的文件。 """ def filters(p): return min_size <= p.size <= max_size return self.select_file(filters, recursive)
def select_by_size(self, min_size=0, max_size=1 << 40, recursive=True): """ Select file path by size. **中文文档** 选择所有文件大小在一定范围内的文件。 """ def filters(p): return min_size <= p.size <= max_size return self.select_file(filters, recursive)
[ "Select", "file", "path", "by", "size", "." ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_path_filters.py#L216-L227
[ "def", "select_by_size", "(", "self", ",", "min_size", "=", "0", ",", "max_size", "=", "1", "<<", "40", ",", "recursive", "=", "True", ")", ":", "def", "filters", "(", "p", ")", ":", "return", "min_size", "<=", "p", ".", "size", "<=", "max_size", "...
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
PathFilters.select_by_mtime
Select file path by modify time. :param min_time: lower bound timestamp :param max_time: upper bound timestamp **中文文档** 选择所有 :attr:`pathlib_mate.pathlib2.Path.mtime` 在一定范围内的文件。
pathlib_mate/mate_path_filters.py
def select_by_mtime(self, min_time=0, max_time=ts_2100, recursive=True): """ Select file path by modify time. :param min_time: lower bound timestamp :param max_time: upper bound timestamp **中文文档** 选择所有 :attr:`pathlib_mate.pathlib2.Path.mtime` 在一...
def select_by_mtime(self, min_time=0, max_time=ts_2100, recursive=True): """ Select file path by modify time. :param min_time: lower bound timestamp :param max_time: upper bound timestamp **中文文档** 选择所有 :attr:`pathlib_mate.pathlib2.Path.mtime` 在一...
[ "Select", "file", "path", "by", "modify", "time", "." ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_path_filters.py#L229-L244
[ "def", "select_by_mtime", "(", "self", ",", "min_time", "=", "0", ",", "max_time", "=", "ts_2100", ",", "recursive", "=", "True", ")", ":", "def", "filters", "(", "p", ")", ":", "return", "min_time", "<=", "p", ".", "mtime", "<=", "max_time", "return",...
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
PathFilters.select_by_atime
Select file path by access time. :param min_time: lower bound timestamp :param max_time: upper bound timestamp **中文文档** 选择所有 :attr:`pathlib_mate.pathlib2.Path.atime` 在一定范围内的文件。
pathlib_mate/mate_path_filters.py
def select_by_atime(self, min_time=0, max_time=ts_2100, recursive=True): """ Select file path by access time. :param min_time: lower bound timestamp :param max_time: upper bound timestamp **中文文档** 选择所有 :attr:`pathlib_mate.pathlib2.Path.atime` 在一定范围内的文件。 """ ...
def select_by_atime(self, min_time=0, max_time=ts_2100, recursive=True): """ Select file path by access time. :param min_time: lower bound timestamp :param max_time: upper bound timestamp **中文文档** 选择所有 :attr:`pathlib_mate.pathlib2.Path.atime` 在一定范围内的文件。 """ ...
[ "Select", "file", "path", "by", "access", "time", "." ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_path_filters.py#L246-L260
[ "def", "select_by_atime", "(", "self", ",", "min_time", "=", "0", ",", "max_time", "=", "ts_2100", ",", "recursive", "=", "True", ")", ":", "def", "filters", "(", "p", ")", ":", "return", "min_time", "<=", "p", ".", "atime", "<=", "max_time", "return",...
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
PathFilters.select_by_ctime
Select file path by create time. :param min_time: lower bound timestamp :param max_time: upper bound timestamp **中文文档** 选择所有 :attr:`pathlib_mate.pathlib2.Path.ctime` 在一定范围内的文件。
pathlib_mate/mate_path_filters.py
def select_by_ctime(self, min_time=0, max_time=ts_2100, recursive=True): """ Select file path by create time. :param min_time: lower bound timestamp :param max_time: upper bound timestamp **中文文档** 选择所有 :attr:`pathlib_mate.pathlib2.Path.ctime` 在一...
def select_by_ctime(self, min_time=0, max_time=ts_2100, recursive=True): """ Select file path by create time. :param min_time: lower bound timestamp :param max_time: upper bound timestamp **中文文档** 选择所有 :attr:`pathlib_mate.pathlib2.Path.ctime` 在一...
[ "Select", "file", "path", "by", "create", "time", "." ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_path_filters.py#L262-L277
[ "def", "select_by_ctime", "(", "self", ",", "min_time", "=", "0", ",", "max_time", "=", "ts_2100", ",", "recursive", "=", "True", ")", ":", "def", "filters", "(", "p", ")", ":", "return", "min_time", "<=", "p", ".", "ctime", "<=", "max_time", "return",...
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
PathFilters.dirsize
Return total file size (include sub folder). Symlink doesn't count.
pathlib_mate/mate_path_filters.py
def dirsize(self): """ Return total file size (include sub folder). Symlink doesn't count. """ total = 0 for p in self.select_file(recursive=True): try: total += p.size except: # pragma: no cover print("Unable to get file s...
def dirsize(self): """ Return total file size (include sub folder). Symlink doesn't count. """ total = 0 for p in self.select_file(recursive=True): try: total += p.size except: # pragma: no cover print("Unable to get file s...
[ "Return", "total", "file", "size", "(", "include", "sub", "folder", ")", ".", "Symlink", "doesn", "t", "count", "." ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_path_filters.py#L403-L413
[ "def", "dirsize", "(", "self", ")", ":", "total", "=", "0", "for", "p", "in", "self", ".", "select_file", "(", "recursive", "=", "True", ")", ":", "try", ":", "total", "+=", "p", ".", "size", "except", ":", "# pragma: no cover", "print", "(", "\"Unab...
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
ToolBoxZip.make_zip_archive
Make a zip archive. :param dst: output file path. if not given, will be automatically assigned. :param filters: custom path filter. By default it allows any file. :param compress: compress or not. :param overwrite: overwrite exists or not. :param verbose: display log or not. ...
pathlib_mate/mate_tool_box_zip.py
def make_zip_archive(self, dst=None, filters=all_true, compress=True, overwrite=False, makedirs=False, verbose=False): # pragma: no cover """ Make a zip ...
def make_zip_archive(self, dst=None, filters=all_true, compress=True, overwrite=False, makedirs=False, verbose=False): # pragma: no cover """ Make a zip ...
[ "Make", "a", "zip", "archive", "." ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_tool_box_zip.py#L37-L112
[ "def", "make_zip_archive", "(", "self", ",", "dst", "=", "None", ",", "filters", "=", "all_true", ",", "compress", "=", "True", ",", "overwrite", "=", "False", ",", "makedirs", "=", "False", ",", "verbose", "=", "False", ")", ":", "# pragma: no cover", "...
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
ToolBoxZip.backup
Create a compressed zip archive backup for a directory. :param dst: the output file path. :param ignore: file or directory defined in this list will be ignored. :param ignore_ext: file with extensions defined in this list will be ignored. :param ignore_pattern: any file or directory tha...
pathlib_mate/mate_tool_box_zip.py
def backup(self, dst=None, ignore=None, ignore_ext=None, ignore_pattern=None, ignore_size_smaller_than=None, ignore_size_larger_than=None, case_sensitive=False): # pragma: no cover """ Create a comp...
def backup(self, dst=None, ignore=None, ignore_ext=None, ignore_pattern=None, ignore_size_smaller_than=None, ignore_size_larger_than=None, case_sensitive=False): # pragma: no cover """ Create a comp...
[ "Create", "a", "compressed", "zip", "archive", "backup", "for", "a", "directory", "." ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_tool_box_zip.py#L114-L208
[ "def", "backup", "(", "self", ",", "dst", "=", "None", ",", "ignore", "=", "None", ",", "ignore_ext", "=", "None", ",", "ignore_pattern", "=", "None", ",", "ignore_size_smaller_than", "=", "None", ",", "ignore_size_larger_than", "=", "None", ",", "case_sensi...
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
acquire_lock
Decorate methods when locking repository is required.
OldRepository.py
def acquire_lock(func): """Decorate methods when locking repository is required.""" @wraps(func) def wrapper(self, *args, **kwargs): with self.locker as r: # get the result acquired, code, _ = r if acquired: try: r = func(self,...
def acquire_lock(func): """Decorate methods when locking repository is required.""" @wraps(func) def wrapper(self, *args, **kwargs): with self.locker as r: # get the result acquired, code, _ = r if acquired: try: r = func(self,...
[ "Decorate", "methods", "when", "locking", "repository", "is", "required", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/OldRepository.py#L246-L269
[ "def", "acquire_lock", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "wrapper", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "with", "self", ".", "locker", "as", "r", ":", "# get the result", "acquired", ",", "c...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
sync_required
Decorate methods when synchronizing repository is required.
OldRepository.py
def sync_required(func): """Decorate methods when synchronizing repository is required.""" @wraps(func) def wrapper(self, *args, **kwargs): if not self._keepSynchronized: r = func(self, *args, **kwargs) else: state = self._load_state() #print("----------->...
def sync_required(func): """Decorate methods when synchronizing repository is required.""" @wraps(func) def wrapper(self, *args, **kwargs): if not self._keepSynchronized: r = func(self, *args, **kwargs) else: state = self._load_state() #print("----------->...
[ "Decorate", "methods", "when", "synchronizing", "repository", "is", "required", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/OldRepository.py#L271-L288
[ "def", "sync_required", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "wrapper", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "self", ".", "_keepSynchronized", ":", "r", "=", "func", "(", "self", ...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
get_pickling_errors
Investigate pickling errors.
OldRepository.py
def get_pickling_errors(obj, seen=None): """Investigate pickling errors.""" if seen == None: seen = [] if hasattr(obj, "__getstate__"): state = obj.__getstate__() #elif hasattr(obj, "__dict__"): # state = obj.__dict__ else: return None #try: # state = obj.__...
def get_pickling_errors(obj, seen=None): """Investigate pickling errors.""" if seen == None: seen = [] if hasattr(obj, "__getstate__"): state = obj.__getstate__() #elif hasattr(obj, "__dict__"): # state = obj.__dict__ else: return None #try: # state = obj.__...
[ "Investigate", "pickling", "errors", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/OldRepository.py#L292-L322
[ "def", "get_pickling_errors", "(", "obj", ",", "seen", "=", "None", ")", ":", "if", "seen", "==", "None", ":", "seen", "=", "[", "]", "if", "hasattr", "(", "obj", ",", "\"__getstate__\"", ")", ":", "state", "=", "obj", ".", "__getstate__", "(", ")", ...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.get_list_representation
Gets a representation of the Repository content in a list of directories(files) format. :Returns: #. repr (list): The list representation of the Repository content.
OldRepository.py
def get_list_representation(self): """ Gets a representation of the Repository content in a list of directories(files) format. :Returns: #. repr (list): The list representation of the Repository content. """ if self.__path is None: return [] repr ...
def get_list_representation(self): """ Gets a representation of the Repository content in a list of directories(files) format. :Returns: #. repr (list): The list representation of the Repository content. """ if self.__path is None: return [] repr ...
[ "Gets", "a", "representation", "of", "the", "Repository", "content", "in", "a", "list", "of", "directories", "(", "files", ")", "format", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/OldRepository.py#L544-L562
[ "def", "get_list_representation", "(", "self", ")", ":", "if", "self", ".", "__path", "is", "None", ":", "return", "[", "]", "repr", "=", "[", "self", ".", "__path", "+", "\":[\"", "+", "','", ".", "join", "(", "list", "(", "dict", ".", "__getitem__"...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.walk_files_relative_path
Walk the repository and yield all found files relative path joined with file name. :parameters: #. relativePath (str): The relative path from which start the walk.
OldRepository.py
def walk_files_relative_path(self, relativePath=""): """ Walk the repository and yield all found files relative path joined with file name. :parameters: #. relativePath (str): The relative path from which start the walk. """ def walk_files(directory, relativePath): ...
def walk_files_relative_path(self, relativePath=""): """ Walk the repository and yield all found files relative path joined with file name. :parameters: #. relativePath (str): The relative path from which start the walk. """ def walk_files(directory, relativePath): ...
[ "Walk", "the", "repository", "and", "yield", "all", "found", "files", "relative", "path", "joined", "with", "file", "name", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/OldRepository.py#L564-L583
[ "def", "walk_files_relative_path", "(", "self", ",", "relativePath", "=", "\"\"", ")", ":", "def", "walk_files", "(", "directory", ",", "relativePath", ")", ":", "directories", "=", "dict", ".", "__getitem__", "(", "directory", ",", "'directories'", ")", "file...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.walk_files_info
Walk the repository and yield tuples as the following:\n (relative path to relativePath joined with file name, file info dict). :parameters: #. relativePath (str): The relative path from which start the walk.
OldRepository.py
def walk_files_info(self, relativePath=""): """ Walk the repository and yield tuples as the following:\n (relative path to relativePath joined with file name, file info dict). :parameters: #. relativePath (str): The relative path from which start the walk. """ ...
def walk_files_info(self, relativePath=""): """ Walk the repository and yield tuples as the following:\n (relative path to relativePath joined with file name, file info dict). :parameters: #. relativePath (str): The relative path from which start the walk. """ ...
[ "Walk", "the", "repository", "and", "yield", "tuples", "as", "the", "following", ":", "\\", "n", "(", "relative", "path", "to", "relativePath", "joined", "with", "file", "name", "file", "info", "dict", ")", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/OldRepository.py#L585-L606
[ "def", "walk_files_info", "(", "self", ",", "relativePath", "=", "\"\"", ")", ":", "def", "walk_files", "(", "directory", ",", "relativePath", ")", ":", "directories", "=", "dict", ".", "__getitem__", "(", "directory", ",", "'directories'", ")", "files", "="...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.walk_directories_relative_path
Walk repository and yield all found directories relative path :parameters: #. relativePath (str): The relative path from which start the walk.
OldRepository.py
def walk_directories_relative_path(self, relativePath=""): """ Walk repository and yield all found directories relative path :parameters: #. relativePath (str): The relative path from which start the walk. """ def walk_directories(directory, relativePath): ...
def walk_directories_relative_path(self, relativePath=""): """ Walk repository and yield all found directories relative path :parameters: #. relativePath (str): The relative path from which start the walk. """ def walk_directories(directory, relativePath): ...
[ "Walk", "repository", "and", "yield", "all", "found", "directories", "relative", "path" ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/OldRepository.py#L608-L627
[ "def", "walk_directories_relative_path", "(", "self", ",", "relativePath", "=", "\"\"", ")", ":", "def", "walk_directories", "(", "directory", ",", "relativePath", ")", ":", "directories", "=", "dict", ".", "__getitem__", "(", "directory", ",", "'directories'", ...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.walk_directories_info
Walk repository and yield all found directories relative path. :parameters: #. relativePath (str): The relative path from which start the walk.
OldRepository.py
def walk_directories_info(self, relativePath=""): """ Walk repository and yield all found directories relative path. :parameters: #. relativePath (str): The relative path from which start the walk. """ def walk_directories(directory, relativePath): direct...
def walk_directories_info(self, relativePath=""): """ Walk repository and yield all found directories relative path. :parameters: #. relativePath (str): The relative path from which start the walk. """ def walk_directories(directory, relativePath): direct...
[ "Walk", "repository", "and", "yield", "all", "found", "directories", "relative", "path", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/OldRepository.py#L629-L648
[ "def", "walk_directories_info", "(", "self", ",", "relativePath", "=", "\"\"", ")", ":", "def", "walk_directories", "(", "directory", ",", "relativePath", ")", ":", "directories", "=", "dict", ".", "__getitem__", "(", "directory", ",", "'directories'", ")", "f...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.walk_directory_directories_relative_path
Walk a certain directory in repository and yield all found directories relative path. :parameters: #. relativePath (str): The relative path of the directory.
OldRepository.py
def walk_directory_directories_relative_path(self, relativePath=""): """ Walk a certain directory in repository and yield all found directories relative path. :parameters: #. relativePath (str): The relative path of the directory. """ # get directory info dict ...
def walk_directory_directories_relative_path(self, relativePath=""): """ Walk a certain directory in repository and yield all found directories relative path. :parameters: #. relativePath (str): The relative path of the directory. """ # get directory info dict ...
[ "Walk", "a", "certain", "directory", "in", "repository", "and", "yield", "all", "found", "directories", "relative", "path", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/OldRepository.py#L680-L693
[ "def", "walk_directory_directories_relative_path", "(", "self", ",", "relativePath", "=", "\"\"", ")", ":", "# get directory info dict", "errorMessage", "=", "\"\"", "relativePath", "=", "os", ".", "path", ".", "normpath", "(", "relativePath", ")", "dirInfoDict", ",...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.walk_directory_directories_info
Walk a certain directory in repository and yield tuples as the following:\n (relative path joined with directory name, file info dict). :parameters: #. relativePath (str): The relative path of the directory.
OldRepository.py
def walk_directory_directories_info(self, relativePath=""): """ Walk a certain directory in repository and yield tuples as the following:\n (relative path joined with directory name, file info dict). :parameters: #. relativePath (str): The relative path of the directory. ...
def walk_directory_directories_info(self, relativePath=""): """ Walk a certain directory in repository and yield tuples as the following:\n (relative path joined with directory name, file info dict). :parameters: #. relativePath (str): The relative path of the directory. ...
[ "Walk", "a", "certain", "directory", "in", "repository", "and", "yield", "tuples", "as", "the", "following", ":", "\\", "n", "(", "relative", "path", "joined", "with", "directory", "name", "file", "info", "dict", ")", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/OldRepository.py#L695-L708
[ "def", "walk_directory_directories_info", "(", "self", ",", "relativePath", "=", "\"\"", ")", ":", "# get directory info dict", "relativePath", "=", "os", ".", "path", ".", "normpath", "(", "relativePath", ")", "dirInfoDict", ",", "errorMessage", "=", "self", ".",...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.synchronize
Synchronizes the Repository information with the directory. All registered but missing files and directories in the directory, will be automatically removed from the Repository. :parameters: #. verbose (boolean): Whether to be warn and inform about any abnormalities.
OldRepository.py
def synchronize(self, verbose=False): """ Synchronizes the Repository information with the directory. All registered but missing files and directories in the directory, will be automatically removed from the Repository. :parameters: #. verbose (boolean): Whether to b...
def synchronize(self, verbose=False): """ Synchronizes the Repository information with the directory. All registered but missing files and directories in the directory, will be automatically removed from the Repository. :parameters: #. verbose (boolean): Whether to b...
[ "Synchronizes", "the", "Repository", "information", "with", "the", "directory", ".", "All", "registered", "but", "missing", "files", "and", "directories", "in", "the", "directory", "will", "be", "automatically", "removed", "from", "the", "Repository", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/OldRepository.py#L711-L761
[ "def", "synchronize", "(", "self", ",", "verbose", "=", "False", ")", ":", "if", "self", ".", "__path", "is", "None", ":", "return", "# walk directories", "for", "dirPath", "in", "sorted", "(", "list", "(", "self", ".", "walk_directories_relative_path", "(",...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.load_repository
Load repository from a directory path and update the current instance. :Parameters: #. path (string): The path of the directory from where to load the repository. If '.' or an empty string is passed, the current working directory will be used. :Returns: #. repos...
OldRepository.py
def load_repository(self, path): """ Load repository from a directory path and update the current instance. :Parameters: #. path (string): The path of the directory from where to load the repository. If '.' or an empty string is passed, the current working directory w...
def load_repository(self, path): """ Load repository from a directory path and update the current instance. :Parameters: #. path (string): The path of the directory from where to load the repository. If '.' or an empty string is passed, the current working directory w...
[ "Load", "repository", "from", "a", "directory", "path", "and", "update", "the", "current", "instance", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/OldRepository.py#L763-L822
[ "def", "load_repository", "(", "self", ",", "path", ")", ":", "# try to open", "if", "path", ".", "strip", "(", ")", "in", "(", "''", ",", "'.'", ")", ":", "path", "=", "os", ".", "getcwd", "(", ")", "repoPath", "=", "os", ".", "path", ".", "real...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.create_repository
create a repository in a directory. This method insures the creation of the directory in the system if it is missing.\n **N.B. This method erases existing pyrep repository in the path but not the repository files.** :Parameters: #. path (string): The real absolute path where to cre...
OldRepository.py
def create_repository(self, path, info=None, verbose=True): """ create a repository in a directory. This method insures the creation of the directory in the system if it is missing.\n **N.B. This method erases existing pyrep repository in the path but not the repository files.** ...
def create_repository(self, path, info=None, verbose=True): """ create a repository in a directory. This method insures the creation of the directory in the system if it is missing.\n **N.B. This method erases existing pyrep repository in the path but not the repository files.** ...
[ "create", "a", "repository", "in", "a", "directory", ".", "This", "method", "insures", "the", "creation", "of", "the", "directory", "in", "the", "system", "if", "it", "is", "missing", ".", "\\", "n" ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/OldRepository.py#L828-L867
[ "def", "create_repository", "(", "self", ",", "path", ",", "info", "=", "None", ",", "verbose", "=", "True", ")", ":", "try", ":", "info", "=", "copy", ".", "deepcopy", "(", "info", ")", "except", ":", "raise", "Exception", "(", "\"Repository info must b...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.get_repository
Create a repository at given real path or load any existing one. This method insures the creation of the directory in the system if it is missing.\n Unlike create_repository, this method doesn't erase any existing repository in the path but loads it instead. **N.B. On some systems and s...
OldRepository.py
def get_repository(self, path, info=None, verbose=True): """ Create a repository at given real path or load any existing one. This method insures the creation of the directory in the system if it is missing.\n Unlike create_repository, this method doesn't erase any existing repository ...
def get_repository(self, path, info=None, verbose=True): """ Create a repository at given real path or load any existing one. This method insures the creation of the directory in the system if it is missing.\n Unlike create_repository, this method doesn't erase any existing repository ...
[ "Create", "a", "repository", "at", "given", "real", "path", "or", "load", "any", "existing", "one", ".", "This", "method", "insures", "the", "creation", "of", "the", "directory", "in", "the", "system", "if", "it", "is", "missing", ".", "\\", "n", "Unlike...
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/OldRepository.py#L869-L895
[ "def", "get_repository", "(", "self", ",", "path", ",", "info", "=", "None", ",", "verbose", "=", "True", ")", ":", "# get real path", "if", "path", ".", "strip", "(", ")", "in", "(", "''", ",", "'.'", ")", ":", "path", "=", "os", ".", "getcwd", ...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.remove_repository
Remove .pyrepinfo file from path if exists and related files and directories when respective flags are set to True. :Parameters: #. path (None, string): The path of the directory where to remove an existing repository. If None, current repository is removed if initialized. ...
OldRepository.py
def remove_repository(self, path=None, relatedFiles=False, relatedFolders=False, verbose=True): """ Remove .pyrepinfo file from path if exists and related files and directories when respective flags are set to True. :Parameters: #. path (None, string): The path of the direct...
def remove_repository(self, path=None, relatedFiles=False, relatedFolders=False, verbose=True): """ Remove .pyrepinfo file from path if exists and related files and directories when respective flags are set to True. :Parameters: #. path (None, string): The path of the direct...
[ "Remove", ".", "pyrepinfo", "file", "from", "path", "if", "exists", "and", "related", "files", "and", "directories", "when", "respective", "flags", "are", "set", "to", "True", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/OldRepository.py#L897-L961
[ "def", "remove_repository", "(", "self", ",", "path", "=", "None", ",", "relatedFiles", "=", "False", ",", "relatedFolders", "=", "False", ",", "verbose", "=", "True", ")", ":", "if", "path", "is", "not", "None", ":", "realPath", "=", "os", ".", "path"...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.save
Save repository .pyrepinfo to disk.
OldRepository.py
def save(self): """ Save repository .pyrepinfo to disk. """ # open file repoInfoPath = os.path.join(self.__path, ".pyrepinfo") try: fdinfo = open(repoInfoPath, 'wb') except Exception as e: raise Exception("unable to open repository info for saving (%s)"%e)...
def save(self): """ Save repository .pyrepinfo to disk. """ # open file repoInfoPath = os.path.join(self.__path, ".pyrepinfo") try: fdinfo = open(repoInfoPath, 'wb') except Exception as e: raise Exception("unable to open repository info for saving (%s)"%e)...
[ "Save", "repository", ".", "pyrepinfo", "to", "disk", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/OldRepository.py#L967-L996
[ "def", "save", "(", "self", ")", ":", "# open file", "repoInfoPath", "=", "os", ".", "path", ".", "join", "(", "self", ".", "__path", ",", "\".pyrepinfo\"", ")", "try", ":", "fdinfo", "=", "open", "(", "repoInfoPath", ",", "'wb'", ")", "except", "Excep...
0449bf2fad3e3e8dda855d4686a8869efeefd433