repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
johnnoone/aioconsul
aioconsul/client/kv_endpoint.py
KVOperations.set
def set(self, key, value, *, flags=None): """Sets the Key to the given Value Parameters: key (str): Key to set value (Payload): Value to set, It will be encoded by flags flags (int): Flags to set with value """ self.append({ "Verb": "set",...
python
def set(self, key, value, *, flags=None): """Sets the Key to the given Value Parameters: key (str): Key to set value (Payload): Value to set, It will be encoded by flags flags (int): Flags to set with value """ self.append({ "Verb": "set",...
[ "def", "set", "(", "self", ",", "key", ",", "value", ",", "*", ",", "flags", "=", "None", ")", ":", "self", ".", "append", "(", "{", "\"Verb\"", ":", "\"set\"", ",", "\"Key\"", ":", "key", ",", "\"Value\"", ":", "encode_value", "(", "value", ",", ...
Sets the Key to the given Value Parameters: key (str): Key to set value (Payload): Value to set, It will be encoded by flags flags (int): Flags to set with value
[ "Sets", "the", "Key", "to", "the", "given", "Value" ]
02f7a529d7dc2e49bed942111067aa5faf320e90
https://github.com/johnnoone/aioconsul/blob/02f7a529d7dc2e49bed942111067aa5faf320e90/aioconsul/client/kv_endpoint.py#L356-L370
train
johnnoone/aioconsul
aioconsul/client/kv_endpoint.py
KVOperations.cas
def cas(self, key, value, *, flags=None, index): """Sets the Key to the given Value with check-and-set semantics Parameters: key (str): Key to set value (Payload): Value to set, It will be encoded by flags index (ObjectIndex): Index ID flags (int): Flags ...
python
def cas(self, key, value, *, flags=None, index): """Sets the Key to the given Value with check-and-set semantics Parameters: key (str): Key to set value (Payload): Value to set, It will be encoded by flags index (ObjectIndex): Index ID flags (int): Flags ...
[ "def", "cas", "(", "self", ",", "key", ",", "value", ",", "*", ",", "flags", "=", "None", ",", "index", ")", ":", "self", ".", "append", "(", "{", "\"Verb\"", ":", "\"cas\"", ",", "\"Key\"", ":", "key", ",", "\"Value\"", ":", "encode_value", "(", ...
Sets the Key to the given Value with check-and-set semantics Parameters: key (str): Key to set value (Payload): Value to set, It will be encoded by flags index (ObjectIndex): Index ID flags (int): Flags to set with value The Key will only be set if its c...
[ "Sets", "the", "Key", "to", "the", "given", "Value", "with", "check", "-", "and", "-", "set", "semantics" ]
02f7a529d7dc2e49bed942111067aa5faf320e90
https://github.com/johnnoone/aioconsul/blob/02f7a529d7dc2e49bed942111067aa5faf320e90/aioconsul/client/kv_endpoint.py#L372-L391
train
johnnoone/aioconsul
aioconsul/client/kv_endpoint.py
KVOperations.lock
def lock(self, key, value, *, flags=None, session): """Locks the Key with the given Session Parameters: key (str): Key to set value (Payload): Value to set, It will be encoded by flags session (ObjectID): Session ID The Key will only be set if its current mo...
python
def lock(self, key, value, *, flags=None, session): """Locks the Key with the given Session Parameters: key (str): Key to set value (Payload): Value to set, It will be encoded by flags session (ObjectID): Session ID The Key will only be set if its current mo...
[ "def", "lock", "(", "self", ",", "key", ",", "value", ",", "*", ",", "flags", "=", "None", ",", "session", ")", ":", "self", ".", "append", "(", "{", "\"Verb\"", ":", "\"lock\"", ",", "\"Key\"", ":", "key", ",", "\"Value\"", ":", "encode_value", "(...
Locks the Key with the given Session Parameters: key (str): Key to set value (Payload): Value to set, It will be encoded by flags session (ObjectID): Session ID The Key will only be set if its current modify index matches the supplied Index
[ "Locks", "the", "Key", "with", "the", "given", "Session" ]
02f7a529d7dc2e49bed942111067aa5faf320e90
https://github.com/johnnoone/aioconsul/blob/02f7a529d7dc2e49bed942111067aa5faf320e90/aioconsul/client/kv_endpoint.py#L393-L411
train
johnnoone/aioconsul
aioconsul/client/kv_endpoint.py
KVOperations.check_index
def check_index(self, key, *, index): """Fails the transaction if Key does not have a modify index equal to Index Parameters: key (str): Key to check index (ObjectIndex): Index ID """ self.append({ "Verb": "check-index", "Key": key...
python
def check_index(self, key, *, index): """Fails the transaction if Key does not have a modify index equal to Index Parameters: key (str): Key to check index (ObjectIndex): Index ID """ self.append({ "Verb": "check-index", "Key": key...
[ "def", "check_index", "(", "self", ",", "key", ",", "*", ",", "index", ")", ":", "self", ".", "append", "(", "{", "\"Verb\"", ":", "\"check-index\"", ",", "\"Key\"", ":", "key", ",", "\"Index\"", ":", "extract_attr", "(", "index", ",", "keys", "=", "...
Fails the transaction if Key does not have a modify index equal to Index Parameters: key (str): Key to check index (ObjectIndex): Index ID
[ "Fails", "the", "transaction", "if", "Key", "does", "not", "have", "a", "modify", "index", "equal", "to", "Index" ]
02f7a529d7dc2e49bed942111067aa5faf320e90
https://github.com/johnnoone/aioconsul/blob/02f7a529d7dc2e49bed942111067aa5faf320e90/aioconsul/client/kv_endpoint.py#L471-L484
train
johnnoone/aioconsul
aioconsul/client/kv_endpoint.py
KVOperations.check_session
def check_session(self, key, *, session=None): """Fails the transaction if Key is not currently locked by Session Parameters: key (str): Key to check session (ObjectID): Session ID """ self.append({ "Verb": "check-session", "Key": key, ...
python
def check_session(self, key, *, session=None): """Fails the transaction if Key is not currently locked by Session Parameters: key (str): Key to check session (ObjectID): Session ID """ self.append({ "Verb": "check-session", "Key": key, ...
[ "def", "check_session", "(", "self", ",", "key", ",", "*", ",", "session", "=", "None", ")", ":", "self", ".", "append", "(", "{", "\"Verb\"", ":", "\"check-session\"", ",", "\"Key\"", ":", "key", ",", "\"Session\"", ":", "extract_attr", "(", "session", ...
Fails the transaction if Key is not currently locked by Session Parameters: key (str): Key to check session (ObjectID): Session ID
[ "Fails", "the", "transaction", "if", "Key", "is", "not", "currently", "locked", "by", "Session" ]
02f7a529d7dc2e49bed942111067aa5faf320e90
https://github.com/johnnoone/aioconsul/blob/02f7a529d7dc2e49bed942111067aa5faf320e90/aioconsul/client/kv_endpoint.py#L486-L498
train
johnnoone/aioconsul
aioconsul/client/kv_endpoint.py
KVOperations.execute
async def execute(self, dc=None, token=None): """Execute stored operations Parameters: dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. token (ObjectID): Token ID Returns: Collection: Results of o...
python
async def execute(self, dc=None, token=None): """Execute stored operations Parameters: dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. token (ObjectID): Token ID Returns: Collection: Results of o...
[ "async", "def", "execute", "(", "self", ",", "dc", "=", "None", ",", "token", "=", "None", ")", ":", "token_id", "=", "extract_attr", "(", "token", ",", "keys", "=", "[", "\"ID\"", "]", ")", "try", ":", "response", "=", "await", "self", ".", "_api"...
Execute stored operations Parameters: dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. token (ObjectID): Token ID Returns: Collection: Results of operations. Raises: TransactionError: ...
[ "Execute", "stored", "operations" ]
02f7a529d7dc2e49bed942111067aa5faf320e90
https://github.com/johnnoone/aioconsul/blob/02f7a529d7dc2e49bed942111067aa5faf320e90/aioconsul/client/kv_endpoint.py#L542-L579
train
tueda/python-form
form/formlink.py
FormLink.write
def write(self, script): # type: (str) -> None """Send a script to FORM. Write the given script to the communication channel to FORM. It could be buffered and so FORM may not execute the sent script until :meth:`flush` or :meth:`read` is called. """ if self._clos...
python
def write(self, script): # type: (str) -> None """Send a script to FORM. Write the given script to the communication channel to FORM. It could be buffered and so FORM may not execute the sent script until :meth:`flush` or :meth:`read` is called. """ if self._clos...
[ "def", "write", "(", "self", ",", "script", ")", ":", "if", "self", ".", "_closed", ":", "raise", "IOError", "(", "'tried to write to closed connection'", ")", "script", "=", "script", ".", "strip", "(", ")", "if", "script", ":", "assert", "self", ".", "...
Send a script to FORM. Write the given script to the communication channel to FORM. It could be buffered and so FORM may not execute the sent script until :meth:`flush` or :meth:`read` is called.
[ "Send", "a", "script", "to", "FORM", "." ]
1e5a8464f7a7a6cbbb32411fc2ea3615fd48334b
https://github.com/tueda/python-form/blob/1e5a8464f7a7a6cbbb32411fc2ea3615fd48334b/form/formlink.py#L310-L324
train
tueda/python-form
form/formlink.py
FormLink.flush
def flush(self): # type: () -> None """Flush the channel to FORM. Flush the communication channel to FORM. Because :meth:`write` is buffered and :meth:`read` is a blocking operation, this method is used for asynchronous execution of FORM scripts. """ if self._clo...
python
def flush(self): # type: () -> None """Flush the channel to FORM. Flush the communication channel to FORM. Because :meth:`write` is buffered and :meth:`read` is a blocking operation, this method is used for asynchronous execution of FORM scripts. """ if self._clo...
[ "def", "flush", "(", "self", ")", ":", "if", "self", ".", "_closed", ":", "raise", "IOError", "(", "'tried to flush closed connection'", ")", "assert", "self", ".", "_parentout", "is", "not", "None", "self", ".", "_parentout", ".", "flush", "(", ")" ]
Flush the channel to FORM. Flush the communication channel to FORM. Because :meth:`write` is buffered and :meth:`read` is a blocking operation, this method is used for asynchronous execution of FORM scripts.
[ "Flush", "the", "channel", "to", "FORM", "." ]
1e5a8464f7a7a6cbbb32411fc2ea3615fd48334b
https://github.com/tueda/python-form/blob/1e5a8464f7a7a6cbbb32411fc2ea3615fd48334b/form/formlink.py#L326-L337
train
whiteclover/dbpy
db/query/delete.py
DeleteQuery.compile
def compile(self): """Compiles the delete sql statement""" sql = '' sql += 'DELETE FROM ' + self.dialect.quote_table(self._table) if self._where: sql += ' WHERE ' + self.compile_condition(self._where) if self._order_by: sql += ' ' + self.compile_order_by(s...
python
def compile(self): """Compiles the delete sql statement""" sql = '' sql += 'DELETE FROM ' + self.dialect.quote_table(self._table) if self._where: sql += ' WHERE ' + self.compile_condition(self._where) if self._order_by: sql += ' ' + self.compile_order_by(s...
[ "def", "compile", "(", "self", ")", ":", "sql", "=", "''", "sql", "+=", "'DELETE FROM '", "+", "self", ".", "dialect", ".", "quote_table", "(", "self", ".", "_table", ")", "if", "self", ".", "_where", ":", "sql", "+=", "' WHERE '", "+", "self", ".", ...
Compiles the delete sql statement
[ "Compiles", "the", "delete", "sql", "statement" ]
3d9ce85f55cfb39cced22081e525f79581b26b3a
https://github.com/whiteclover/dbpy/blob/3d9ce85f55cfb39cced22081e525f79581b26b3a/db/query/delete.py#L40-L51
train
whiteclover/dbpy
db/query/delete.py
DeleteQuery.clear
def clear(self): """Clear and reset to orignal state""" WhereQuery.clear(self) self._table = None self._parameters = [] self._sql = None
python
def clear(self): """Clear and reset to orignal state""" WhereQuery.clear(self) self._table = None self._parameters = [] self._sql = None
[ "def", "clear", "(", "self", ")", ":", "WhereQuery", ".", "clear", "(", "self", ")", "self", ".", "_table", "=", "None", "self", ".", "_parameters", "=", "[", "]", "self", ".", "_sql", "=", "None" ]
Clear and reset to orignal state
[ "Clear", "and", "reset", "to", "orignal", "state" ]
3d9ce85f55cfb39cced22081e525f79581b26b3a
https://github.com/whiteclover/dbpy/blob/3d9ce85f55cfb39cced22081e525f79581b26b3a/db/query/delete.py#L53-L58
train
bitesofcode/projexui
projexui/widgets/xtreewidget/xloaderitem.py
XLoaderItem.startLoading
def startLoading(self): """ Updates this item to mark the item as loading. This will create a QLabel with the loading ajax spinner to indicate that progress is occurring. """ if self._loading: return False tree = self.treeWidget() ...
python
def startLoading(self): """ Updates this item to mark the item as loading. This will create a QLabel with the loading ajax spinner to indicate that progress is occurring. """ if self._loading: return False tree = self.treeWidget() ...
[ "def", "startLoading", "(", "self", ")", ":", "if", "self", ".", "_loading", ":", "return", "False", "tree", "=", "self", ".", "treeWidget", "(", ")", "if", "not", "tree", ":", "return", "self", ".", "_loading", "=", "True", "self", ".", "setText", "...
Updates this item to mark the item as loading. This will create a QLabel with the loading ajax spinner to indicate that progress is occurring.
[ "Updates", "this", "item", "to", "mark", "the", "item", "as", "loading", ".", "This", "will", "create", "a", "QLabel", "with", "the", "loading", "ajax", "spinner", "to", "indicate", "that", "progress", "is", "occurring", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xtreewidget/xloaderitem.py#L73-L100
train
bitesofcode/projexui
projexui/xhistorystack.py
XHistoryStack.emitCurrentChanged
def emitCurrentChanged(self): """ Emits the current index changed signal provided signals are not blocked. """ if not self.signalsBlocked(): self.currentIndexChanged.emit(self.currentIndex()) self.currentUrlChanged.emit(self.currentUrl()) ...
python
def emitCurrentChanged(self): """ Emits the current index changed signal provided signals are not blocked. """ if not self.signalsBlocked(): self.currentIndexChanged.emit(self.currentIndex()) self.currentUrlChanged.emit(self.currentUrl()) ...
[ "def", "emitCurrentChanged", "(", "self", ")", ":", "if", "not", "self", ".", "signalsBlocked", "(", ")", ":", "self", ".", "currentIndexChanged", ".", "emit", "(", "self", ".", "currentIndex", "(", ")", ")", "self", ".", "currentUrlChanged", ".", "emit", ...
Emits the current index changed signal provided signals are not blocked.
[ "Emits", "the", "current", "index", "changed", "signal", "provided", "signals", "are", "not", "blocked", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/xhistorystack.py#L94-L103
train
bitesofcode/projexui
projexui/xhistorystack.py
XHistoryStack.goHome
def goHome(self): """ Goes to the home url. If there is no home url specifically set, then \ this will go to the first url in the history. Otherwise, it will \ look to see if the home url is in the stack and go to that level, if \ the home url is not found, then it will be push...
python
def goHome(self): """ Goes to the home url. If there is no home url specifically set, then \ this will go to the first url in the history. Otherwise, it will \ look to see if the home url is in the stack and go to that level, if \ the home url is not found, then it will be push...
[ "def", "goHome", "(", "self", ")", ":", "if", "not", "self", ".", "canGoBack", "(", ")", ":", "return", "''", "if", "self", ".", "homeUrl", "(", ")", ":", "self", ".", "push", "(", "self", ".", "homeUrl", "(", ")", ")", "self", ".", "_blockStack"...
Goes to the home url. If there is no home url specifically set, then \ this will go to the first url in the history. Otherwise, it will \ look to see if the home url is in the stack and go to that level, if \ the home url is not found, then it will be pushed to the top of the \ stack u...
[ "Goes", "to", "the", "home", "url", ".", "If", "there", "is", "no", "home", "url", "specifically", "set", "then", "\\", "this", "will", "go", "to", "the", "first", "url", "in", "the", "history", ".", "Otherwise", "it", "will", "\\", "look", "to", "se...
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/xhistorystack.py#L141-L159
train
talkincode/txradius
txradius/openvpn/user_pass_verify.py
cli
def cli(conf): """ OpenVPN user_pass_verify method """ config = init_config(conf) nas_id = config.get('DEFAULT', 'nas_id') nas_addr = config.get('DEFAULT', 'nas_addr') secret = config.get('DEFAULT', 'radius_secret') radius_addr = config.get('DEFAULT', 'radius_addr') radius_auth_port = co...
python
def cli(conf): """ OpenVPN user_pass_verify method """ config = init_config(conf) nas_id = config.get('DEFAULT', 'nas_id') nas_addr = config.get('DEFAULT', 'nas_addr') secret = config.get('DEFAULT', 'radius_secret') radius_addr = config.get('DEFAULT', 'radius_addr') radius_auth_port = co...
[ "def", "cli", "(", "conf", ")", ":", "config", "=", "init_config", "(", "conf", ")", "nas_id", "=", "config", ".", "get", "(", "'DEFAULT'", ",", "'nas_id'", ")", "nas_addr", "=", "config", ".", "get", "(", "'DEFAULT'", ",", "'nas_addr'", ")", "secret",...
OpenVPN user_pass_verify method
[ "OpenVPN", "user_pass_verify", "method" ]
b86fdbc9be41183680b82b07d3a8e8ea10926e01
https://github.com/talkincode/txradius/blob/b86fdbc9be41183680b82b07d3a8e8ea10926e01/txradius/openvpn/user_pass_verify.py#L24-L78
train
johnnoone/aioconsul
aioconsul/client/session_endpoint.py
SessionEndpoint.create
async def create(self, session, *, dc=None): """Creates a new session Parameters: session (Object): Session definition dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. Returns: Object: ID of the ...
python
async def create(self, session, *, dc=None): """Creates a new session Parameters: session (Object): Session definition dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. Returns: Object: ID of the ...
[ "async", "def", "create", "(", "self", ",", "session", ",", "*", ",", "dc", "=", "None", ")", ":", "response", "=", "await", "self", ".", "_api", ".", "put", "(", "\"/v1/session/create\"", ",", "data", "=", "session", ",", "params", "=", "{", "\"dc\"...
Creates a new session Parameters: session (Object): Session definition dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. Returns: Object: ID of the created session The create endpoint is used to ...
[ "Creates", "a", "new", "session" ]
02f7a529d7dc2e49bed942111067aa5faf320e90
https://github.com/johnnoone/aioconsul/blob/02f7a529d7dc2e49bed942111067aa5faf320e90/aioconsul/client/session_endpoint.py#L18-L76
train
johnnoone/aioconsul
aioconsul/client/session_endpoint.py
SessionEndpoint.destroy
async def destroy(self, session, *, dc=None): """Destroys a given session Parameters: session (ObjectID): Session ID dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. Returns: bool: ``True`` on suc...
python
async def destroy(self, session, *, dc=None): """Destroys a given session Parameters: session (ObjectID): Session ID dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. Returns: bool: ``True`` on suc...
[ "async", "def", "destroy", "(", "self", ",", "session", ",", "*", ",", "dc", "=", "None", ")", ":", "session_id", "=", "extract_attr", "(", "session", ",", "keys", "=", "[", "\"ID\"", "]", ")", "response", "=", "await", "self", ".", "_api", ".", "p...
Destroys a given session Parameters: session (ObjectID): Session ID dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. Returns: bool: ``True`` on success
[ "Destroys", "a", "given", "session" ]
02f7a529d7dc2e49bed942111067aa5faf320e90
https://github.com/johnnoone/aioconsul/blob/02f7a529d7dc2e49bed942111067aa5faf320e90/aioconsul/client/session_endpoint.py#L78-L91
train
johnnoone/aioconsul
aioconsul/client/session_endpoint.py
SessionEndpoint.info
async def info(self, session, *, dc=None, watch=None, consistency=None): """Queries a given session Parameters: session (ObjectID): Session ID dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. watch (Block...
python
async def info(self, session, *, dc=None, watch=None, consistency=None): """Queries a given session Parameters: session (ObjectID): Session ID dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. watch (Block...
[ "async", "def", "info", "(", "self", ",", "session", ",", "*", ",", "dc", "=", "None", ",", "watch", "=", "None", ",", "consistency", "=", "None", ")", ":", "session_id", "=", "extract_attr", "(", "session", ",", "keys", "=", "[", "\"ID\"", "]", ")...
Queries a given session Parameters: session (ObjectID): Session ID dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. watch (Blocking): Do a blocking query consistency (Consistency): Force consistency ...
[ "Queries", "a", "given", "session" ]
02f7a529d7dc2e49bed942111067aa5faf320e90
https://github.com/johnnoone/aioconsul/blob/02f7a529d7dc2e49bed942111067aa5faf320e90/aioconsul/client/session_endpoint.py#L95-L133
train
johnnoone/aioconsul
aioconsul/client/session_endpoint.py
SessionEndpoint.renew
async def renew(self, session, *, dc=None): """Renews a TTL-based session Parameters: session (ObjectID): Session ID dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. Returns: ObjectMeta: where val...
python
async def renew(self, session, *, dc=None): """Renews a TTL-based session Parameters: session (ObjectID): Session ID dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. Returns: ObjectMeta: where val...
[ "async", "def", "renew", "(", "self", ",", "session", ",", "*", ",", "dc", "=", "None", ")", ":", "session_id", "=", "extract_attr", "(", "session", ",", "keys", "=", "[", "\"ID\"", "]", ")", "response", "=", "await", "self", ".", "_api", ".", "put...
Renews a TTL-based session Parameters: session (ObjectID): Session ID dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. Returns: ObjectMeta: where value is session Raises: NotFound: ses...
[ "Renews", "a", "TTL", "-", "based", "session" ]
02f7a529d7dc2e49bed942111067aa5faf320e90
https://github.com/johnnoone/aioconsul/blob/02f7a529d7dc2e49bed942111067aa5faf320e90/aioconsul/client/session_endpoint.py#L198-L237
train
adonisnafeh/urlvalidator
urlvalidator/utils.py
_lazy_re_compile
def _lazy_re_compile(regex, flags=0): """Lazily compile a regex with flags.""" def _compile(): # Compile the regex if it was not passed pre-compiled. if isinstance(regex, str): return re.compile(regex, flags) else: assert not flags, "flags must be empty if regex i...
python
def _lazy_re_compile(regex, flags=0): """Lazily compile a regex with flags.""" def _compile(): # Compile the regex if it was not passed pre-compiled. if isinstance(regex, str): return re.compile(regex, flags) else: assert not flags, "flags must be empty if regex i...
[ "def", "_lazy_re_compile", "(", "regex", ",", "flags", "=", "0", ")", ":", "def", "_compile", "(", ")", ":", "if", "isinstance", "(", "regex", ",", "str", ")", ":", "return", "re", ".", "compile", "(", "regex", ",", "flags", ")", "else", ":", "asse...
Lazily compile a regex with flags.
[ "Lazily", "compile", "a", "regex", "with", "flags", "." ]
008438365faa00b2c580e3991068ec6b161c3578
https://github.com/adonisnafeh/urlvalidator/blob/008438365faa00b2c580e3991068ec6b161c3578/urlvalidator/utils.py#L95-L104
train
adonisnafeh/urlvalidator
urlvalidator/utils.py
deconstructible
def deconstructible(*args, path=None): """ Class decorator that allows the decorated class to be serialized by the migrations subsystem. The `path` kwarg specifies the import path. """ def decorator(klass): def __new__(cls, *args, **kwargs): # We capture the arguments to mak...
python
def deconstructible(*args, path=None): """ Class decorator that allows the decorated class to be serialized by the migrations subsystem. The `path` kwarg specifies the import path. """ def decorator(klass): def __new__(cls, *args, **kwargs): # We capture the arguments to mak...
[ "def", "deconstructible", "(", "*", "args", ",", "path", "=", "None", ")", ":", "def", "decorator", "(", "klass", ")", ":", "def", "__new__", "(", "cls", ",", "*", "args", ",", "**", "kwargs", ")", ":", "obj", "=", "super", "(", "klass", ",", "cl...
Class decorator that allows the decorated class to be serialized by the migrations subsystem. The `path` kwarg specifies the import path.
[ "Class", "decorator", "that", "allows", "the", "decorated", "class", "to", "be", "serialized", "by", "the", "migrations", "subsystem", "." ]
008438365faa00b2c580e3991068ec6b161c3578
https://github.com/adonisnafeh/urlvalidator/blob/008438365faa00b2c580e3991068ec6b161c3578/urlvalidator/utils.py#L107-L127
train
bitesofcode/projexui
projexui/menus/xmenu.py
XSearchActionWidget.clear
def clear(self): """ Clears the text from the search edit. """ self._searchEdit.blockSignals(True) self._searchEdit.setText('') self._searchEdit.blockSignals(False)
python
def clear(self): """ Clears the text from the search edit. """ self._searchEdit.blockSignals(True) self._searchEdit.setText('') self._searchEdit.blockSignals(False)
[ "def", "clear", "(", "self", ")", ":", "self", ".", "_searchEdit", ".", "blockSignals", "(", "True", ")", "self", ".", "_searchEdit", ".", "setText", "(", "''", ")", "self", ".", "_searchEdit", ".", "blockSignals", "(", "False", ")" ]
Clears the text from the search edit.
[ "Clears", "the", "text", "from", "the", "search", "edit", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/menus/xmenu.py#L150-L156
train
bitesofcode/projexui
projexui/menus/xmenu.py
XMenu.clearAdvancedActions
def clearAdvancedActions( self ): """ Clears out the advanced action map. """ self._advancedMap.clear() margins = list(self.getContentsMargins()) margins[2] = 0 self.setContentsMargins(*margins)
python
def clearAdvancedActions( self ): """ Clears out the advanced action map. """ self._advancedMap.clear() margins = list(self.getContentsMargins()) margins[2] = 0 self.setContentsMargins(*margins)
[ "def", "clearAdvancedActions", "(", "self", ")", ":", "self", ".", "_advancedMap", ".", "clear", "(", ")", "margins", "=", "list", "(", "self", ".", "getContentsMargins", "(", ")", ")", "margins", "[", "2", "]", "=", "0", "self", ".", "setContentsMargins...
Clears out the advanced action map.
[ "Clears", "out", "the", "advanced", "action", "map", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/menus/xmenu.py#L389-L396
train
bitesofcode/projexui
projexui/menus/xmenu.py
XMenu.rebuildButtons
def rebuildButtons(self): """ Rebuilds the buttons for the advanced actions. """ for btn in self.findChildren(XAdvancedButton): btn.close() btn.setParent(None) btn.deleteLater() for standard, advanced in self._advancedMap.items(): ...
python
def rebuildButtons(self): """ Rebuilds the buttons for the advanced actions. """ for btn in self.findChildren(XAdvancedButton): btn.close() btn.setParent(None) btn.deleteLater() for standard, advanced in self._advancedMap.items(): ...
[ "def", "rebuildButtons", "(", "self", ")", ":", "for", "btn", "in", "self", ".", "findChildren", "(", "XAdvancedButton", ")", ":", "btn", ".", "close", "(", ")", "btn", ".", "setParent", "(", "None", ")", "btn", ".", "deleteLater", "(", ")", "for", "...
Rebuilds the buttons for the advanced actions.
[ "Rebuilds", "the", "buttons", "for", "the", "advanced", "actions", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/menus/xmenu.py#L440-L462
train
bitesofcode/projexui
projexui/widgets/xcalendarwidget/xcalendarscene.py
XCalendarScene.rebuild
def rebuild( self ): """ Rebuilds the information for this scene. """ self._buildData.clear() self._dateGrid.clear() self._dateTimeGrid.clear() curr_min = self._minimumDate curr_max = self._maximumDate self._maximumDate...
python
def rebuild( self ): """ Rebuilds the information for this scene. """ self._buildData.clear() self._dateGrid.clear() self._dateTimeGrid.clear() curr_min = self._minimumDate curr_max = self._maximumDate self._maximumDate...
[ "def", "rebuild", "(", "self", ")", ":", "self", ".", "_buildData", ".", "clear", "(", ")", "self", ".", "_dateGrid", ".", "clear", "(", ")", "self", ".", "_dateTimeGrid", ".", "clear", "(", ")", "curr_min", "=", "self", ".", "_minimumDate", "curr_max"...
Rebuilds the information for this scene.
[ "Rebuilds", "the", "information", "for", "this", "scene", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xcalendarwidget/xcalendarscene.py#L253-L290
train
intelsdi-x/snap-plugin-lib-py
snap_plugin/v1/timestamp.py
Timestamp.set
def set(self, time): """Sets time in seconds since Epoch Args: time (:obj:`float`): time in seconds since Epoch (see time.time()) Returns: None """ self._time = time self._pb.sec = int(self._time) self._pb.nsec = int((self._time - self._p...
python
def set(self, time): """Sets time in seconds since Epoch Args: time (:obj:`float`): time in seconds since Epoch (see time.time()) Returns: None """ self._time = time self._pb.sec = int(self._time) self._pb.nsec = int((self._time - self._p...
[ "def", "set", "(", "self", ",", "time", ")", ":", "self", ".", "_time", "=", "time", "self", ".", "_pb", ".", "sec", "=", "int", "(", "self", ".", "_time", ")", "self", ".", "_pb", ".", "nsec", "=", "int", "(", "(", "self", ".", "_time", "-",...
Sets time in seconds since Epoch Args: time (:obj:`float`): time in seconds since Epoch (see time.time()) Returns: None
[ "Sets", "time", "in", "seconds", "since", "Epoch" ]
8da5d00ac5f9d2b48a7239563ac7788209891ca4
https://github.com/intelsdi-x/snap-plugin-lib-py/blob/8da5d00ac5f9d2b48a7239563ac7788209891ca4/snap_plugin/v1/timestamp.py#L56-L67
train
whiteclover/dbpy
db/query/expr.py
Expr.compile
def compile(self, db): """Building the sql expression :param db: the database instance """ sql = self.expression if self.alias: sql += (' AS ' + db.quote_column(self.alias)) return sql
python
def compile(self, db): """Building the sql expression :param db: the database instance """ sql = self.expression if self.alias: sql += (' AS ' + db.quote_column(self.alias)) return sql
[ "def", "compile", "(", "self", ",", "db", ")", ":", "sql", "=", "self", ".", "expression", "if", "self", ".", "alias", ":", "sql", "+=", "(", "' AS '", "+", "db", ".", "quote_column", "(", "self", ".", "alias", ")", ")", "return", "sql" ]
Building the sql expression :param db: the database instance
[ "Building", "the", "sql", "expression" ]
3d9ce85f55cfb39cced22081e525f79581b26b3a
https://github.com/whiteclover/dbpy/blob/3d9ce85f55cfb39cced22081e525f79581b26b3a/db/query/expr.py#L26-L34
train
johnnoone/aioconsul
aioconsul/client/checks_endpoint.py
ChecksEndpoint.register
async def register(self, check, *, token=None): """Registers a new local check Parameters: check (Object): Check definition token (ObjectID): Token ID Returns: bool: ``True`` on success The register endpoint is used to add a new check to the local ag...
python
async def register(self, check, *, token=None): """Registers a new local check Parameters: check (Object): Check definition token (ObjectID): Token ID Returns: bool: ``True`` on success The register endpoint is used to add a new check to the local ag...
[ "async", "def", "register", "(", "self", ",", "check", ",", "*", ",", "token", "=", "None", ")", ":", "token_id", "=", "extract_attr", "(", "token", ",", "keys", "=", "[", "\"ID\"", "]", ")", "params", "=", "{", "\"token\"", ":", "token_id", "}", "...
Registers a new local check Parameters: check (Object): Check definition token (ObjectID): Token ID Returns: bool: ``True`` on success The register endpoint is used to add a new check to the local agent. Checks may be of script, HTTP, TCP, or TTL typ...
[ "Registers", "a", "new", "local", "check" ]
02f7a529d7dc2e49bed942111067aa5faf320e90
https://github.com/johnnoone/aioconsul/blob/02f7a529d7dc2e49bed942111067aa5faf320e90/aioconsul/client/checks_endpoint.py#L34-L123
train
johnnoone/aioconsul
aioconsul/client/checks_endpoint.py
ChecksEndpoint.deregister
async def deregister(self, check): """Deregisters a local check Parameters: check (ObjectID): Check ID Returns: bool: ``True`` on success The agent will take care of deregistering the check from the Catalog. """ check_id = extract_attr(check, key...
python
async def deregister(self, check): """Deregisters a local check Parameters: check (ObjectID): Check ID Returns: bool: ``True`` on success The agent will take care of deregistering the check from the Catalog. """ check_id = extract_attr(check, key...
[ "async", "def", "deregister", "(", "self", ",", "check", ")", ":", "check_id", "=", "extract_attr", "(", "check", ",", "keys", "=", "[", "\"CheckID\"", ",", "\"ID\"", "]", ")", "response", "=", "await", "self", ".", "_api", ".", "get", "(", "\"/v1/agen...
Deregisters a local check Parameters: check (ObjectID): Check ID Returns: bool: ``True`` on success The agent will take care of deregistering the check from the Catalog.
[ "Deregisters", "a", "local", "check" ]
02f7a529d7dc2e49bed942111067aa5faf320e90
https://github.com/johnnoone/aioconsul/blob/02f7a529d7dc2e49bed942111067aa5faf320e90/aioconsul/client/checks_endpoint.py#L125-L137
train
johnnoone/aioconsul
aioconsul/client/checks_endpoint.py
ChecksEndpoint.mark
async def mark(self, check, status, *, note=None): """Marks a local check as passing, warning or critical """ check_id = extract_attr(check, keys=["CheckID", "ID"]) data = { "Status": status, "Output": note } response = await self._api.put("/v1/age...
python
async def mark(self, check, status, *, note=None): """Marks a local check as passing, warning or critical """ check_id = extract_attr(check, keys=["CheckID", "ID"]) data = { "Status": status, "Output": note } response = await self._api.put("/v1/age...
[ "async", "def", "mark", "(", "self", ",", "check", ",", "status", ",", "*", ",", "note", "=", "None", ")", ":", "check_id", "=", "extract_attr", "(", "check", ",", "keys", "=", "[", "\"CheckID\"", ",", "\"ID\"", "]", ")", "data", "=", "{", "\"Statu...
Marks a local check as passing, warning or critical
[ "Marks", "a", "local", "check", "as", "passing", "warning", "or", "critical" ]
02f7a529d7dc2e49bed942111067aa5faf320e90
https://github.com/johnnoone/aioconsul/blob/02f7a529d7dc2e49bed942111067aa5faf320e90/aioconsul/client/checks_endpoint.py#L172-L182
train
whiteclover/dbpy
samples/orm.py
UserMapper.find_by_username
def find_by_username(self, username): """Return user by username if find in database otherwise None""" data = (db.select(self.table).select('username', 'email', 'real_name', 'password', 'bio', 'status', 'role', 'uid'). condition('username', us...
python
def find_by_username(self, username): """Return user by username if find in database otherwise None""" data = (db.select(self.table).select('username', 'email', 'real_name', 'password', 'bio', 'status', 'role', 'uid'). condition('username', us...
[ "def", "find_by_username", "(", "self", ",", "username", ")", ":", "data", "=", "(", "db", ".", "select", "(", "self", ".", "table", ")", ".", "select", "(", "'username'", ",", "'email'", ",", "'real_name'", ",", "'password'", ",", "'bio'", ",", "'stat...
Return user by username if find in database otherwise None
[ "Return", "user", "by", "username", "if", "find", "in", "database", "otherwise", "None" ]
3d9ce85f55cfb39cced22081e525f79581b26b3a
https://github.com/whiteclover/dbpy/blob/3d9ce85f55cfb39cced22081e525f79581b26b3a/samples/orm.py#L56-L63
train
whiteclover/dbpy
samples/orm.py
UserMapper.search
def search(self, **kw): """Find the users match the condition in kw""" q = db.select(self.table).condition('status', 'active') for k, v in kw: q.condition(k, v) data = q.execute() users = [] for user in data: users.append(self.load(user, self.model...
python
def search(self, **kw): """Find the users match the condition in kw""" q = db.select(self.table).condition('status', 'active') for k, v in kw: q.condition(k, v) data = q.execute() users = [] for user in data: users.append(self.load(user, self.model...
[ "def", "search", "(", "self", ",", "**", "kw", ")", ":", "q", "=", "db", ".", "select", "(", "self", ".", "table", ")", ".", "condition", "(", "'status'", ",", "'active'", ")", "for", "k", ",", "v", "in", "kw", ":", "q", ".", "condition", "(", ...
Find the users match the condition in kw
[ "Find", "the", "users", "match", "the", "condition", "in", "kw" ]
3d9ce85f55cfb39cced22081e525f79581b26b3a
https://github.com/whiteclover/dbpy/blob/3d9ce85f55cfb39cced22081e525f79581b26b3a/samples/orm.py#L70-L79
train
whiteclover/dbpy
samples/orm.py
PostMapper.paginate
def paginate(self, page=1, perpage=10, category=None): """Paginate the posts""" q = db.select(self.table).fields('title', 'slug', 'description', 'html', 'css', 'js', 'category', 'status', 'comments', 'author', 'created', 'pid') if category: q....
python
def paginate(self, page=1, perpage=10, category=None): """Paginate the posts""" q = db.select(self.table).fields('title', 'slug', 'description', 'html', 'css', 'js', 'category', 'status', 'comments', 'author', 'created', 'pid') if category: q....
[ "def", "paginate", "(", "self", ",", "page", "=", "1", ",", "perpage", "=", "10", ",", "category", "=", "None", ")", ":", "q", "=", "db", ".", "select", "(", "self", ".", "table", ")", ".", "fields", "(", "'title'", ",", "'slug'", ",", "'descript...
Paginate the posts
[ "Paginate", "the", "posts" ]
3d9ce85f55cfb39cced22081e525f79581b26b3a
https://github.com/whiteclover/dbpy/blob/3d9ce85f55cfb39cced22081e525f79581b26b3a/samples/orm.py#L124-L132
train
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodescene.py
XNodeScene.clear
def clear( self ): """ Clears the current scene of all the items and layers. """ self.setCurrentLayer(None) self._layers = [] self._cache.clear() super(XNodeScene, self).clear()
python
def clear( self ): """ Clears the current scene of all the items and layers. """ self.setCurrentLayer(None) self._layers = [] self._cache.clear() super(XNodeScene, self).clear()
[ "def", "clear", "(", "self", ")", ":", "self", ".", "setCurrentLayer", "(", "None", ")", "self", ".", "_layers", "=", "[", "]", "self", ".", "_cache", ".", "clear", "(", ")", "super", "(", "XNodeScene", ",", "self", ")", ".", "clear", "(", ")" ]
Clears the current scene of all the items and layers.
[ "Clears", "the", "current", "scene", "of", "all", "the", "items", "and", "layers", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodescene.py#L535-L544
train
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodescene.py
XNodeScene.rebuild
def rebuild( self ): """ Rebuilds the grid lines based on the current settings and \ scene width. This method is triggered automatically, and \ shouldn't need to be manually called. """ rect = self.sceneRect() x = rect.left() y = rect.top()...
python
def rebuild( self ): """ Rebuilds the grid lines based on the current settings and \ scene width. This method is triggered automatically, and \ shouldn't need to be manually called. """ rect = self.sceneRect() x = rect.left() y = rect.top()...
[ "def", "rebuild", "(", "self", ")", ":", "rect", "=", "self", ".", "sceneRect", "(", ")", "x", "=", "rect", ".", "left", "(", ")", "y", "=", "rect", ".", "top", "(", ")", "w", "=", "rect", ".", "width", "(", ")", "h", "=", "rect", ".", "hei...
Rebuilds the grid lines based on the current settings and \ scene width. This method is triggered automatically, and \ shouldn't need to be manually called.
[ "Rebuilds", "the", "grid", "lines", "based", "on", "the", "current", "settings", "and", "\\", "scene", "width", ".", "This", "method", "is", "triggered", "automatically", "and", "\\", "shouldn", "t", "need", "to", "be", "manually", "called", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodescene.py#L1127-L1193
train
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodescene.py
XNodeScene.selectAll
def selectAll( self ): """ Selects all the items in the scene. """ currLayer = self._currentLayer for item in self.items(): layer = item.layer() if ( layer == currLayer or not layer ): item.setSelected(True)
python
def selectAll( self ): """ Selects all the items in the scene. """ currLayer = self._currentLayer for item in self.items(): layer = item.layer() if ( layer == currLayer or not layer ): item.setSelected(True)
[ "def", "selectAll", "(", "self", ")", ":", "currLayer", "=", "self", ".", "_currentLayer", "for", "item", "in", "self", ".", "items", "(", ")", ":", "layer", "=", "item", ".", "layer", "(", ")", "if", "(", "layer", "==", "currLayer", "or", "not", "...
Selects all the items in the scene.
[ "Selects", "all", "the", "items", "in", "the", "scene", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodescene.py#L1280-L1288
train
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodescene.py
XNodeScene.selectInvert
def selectInvert( self ): """ Inverts the currently selected items in the scene. """ currLayer = self._currentLayer for item in self.items(): layer = item.layer() if ( layer == currLayer or not layer ): item.setSelected(not item.isSelected(...
python
def selectInvert( self ): """ Inverts the currently selected items in the scene. """ currLayer = self._currentLayer for item in self.items(): layer = item.layer() if ( layer == currLayer or not layer ): item.setSelected(not item.isSelected(...
[ "def", "selectInvert", "(", "self", ")", ":", "currLayer", "=", "self", ".", "_currentLayer", "for", "item", "in", "self", ".", "items", "(", ")", ":", "layer", "=", "item", ".", "layer", "(", ")", "if", "(", "layer", "==", "currLayer", "or", "not", ...
Inverts the currently selected items in the scene.
[ "Inverts", "the", "currently", "selected", "items", "in", "the", "scene", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodescene.py#L1290-L1298
train
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodescene.py
XNodeScene.selectNone
def selectNone( self ): """ Deselects all the items in the scene. """ currLayer = self._currentLayer for item in self.items(): layer = item.layer() if ( layer == currLayer or not layer ): item.setSelected(False)
python
def selectNone( self ): """ Deselects all the items in the scene. """ currLayer = self._currentLayer for item in self.items(): layer = item.layer() if ( layer == currLayer or not layer ): item.setSelected(False)
[ "def", "selectNone", "(", "self", ")", ":", "currLayer", "=", "self", ".", "_currentLayer", "for", "item", "in", "self", ".", "items", "(", ")", ":", "layer", "=", "item", ".", "layer", "(", ")", "if", "(", "layer", "==", "currLayer", "or", "not", ...
Deselects all the items in the scene.
[ "Deselects", "all", "the", "items", "in", "the", "scene", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodescene.py#L1300-L1308
train
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodescene.py
XNodeScene.setViewMode
def setViewMode( self, state = True ): """ Starts the view mode for moving around the scene. """ if self._viewMode == state: return self._viewMode = state if state: self._mainView.setDragMode( self._mainView.ScrollHandDrag ) el...
python
def setViewMode( self, state = True ): """ Starts the view mode for moving around the scene. """ if self._viewMode == state: return self._viewMode = state if state: self._mainView.setDragMode( self._mainView.ScrollHandDrag ) el...
[ "def", "setViewMode", "(", "self", ",", "state", "=", "True", ")", ":", "if", "self", ".", "_viewMode", "==", "state", ":", "return", "self", ".", "_viewMode", "=", "state", "if", "state", ":", "self", ".", "_mainView", ".", "setDragMode", "(", "self",...
Starts the view mode for moving around the scene.
[ "Starts", "the", "view", "mode", "for", "moving", "around", "the", "scene", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodescene.py#L1564-L1577
train
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodescene.py
XNodeScene.updateIsolated
def updateIsolated( self, force = False ): """ Updates the visible state of nodes based on whether or not they are isolated. """ if ( not (self.isolationMode() or force) ): return # make sure all nodes are not being hidden because of isolation ...
python
def updateIsolated( self, force = False ): """ Updates the visible state of nodes based on whether or not they are isolated. """ if ( not (self.isolationMode() or force) ): return # make sure all nodes are not being hidden because of isolation ...
[ "def", "updateIsolated", "(", "self", ",", "force", "=", "False", ")", ":", "if", "(", "not", "(", "self", ".", "isolationMode", "(", ")", "or", "force", ")", ")", ":", "return", "if", "(", "not", "self", ".", "isolationMode", "(", ")", ")", ":", ...
Updates the visible state of nodes based on whether or not they are isolated.
[ "Updates", "the", "visible", "state", "of", "nodes", "based", "on", "whether", "or", "not", "they", "are", "isolated", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodescene.py#L1662-L1689
train
pmuller/versions
versions/constraints.py
merge
def merge(constraints): """Merge ``constraints``. It removes dupplicate, pruned and merged constraints. :param constraints: Current constraints. :type constraints: Iterable of :class:`.Constraint` objects. :rtype: :func:`list` of :class:`.Constraint` objects. :raises: :exc:`.ExclusiveConstrain...
python
def merge(constraints): """Merge ``constraints``. It removes dupplicate, pruned and merged constraints. :param constraints: Current constraints. :type constraints: Iterable of :class:`.Constraint` objects. :rtype: :func:`list` of :class:`.Constraint` objects. :raises: :exc:`.ExclusiveConstrain...
[ "def", "merge", "(", "constraints", ")", ":", "operators", "=", "defaultdict", "(", "set", ")", "for", "constraint", "in", "constraints", ":", "operators", "[", "constraint", ".", "operator", "]", ".", "add", "(", "constraint", ".", "version", ")", "if", ...
Merge ``constraints``. It removes dupplicate, pruned and merged constraints. :param constraints: Current constraints. :type constraints: Iterable of :class:`.Constraint` objects. :rtype: :func:`list` of :class:`.Constraint` objects. :raises: :exc:`.ExclusiveConstraints`
[ "Merge", "constraints", "." ]
951bc3fd99b6a675190f11ee0752af1d7ff5b440
https://github.com/pmuller/versions/blob/951bc3fd99b6a675190f11ee0752af1d7ff5b440/versions/constraints.py#L109-L224
train
pmuller/versions
versions/constraints.py
Constraints.match
def match(self, version): """Match ``version`` with this collection of constraints. :param version: Version to match against the constraint. :type version: :ref:`version expression <version-expressions>` or \ :class:`.Version` :rtype: ``True`` if ``version`` satisfies the constr...
python
def match(self, version): """Match ``version`` with this collection of constraints. :param version: Version to match against the constraint. :type version: :ref:`version expression <version-expressions>` or \ :class:`.Version` :rtype: ``True`` if ``version`` satisfies the constr...
[ "def", "match", "(", "self", ",", "version", ")", ":", "return", "all", "(", "constraint", ".", "match", "(", "version", ")", "for", "constraint", "in", "self", ".", "constraints", ")" ]
Match ``version`` with this collection of constraints. :param version: Version to match against the constraint. :type version: :ref:`version expression <version-expressions>` or \ :class:`.Version` :rtype: ``True`` if ``version`` satisfies the constraint, \ ``False`` if it doesn...
[ "Match", "version", "with", "this", "collection", "of", "constraints", "." ]
951bc3fd99b6a675190f11ee0752af1d7ff5b440
https://github.com/pmuller/versions/blob/951bc3fd99b6a675190f11ee0752af1d7ff5b440/versions/constraints.py#L46-L56
train
evansd/django-envsettings
envsettings/cache.py
CacheSettings.set_memcached_backend
def set_memcached_backend(self, config): """ Select the most suitable Memcached backend based on the config and on what's installed """ # This is the preferred backend as it is the fastest and most fully # featured, so we use this by default config['BACKEND'] = 'd...
python
def set_memcached_backend(self, config): """ Select the most suitable Memcached backend based on the config and on what's installed """ # This is the preferred backend as it is the fastest and most fully # featured, so we use this by default config['BACKEND'] = 'd...
[ "def", "set_memcached_backend", "(", "self", ",", "config", ")", ":", "config", "[", "'BACKEND'", "]", "=", "'django_pylibmc.memcached.PyLibMCCache'", "if", "is_importable", "(", "config", "[", "'BACKEND'", "]", ")", ":", "return", "if", "config", ".", "get", ...
Select the most suitable Memcached backend based on the config and on what's installed
[ "Select", "the", "most", "suitable", "Memcached", "backend", "based", "on", "the", "config", "and", "on", "what", "s", "installed" ]
541932af261d5369f211f836a238dc020ee316e8
https://github.com/evansd/django-envsettings/blob/541932af261d5369f211f836a238dc020ee316e8/envsettings/cache.py#L63-L86
train
bitesofcode/projexui
projexui/widgets/xorbquerywidget/xorbqueryentrywidget.py
XOrbQueryEntryWidget.addEntry
def addEntry(self): """ This will either add a new widget or switch the joiner based on the state of the entry """ joiner = self.joiner() curr_joiner = self._containerWidget.currentJoiner() # update the joining option if it is modified if...
python
def addEntry(self): """ This will either add a new widget or switch the joiner based on the state of the entry """ joiner = self.joiner() curr_joiner = self._containerWidget.currentJoiner() # update the joining option if it is modified if...
[ "def", "addEntry", "(", "self", ")", ":", "joiner", "=", "self", ".", "joiner", "(", ")", "curr_joiner", "=", "self", ".", "_containerWidget", ".", "currentJoiner", "(", ")", "if", "joiner", "!=", "curr_joiner", ":", "if", "not", "self", ".", "_last", ...
This will either add a new widget or switch the joiner based on the state of the entry
[ "This", "will", "either", "add", "a", "new", "widget", "or", "switch", "the", "joiner", "based", "on", "the", "state", "of", "the", "entry" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbquerywidget/xorbqueryentrywidget.py#L68-L85
train
bitesofcode/projexui
projexui/widgets/xorbquerywidget/xorbqueryentrywidget.py
XOrbQueryEntryWidget.assignPlugin
def assignPlugin(self): """ Assigns an editor based on the current column for this schema. """ self.uiOperatorDDL.blockSignals(True) self.uiOperatorDDL.clear() plugin = self.currentPlugin() if plugin: flags = 0 if not sel...
python
def assignPlugin(self): """ Assigns an editor based on the current column for this schema. """ self.uiOperatorDDL.blockSignals(True) self.uiOperatorDDL.clear() plugin = self.currentPlugin() if plugin: flags = 0 if not sel...
[ "def", "assignPlugin", "(", "self", ")", ":", "self", ".", "uiOperatorDDL", ".", "blockSignals", "(", "True", ")", "self", ".", "uiOperatorDDL", ".", "clear", "(", ")", "plugin", "=", "self", ".", "currentPlugin", "(", ")", "if", "plugin", ":", "flags", ...
Assigns an editor based on the current column for this schema.
[ "Assigns", "an", "editor", "based", "on", "the", "current", "column", "for", "this", "schema", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbquerywidget/xorbqueryentrywidget.py#L88-L104
train
bitesofcode/projexui
projexui/widgets/xorbquerywidget/xorbqueryentrywidget.py
XOrbQueryEntryWidget.assignEditor
def assignEditor(self): """ Assigns the editor for this entry based on the plugin. """ plugin = self.currentPlugin() column = self.currentColumn() value = self.currentValue() if not plugin: self.setEditor(None) return ...
python
def assignEditor(self): """ Assigns the editor for this entry based on the plugin. """ plugin = self.currentPlugin() column = self.currentColumn() value = self.currentValue() if not plugin: self.setEditor(None) return ...
[ "def", "assignEditor", "(", "self", ")", ":", "plugin", "=", "self", ".", "currentPlugin", "(", ")", "column", "=", "self", ".", "currentColumn", "(", ")", "value", "=", "self", ".", "currentValue", "(", ")", "if", "not", "plugin", ":", "self", ".", ...
Assigns the editor for this entry based on the plugin.
[ "Assigns", "the", "editor", "for", "this", "entry", "based", "on", "the", "plugin", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbquerywidget/xorbqueryentrywidget.py#L107-L124
train
bitesofcode/projexui
projexui/widgets/xorbquerywidget/xorbqueryentrywidget.py
XOrbQueryEntryWidget.refreshButtons
def refreshButtons(self): """ Refreshes the buttons for building this sql query. """ last = self._last first = self._first joiner = self._containerWidget.currentJoiner() # the first button set can contain the toggle options if f...
python
def refreshButtons(self): """ Refreshes the buttons for building this sql query. """ last = self._last first = self._first joiner = self._containerWidget.currentJoiner() # the first button set can contain the toggle options if f...
[ "def", "refreshButtons", "(", "self", ")", ":", "last", "=", "self", ".", "_last", "first", "=", "self", ".", "_first", "joiner", "=", "self", ".", "_containerWidget", ".", "currentJoiner", "(", ")", "if", "first", ":", "self", ".", "uiJoinSBTN", ".", ...
Refreshes the buttons for building this sql query.
[ "Refreshes", "the", "buttons", "for", "building", "this", "sql", "query", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbquerywidget/xorbqueryentrywidget.py#L223-L250
train
bitesofcode/projexui
projexui/widgets/xorbquerywidget/xorbqueryentrywidget.py
XOrbQueryEntryWidget.updateJoin
def updateJoin(self): """ Updates the joining method used by the system. """ text = self.uiJoinSBTN.currentAction().text() if text == 'AND': joiner = QueryCompound.Op.And else: joiner = QueryCompound.Op.Or self._container...
python
def updateJoin(self): """ Updates the joining method used by the system. """ text = self.uiJoinSBTN.currentAction().text() if text == 'AND': joiner = QueryCompound.Op.And else: joiner = QueryCompound.Op.Or self._container...
[ "def", "updateJoin", "(", "self", ")", ":", "text", "=", "self", ".", "uiJoinSBTN", ".", "currentAction", "(", ")", ".", "text", "(", ")", "if", "text", "==", "'AND'", ":", "joiner", "=", "QueryCompound", ".", "Op", ".", "And", "else", ":", "joiner",...
Updates the joining method used by the system.
[ "Updates", "the", "joining", "method", "used", "by", "the", "system", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbquerywidget/xorbqueryentrywidget.py#L350-L360
train
lingpy/sinopy
src/sinopy/sinopy.py
is_chinese
def is_chinese(name): """ Check if a symbol is a Chinese character. Note ---- Taken from http://stackoverflow.com/questions/16441633/python-2-7-test-if-characters-in-a-string-are-all-chinese-characters """ if not name: return False for ch in name: ordch = ord(ch) ...
python
def is_chinese(name): """ Check if a symbol is a Chinese character. Note ---- Taken from http://stackoverflow.com/questions/16441633/python-2-7-test-if-characters-in-a-string-are-all-chinese-characters """ if not name: return False for ch in name: ordch = ord(ch) ...
[ "def", "is_chinese", "(", "name", ")", ":", "if", "not", "name", ":", "return", "False", "for", "ch", "in", "name", ":", "ordch", "=", "ord", "(", "ch", ")", "if", "not", "(", "0x3400", "<=", "ordch", "<=", "0x9fff", ")", "and", "not", "(", "0x20...
Check if a symbol is a Chinese character. Note ---- Taken from http://stackoverflow.com/questions/16441633/python-2-7-test-if-characters-in-a-string-are-all-chinese-characters
[ "Check", "if", "a", "symbol", "is", "a", "Chinese", "character", "." ]
59a47fcdfae3e0000ac6d2b3d7919bf875ec2056
https://github.com/lingpy/sinopy/blob/59a47fcdfae3e0000ac6d2b3d7919bf875ec2056/src/sinopy/sinopy.py#L10-L26
train
lingpy/sinopy
src/sinopy/sinopy.py
pinyin
def pinyin(char, variant='mandarin', sep=' ', out='tones'): """ Retrieve Pinyin of a character. """ if len(char) > 1: return sep.join([pinyin(c, variant=variant, sep=sep, out=out) for c in char]) if not is_chinese(char): return char if char in _cd.GBK: char = gbk2big5(...
python
def pinyin(char, variant='mandarin', sep=' ', out='tones'): """ Retrieve Pinyin of a character. """ if len(char) > 1: return sep.join([pinyin(c, variant=variant, sep=sep, out=out) for c in char]) if not is_chinese(char): return char if char in _cd.GBK: char = gbk2big5(...
[ "def", "pinyin", "(", "char", ",", "variant", "=", "'mandarin'", ",", "sep", "=", "' '", ",", "out", "=", "'tones'", ")", ":", "if", "len", "(", "char", ")", ">", "1", ":", "return", "sep", ".", "join", "(", "[", "pinyin", "(", "c", ",", "varia...
Retrieve Pinyin of a character.
[ "Retrieve", "Pinyin", "of", "a", "character", "." ]
59a47fcdfae3e0000ac6d2b3d7919bf875ec2056
https://github.com/lingpy/sinopy/blob/59a47fcdfae3e0000ac6d2b3d7919bf875ec2056/src/sinopy/sinopy.py#L29-L47
train
lingpy/sinopy
src/sinopy/sinopy.py
parse_baxter
def parse_baxter(reading): """ Parse a Baxter string and render it with all its contents, namely initial, medial, final, and tone. """ initial = '' medial = '' final = '' tone = '' # determine environments inienv = True medienv = False finenv = False tonenv = Fa...
python
def parse_baxter(reading): """ Parse a Baxter string and render it with all its contents, namely initial, medial, final, and tone. """ initial = '' medial = '' final = '' tone = '' # determine environments inienv = True medienv = False finenv = False tonenv = Fa...
[ "def", "parse_baxter", "(", "reading", ")", ":", "initial", "=", "''", "medial", "=", "''", "final", "=", "''", "tone", "=", "''", "inienv", "=", "True", "medienv", "=", "False", "finenv", "=", "False", "tonenv", "=", "False", "inichars", "=", "\"pbmrt...
Parse a Baxter string and render it with all its contents, namely initial, medial, final, and tone.
[ "Parse", "a", "Baxter", "string", "and", "render", "it", "with", "all", "its", "contents", "namely", "initial", "medial", "final", "and", "tone", "." ]
59a47fcdfae3e0000ac6d2b3d7919bf875ec2056
https://github.com/lingpy/sinopy/blob/59a47fcdfae3e0000ac6d2b3d7919bf875ec2056/src/sinopy/sinopy.py#L69-L128
train
lingpy/sinopy
src/sinopy/sinopy.py
chars2gloss
def chars2gloss(chars): """ Get the TLS basic gloss for a characters. """ out = [] chars = gbk2big5(chars) for char in chars: tmp = [] if char in _cd.TLS: for entry in _cd.TLS[char]: baxter = _cd.TLS[char][entry]['UNIHAN_GLOSS'] if baxt...
python
def chars2gloss(chars): """ Get the TLS basic gloss for a characters. """ out = [] chars = gbk2big5(chars) for char in chars: tmp = [] if char in _cd.TLS: for entry in _cd.TLS[char]: baxter = _cd.TLS[char][entry]['UNIHAN_GLOSS'] if baxt...
[ "def", "chars2gloss", "(", "chars", ")", ":", "out", "=", "[", "]", "chars", "=", "gbk2big5", "(", "chars", ")", "for", "char", "in", "chars", ":", "tmp", "=", "[", "]", "if", "char", "in", "_cd", ".", "TLS", ":", "for", "entry", "in", "_cd", "...
Get the TLS basic gloss for a characters.
[ "Get", "the", "TLS", "basic", "gloss", "for", "a", "characters", "." ]
59a47fcdfae3e0000ac6d2b3d7919bf875ec2056
https://github.com/lingpy/sinopy/blob/59a47fcdfae3e0000ac6d2b3d7919bf875ec2056/src/sinopy/sinopy.py#L150-L164
train
lingpy/sinopy
src/sinopy/sinopy.py
baxter2ipa
def baxter2ipa(mch, segmented=False): """ Very simple aber convient-enough conversion from baxter MCH to IPA MCH. this is also more or less already implemented in MiddleChinese """ out = mch if out[-1] in 'ptk': out += 'R' elif out[-1] not in 'XHP': out += 'P' f...
python
def baxter2ipa(mch, segmented=False): """ Very simple aber convient-enough conversion from baxter MCH to IPA MCH. this is also more or less already implemented in MiddleChinese """ out = mch if out[-1] in 'ptk': out += 'R' elif out[-1] not in 'XHP': out += 'P' f...
[ "def", "baxter2ipa", "(", "mch", ",", "segmented", "=", "False", ")", ":", "out", "=", "mch", "if", "out", "[", "-", "1", "]", "in", "'ptk'", ":", "out", "+=", "'R'", "elif", "out", "[", "-", "1", "]", "not", "in", "'XHP'", ":", "out", "+=", ...
Very simple aber convient-enough conversion from baxter MCH to IPA MCH. this is also more or less already implemented in MiddleChinese
[ "Very", "simple", "aber", "convient", "-", "enough", "conversion", "from", "baxter", "MCH", "to", "IPA", "MCH", ".", "this", "is", "also", "more", "or", "less", "already", "implemented", "in", "MiddleChinese" ]
59a47fcdfae3e0000ac6d2b3d7919bf875ec2056
https://github.com/lingpy/sinopy/blob/59a47fcdfae3e0000ac6d2b3d7919bf875ec2056/src/sinopy/sinopy.py#L329-L345
train
lingpy/sinopy
src/sinopy/sinopy.py
gbk2big5
def gbk2big5(chars): """ Convert from gbk format to big5 representation of chars. """ out = '' for char in chars: if char in _cd.GBK: out += _cd.BIG5[_cd.GBK.index(char)] else: out += char return out
python
def gbk2big5(chars): """ Convert from gbk format to big5 representation of chars. """ out = '' for char in chars: if char in _cd.GBK: out += _cd.BIG5[_cd.GBK.index(char)] else: out += char return out
[ "def", "gbk2big5", "(", "chars", ")", ":", "out", "=", "''", "for", "char", "in", "chars", ":", "if", "char", "in", "_cd", ".", "GBK", ":", "out", "+=", "_cd", ".", "BIG5", "[", "_cd", ".", "GBK", ".", "index", "(", "char", ")", "]", "else", ...
Convert from gbk format to big5 representation of chars.
[ "Convert", "from", "gbk", "format", "to", "big5", "representation", "of", "chars", "." ]
59a47fcdfae3e0000ac6d2b3d7919bf875ec2056
https://github.com/lingpy/sinopy/blob/59a47fcdfae3e0000ac6d2b3d7919bf875ec2056/src/sinopy/sinopy.py#L348-L358
train
lingpy/sinopy
src/sinopy/sinopy.py
big52gbk
def big52gbk(chars): """ Convert from long chars to short chars. """ out = '' for char in chars: if char in _cd.BIG5: out += _cd.GBK[_cd.BIG5.index(char)] else: out += char return out
python
def big52gbk(chars): """ Convert from long chars to short chars. """ out = '' for char in chars: if char in _cd.BIG5: out += _cd.GBK[_cd.BIG5.index(char)] else: out += char return out
[ "def", "big52gbk", "(", "chars", ")", ":", "out", "=", "''", "for", "char", "in", "chars", ":", "if", "char", "in", "_cd", ".", "BIG5", ":", "out", "+=", "_cd", ".", "GBK", "[", "_cd", ".", "BIG5", ".", "index", "(", "char", ")", "]", "else", ...
Convert from long chars to short chars.
[ "Convert", "from", "long", "chars", "to", "short", "chars", "." ]
59a47fcdfae3e0000ac6d2b3d7919bf875ec2056
https://github.com/lingpy/sinopy/blob/59a47fcdfae3e0000ac6d2b3d7919bf875ec2056/src/sinopy/sinopy.py#L361-L371
train
cts2/pyjxslt
pyjxslt-python/src/pyjxslt/XSLTGateway.py
Gateway.add_transform
def add_transform(self, key, xslt): """ Add or update a transform. @param key: Transform key to use when executing transformations @param xslt: Text or file name of an xslt transform """ self._remove_converter(key) self._xsltLibrary[key] = xslt self._add_convert...
python
def add_transform(self, key, xslt): """ Add or update a transform. @param key: Transform key to use when executing transformations @param xslt: Text or file name of an xslt transform """ self._remove_converter(key) self._xsltLibrary[key] = xslt self._add_convert...
[ "def", "add_transform", "(", "self", ",", "key", ",", "xslt", ")", ":", "self", ".", "_remove_converter", "(", "key", ")", "self", ".", "_xsltLibrary", "[", "key", "]", "=", "xslt", "self", ".", "_add_converter", "(", "key", ")" ]
Add or update a transform. @param key: Transform key to use when executing transformations @param xslt: Text or file name of an xslt transform
[ "Add", "or", "update", "a", "transform", "." ]
66cd9233186cf5000d32e3a5b572e0002a8361c4
https://github.com/cts2/pyjxslt/blob/66cd9233186cf5000d32e3a5b572e0002a8361c4/pyjxslt-python/src/pyjxslt/XSLTGateway.py#L92-L101
train
cts2/pyjxslt
pyjxslt-python/src/pyjxslt/XSLTGateway.py
Gateway._refresh_converters
def _refresh_converters(self): """ Refresh all of the converters in the py4j library @return: True if all converters were succesfully updated """ self._converters.clear() return reduce(lambda a, b: a and b, [self._add_converter(k) for k in list(self._xsltLibrary.keys())], True)
python
def _refresh_converters(self): """ Refresh all of the converters in the py4j library @return: True if all converters were succesfully updated """ self._converters.clear() return reduce(lambda a, b: a and b, [self._add_converter(k) for k in list(self._xsltLibrary.keys())], True)
[ "def", "_refresh_converters", "(", "self", ")", ":", "self", ".", "_converters", ".", "clear", "(", ")", "return", "reduce", "(", "lambda", "a", ",", "b", ":", "a", "and", "b", ",", "[", "self", ".", "_add_converter", "(", "k", ")", "for", "k", "in...
Refresh all of the converters in the py4j library @return: True if all converters were succesfully updated
[ "Refresh", "all", "of", "the", "converters", "in", "the", "py4j", "library" ]
66cd9233186cf5000d32e3a5b572e0002a8361c4
https://github.com/cts2/pyjxslt/blob/66cd9233186cf5000d32e3a5b572e0002a8361c4/pyjxslt-python/src/pyjxslt/XSLTGateway.py#L110-L115
train
cts2/pyjxslt
pyjxslt-python/src/pyjxslt/XSLTGateway.py
Gateway.transform
def transform(self, key, xml, **kwargs): """ Transform the supplied XML using the transform identified by key @param key: name of the transform to apply @param xml: XML to transform @param kwargs: XSLT parameters @return: Transform output or None if transform failed ...
python
def transform(self, key, xml, **kwargs): """ Transform the supplied XML using the transform identified by key @param key: name of the transform to apply @param xml: XML to transform @param kwargs: XSLT parameters @return: Transform output or None if transform failed ...
[ "def", "transform", "(", "self", ",", "key", ",", "xml", ",", "**", "kwargs", ")", ":", "if", "key", "in", "self", ".", "_xsltLibrary", "and", "self", ".", "gateway_connected", "(", ")", "and", "key", "in", "self", ".", "_converters", ":", "return", ...
Transform the supplied XML using the transform identified by key @param key: name of the transform to apply @param xml: XML to transform @param kwargs: XSLT parameters @return: Transform output or None if transform failed
[ "Transform", "the", "supplied", "XML", "using", "the", "transform", "identified", "by", "key" ]
66cd9233186cf5000d32e3a5b572e0002a8361c4
https://github.com/cts2/pyjxslt/blob/66cd9233186cf5000d32e3a5b572e0002a8361c4/pyjxslt-python/src/pyjxslt/XSLTGateway.py#L139-L149
train
johnnoone/aioconsul
aioconsul/client/query_endpoint.py
QueryEndpoint.items
async def items(self, *, dc=None, watch=None, consistency=None): """Provides a listing of all prepared queries Parameters: dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. watch (Blocking): Do a blocking query ...
python
async def items(self, *, dc=None, watch=None, consistency=None): """Provides a listing of all prepared queries Parameters: dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. watch (Blocking): Do a blocking query ...
[ "async", "def", "items", "(", "self", ",", "*", ",", "dc", "=", "None", ",", "watch", "=", "None", ",", "consistency", "=", "None", ")", ":", "response", "=", "await", "self", ".", "_api", ".", "get", "(", "\"/v1/query\"", ",", "params", "=", "{", ...
Provides a listing of all prepared queries Parameters: dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. watch (Blocking): Do a blocking query consistency (Consistency): Force consistency Returns: ...
[ "Provides", "a", "listing", "of", "all", "prepared", "queries" ]
02f7a529d7dc2e49bed942111067aa5faf320e90
https://github.com/johnnoone/aioconsul/blob/02f7a529d7dc2e49bed942111067aa5faf320e90/aioconsul/client/query_endpoint.py#L15-L54
train
johnnoone/aioconsul
aioconsul/client/query_endpoint.py
QueryEndpoint.create
async def create(self, query, *, dc=None): """Creates a new prepared query Parameters: Query (Object): Query definition dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. Returns: Object: New query ...
python
async def create(self, query, *, dc=None): """Creates a new prepared query Parameters: Query (Object): Query definition dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. Returns: Object: New query ...
[ "async", "def", "create", "(", "self", ",", "query", ",", "*", ",", "dc", "=", "None", ")", ":", "if", "\"Token\"", "in", "query", ":", "query", "[", "\"Token\"", "]", "=", "extract_attr", "(", "query", "[", "\"Token\"", "]", ",", "keys", "=", "[",...
Creates a new prepared query Parameters: Query (Object): Query definition dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. Returns: Object: New query ID The create operation expects a body that d...
[ "Creates", "a", "new", "prepared", "query" ]
02f7a529d7dc2e49bed942111067aa5faf320e90
https://github.com/johnnoone/aioconsul/blob/02f7a529d7dc2e49bed942111067aa5faf320e90/aioconsul/client/query_endpoint.py#L56-L180
train
johnnoone/aioconsul
aioconsul/client/query_endpoint.py
QueryEndpoint.update
async def update(self, query, *, dc=None): """Updates existing prepared query Parameters: Query (Object): Query definition dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. Returns: bool: ``True`` ...
python
async def update(self, query, *, dc=None): """Updates existing prepared query Parameters: Query (Object): Query definition dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. Returns: bool: ``True`` ...
[ "async", "def", "update", "(", "self", ",", "query", ",", "*", ",", "dc", "=", "None", ")", ":", "query_id", "=", "extract_attr", "(", "query", ",", "keys", "=", "[", "\"ID\"", "]", ")", "response", "=", "await", "self", ".", "_api", ".", "put", ...
Updates existing prepared query Parameters: Query (Object): Query definition dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. Returns: bool: ``True`` on success
[ "Updates", "existing", "prepared", "query" ]
02f7a529d7dc2e49bed942111067aa5faf320e90
https://github.com/johnnoone/aioconsul/blob/02f7a529d7dc2e49bed942111067aa5faf320e90/aioconsul/client/query_endpoint.py#L203-L216
train
johnnoone/aioconsul
aioconsul/client/query_endpoint.py
QueryEndpoint.delete
async def delete(self, query, *, dc=None): """Delete existing prepared query Parameters: query (ObjectID): Query ID dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. Results: bool: ``True`` on succ...
python
async def delete(self, query, *, dc=None): """Delete existing prepared query Parameters: query (ObjectID): Query ID dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. Results: bool: ``True`` on succ...
[ "async", "def", "delete", "(", "self", ",", "query", ",", "*", ",", "dc", "=", "None", ")", ":", "query_id", "=", "extract_attr", "(", "query", ",", "keys", "=", "[", "\"ID\"", "]", ")", "response", "=", "await", "self", ".", "_api", ".", "delete",...
Delete existing prepared query Parameters: query (ObjectID): Query ID dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. Results: bool: ``True`` on success
[ "Delete", "existing", "prepared", "query" ]
02f7a529d7dc2e49bed942111067aa5faf320e90
https://github.com/johnnoone/aioconsul/blob/02f7a529d7dc2e49bed942111067aa5faf320e90/aioconsul/client/query_endpoint.py#L218-L231
train
johnnoone/aioconsul
aioconsul/client/query_endpoint.py
QueryEndpoint.execute
async def execute(self, query, *, dc=None, near=None, limit=None, consistency=None): """Executes a prepared query Parameters: query (ObjectID): Query ID dc (str): Specify datacenter that will be used. Defaults to the agent's local data...
python
async def execute(self, query, *, dc=None, near=None, limit=None, consistency=None): """Executes a prepared query Parameters: query (ObjectID): Query ID dc (str): Specify datacenter that will be used. Defaults to the agent's local data...
[ "async", "def", "execute", "(", "self", ",", "query", ",", "*", ",", "dc", "=", "None", ",", "near", "=", "None", ",", "limit", "=", "None", ",", "consistency", "=", "None", ")", ":", "query_id", "=", "extract_attr", "(", "query", ",", "keys", "=",...
Executes a prepared query Parameters: query (ObjectID): Query ID dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. near (str): Sort the resulting list in ascending order based on the estima...
[ "Executes", "a", "prepared", "query" ]
02f7a529d7dc2e49bed942111067aa5faf320e90
https://github.com/johnnoone/aioconsul/blob/02f7a529d7dc2e49bed942111067aa5faf320e90/aioconsul/client/query_endpoint.py#L233-L324
train
bitesofcode/projexui
projexui/widgets/xorbtreewidget/xorbgroupitem.py
XOrbGroupItem.load
def load(self): """ Loads the records from the query set linked with this item. """ if self._loaded: return rset = self.recordSet() QApplication.setOverrideCursor(Qt.WaitCursor) self.loadRecords(rset) QApplication.r...
python
def load(self): """ Loads the records from the query set linked with this item. """ if self._loaded: return rset = self.recordSet() QApplication.setOverrideCursor(Qt.WaitCursor) self.loadRecords(rset) QApplication.r...
[ "def", "load", "(", "self", ")", ":", "if", "self", ".", "_loaded", ":", "return", "rset", "=", "self", ".", "recordSet", "(", ")", "QApplication", ".", "setOverrideCursor", "(", "Qt", ".", "WaitCursor", ")", "self", ".", "loadRecords", "(", "rset", ")...
Loads the records from the query set linked with this item.
[ "Loads", "the", "records", "from", "the", "query", "set", "linked", "with", "this", "item", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbtreewidget/xorbgroupitem.py#L117-L128
train
intelsdi-x/snap-plugin-lib-py
snap_plugin/v1/plugin.py
_tabulate
def _tabulate(rows, headers, spacing=5): """Prepare simple table with spacing based on content""" if len(rows) == 0: return "None\n" assert len(rows[0]) == len(headers) count = len(rows[0]) widths = [0 for _ in range(count)] rows = [headers] + rows for row in rows: for index...
python
def _tabulate(rows, headers, spacing=5): """Prepare simple table with spacing based on content""" if len(rows) == 0: return "None\n" assert len(rows[0]) == len(headers) count = len(rows[0]) widths = [0 for _ in range(count)] rows = [headers] + rows for row in rows: for index...
[ "def", "_tabulate", "(", "rows", ",", "headers", ",", "spacing", "=", "5", ")", ":", "if", "len", "(", "rows", ")", "==", "0", ":", "return", "\"None\\n\"", "assert", "len", "(", "rows", "[", "0", "]", ")", "==", "len", "(", "headers", ")", "coun...
Prepare simple table with spacing based on content
[ "Prepare", "simple", "table", "with", "spacing", "based", "on", "content" ]
8da5d00ac5f9d2b48a7239563ac7788209891ca4
https://github.com/intelsdi-x/snap-plugin-lib-py/blob/8da5d00ac5f9d2b48a7239563ac7788209891ca4/snap_plugin/v1/plugin.py#L786-L806
train
intelsdi-x/snap-plugin-lib-py
snap_plugin/v1/plugin.py
_Flags.add_item
def add_item(self, item): """Add single command line flag Arguments: name (:obj:`str`): Name of flag used in command line flag_type (:py:class:`snap_plugin.v1.plugin.FlagType`): Indication if flag should store value or is simple bool flag description ...
python
def add_item(self, item): """Add single command line flag Arguments: name (:obj:`str`): Name of flag used in command line flag_type (:py:class:`snap_plugin.v1.plugin.FlagType`): Indication if flag should store value or is simple bool flag description ...
[ "def", "add_item", "(", "self", ",", "item", ")", ":", "if", "not", "(", "isinstance", "(", "item", ".", "name", ",", "basestring", ")", "and", "isinstance", "(", "item", ".", "description", ",", "basestring", ")", ")", ":", "raise", "TypeError", "(", ...
Add single command line flag Arguments: name (:obj:`str`): Name of flag used in command line flag_type (:py:class:`snap_plugin.v1.plugin.FlagType`): Indication if flag should store value or is simple bool flag description (:obj:`str`): Flag description used i...
[ "Add", "single", "command", "line", "flag" ]
8da5d00ac5f9d2b48a7239563ac7788209891ca4
https://github.com/intelsdi-x/snap-plugin-lib-py/blob/8da5d00ac5f9d2b48a7239563ac7788209891ca4/snap_plugin/v1/plugin.py#L107-L133
train
intelsdi-x/snap-plugin-lib-py
snap_plugin/v1/plugin.py
_Flags.add_multiple
def add_multiple(self, flags): """Add multiple command line flags Arguments: flags (:obj:`list` of :obj:`tuple`): List of flags in tuples (name, flag_type, description, (optional) default) Raises: TypeError: Provided wrong arguments or arguments of wrong...
python
def add_multiple(self, flags): """Add multiple command line flags Arguments: flags (:obj:`list` of :obj:`tuple`): List of flags in tuples (name, flag_type, description, (optional) default) Raises: TypeError: Provided wrong arguments or arguments of wrong...
[ "def", "add_multiple", "(", "self", ",", "flags", ")", ":", "if", "not", "isinstance", "(", "flags", ",", "list", ")", ":", "raise", "TypeError", "(", "\"Expected list of flags, got object of type{}\"", ".", "format", "(", "type", "(", "flags", ")", ")", ")"...
Add multiple command line flags Arguments: flags (:obj:`list` of :obj:`tuple`): List of flags in tuples (name, flag_type, description, (optional) default) Raises: TypeError: Provided wrong arguments or arguments of wrong types, method will raise TypeError
[ "Add", "multiple", "command", "line", "flags" ]
8da5d00ac5f9d2b48a7239563ac7788209891ca4
https://github.com/intelsdi-x/snap-plugin-lib-py/blob/8da5d00ac5f9d2b48a7239563ac7788209891ca4/snap_plugin/v1/plugin.py#L138-L160
train
bitesofcode/projexui
projexui/widgets/xcalendarwidget/xcalendarwidget.py
XCalendarWidget.gotoNext
def gotoNext( self ): """ Goes to the next date based on the current mode and date. """ scene = self.scene() date = scene.currentDate() # go forward a day if ( scene.currentMode() == scene.Mode.Day ): scene.setCurrentDate(date.addDay...
python
def gotoNext( self ): """ Goes to the next date based on the current mode and date. """ scene = self.scene() date = scene.currentDate() # go forward a day if ( scene.currentMode() == scene.Mode.Day ): scene.setCurrentDate(date.addDay...
[ "def", "gotoNext", "(", "self", ")", ":", "scene", "=", "self", ".", "scene", "(", ")", "date", "=", "scene", ".", "currentDate", "(", ")", "if", "(", "scene", ".", "currentMode", "(", ")", "==", "scene", ".", "Mode", ".", "Day", ")", ":", "scene...
Goes to the next date based on the current mode and date.
[ "Goes", "to", "the", "next", "date", "based", "on", "the", "current", "mode", "and", "date", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xcalendarwidget/xcalendarwidget.py#L168-L185
train
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodewidget.py
XNodeWidget.zoomExtents
def zoomExtents(self): """ Fits all the nodes in the view. """ rect = self.scene().visibleItemsBoundingRect() vrect = self.viewportRect() if rect.width(): changed = False scene_rect = self.scene().sceneRect() ...
python
def zoomExtents(self): """ Fits all the nodes in the view. """ rect = self.scene().visibleItemsBoundingRect() vrect = self.viewportRect() if rect.width(): changed = False scene_rect = self.scene().sceneRect() ...
[ "def", "zoomExtents", "(", "self", ")", ":", "rect", "=", "self", ".", "scene", "(", ")", ".", "visibleItemsBoundingRect", "(", ")", "vrect", "=", "self", ".", "viewportRect", "(", ")", "if", "rect", ".", "width", "(", ")", ":", "changed", "=", "Fals...
Fits all the nodes in the view.
[ "Fits", "all", "the", "nodes", "in", "the", "view", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodewidget.py#L287-L314
train
FNNDSC/pfurl
pfurl/pfurl.py
zipdir
def zipdir(path, ziph, **kwargs): """ Zip up a directory. :param path: :param ziph: :param kwargs: :return: """ str_arcroot = "" for k, v in kwargs.items(): if k == 'arcroot': str_arcroot = v for root, dirs, files in os.walk(path): for file in files: ...
python
def zipdir(path, ziph, **kwargs): """ Zip up a directory. :param path: :param ziph: :param kwargs: :return: """ str_arcroot = "" for k, v in kwargs.items(): if k == 'arcroot': str_arcroot = v for root, dirs, files in os.walk(path): for file in files: ...
[ "def", "zipdir", "(", "path", ",", "ziph", ",", "**", "kwargs", ")", ":", "str_arcroot", "=", "\"\"", "for", "k", ",", "v", "in", "kwargs", ".", "items", "(", ")", ":", "if", "k", "==", "'arcroot'", ":", "str_arcroot", "=", "v", "for", "root", ",...
Zip up a directory. :param path: :param ziph: :param kwargs: :return:
[ "Zip", "up", "a", "directory", "." ]
572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958
https://github.com/FNNDSC/pfurl/blob/572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958/pfurl/pfurl.py#L1350-L1373
train
FNNDSC/pfurl
pfurl/pfurl.py
zip_process
def zip_process(**kwargs): """ Process zip operations. :param kwargs: :return: """ str_localPath = "" str_zipFileName = "" str_action = "zip" str_arcroot = "" for k,v in kwargs.items(): if k == 'path': str_localPath = v if k == 'action':...
python
def zip_process(**kwargs): """ Process zip operations. :param kwargs: :return: """ str_localPath = "" str_zipFileName = "" str_action = "zip" str_arcroot = "" for k,v in kwargs.items(): if k == 'path': str_localPath = v if k == 'action':...
[ "def", "zip_process", "(", "**", "kwargs", ")", ":", "str_localPath", "=", "\"\"", "str_zipFileName", "=", "\"\"", "str_action", "=", "\"zip\"", "str_arcroot", "=", "\"\"", "for", "k", ",", "v", "in", "kwargs", ".", "items", "(", ")", ":", "if", "k", "...
Process zip operations. :param kwargs: :return:
[ "Process", "zip", "operations", "." ]
572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958
https://github.com/FNNDSC/pfurl/blob/572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958/pfurl/pfurl.py#L1376-L1435
train
FNNDSC/pfurl
pfurl/pfurl.py
base64_process
def base64_process(**kwargs): """ Process base64 file io """ str_fileToSave = "" str_fileToRead = "" str_action = "encode" data = None for k,v in kwargs.items(): if k == 'action': str_action = v if k == 'payloadBytes'...
python
def base64_process(**kwargs): """ Process base64 file io """ str_fileToSave = "" str_fileToRead = "" str_action = "encode" data = None for k,v in kwargs.items(): if k == 'action': str_action = v if k == 'payloadBytes'...
[ "def", "base64_process", "(", "**", "kwargs", ")", ":", "str_fileToSave", "=", "\"\"", "str_fileToRead", "=", "\"\"", "str_action", "=", "\"encode\"", "data", "=", "None", "for", "k", ",", "v", "in", "kwargs", ".", "items", "(", ")", ":", "if", "k", "=...
Process base64 file io
[ "Process", "base64", "file", "io" ]
572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958
https://github.com/FNNDSC/pfurl/blob/572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958/pfurl/pfurl.py#L1438-L1488
train
FNNDSC/pfurl
pfurl/pfurl.py
Pfurl.storage_resolveBasedOnKey
def storage_resolveBasedOnKey(self, *args, **kwargs): """ Call the remote service and ask for the storage location based on the key. :param args: :param kwargs: :return: """ global Gd_internalvar d_msg = { 'action': 'internalctl', ...
python
def storage_resolveBasedOnKey(self, *args, **kwargs): """ Call the remote service and ask for the storage location based on the key. :param args: :param kwargs: :return: """ global Gd_internalvar d_msg = { 'action': 'internalctl', ...
[ "def", "storage_resolveBasedOnKey", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "global", "Gd_internalvar", "d_msg", "=", "{", "'action'", ":", "'internalctl'", ",", "'meta'", ":", "{", "'var'", ":", "'key2address'", ",", "'compute'", ":", ...
Call the remote service and ask for the storage location based on the key. :param args: :param kwargs: :return:
[ "Call", "the", "remote", "service", "and", "ask", "for", "the", "storage", "location", "based", "on", "the", "key", "." ]
572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958
https://github.com/FNNDSC/pfurl/blob/572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958/pfurl/pfurl.py#L190-L221
train
FNNDSC/pfurl
pfurl/pfurl.py
Pfurl.remoteLocation_resolveSimple
def remoteLocation_resolveSimple(self, d_remote): """ Resolve the remote "path" location by returning either the 'path' or 'key' parameter in the 'remote' JSON record. :param d_remote: :return: """ b_status = False str_remotePath = "" if '...
python
def remoteLocation_resolveSimple(self, d_remote): """ Resolve the remote "path" location by returning either the 'path' or 'key' parameter in the 'remote' JSON record. :param d_remote: :return: """ b_status = False str_remotePath = "" if '...
[ "def", "remoteLocation_resolveSimple", "(", "self", ",", "d_remote", ")", ":", "b_status", "=", "False", "str_remotePath", "=", "\"\"", "if", "'path'", "in", "d_remote", ".", "keys", "(", ")", ":", "str_remotePath", "=", "d_remote", "[", "'path'", "]", "b_st...
Resolve the remote "path" location by returning either the 'path' or 'key' parameter in the 'remote' JSON record. :param d_remote: :return:
[ "Resolve", "the", "remote", "path", "location", "by", "returning", "either", "the", "path", "or", "key", "parameter", "in", "the", "remote", "JSON", "record", "." ]
572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958
https://github.com/FNNDSC/pfurl/blob/572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958/pfurl/pfurl.py#L223-L242
train
FNNDSC/pfurl
pfurl/pfurl.py
Pfurl.remoteLocation_resolve
def remoteLocation_resolve(self, d_remote): """ Resolve the remote path location :param d_remote: the "remote" specification :return: a string representation of the remote path """ b_status = False str_remotePath = "" if 'path' in d_remote.keys():...
python
def remoteLocation_resolve(self, d_remote): """ Resolve the remote path location :param d_remote: the "remote" specification :return: a string representation of the remote path """ b_status = False str_remotePath = "" if 'path' in d_remote.keys():...
[ "def", "remoteLocation_resolve", "(", "self", ",", "d_remote", ")", ":", "b_status", "=", "False", "str_remotePath", "=", "\"\"", "if", "'path'", "in", "d_remote", ".", "keys", "(", ")", ":", "str_remotePath", "=", "d_remote", "[", "'path'", "]", "b_status",...
Resolve the remote path location :param d_remote: the "remote" specification :return: a string representation of the remote path
[ "Resolve", "the", "remote", "path", "location" ]
572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958
https://github.com/FNNDSC/pfurl/blob/572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958/pfurl/pfurl.py#L244-L264
train
FNNDSC/pfurl
pfurl/pfurl.py
Pfurl.path_localLocationCheck
def path_localLocationCheck(self, d_msg, **kwargs): """ Check if a path exists on the local filesystem :param self: :param kwargs: :return: """ b_pull = False d_meta = d_msg['meta'] if 'do' in d_meta: ...
python
def path_localLocationCheck(self, d_msg, **kwargs): """ Check if a path exists on the local filesystem :param self: :param kwargs: :return: """ b_pull = False d_meta = d_msg['meta'] if 'do' in d_meta: ...
[ "def", "path_localLocationCheck", "(", "self", ",", "d_msg", ",", "**", "kwargs", ")", ":", "b_pull", "=", "False", "d_meta", "=", "d_msg", "[", "'meta'", "]", "if", "'do'", "in", "d_meta", ":", "if", "d_meta", "[", "'do'", "]", "==", "'pull'", ":", ...
Check if a path exists on the local filesystem :param self: :param kwargs: :return:
[ "Check", "if", "a", "path", "exists", "on", "the", "local", "filesystem" ]
572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958
https://github.com/FNNDSC/pfurl/blob/572f634ab582b7b7b7a3fbfd5bf12aadc1ba7958/pfurl/pfurl.py#L810-L879
train
SkullTech/webdriver-start
wdstart/helper.py
find_executable
def find_executable(name): """ Returns the path of an executable file. Searches for an executable with the given name, first in the `PATH`, then in the current directory (recursively). Upon finding the file, returns the full filepath of it. Parameters ---------- name : str The...
python
def find_executable(name): """ Returns the path of an executable file. Searches for an executable with the given name, first in the `PATH`, then in the current directory (recursively). Upon finding the file, returns the full filepath of it. Parameters ---------- name : str The...
[ "def", "find_executable", "(", "name", ")", ":", "if", "sys", ".", "platform", ".", "startswith", "(", "'win'", ")", "or", "os", ".", "name", ".", "startswith", "(", "'os2'", ")", ":", "name", "=", "name", "+", "'.exe'", "executable_path", "=", "find_f...
Returns the path of an executable file. Searches for an executable with the given name, first in the `PATH`, then in the current directory (recursively). Upon finding the file, returns the full filepath of it. Parameters ---------- name : str The name of the executable. This is platfo...
[ "Returns", "the", "path", "of", "an", "executable", "file", "." ]
26285fd84c4deaf8906828e0ec0758a650b7ba49
https://github.com/SkullTech/webdriver-start/blob/26285fd84c4deaf8906828e0ec0758a650b7ba49/wdstart/helper.py#L91-L117
train
starling-lab/rnlp
rnlp/corpus.py
readCorpus
def readCorpus(location): """ Returns the contents of a file or a group of files as a string. :param location: .txt file or a directory to read files from. :type location: str. :returns: A string of all contents joined together. :rtype: str. .. note:: This function takes a ``loca...
python
def readCorpus(location): """ Returns the contents of a file or a group of files as a string. :param location: .txt file or a directory to read files from. :type location: str. :returns: A string of all contents joined together. :rtype: str. .. note:: This function takes a ``loca...
[ "def", "readCorpus", "(", "location", ")", ":", "print", "(", "\"Reading corpus from file(s)...\"", ")", "corpus", "=", "''", "if", "'.txt'", "in", "location", ":", "with", "open", "(", "location", ")", "as", "fp", ":", "corpus", "=", "fp", ".", "read", ...
Returns the contents of a file or a group of files as a string. :param location: .txt file or a directory to read files from. :type location: str. :returns: A string of all contents joined together. :rtype: str. .. note:: This function takes a ``location`` on disk as a parameter. Locatio...
[ "Returns", "the", "contents", "of", "a", "file", "or", "a", "group", "of", "files", "as", "a", "string", "." ]
72054cc2c0cbaea1d281bf3d56b271d4da29fc4a
https://github.com/starling-lab/rnlp/blob/72054cc2c0cbaea1d281bf3d56b271d4da29fc4a/rnlp/corpus.py#L33-L78
train
bearyinnovative/bearychat.py
bearychat/incoming.py
validate
def validate(data): """Validates incoming data Args: data(dict): the incoming data Returns: True if the data is valid Raises: ValueError: the data is not valid """ text = data.get('text') if not isinstance(text, _string_types) or len(text) == 0: raise Value...
python
def validate(data): """Validates incoming data Args: data(dict): the incoming data Returns: True if the data is valid Raises: ValueError: the data is not valid """ text = data.get('text') if not isinstance(text, _string_types) or len(text) == 0: raise Value...
[ "def", "validate", "(", "data", ")", ":", "text", "=", "data", ".", "get", "(", "'text'", ")", "if", "not", "isinstance", "(", "text", ",", "_string_types", ")", "or", "len", "(", "text", ")", "==", "0", ":", "raise", "ValueError", "(", "'text field ...
Validates incoming data Args: data(dict): the incoming data Returns: True if the data is valid Raises: ValueError: the data is not valid
[ "Validates", "incoming", "data" ]
6c7af2d215c2ff7135bb5af66ca333d0ea1089fd
https://github.com/bearyinnovative/bearychat.py/blob/6c7af2d215c2ff7135bb5af66ca333d0ea1089fd/bearychat/incoming.py#L13-L40
train
bearyinnovative/bearychat.py
bearychat/incoming.py
send
def send(url, data): """Sends an incoming message Args: url(str): the incoming hook url data(dict): the sending data Returns: requests.Response """ validate(data) return requests.post(url, json=data)
python
def send(url, data): """Sends an incoming message Args: url(str): the incoming hook url data(dict): the sending data Returns: requests.Response """ validate(data) return requests.post(url, json=data)
[ "def", "send", "(", "url", ",", "data", ")", ":", "validate", "(", "data", ")", "return", "requests", ".", "post", "(", "url", ",", "json", "=", "data", ")" ]
Sends an incoming message Args: url(str): the incoming hook url data(dict): the sending data Returns: requests.Response
[ "Sends", "an", "incoming", "message" ]
6c7af2d215c2ff7135bb5af66ca333d0ea1089fd
https://github.com/bearyinnovative/bearychat.py/blob/6c7af2d215c2ff7135bb5af66ca333d0ea1089fd/bearychat/incoming.py#L43-L55
train
pnegahdar/inenv
inenv/cli.py
switch_or_run
def switch_or_run(cmd, venv_name=None): """Switch or run in this env""" if cmd: return _run(venv_name, cmd) inenv = InenvManager() if not os.getenv(INENV_ENV_VAR): activator_warn(inenv) return else: venv = inenv.get_prepped_venv(venv_name) inenv.clear_extra_so...
python
def switch_or_run(cmd, venv_name=None): """Switch or run in this env""" if cmd: return _run(venv_name, cmd) inenv = InenvManager() if not os.getenv(INENV_ENV_VAR): activator_warn(inenv) return else: venv = inenv.get_prepped_venv(venv_name) inenv.clear_extra_so...
[ "def", "switch_or_run", "(", "cmd", ",", "venv_name", "=", "None", ")", ":", "if", "cmd", ":", "return", "_run", "(", "venv_name", ",", "cmd", ")", "inenv", "=", "InenvManager", "(", ")", "if", "not", "os", ".", "getenv", "(", "INENV_ENV_VAR", ")", "...
Switch or run in this env
[ "Switch", "or", "run", "in", "this", "env" ]
8f484e520892bf9eb59f91b4b5c92df9fbd9a4e6
https://github.com/pnegahdar/inenv/blob/8f484e520892bf9eb59f91b4b5c92df9fbd9a4e6/inenv/cli.py#L91-L108
train
pnegahdar/inenv
inenv/cli.py
rm
def rm(venv_name): """ Removes the venv by name """ inenv = InenvManager() venv = inenv.get_venv(venv_name) click.confirm("Delete dir {}".format(venv.path)) shutil.rmtree(venv.path)
python
def rm(venv_name): """ Removes the venv by name """ inenv = InenvManager() venv = inenv.get_venv(venv_name) click.confirm("Delete dir {}".format(venv.path)) shutil.rmtree(venv.path)
[ "def", "rm", "(", "venv_name", ")", ":", "inenv", "=", "InenvManager", "(", ")", "venv", "=", "inenv", ".", "get_venv", "(", "venv_name", ")", "click", ".", "confirm", "(", "\"Delete dir {}\"", ".", "format", "(", "venv", ".", "path", ")", ")", "shutil...
Removes the venv by name
[ "Removes", "the", "venv", "by", "name" ]
8f484e520892bf9eb59f91b4b5c92df9fbd9a4e6
https://github.com/pnegahdar/inenv/blob/8f484e520892bf9eb59f91b4b5c92df9fbd9a4e6/inenv/cli.py#L113-L118
train
pnegahdar/inenv
inenv/cli.py
root
def root(venv_name): """Print the root directory of a virtualenv""" inenv = InenvManager() inenv.get_venv(venv_name) venv = inenv.registered_venvs[venv_name] click.secho(venv['root'])
python
def root(venv_name): """Print the root directory of a virtualenv""" inenv = InenvManager() inenv.get_venv(venv_name) venv = inenv.registered_venvs[venv_name] click.secho(venv['root'])
[ "def", "root", "(", "venv_name", ")", ":", "inenv", "=", "InenvManager", "(", ")", "inenv", ".", "get_venv", "(", "venv_name", ")", "venv", "=", "inenv", ".", "registered_venvs", "[", "venv_name", "]", "click", ".", "secho", "(", "venv", "[", "'root'", ...
Print the root directory of a virtualenv
[ "Print", "the", "root", "directory", "of", "a", "virtualenv" ]
8f484e520892bf9eb59f91b4b5c92df9fbd9a4e6
https://github.com/pnegahdar/inenv/blob/8f484e520892bf9eb59f91b4b5c92df9fbd9a4e6/inenv/cli.py#L123-L128
train
pnegahdar/inenv
inenv/cli.py
init
def init(venv_name): """Initializez a virtualenv""" inenv = InenvManager() inenv.get_prepped_venv(venv_name, skip_cached=False) if not os.getenv(INENV_ENV_VAR): activator_warn(inenv) click.secho("Your venv is ready. Enjoy!", fg='green')
python
def init(venv_name): """Initializez a virtualenv""" inenv = InenvManager() inenv.get_prepped_venv(venv_name, skip_cached=False) if not os.getenv(INENV_ENV_VAR): activator_warn(inenv) click.secho("Your venv is ready. Enjoy!", fg='green')
[ "def", "init", "(", "venv_name", ")", ":", "inenv", "=", "InenvManager", "(", ")", "inenv", ".", "get_prepped_venv", "(", "venv_name", ",", "skip_cached", "=", "False", ")", "if", "not", "os", ".", "getenv", "(", "INENV_ENV_VAR", ")", ":", "activator_warn"...
Initializez a virtualenv
[ "Initializez", "a", "virtualenv" ]
8f484e520892bf9eb59f91b4b5c92df9fbd9a4e6
https://github.com/pnegahdar/inenv/blob/8f484e520892bf9eb59f91b4b5c92df9fbd9a4e6/inenv/cli.py#L133-L139
train
pnegahdar/inenv
inenv/cli.py
autojump
def autojump(): """Initializes a virtualenv""" currently_enabled = autojump_enabled() toggle_autojump() if not currently_enabled: click.secho("Autojump enabled", fg='green') else: click.secho("Autojump disabled", fg='red')
python
def autojump(): """Initializes a virtualenv""" currently_enabled = autojump_enabled() toggle_autojump() if not currently_enabled: click.secho("Autojump enabled", fg='green') else: click.secho("Autojump disabled", fg='red')
[ "def", "autojump", "(", ")", ":", "currently_enabled", "=", "autojump_enabled", "(", ")", "toggle_autojump", "(", ")", "if", "not", "currently_enabled", ":", "click", ".", "secho", "(", "\"Autojump enabled\"", ",", "fg", "=", "'green'", ")", "else", ":", "cl...
Initializes a virtualenv
[ "Initializes", "a", "virtualenv" ]
8f484e520892bf9eb59f91b4b5c92df9fbd9a4e6
https://github.com/pnegahdar/inenv/blob/8f484e520892bf9eb59f91b4b5c92df9fbd9a4e6/inenv/cli.py#L143-L150
train
bitesofcode/projexui
projexui/widgets/xchartwidget/xchartruler.py
XChartRuler.clear
def clear( self ): """ Clears all the cached information about this ruler. """ self._minimum = None self._maximum = None self._step = None self._notches = None self._format = None self._formatter = None self._padEnd = 0 ...
python
def clear( self ): """ Clears all the cached information about this ruler. """ self._minimum = None self._maximum = None self._step = None self._notches = None self._format = None self._formatter = None self._padEnd = 0 ...
[ "def", "clear", "(", "self", ")", ":", "self", ".", "_minimum", "=", "None", "self", ".", "_maximum", "=", "None", "self", ".", "_step", "=", "None", "self", ".", "_notches", "=", "None", "self", ".", "_format", "=", "None", "self", ".", "_formatter"...
Clears all the cached information about this ruler.
[ "Clears", "all", "the", "cached", "information", "about", "this", "ruler", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xchartwidget/xchartruler.py#L91-L102
train
bitesofcode/projexui
projexui/widgets/xorbquerywidget/xorbquickfilterwidget.py
XOrbQuickFilterWidget.keyPressEvent
def keyPressEvent(self, event): """ Listens for the enter event to check if the query is setup. """ if event.key() in (Qt.Key_Enter, Qt.Key_Return): self.queryEntered.emit(self.query()) super(XOrbQuickFilterWidget, self).keyPressEvent(event)
python
def keyPressEvent(self, event): """ Listens for the enter event to check if the query is setup. """ if event.key() in (Qt.Key_Enter, Qt.Key_Return): self.queryEntered.emit(self.query()) super(XOrbQuickFilterWidget, self).keyPressEvent(event)
[ "def", "keyPressEvent", "(", "self", ",", "event", ")", ":", "if", "event", ".", "key", "(", ")", "in", "(", "Qt", ".", "Key_Enter", ",", "Qt", ".", "Key_Return", ")", ":", "self", ".", "queryEntered", ".", "emit", "(", "self", ".", "query", "(", ...
Listens for the enter event to check if the query is setup.
[ "Listens", "for", "the", "enter", "event", "to", "check", "if", "the", "query", "is", "setup", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbquerywidget/xorbquickfilterwidget.py#L96-L103
train
bitesofcode/projexui
projexui/widgets/xorbquerywidget/xorbquickfilterwidget.py
XOrbQuickFilterWidget.rebuild
def rebuild(self): """ Rebuilds the data associated with this filter widget. """ table = self.tableType() form = nativestring(self.filterFormat()) if not table and form: if self.layout().count() == 0: self.layout().addWidget(...
python
def rebuild(self): """ Rebuilds the data associated with this filter widget. """ table = self.tableType() form = nativestring(self.filterFormat()) if not table and form: if self.layout().count() == 0: self.layout().addWidget(...
[ "def", "rebuild", "(", "self", ")", ":", "table", "=", "self", ".", "tableType", "(", ")", "form", "=", "nativestring", "(", "self", ".", "filterFormat", "(", ")", ")", "if", "not", "table", "and", "form", ":", "if", "self", ".", "layout", "(", ")"...
Rebuilds the data associated with this filter widget.
[ "Rebuilds", "the", "data", "associated", "with", "this", "filter", "widget", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbquerywidget/xorbquickfilterwidget.py#L105-L168
train
bitesofcode/projexui
projexui/widgets/xorbquerywidget/xorbquickfilterwidget.py
XOrbQuickFilterWidget.showMenu
def showMenu(self, point): """ Displays the menu for this filter widget. """ menu = QMenu(self) acts = {} acts['edit'] = menu.addAction('Edit quick filter...') trigger = menu.exec_(self.mapToGlobal(point)) if trigger == acts['ed...
python
def showMenu(self, point): """ Displays the menu for this filter widget. """ menu = QMenu(self) acts = {} acts['edit'] = menu.addAction('Edit quick filter...') trigger = menu.exec_(self.mapToGlobal(point)) if trigger == acts['ed...
[ "def", "showMenu", "(", "self", ",", "point", ")", ":", "menu", "=", "QMenu", "(", "self", ")", "acts", "=", "{", "}", "acts", "[", "'edit'", "]", "=", "menu", ".", "addAction", "(", "'Edit quick filter...'", ")", "trigger", "=", "menu", ".", "exec_"...
Displays the menu for this filter widget.
[ "Displays", "the", "menu", "for", "this", "filter", "widget", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbquerywidget/xorbquickfilterwidget.py#L170-L188
train
tueda/python-form
form/ioutil.py
set_nonblock
def set_nonblock(fd): # type: (int) -> None """Set the given file descriptor to non-blocking mode.""" fcntl.fcntl(fd, fcntl.F_SETFL, fcntl.fcntl(fd, fcntl.F_GETFL) | os.O_NONBLOCK)
python
def set_nonblock(fd): # type: (int) -> None """Set the given file descriptor to non-blocking mode.""" fcntl.fcntl(fd, fcntl.F_SETFL, fcntl.fcntl(fd, fcntl.F_GETFL) | os.O_NONBLOCK)
[ "def", "set_nonblock", "(", "fd", ")", ":", "fcntl", ".", "fcntl", "(", "fd", ",", "fcntl", ".", "F_SETFL", ",", "fcntl", ".", "fcntl", "(", "fd", ",", "fcntl", ".", "F_GETFL", ")", "|", "os", ".", "O_NONBLOCK", ")" ]
Set the given file descriptor to non-blocking mode.
[ "Set", "the", "given", "file", "descriptor", "to", "non", "-", "blocking", "mode", "." ]
1e5a8464f7a7a6cbbb32411fc2ea3615fd48334b
https://github.com/tueda/python-form/blob/1e5a8464f7a7a6cbbb32411fc2ea3615fd48334b/form/ioutil.py#L10-L15
train
tueda/python-form
form/ioutil.py
PushbackReader.read
def read(self): # type: () -> str """Read data from the stream.""" s = self._buf + self._raw.read() self._buf = '' return s
python
def read(self): # type: () -> str """Read data from the stream.""" s = self._buf + self._raw.read() self._buf = '' return s
[ "def", "read", "(", "self", ")", ":", "s", "=", "self", ".", "_buf", "+", "self", ".", "_raw", ".", "read", "(", ")", "self", ".", "_buf", "=", "''", "return", "s" ]
Read data from the stream.
[ "Read", "data", "from", "the", "stream", "." ]
1e5a8464f7a7a6cbbb32411fc2ea3615fd48334b
https://github.com/tueda/python-form/blob/1e5a8464f7a7a6cbbb32411fc2ea3615fd48334b/form/ioutil.py#L37-L42
train
bearyinnovative/bearychat.py
examples/rtm_loop.py
RTMLoop.on_open
def on_open(self, ws): """Websocket on_open event handler""" def keep_alive(interval): while True: time.sleep(interval) self.ping() start_new_thread(keep_alive, (self.keep_alive_interval, ))
python
def on_open(self, ws): """Websocket on_open event handler""" def keep_alive(interval): while True: time.sleep(interval) self.ping() start_new_thread(keep_alive, (self.keep_alive_interval, ))
[ "def", "on_open", "(", "self", ",", "ws", ")", ":", "def", "keep_alive", "(", "interval", ")", ":", "while", "True", ":", "time", ".", "sleep", "(", "interval", ")", "self", ".", "ping", "(", ")", "start_new_thread", "(", "keep_alive", ",", "(", "sel...
Websocket on_open event handler
[ "Websocket", "on_open", "event", "handler" ]
6c7af2d215c2ff7135bb5af66ca333d0ea1089fd
https://github.com/bearyinnovative/bearychat.py/blob/6c7af2d215c2ff7135bb5af66ca333d0ea1089fd/examples/rtm_loop.py#L50-L57
train
bearyinnovative/bearychat.py
examples/rtm_loop.py
RTMLoop.on_message
def on_message(self, ws, message): """Websocket on_message event handler Saves message as RTMMessage in self._inbox """ try: data = json.loads(message) except Exception: self._set_error(message, "decode message failed") else: self._inb...
python
def on_message(self, ws, message): """Websocket on_message event handler Saves message as RTMMessage in self._inbox """ try: data = json.loads(message) except Exception: self._set_error(message, "decode message failed") else: self._inb...
[ "def", "on_message", "(", "self", ",", "ws", ",", "message", ")", ":", "try", ":", "data", "=", "json", ".", "loads", "(", "message", ")", "except", "Exception", ":", "self", ".", "_set_error", "(", "message", ",", "\"decode message failed\"", ")", "else...
Websocket on_message event handler Saves message as RTMMessage in self._inbox
[ "Websocket", "on_message", "event", "handler" ]
6c7af2d215c2ff7135bb5af66ca333d0ea1089fd
https://github.com/bearyinnovative/bearychat.py/blob/6c7af2d215c2ff7135bb5af66ca333d0ea1089fd/examples/rtm_loop.py#L59-L69
train
bearyinnovative/bearychat.py
examples/rtm_loop.py
RTMLoop.send
def send(self, message): """Sends a RTMMessage Should be called after starting the loop Args: message(RTMMessage): the sending message Raises: WebSocketConnectionClosedException: if the loop is closed """ if "call_id" not in message: ...
python
def send(self, message): """Sends a RTMMessage Should be called after starting the loop Args: message(RTMMessage): the sending message Raises: WebSocketConnectionClosedException: if the loop is closed """ if "call_id" not in message: ...
[ "def", "send", "(", "self", ",", "message", ")", ":", "if", "\"call_id\"", "not", "in", "message", ":", "message", "[", "\"call_id\"", "]", "=", "self", ".", "gen_call_id", "(", ")", "self", ".", "_ws", ".", "send", "(", "message", ".", "to_json", "(...
Sends a RTMMessage Should be called after starting the loop Args: message(RTMMessage): the sending message Raises: WebSocketConnectionClosedException: if the loop is closed
[ "Sends", "a", "RTMMessage", "Should", "be", "called", "after", "starting", "the", "loop" ]
6c7af2d215c2ff7135bb5af66ca333d0ea1089fd
https://github.com/bearyinnovative/bearychat.py/blob/6c7af2d215c2ff7135bb5af66ca333d0ea1089fd/examples/rtm_loop.py#L120-L133
train
bearyinnovative/bearychat.py
examples/rtm_loop.py
RTMLoop.get_message
def get_message(self, block=False, timeout=None): """Removes and returns a RTMMessage from self._inbox Args: block(bool): if True block until a RTMMessage is available, else it will return None when self._inbox is empty timeout(int): it blocks at most ti...
python
def get_message(self, block=False, timeout=None): """Removes and returns a RTMMessage from self._inbox Args: block(bool): if True block until a RTMMessage is available, else it will return None when self._inbox is empty timeout(int): it blocks at most ti...
[ "def", "get_message", "(", "self", ",", "block", "=", "False", ",", "timeout", "=", "None", ")", ":", "try", ":", "message", "=", "self", ".", "_inbox", ".", "get", "(", "block", "=", "block", ",", "timeout", "=", "timeout", ")", "return", "message",...
Removes and returns a RTMMessage from self._inbox Args: block(bool): if True block until a RTMMessage is available, else it will return None when self._inbox is empty timeout(int): it blocks at most timeout seconds Returns: RTMMessage if sel...
[ "Removes", "and", "returns", "a", "RTMMessage", "from", "self", ".", "_inbox" ]
6c7af2d215c2ff7135bb5af66ca333d0ea1089fd
https://github.com/bearyinnovative/bearychat.py/blob/6c7af2d215c2ff7135bb5af66ca333d0ea1089fd/examples/rtm_loop.py#L135-L150
train
bearyinnovative/bearychat.py
examples/rtm_loop.py
RTMLoop.get_error
def get_error(self, block=False, timeout=None): """Removes and returns an error from self._errors Args: block(bool): if True block until a RTMMessage is available, else it will return None when self._inbox is empty timeout(int): it blocks at most timeout...
python
def get_error(self, block=False, timeout=None): """Removes and returns an error from self._errors Args: block(bool): if True block until a RTMMessage is available, else it will return None when self._inbox is empty timeout(int): it blocks at most timeout...
[ "def", "get_error", "(", "self", ",", "block", "=", "False", ",", "timeout", "=", "None", ")", ":", "try", ":", "error", "=", "self", ".", "_errors", ".", "get", "(", "block", "=", "block", ",", "timeout", "=", "timeout", ")", "return", "error", "e...
Removes and returns an error from self._errors Args: block(bool): if True block until a RTMMessage is available, else it will return None when self._inbox is empty timeout(int): it blocks at most timeout seconds Returns: error if inbox is no...
[ "Removes", "and", "returns", "an", "error", "from", "self", ".", "_errors" ]
6c7af2d215c2ff7135bb5af66ca333d0ea1089fd
https://github.com/bearyinnovative/bearychat.py/blob/6c7af2d215c2ff7135bb5af66ca333d0ea1089fd/examples/rtm_loop.py#L152-L167
train
bitesofcode/projexui
projexui/widgets/xorbquerywidget/plugins.py
EnumPlugin.createEditor
def createEditor(self, parent, column, operator, value): """ Creates a new editor for the system. """ editor = super(EnumPlugin, self).createEditor(parent, column, operator, ...
python
def createEditor(self, parent, column, operator, value): """ Creates a new editor for the system. """ editor = super(EnumPlugin, self).createEditor(parent, column, operator, ...
[ "def", "createEditor", "(", "self", ",", "parent", ",", "column", ",", "operator", ",", "value", ")", ":", "editor", "=", "super", "(", "EnumPlugin", ",", "self", ")", ".", "createEditor", "(", "parent", ",", "column", ",", "operator", ",", "value", ")...
Creates a new editor for the system.
[ "Creates", "a", "new", "editor", "for", "the", "system", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbquerywidget/plugins.py#L127-L141
train
bitesofcode/projexui
projexui/widgets/xorbquerywidget/plugins.py
ForeignKeyPlugin.setupQuery
def setupQuery(self, query, op, editor): """ Sets up the query for this editor. """ if editor is not None: value = editor.currentRecord() if value is None: return False return super(ForeignKeyPlugin, self).setupQuery(query...
python
def setupQuery(self, query, op, editor): """ Sets up the query for this editor. """ if editor is not None: value = editor.currentRecord() if value is None: return False return super(ForeignKeyPlugin, self).setupQuery(query...
[ "def", "setupQuery", "(", "self", ",", "query", ",", "op", ",", "editor", ")", ":", "if", "editor", "is", "not", "None", ":", "value", "=", "editor", ".", "currentRecord", "(", ")", "if", "value", "is", "None", ":", "return", "False", "return", "supe...
Sets up the query for this editor.
[ "Sets", "up", "the", "query", "for", "this", "editor", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbquerywidget/plugins.py#L189-L198
train
hover2pi/svo_filters
svo_filters/svo.py
color_gen
def color_gen(colormap='viridis', key=None, n=15): """Color generator for Bokeh plots Parameters ---------- colormap: str, sequence The name of the color map Returns ------- generator A generator for the color palette """ if colormap in dir(bpal): palette = ...
python
def color_gen(colormap='viridis', key=None, n=15): """Color generator for Bokeh plots Parameters ---------- colormap: str, sequence The name of the color map Returns ------- generator A generator for the color palette """ if colormap in dir(bpal): palette = ...
[ "def", "color_gen", "(", "colormap", "=", "'viridis'", ",", "key", "=", "None", ",", "n", "=", "15", ")", ":", "if", "colormap", "in", "dir", "(", "bpal", ")", ":", "palette", "=", "getattr", "(", "bpal", ",", "colormap", ")", "if", "isinstance", "...
Color generator for Bokeh plots Parameters ---------- colormap: str, sequence The name of the color map Returns ------- generator A generator for the color palette
[ "Color", "generator", "for", "Bokeh", "plots" ]
f0587c4908baf636d4bdf030fa95029e8f31b975
https://github.com/hover2pi/svo_filters/blob/f0587c4908baf636d4bdf030fa95029e8f31b975/svo_filters/svo.py#L763-L796
train
hover2pi/svo_filters
svo_filters/svo.py
filters
def filters(filter_directory=None, update=False, fmt='table', **kwargs): """ Get a list of the available filters Parameters ---------- filter_directory: str The directory containing the filter relative spectral response curves update: bool Check the filter directory for new filt...
python
def filters(filter_directory=None, update=False, fmt='table', **kwargs): """ Get a list of the available filters Parameters ---------- filter_directory: str The directory containing the filter relative spectral response curves update: bool Check the filter directory for new filt...
[ "def", "filters", "(", "filter_directory", "=", "None", ",", "update", "=", "False", ",", "fmt", "=", "'table'", ",", "**", "kwargs", ")", ":", "if", "filter_directory", "is", "None", ":", "filter_directory", "=", "resource_filename", "(", "'svo_filters'", "...
Get a list of the available filters Parameters ---------- filter_directory: str The directory containing the filter relative spectral response curves update: bool Check the filter directory for new filters and generate pickle of table fmt: str The format for the returned tab...
[ "Get", "a", "list", "of", "the", "available", "filters" ]
f0587c4908baf636d4bdf030fa95029e8f31b975
https://github.com/hover2pi/svo_filters/blob/f0587c4908baf636d4bdf030fa95029e8f31b975/svo_filters/svo.py#L799-L886
train
hover2pi/svo_filters
svo_filters/svo.py
rebin_spec
def rebin_spec(spec, wavnew, oversamp=100, plot=False): """ Rebin a spectrum to a new wavelength array while preserving the total flux Parameters ---------- spec: array-like The wavelength and flux to be binned wavenew: array-like The new wavelength array Returns --...
python
def rebin_spec(spec, wavnew, oversamp=100, plot=False): """ Rebin a spectrum to a new wavelength array while preserving the total flux Parameters ---------- spec: array-like The wavelength and flux to be binned wavenew: array-like The new wavelength array Returns --...
[ "def", "rebin_spec", "(", "spec", ",", "wavnew", ",", "oversamp", "=", "100", ",", "plot", "=", "False", ")", ":", "wave", ",", "flux", "=", "spec", "nlam", "=", "len", "(", "wave", ")", "x0", "=", "np", ".", "arange", "(", "nlam", ",", "dtype", ...
Rebin a spectrum to a new wavelength array while preserving the total flux Parameters ---------- spec: array-like The wavelength and flux to be binned wavenew: array-like The new wavelength array Returns ------- np.ndarray The rebinned flux
[ "Rebin", "a", "spectrum", "to", "a", "new", "wavelength", "array", "while", "preserving", "the", "total", "flux" ]
f0587c4908baf636d4bdf030fa95029e8f31b975
https://github.com/hover2pi/svo_filters/blob/f0587c4908baf636d4bdf030fa95029e8f31b975/svo_filters/svo.py#L889-L931
train