id
int32
0
252k
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
238,900
znerol/txexiftool
txexiftool/__init__.py
ExiftoolProtocol.dataReceived
def dataReceived(self, data): """ Parses chunks of bytes into responses. Whenever a complete response is received, this method extracts its payload and calls L{responseReceived} to process it. @param data: A chunk of data representing a (possibly partial) response @type...
python
def dataReceived(self, data): """ Parses chunks of bytes into responses. Whenever a complete response is received, this method extracts its payload and calls L{responseReceived} to process it. @param data: A chunk of data representing a (possibly partial) response @type...
[ "def", "dataReceived", "(", "self", ",", "data", ")", ":", "size", "=", "len", "(", "self", ".", "_buffer", ")", "+", "len", "(", "data", ")", "if", "size", ">", "self", ".", "MAX_LENGTH", ":", "self", ".", "lengthLimitExceeded", "(", "size", ")", ...
Parses chunks of bytes into responses. Whenever a complete response is received, this method extracts its payload and calls L{responseReceived} to process it. @param data: A chunk of data representing a (possibly partial) response @type data: C{bytes}
[ "Parses", "chunks", "of", "bytes", "into", "responses", "." ]
a3d75a31262a492f81072840d4fc818f65bf3265
https://github.com/znerol/txexiftool/blob/a3d75a31262a492f81072840d4fc818f65bf3265/txexiftool/__init__.py#L42-L68
238,901
znerol/txexiftool
txexiftool/__init__.py
ExiftoolProtocol.responseReceived
def responseReceived(self, response, tag): """ Receives some characters of a netstring. Whenever a complete response is received, this method calls the deferred associated with it. @param response: A complete response generated by exiftool. @type response: C{bytes} ...
python
def responseReceived(self, response, tag): """ Receives some characters of a netstring. Whenever a complete response is received, this method calls the deferred associated with it. @param response: A complete response generated by exiftool. @type response: C{bytes} ...
[ "def", "responseReceived", "(", "self", ",", "response", ",", "tag", ")", ":", "self", ".", "_queue", ".", "pop", "(", "tag", ")", ".", "callback", "(", "response", ")" ]
Receives some characters of a netstring. Whenever a complete response is received, this method calls the deferred associated with it. @param response: A complete response generated by exiftool. @type response: C{bytes} @param tag: The tag associated with the response @t...
[ "Receives", "some", "characters", "of", "a", "netstring", "." ]
a3d75a31262a492f81072840d4fc818f65bf3265
https://github.com/znerol/txexiftool/blob/a3d75a31262a492f81072840d4fc818f65bf3265/txexiftool/__init__.py#L70-L82
238,902
znerol/txexiftool
txexiftool/__init__.py
ExiftoolProtocol.execute
def execute(self, *args): """ Pass one command to exiftool and return a deferred which is fired as soon as the command completes. @param *args: Command line arguments passed to exiftool @type *args: C{unicode} @rtype: C{Deferred} @return: A deferred whose callba...
python
def execute(self, *args): """ Pass one command to exiftool and return a deferred which is fired as soon as the command completes. @param *args: Command line arguments passed to exiftool @type *args: C{unicode} @rtype: C{Deferred} @return: A deferred whose callba...
[ "def", "execute", "(", "self", ",", "*", "args", ")", ":", "result", "=", "defer", ".", "Deferred", "(", ")", "if", "self", ".", "connected", "and", "not", "self", ".", "_stopped", ":", "self", ".", "_tag", "+=", "1", "args", "=", "tuple", "(", "...
Pass one command to exiftool and return a deferred which is fired as soon as the command completes. @param *args: Command line arguments passed to exiftool @type *args: C{unicode} @rtype: C{Deferred} @return: A deferred whose callback will be invoked when the command co...
[ "Pass", "one", "command", "to", "exiftool", "and", "return", "a", "deferred", "which", "is", "fired", "as", "soon", "as", "the", "command", "completes", "." ]
a3d75a31262a492f81072840d4fc818f65bf3265
https://github.com/znerol/txexiftool/blob/a3d75a31262a492f81072840d4fc818f65bf3265/txexiftool/__init__.py#L95-L121
238,903
znerol/txexiftool
txexiftool/__init__.py
ExiftoolProtocol.loseConnection
def loseConnection(self): """ Close the connection and terminate the exiftool process. @rtype: C{Deferred} @return: A deferred whose callback will be invoked when the connection was closed. """ if self._stopped: result = self._stopped elif sel...
python
def loseConnection(self): """ Close the connection and terminate the exiftool process. @rtype: C{Deferred} @return: A deferred whose callback will be invoked when the connection was closed. """ if self._stopped: result = self._stopped elif sel...
[ "def", "loseConnection", "(", "self", ")", ":", "if", "self", ".", "_stopped", ":", "result", "=", "self", ".", "_stopped", "elif", "self", ".", "connected", ":", "result", "=", "defer", ".", "Deferred", "(", ")", "self", ".", "_stopped", "=", "result"...
Close the connection and terminate the exiftool process. @rtype: C{Deferred} @return: A deferred whose callback will be invoked when the connection was closed.
[ "Close", "the", "connection", "and", "terminate", "the", "exiftool", "process", "." ]
a3d75a31262a492f81072840d4fc818f65bf3265
https://github.com/znerol/txexiftool/blob/a3d75a31262a492f81072840d4fc818f65bf3265/txexiftool/__init__.py#L124-L142
238,904
znerol/txexiftool
txexiftool/__init__.py
ExiftoolProtocol.connectionLost
def connectionLost(self, reason=protocol.connectionDone): """ Check whether termination was intended and invoke the deferred. If the connection terminated unexpectedly, reraise the failure. @type reason: L{twisted.python.failure.Failure} """ self.connected = 0 ...
python
def connectionLost(self, reason=protocol.connectionDone): """ Check whether termination was intended and invoke the deferred. If the connection terminated unexpectedly, reraise the failure. @type reason: L{twisted.python.failure.Failure} """ self.connected = 0 ...
[ "def", "connectionLost", "(", "self", ",", "reason", "=", "protocol", ".", "connectionDone", ")", ":", "self", ".", "connected", "=", "0", "for", "pending", "in", "self", ".", "_queue", ".", "values", "(", ")", ":", "pending", ".", "errback", "(", "rea...
Check whether termination was intended and invoke the deferred. If the connection terminated unexpectedly, reraise the failure. @type reason: L{twisted.python.failure.Failure}
[ "Check", "whether", "termination", "was", "intended", "and", "invoke", "the", "deferred", "." ]
a3d75a31262a492f81072840d4fc818f65bf3265
https://github.com/znerol/txexiftool/blob/a3d75a31262a492f81072840d4fc818f65bf3265/txexiftool/__init__.py#L144-L163
238,905
JoaoFelipe/pyposast
pyposast/utils.py
find_next_character
def find_next_character(code, position, char): """Find next char and return its first and last positions""" end = LineCol(code, *position) while not end.eof and end.char() in WHITESPACE: end.inc() if not end.eof and end.char() == char: return end.tuple(), inc_tuple(end.tuple()) retu...
python
def find_next_character(code, position, char): """Find next char and return its first and last positions""" end = LineCol(code, *position) while not end.eof and end.char() in WHITESPACE: end.inc() if not end.eof and end.char() == char: return end.tuple(), inc_tuple(end.tuple()) retu...
[ "def", "find_next_character", "(", "code", ",", "position", ",", "char", ")", ":", "end", "=", "LineCol", "(", "code", ",", "*", "position", ")", "while", "not", "end", ".", "eof", "and", "end", ".", "char", "(", ")", "in", "WHITESPACE", ":", "end", ...
Find next char and return its first and last positions
[ "Find", "next", "char", "and", "return", "its", "first", "and", "last", "positions" ]
497c88c66b451ff2cd7354be1af070c92e119f41
https://github.com/JoaoFelipe/pyposast/blob/497c88c66b451ff2cd7354be1af070c92e119f41/pyposast/utils.py#L132-L140
238,906
pip-services3-python/pip-services3-commons-python
pip_services3_commons/data/ProjectionParams.py
ProjectionParams.from_value
def from_value(value = None): """ Converts specified value into ProjectionParams. :param value: value to be converted :return: a newly created ProjectionParams. """ if isinstance(value, ProjectionParams): return value array = AnyValueArray.from_value...
python
def from_value(value = None): """ Converts specified value into ProjectionParams. :param value: value to be converted :return: a newly created ProjectionParams. """ if isinstance(value, ProjectionParams): return value array = AnyValueArray.from_value...
[ "def", "from_value", "(", "value", "=", "None", ")", ":", "if", "isinstance", "(", "value", ",", "ProjectionParams", ")", ":", "return", "value", "array", "=", "AnyValueArray", ".", "from_value", "(", "value", ")", "if", "value", "!=", "None", "else", "A...
Converts specified value into ProjectionParams. :param value: value to be converted :return: a newly created ProjectionParams.
[ "Converts", "specified", "value", "into", "ProjectionParams", "." ]
22cbbb3e91e49717f65c083d36147fdb07ba9e3b
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/data/ProjectionParams.py#L50-L61
238,907
pip-services3-python/pip-services3-commons-python
pip_services3_commons/data/ProjectionParams.py
ProjectionParams.to_string
def to_string(self): """ Gets a string representation of the object. The result is a comma-separated list of projection fields "field1,field2.field21,field2.field22.field221" :return: a string representation of the object. """ builder = "" index = 0 ...
python
def to_string(self): """ Gets a string representation of the object. The result is a comma-separated list of projection fields "field1,field2.field21,field2.field22.field221" :return: a string representation of the object. """ builder = "" index = 0 ...
[ "def", "to_string", "(", "self", ")", ":", "builder", "=", "\"\"", "index", "=", "0", "while", "index", "<", "self", ".", "__len__", "(", ")", ":", "if", "index", ">", "0", ":", "builder", "=", "builder", "+", "','", "builder", "=", "builder", "+",...
Gets a string representation of the object. The result is a comma-separated list of projection fields "field1,field2.field21,field2.field22.field221" :return: a string representation of the object.
[ "Gets", "a", "string", "representation", "of", "the", "object", ".", "The", "result", "is", "a", "comma", "-", "separated", "list", "of", "projection", "fields", "field1", "field2", ".", "field21", "field2", ".", "field22", ".", "field221" ]
22cbbb3e91e49717f65c083d36147fdb07ba9e3b
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/data/ProjectionParams.py#L79-L96
238,908
mikicz/arca
arca/backend/base.py
BaseBackend.snake_case_backend_name
def snake_case_backend_name(self): """ CamelCase -> camel_case """ s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', type(self).__name__) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
python
def snake_case_backend_name(self): """ CamelCase -> camel_case """ s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', type(self).__name__) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
[ "def", "snake_case_backend_name", "(", "self", ")", ":", "s1", "=", "re", ".", "sub", "(", "'(.)([A-Z][a-z]+)'", ",", "r'\\1_\\2'", ",", "type", "(", "self", ")", ".", "__name__", ")", "return", "re", ".", "sub", "(", "'([a-z0-9])([A-Z])'", ",", "r'\\1_\\2...
CamelCase -> camel_case
[ "CamelCase", "-", ">", "camel_case" ]
e67fdc00be473ecf8ec16d024e1a3f2c47ca882c
https://github.com/mikicz/arca/blob/e67fdc00be473ecf8ec16d024e1a3f2c47ca882c/arca/backend/base.py#L69-L73
238,909
mikicz/arca
arca/backend/base.py
BaseBackend.get_setting
def get_setting(self, key, default=NOT_SET): """ Gets a setting for the key. :raise KeyError: If the key is not set and default isn't provided. """ if self._arca is None: raise LazySettingProperty.SettingsNotReady return self._arca.settings.get(*self.get_settings_key...
python
def get_setting(self, key, default=NOT_SET): """ Gets a setting for the key. :raise KeyError: If the key is not set and default isn't provided. """ if self._arca is None: raise LazySettingProperty.SettingsNotReady return self._arca.settings.get(*self.get_settings_key...
[ "def", "get_setting", "(", "self", ",", "key", ",", "default", "=", "NOT_SET", ")", ":", "if", "self", ".", "_arca", "is", "None", ":", "raise", "LazySettingProperty", ".", "SettingsNotReady", "return", "self", ".", "_arca", ".", "settings", ".", "get", ...
Gets a setting for the key. :raise KeyError: If the key is not set and default isn't provided.
[ "Gets", "a", "setting", "for", "the", "key", "." ]
e67fdc00be473ecf8ec16d024e1a3f2c47ca882c
https://github.com/mikicz/arca/blob/e67fdc00be473ecf8ec16d024e1a3f2c47ca882c/arca/backend/base.py#L82-L89
238,910
mikicz/arca
arca/backend/base.py
BaseBackend.hash_file_contents
def hash_file_contents(requirements_option: RequirementsOptions, path: Path) -> str: """ Returns a SHA256 hash of the contents of ``path`` combined with the Arca version. """ return hashlib.sha256(path.read_bytes() + bytes( requirements_option.name + arca.__version__, "utf-8" ...
python
def hash_file_contents(requirements_option: RequirementsOptions, path: Path) -> str: """ Returns a SHA256 hash of the contents of ``path`` combined with the Arca version. """ return hashlib.sha256(path.read_bytes() + bytes( requirements_option.name + arca.__version__, "utf-8" ...
[ "def", "hash_file_contents", "(", "requirements_option", ":", "RequirementsOptions", ",", "path", ":", "Path", ")", "->", "str", ":", "return", "hashlib", ".", "sha256", "(", "path", ".", "read_bytes", "(", ")", "+", "bytes", "(", "requirements_option", ".", ...
Returns a SHA256 hash of the contents of ``path`` combined with the Arca version.
[ "Returns", "a", "SHA256", "hash", "of", "the", "contents", "of", "path", "combined", "with", "the", "Arca", "version", "." ]
e67fdc00be473ecf8ec16d024e1a3f2c47ca882c
https://github.com/mikicz/arca/blob/e67fdc00be473ecf8ec16d024e1a3f2c47ca882c/arca/backend/base.py#L92-L97
238,911
mikicz/arca
arca/backend/base.py
BaseBackend.get_requirements_information
def get_requirements_information(self, path: Path) -> Tuple[RequirementsOptions, Optional[str]]: """ Returns the information needed to install requirements for a repository - what kind is used and the hash of contents of the defining file. """ if self.pipfile_location is not None...
python
def get_requirements_information(self, path: Path) -> Tuple[RequirementsOptions, Optional[str]]: """ Returns the information needed to install requirements for a repository - what kind is used and the hash of contents of the defining file. """ if self.pipfile_location is not None...
[ "def", "get_requirements_information", "(", "self", ",", "path", ":", "Path", ")", "->", "Tuple", "[", "RequirementsOptions", ",", "Optional", "[", "str", "]", "]", ":", "if", "self", ".", "pipfile_location", "is", "not", "None", ":", "pipfile", "=", "path...
Returns the information needed to install requirements for a repository - what kind is used and the hash of contents of the defining file.
[ "Returns", "the", "information", "needed", "to", "install", "requirements", "for", "a", "repository", "-", "what", "kind", "is", "used", "and", "the", "hash", "of", "contents", "of", "the", "defining", "file", "." ]
e67fdc00be473ecf8ec16d024e1a3f2c47ca882c
https://github.com/mikicz/arca/blob/e67fdc00be473ecf8ec16d024e1a3f2c47ca882c/arca/backend/base.py#L99-L126
238,912
mikicz/arca
arca/backend/base.py
BaseBackend.serialized_task
def serialized_task(self, task: Task) -> Tuple[str, str]: """ Returns the name of the task definition file and its contents. """ return f"{task.hash}.json", task.json
python
def serialized_task(self, task: Task) -> Tuple[str, str]: """ Returns the name of the task definition file and its contents. """ return f"{task.hash}.json", task.json
[ "def", "serialized_task", "(", "self", ",", "task", ":", "Task", ")", "->", "Tuple", "[", "str", ",", "str", "]", ":", "return", "f\"{task.hash}.json\"", ",", "task", ".", "json" ]
Returns the name of the task definition file and its contents.
[ "Returns", "the", "name", "of", "the", "task", "definition", "file", "and", "its", "contents", "." ]
e67fdc00be473ecf8ec16d024e1a3f2c47ca882c
https://github.com/mikicz/arca/blob/e67fdc00be473ecf8ec16d024e1a3f2c47ca882c/arca/backend/base.py#L128-L131
238,913
mikicz/arca
arca/backend/base.py
BaseBackend.run
def run(self, repo: str, branch: str, task: Task, git_repo: Repo, repo_path: Path) -> Result: # pragma: no cover """ Executes the script and returns the result. Must be implemented by subclasses. :param repo: Repo URL :param branch: Branch name :param task: The request...
python
def run(self, repo: str, branch: str, task: Task, git_repo: Repo, repo_path: Path) -> Result: # pragma: no cover """ Executes the script and returns the result. Must be implemented by subclasses. :param repo: Repo URL :param branch: Branch name :param task: The request...
[ "def", "run", "(", "self", ",", "repo", ":", "str", ",", "branch", ":", "str", ",", "task", ":", "Task", ",", "git_repo", ":", "Repo", ",", "repo_path", ":", "Path", ")", "->", "Result", ":", "# pragma: no cover", "raise", "NotImplementedError" ]
Executes the script and returns the result. Must be implemented by subclasses. :param repo: Repo URL :param branch: Branch name :param task: The requested :class:`Task` :param git_repo: A :class:`Repo <git.repo.base.Repo>` of the repo/branch :param repo_path: :class:`Pa...
[ "Executes", "the", "script", "and", "returns", "the", "result", "." ]
e67fdc00be473ecf8ec16d024e1a3f2c47ca882c
https://github.com/mikicz/arca/blob/e67fdc00be473ecf8ec16d024e1a3f2c47ca882c/arca/backend/base.py#L133-L146
238,914
mikicz/arca
arca/backend/base.py
BaseRunInSubprocessBackend.get_or_create_environment
def get_or_create_environment(self, repo: str, branch: str, git_repo: Repo, repo_path: Path) -> str: # pragma: no cover """ Abstract method which must be implemented in subclasses, which must return a str path to a Python executable which will be used to run th...
python
def get_or_create_environment(self, repo: str, branch: str, git_repo: Repo, repo_path: Path) -> str: # pragma: no cover """ Abstract method which must be implemented in subclasses, which must return a str path to a Python executable which will be used to run th...
[ "def", "get_or_create_environment", "(", "self", ",", "repo", ":", "str", ",", "branch", ":", "str", ",", "git_repo", ":", "Repo", ",", "repo_path", ":", "Path", ")", "->", "str", ":", "# pragma: no cover", "raise", "NotImplementedError" ]
Abstract method which must be implemented in subclasses, which must return a str path to a Python executable which will be used to run the script. See :meth:`BaseBackend.run <arca.BaseBackend.run>` to see arguments description.
[ "Abstract", "method", "which", "must", "be", "implemented", "in", "subclasses", "which", "must", "return", "a", "str", "path", "to", "a", "Python", "executable", "which", "will", "be", "used", "to", "run", "the", "script", "." ]
e67fdc00be473ecf8ec16d024e1a3f2c47ca882c
https://github.com/mikicz/arca/blob/e67fdc00be473ecf8ec16d024e1a3f2c47ca882c/arca/backend/base.py#L153-L161
238,915
voicecom/pgtool
pgtool/pgtool.py
quote_names
def quote_names(db, names): """psycopg2 doesn't know how to quote identifier names, so we ask the server""" c = db.cursor() c.execute("SELECT pg_catalog.quote_ident(n) FROM pg_catalog.unnest(%s::text[]) n", [list(names)]) return [name for (name,) in c]
python
def quote_names(db, names): """psycopg2 doesn't know how to quote identifier names, so we ask the server""" c = db.cursor() c.execute("SELECT pg_catalog.quote_ident(n) FROM pg_catalog.unnest(%s::text[]) n", [list(names)]) return [name for (name,) in c]
[ "def", "quote_names", "(", "db", ",", "names", ")", ":", "c", "=", "db", ".", "cursor", "(", ")", "c", ".", "execute", "(", "\"SELECT pg_catalog.quote_ident(n) FROM pg_catalog.unnest(%s::text[]) n\"", ",", "[", "list", "(", "names", ")", "]", ")", "return", ...
psycopg2 doesn't know how to quote identifier names, so we ask the server
[ "psycopg2", "doesn", "t", "know", "how", "to", "quote", "identifier", "names", "so", "we", "ask", "the", "server" ]
36b8682bfca614d784fe58451e0cbc41315bc72e
https://github.com/voicecom/pgtool/blob/36b8682bfca614d784fe58451e0cbc41315bc72e/pgtool/pgtool.py#L63-L67
238,916
voicecom/pgtool
pgtool/pgtool.py
execute_catch
def execute_catch(c, sql, vars=None): """Run a query, but ignore any errors. For error recovery paths where the error handler should not raise another.""" try: c.execute(sql, vars) except Exception as err: cmd = sql.split(' ', 1)[0] log.error("Error executing %s: %s", cmd, err)
python
def execute_catch(c, sql, vars=None): """Run a query, but ignore any errors. For error recovery paths where the error handler should not raise another.""" try: c.execute(sql, vars) except Exception as err: cmd = sql.split(' ', 1)[0] log.error("Error executing %s: %s", cmd, err)
[ "def", "execute_catch", "(", "c", ",", "sql", ",", "vars", "=", "None", ")", ":", "try", ":", "c", ".", "execute", "(", "sql", ",", "vars", ")", "except", "Exception", "as", "err", ":", "cmd", "=", "sql", ".", "split", "(", "' '", ",", "1", ")"...
Run a query, but ignore any errors. For error recovery paths where the error handler should not raise another.
[ "Run", "a", "query", "but", "ignore", "any", "errors", ".", "For", "error", "recovery", "paths", "where", "the", "error", "handler", "should", "not", "raise", "another", "." ]
36b8682bfca614d784fe58451e0cbc41315bc72e
https://github.com/voicecom/pgtool/blob/36b8682bfca614d784fe58451e0cbc41315bc72e/pgtool/pgtool.py#L70-L76
238,917
voicecom/pgtool
pgtool/pgtool.py
cmd_copy
def cmd_copy(): """Uses CREATE DATABASE ... TEMPLATE to create a duplicate of a database. Additionally copies over database-specific settings. When used with --force, an existing database with the same name as DEST is replaced, the original is renamed out of place in the form DEST_old_YYYYMMDD (unless ...
python
def cmd_copy(): """Uses CREATE DATABASE ... TEMPLATE to create a duplicate of a database. Additionally copies over database-specific settings. When used with --force, an existing database with the same name as DEST is replaced, the original is renamed out of place in the form DEST_old_YYYYMMDD (unless ...
[ "def", "cmd_copy", "(", ")", ":", "db", "=", "connect", "(", ")", "if", "args", ".", "force", "and", "db_exists", "(", "db", ",", "args", ".", "dest", ")", ":", "tmp_db", "=", "generate_alt_dbname", "(", "db", ",", "args", ".", "dest", ",", "'tmp'"...
Uses CREATE DATABASE ... TEMPLATE to create a duplicate of a database. Additionally copies over database-specific settings. When used with --force, an existing database with the same name as DEST is replaced, the original is renamed out of place in the form DEST_old_YYYYMMDD (unless --no-backup is specifie...
[ "Uses", "CREATE", "DATABASE", "...", "TEMPLATE", "to", "create", "a", "duplicate", "of", "a", "database", ".", "Additionally", "copies", "over", "database", "-", "specific", "settings", "." ]
36b8682bfca614d784fe58451e0cbc41315bc72e
https://github.com/voicecom/pgtool/blob/36b8682bfca614d784fe58451e0cbc41315bc72e/pgtool/pgtool.py#L290-L306
238,918
voicecom/pgtool
pgtool/pgtool.py
cmd_move
def cmd_move(db=None): """Rename a database within a server. When used with --force, an existing database with the same name as DEST is replaced, the original is renamed out of place in the form DEST_old_YYYYMMDD (unless --no-backup is specified). """ if db is None: db = connect() pg_m...
python
def cmd_move(db=None): """Rename a database within a server. When used with --force, an existing database with the same name as DEST is replaced, the original is renamed out of place in the form DEST_old_YYYYMMDD (unless --no-backup is specified). """ if db is None: db = connect() pg_m...
[ "def", "cmd_move", "(", "db", "=", "None", ")", ":", "if", "db", "is", "None", ":", "db", "=", "connect", "(", ")", "pg_move_extended", "(", "db", ",", "args", ".", "src", ",", "args", ".", "dest", ")" ]
Rename a database within a server. When used with --force, an existing database with the same name as DEST is replaced, the original is renamed out of place in the form DEST_old_YYYYMMDD (unless --no-backup is specified).
[ "Rename", "a", "database", "within", "a", "server", "." ]
36b8682bfca614d784fe58451e0cbc41315bc72e
https://github.com/voicecom/pgtool/blob/36b8682bfca614d784fe58451e0cbc41315bc72e/pgtool/pgtool.py#L309-L318
238,919
voicecom/pgtool
pgtool/pgtool.py
cmd_reindex
def cmd_reindex(): """Uses CREATE INDEX CONCURRENTLY to create a duplicate index, then tries to swap the new index for the original. The index swap is done using a short lock timeout to prevent it from interfering with running queries. Retries until the rename succeeds. """ db = connect(args.databa...
python
def cmd_reindex(): """Uses CREATE INDEX CONCURRENTLY to create a duplicate index, then tries to swap the new index for the original. The index swap is done using a short lock timeout to prevent it from interfering with running queries. Retries until the rename succeeds. """ db = connect(args.databa...
[ "def", "cmd_reindex", "(", ")", ":", "db", "=", "connect", "(", "args", ".", "database", ")", "for", "idx", "in", "args", ".", "indexes", ":", "pg_reindex", "(", "db", ",", "idx", ")" ]
Uses CREATE INDEX CONCURRENTLY to create a duplicate index, then tries to swap the new index for the original. The index swap is done using a short lock timeout to prevent it from interfering with running queries. Retries until the rename succeeds.
[ "Uses", "CREATE", "INDEX", "CONCURRENTLY", "to", "create", "a", "duplicate", "index", "then", "tries", "to", "swap", "the", "new", "index", "for", "the", "original", "." ]
36b8682bfca614d784fe58451e0cbc41315bc72e
https://github.com/voicecom/pgtool/blob/36b8682bfca614d784fe58451e0cbc41315bc72e/pgtool/pgtool.py#L331-L339
238,920
luismsgomes/stringology
src/stringology/align.py
align
def align(s1, s2, gap=' ', eq=operator.eq): '''aligns two strings >>> print(*align('pharmacy', 'farmácia', gap='_'), sep='\\n') pharmac_y _farmácia >>> print(*align('advantage', 'vantagem', gap='_'), sep='\\n') advantage_ __vantagem ''' # first we compute the dynamic programming t...
python
def align(s1, s2, gap=' ', eq=operator.eq): '''aligns two strings >>> print(*align('pharmacy', 'farmácia', gap='_'), sep='\\n') pharmac_y _farmácia >>> print(*align('advantage', 'vantagem', gap='_'), sep='\\n') advantage_ __vantagem ''' # first we compute the dynamic programming t...
[ "def", "align", "(", "s1", ",", "s2", ",", "gap", "=", "' '", ",", "eq", "=", "operator", ".", "eq", ")", ":", "# first we compute the dynamic programming table", "m", ",", "n", "=", "len", "(", "s1", ")", ",", "len", "(", "s2", ")", "table", "=", ...
aligns two strings >>> print(*align('pharmacy', 'farmácia', gap='_'), sep='\\n') pharmac_y _farmácia >>> print(*align('advantage', 'vantagem', gap='_'), sep='\\n') advantage_ __vantagem
[ "aligns", "two", "strings" ]
c627dc5a0d4c6af10946040a6463d5495d39d960
https://github.com/luismsgomes/stringology/blob/c627dc5a0d4c6af10946040a6463d5495d39d960/src/stringology/align.py#L4-L44
238,921
luismsgomes/stringology
src/stringology/align.py
mismatches
def mismatches(s1, s2, context=0, eq=operator.eq): '''extract mismatched segments from aligned strings >>> list(mismatches(*align('pharmacy', 'farmácia'), context=1)) [('pha', ' fa'), ('mac', 'mác'), ('c y', 'cia')] >>> list(mismatches(*align('constitution', 'constituição'), context=1)) [('ution',...
python
def mismatches(s1, s2, context=0, eq=operator.eq): '''extract mismatched segments from aligned strings >>> list(mismatches(*align('pharmacy', 'farmácia'), context=1)) [('pha', ' fa'), ('mac', 'mác'), ('c y', 'cia')] >>> list(mismatches(*align('constitution', 'constituição'), context=1)) [('ution',...
[ "def", "mismatches", "(", "s1", ",", "s2", ",", "context", "=", "0", ",", "eq", "=", "operator", ".", "eq", ")", ":", "n", "=", "len", "(", "s1", ")", "assert", "(", "len", "(", "s2", ")", "==", "n", ")", "lct", ",", "rct", "=", "context", ...
extract mismatched segments from aligned strings >>> list(mismatches(*align('pharmacy', 'farmácia'), context=1)) [('pha', ' fa'), ('mac', 'mác'), ('c y', 'cia')] >>> list(mismatches(*align('constitution', 'constituição'), context=1)) [('ution', 'uição')] >>> list(mismatches(*align('idea', 'ideia'...
[ "extract", "mismatched", "segments", "from", "aligned", "strings" ]
c627dc5a0d4c6af10946040a6463d5495d39d960
https://github.com/luismsgomes/stringology/blob/c627dc5a0d4c6af10946040a6463d5495d39d960/src/stringology/align.py#L47-L81
238,922
williamfzc/ConnectionTracer
ConnectionTracer/__init__.py
_init
def _init(): """ build connection and init it""" connection.connect() # start track # all services were provided here: # https://android.googlesource.com/platform/system/core/+/jb-dev/adb/SERVICES.TXT ready_data = utils.encode_data('host:track-devices') connection.adb_socket.send(ready_data...
python
def _init(): """ build connection and init it""" connection.connect() # start track # all services were provided here: # https://android.googlesource.com/platform/system/core/+/jb-dev/adb/SERVICES.TXT ready_data = utils.encode_data('host:track-devices') connection.adb_socket.send(ready_data...
[ "def", "_init", "(", ")", ":", "connection", ".", "connect", "(", ")", "# start track", "# all services were provided here:", "# https://android.googlesource.com/platform/system/core/+/jb-dev/adb/SERVICES.TXT", "ready_data", "=", "utils", ".", "encode_data", "(", "'host:track-d...
build connection and init it
[ "build", "connection", "and", "init", "it" ]
190003e374d6903cb82d2d21a1378979dc419ed3
https://github.com/williamfzc/ConnectionTracer/blob/190003e374d6903cb82d2d21a1378979dc419ed3/ConnectionTracer/__init__.py#L25-L40
238,923
gorakhargosh/pepe
pepe/content_types.py
ContentTypesDatabase.get_comment_group_for_path
def get_comment_group_for_path(self, pathname, default_content_type=None): """ Obtains the comment group for a specified pathname. :param pathname: The path for which the comment group will be obtained. :return: Returns the comment group for the specified pathnam...
python
def get_comment_group_for_path(self, pathname, default_content_type=None): """ Obtains the comment group for a specified pathname. :param pathname: The path for which the comment group will be obtained. :return: Returns the comment group for the specified pathnam...
[ "def", "get_comment_group_for_path", "(", "self", ",", "pathname", ",", "default_content_type", "=", "None", ")", ":", "content_type", "=", "self", ".", "guess_content_type", "(", "pathname", ")", "if", "not", "content_type", ":", "# Content type is not found.", "if...
Obtains the comment group for a specified pathname. :param pathname: The path for which the comment group will be obtained. :return: Returns the comment group for the specified pathname or raises a ``ValueError`` if a content type is not found or raises a...
[ "Obtains", "the", "comment", "group", "for", "a", "specified", "pathname", "." ]
1e40853378d515c99f03b3f59efa9b943d26eb62
https://github.com/gorakhargosh/pepe/blob/1e40853378d515c99f03b3f59efa9b943d26eb62/pepe/content_types.py#L97-L151
238,924
gorakhargosh/pepe
pepe/content_types.py
ContentTypesDatabase.add_config_file
def add_config_file(self, config_filename): """ Parses the content.types file and updates the content types database. :param config_filename: The path to the configuration file. """ with open(config_filename, 'rb') as f: content = f.read() con...
python
def add_config_file(self, config_filename): """ Parses the content.types file and updates the content types database. :param config_filename: The path to the configuration file. """ with open(config_filename, 'rb') as f: content = f.read() con...
[ "def", "add_config_file", "(", "self", ",", "config_filename", ")", ":", "with", "open", "(", "config_filename", ",", "'rb'", ")", "as", "f", ":", "content", "=", "f", ".", "read", "(", ")", "config", "=", "yaml", ".", "load", "(", "content", ")", "s...
Parses the content.types file and updates the content types database. :param config_filename: The path to the configuration file.
[ "Parses", "the", "content", ".", "types", "file", "and", "updates", "the", "content", "types", "database", "." ]
1e40853378d515c99f03b3f59efa9b943d26eb62
https://github.com/gorakhargosh/pepe/blob/1e40853378d515c99f03b3f59efa9b943d26eb62/pepe/content_types.py#L185-L195
238,925
gorakhargosh/pepe
pepe/content_types.py
ContentTypesDatabase.guess_content_type
def guess_content_type(self, pathname): """Guess the content type for the given path. :param path: The path of file for which to guess the content type. :return: Returns the content type or ``None`` if the content type could not be determined. Usage:...
python
def guess_content_type(self, pathname): """Guess the content type for the given path. :param path: The path of file for which to guess the content type. :return: Returns the content type or ``None`` if the content type could not be determined. Usage:...
[ "def", "guess_content_type", "(", "self", ",", "pathname", ")", ":", "file_basename", "=", "os", ".", "path", ".", "basename", "(", "pathname", ")", "content_type", "=", "None", "# Try to determine from the path.", "if", "not", "content_type", "and", "self", "."...
Guess the content type for the given path. :param path: The path of file for which to guess the content type. :return: Returns the content type or ``None`` if the content type could not be determined. Usage: >>> db = ContentTypesDatabase() ...
[ "Guess", "the", "content", "type", "for", "the", "given", "path", "." ]
1e40853378d515c99f03b3f59efa9b943d26eb62
https://github.com/gorakhargosh/pepe/blob/1e40853378d515c99f03b3f59efa9b943d26eb62/pepe/content_types.py#L232-L299
238,926
williamfzc/ConnectionTracer
ConnectionTracer/connection.py
connect
def connect(): """ create socket and connect to adb server """ global adb_socket if adb_socket is not None: raise RuntimeError('connection already existed') host, port = config.HOST, config.PORT connection = socket.socket() try: connection.connect((host, port)) except Conne...
python
def connect(): """ create socket and connect to adb server """ global adb_socket if adb_socket is not None: raise RuntimeError('connection already existed') host, port = config.HOST, config.PORT connection = socket.socket() try: connection.connect((host, port)) except Conne...
[ "def", "connect", "(", ")", ":", "global", "adb_socket", "if", "adb_socket", "is", "not", "None", ":", "raise", "RuntimeError", "(", "'connection already existed'", ")", "host", ",", "port", "=", "config", ".", "HOST", ",", "config", ".", "PORT", "connection...
create socket and connect to adb server
[ "create", "socket", "and", "connect", "to", "adb", "server" ]
190003e374d6903cb82d2d21a1378979dc419ed3
https://github.com/williamfzc/ConnectionTracer/blob/190003e374d6903cb82d2d21a1378979dc419ed3/ConnectionTracer/connection.py#L12-L30
238,927
williamfzc/ConnectionTracer
ConnectionTracer/connection.py
reboot_adb_server
def reboot_adb_server(): """ execute 'adb devices' to start adb server """ _reboot_count = 0 _max_retry = 1 def _reboot(): nonlocal _reboot_count if _reboot_count >= _max_retry: raise RuntimeError('fail after retry {} times'.format(_max_retry)) _reboot_count += 1 ...
python
def reboot_adb_server(): """ execute 'adb devices' to start adb server """ _reboot_count = 0 _max_retry = 1 def _reboot(): nonlocal _reboot_count if _reboot_count >= _max_retry: raise RuntimeError('fail after retry {} times'.format(_max_retry)) _reboot_count += 1 ...
[ "def", "reboot_adb_server", "(", ")", ":", "_reboot_count", "=", "0", "_max_retry", "=", "1", "def", "_reboot", "(", ")", ":", "nonlocal", "_reboot_count", "if", "_reboot_count", ">=", "_max_retry", ":", "raise", "RuntimeError", "(", "'fail after retry {} times'",...
execute 'adb devices' to start adb server
[ "execute", "adb", "devices", "to", "start", "adb", "server" ]
190003e374d6903cb82d2d21a1378979dc419ed3
https://github.com/williamfzc/ConnectionTracer/blob/190003e374d6903cb82d2d21a1378979dc419ed3/ConnectionTracer/connection.py#L49-L65
238,928
koriakin/binflakes
binflakes/sexpr/string.py
escape_string
def escape_string(value): """Converts a string to its S-expression representation, adding quotes and escaping funny characters. """ res = StringIO() res.write('"') for c in value: if c in CHAR_TO_ESCAPE: res.write(f'\\{CHAR_TO_ESCAPE[c]}') elif c.isprintable(): ...
python
def escape_string(value): """Converts a string to its S-expression representation, adding quotes and escaping funny characters. """ res = StringIO() res.write('"') for c in value: if c in CHAR_TO_ESCAPE: res.write(f'\\{CHAR_TO_ESCAPE[c]}') elif c.isprintable(): ...
[ "def", "escape_string", "(", "value", ")", ":", "res", "=", "StringIO", "(", ")", "res", ".", "write", "(", "'\"'", ")", "for", "c", "in", "value", ":", "if", "c", "in", "CHAR_TO_ESCAPE", ":", "res", ".", "write", "(", "f'\\\\{CHAR_TO_ESCAPE[c]}'", ")"...
Converts a string to its S-expression representation, adding quotes and escaping funny characters.
[ "Converts", "a", "string", "to", "its", "S", "-", "expression", "representation", "adding", "quotes", "and", "escaping", "funny", "characters", "." ]
f059cecadf1c605802a713c62375b5bd5606d53f
https://github.com/koriakin/binflakes/blob/f059cecadf1c605802a713c62375b5bd5606d53f/binflakes/sexpr/string.py#L18-L36
238,929
pip-services3-python/pip-services3-commons-python
pip_services3_commons/validate/ObjectComparator.py
ObjectComparator.compare
def compare(value1, operation, value2): """ Perform comparison operation over two arguments. The operation can be performed over values of any type. :param value1: the first argument to compare :param operation: the comparison operation: "==" ("=", "EQ"), "!= " ("<>", "NE"); "<...
python
def compare(value1, operation, value2): """ Perform comparison operation over two arguments. The operation can be performed over values of any type. :param value1: the first argument to compare :param operation: the comparison operation: "==" ("=", "EQ"), "!= " ("<>", "NE"); "<...
[ "def", "compare", "(", "value1", ",", "operation", ",", "value2", ")", ":", "if", "operation", "==", "None", ":", "return", "False", "operation", "=", "operation", ".", "upper", "(", ")", "if", "operation", "in", "[", "\"=\"", ",", "\"==\"", ",", "\"EQ...
Perform comparison operation over two arguments. The operation can be performed over values of any type. :param value1: the first argument to compare :param operation: the comparison operation: "==" ("=", "EQ"), "!= " ("<>", "NE"); "<"/">" ("...
[ "Perform", "comparison", "operation", "over", "two", "arguments", ".", "The", "operation", "can", "be", "performed", "over", "values", "of", "any", "type", "." ]
22cbbb3e91e49717f65c083d36147fdb07ba9e3b
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/validate/ObjectComparator.py#L25-L59
238,930
pip-services3-python/pip-services3-commons-python
pip_services3_commons/validate/ObjectComparator.py
ObjectComparator.are_equal
def are_equal(value1, value2): """ Checks if two values are equal. The operation can be performed over values of any type. :param value1: the first value to compare :param value2: the second value to compare :return: true if values are equal and false otherwise """ ...
python
def are_equal(value1, value2): """ Checks if two values are equal. The operation can be performed over values of any type. :param value1: the first value to compare :param value2: the second value to compare :return: true if values are equal and false otherwise """ ...
[ "def", "are_equal", "(", "value1", ",", "value2", ")", ":", "if", "value1", "==", "None", "or", "value2", "==", "None", ":", "return", "True", "if", "value1", "==", "None", "or", "value2", "==", "None", ":", "return", "False", "return", "value1", "==",...
Checks if two values are equal. The operation can be performed over values of any type. :param value1: the first value to compare :param value2: the second value to compare :return: true if values are equal and false otherwise
[ "Checks", "if", "two", "values", "are", "equal", ".", "The", "operation", "can", "be", "performed", "over", "values", "of", "any", "type", "." ]
22cbbb3e91e49717f65c083d36147fdb07ba9e3b
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/validate/ObjectComparator.py#L62-L76
238,931
pip-services3-python/pip-services3-commons-python
pip_services3_commons/validate/ObjectComparator.py
ObjectComparator.less
def less(value1, value2): """ Checks if first value is less than the second one. The operation can be performed over numbers or strings. :param value1: the first value to compare :param value2: the second value to compare :return: true if the first value is less than s...
python
def less(value1, value2): """ Checks if first value is less than the second one. The operation can be performed over numbers or strings. :param value1: the first value to compare :param value2: the second value to compare :return: true if the first value is less than s...
[ "def", "less", "(", "value1", ",", "value2", ")", ":", "number1", "=", "FloatConverter", ".", "to_nullable_float", "(", "value1", ")", "number2", "=", "FloatConverter", ".", "to_nullable_float", "(", "value2", ")", "if", "number1", "==", "None", "or", "numbe...
Checks if first value is less than the second one. The operation can be performed over numbers or strings. :param value1: the first value to compare :param value2: the second value to compare :return: true if the first value is less than second and false otherwise.
[ "Checks", "if", "first", "value", "is", "less", "than", "the", "second", "one", ".", "The", "operation", "can", "be", "performed", "over", "numbers", "or", "strings", "." ]
22cbbb3e91e49717f65c083d36147fdb07ba9e3b
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/validate/ObjectComparator.py#L92-L109
238,932
pip-services3-python/pip-services3-commons-python
pip_services3_commons/validate/ObjectComparator.py
ObjectComparator.more
def more(value1, value2): """ Checks if first value is greater than the second one. The operation can be performed over numbers or strings. :param value1: the first value to compare :param value2: the second value to compare :return: true if the first value is greater ...
python
def more(value1, value2): """ Checks if first value is greater than the second one. The operation can be performed over numbers or strings. :param value1: the first value to compare :param value2: the second value to compare :return: true if the first value is greater ...
[ "def", "more", "(", "value1", ",", "value2", ")", ":", "number1", "=", "FloatConverter", ".", "to_nullable_float", "(", "value1", ")", "number2", "=", "FloatConverter", ".", "to_nullable_float", "(", "value2", ")", "if", "number1", "==", "None", "or", "numbe...
Checks if first value is greater than the second one. The operation can be performed over numbers or strings. :param value1: the first value to compare :param value2: the second value to compare :return: true if the first value is greater than second and false otherwise.
[ "Checks", "if", "first", "value", "is", "greater", "than", "the", "second", "one", ".", "The", "operation", "can", "be", "performed", "over", "numbers", "or", "strings", "." ]
22cbbb3e91e49717f65c083d36147fdb07ba9e3b
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/validate/ObjectComparator.py#L112-L129
238,933
pip-services3-python/pip-services3-commons-python
pip_services3_commons/validate/ObjectComparator.py
ObjectComparator.match
def match(value1, value2): """ Checks if string matches a regular expression :param value1: a string value to match :param value2: a regular expression string :return: true if the value matches regular expression and false otherwise. """ if value1 == None and v...
python
def match(value1, value2): """ Checks if string matches a regular expression :param value1: a string value to match :param value2: a regular expression string :return: true if the value matches regular expression and false otherwise. """ if value1 == None and v...
[ "def", "match", "(", "value1", ",", "value2", ")", ":", "if", "value1", "==", "None", "and", "value2", "==", "None", ":", "return", "True", "if", "value1", "==", "None", "or", "value2", "==", "None", ":", "return", "False", "string1", "=", "str", "("...
Checks if string matches a regular expression :param value1: a string value to match :param value2: a regular expression string :return: true if the value matches regular expression and false otherwise.
[ "Checks", "if", "string", "matches", "a", "regular", "expression" ]
22cbbb3e91e49717f65c083d36147fdb07ba9e3b
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/validate/ObjectComparator.py#L132-L149
238,934
roboogle/gtkmvc3
gtkmvco/examples/converter/src/controllers/about.py
AboutCtrl.register_view
def register_view(self, view): """Loads the text taking it from the model, then starts a timer to scroll it.""" self.view.set_text(self.model.credits) gobject.timeout_add(1500, self.on_begin_scroll) return
python
def register_view(self, view): """Loads the text taking it from the model, then starts a timer to scroll it.""" self.view.set_text(self.model.credits) gobject.timeout_add(1500, self.on_begin_scroll) return
[ "def", "register_view", "(", "self", ",", "view", ")", ":", "self", ".", "view", ".", "set_text", "(", "self", ".", "model", ".", "credits", ")", "gobject", ".", "timeout_add", "(", "1500", ",", "self", ".", "on_begin_scroll", ")", "return" ]
Loads the text taking it from the model, then starts a timer to scroll it.
[ "Loads", "the", "text", "taking", "it", "from", "the", "model", "then", "starts", "a", "timer", "to", "scroll", "it", "." ]
63405fd8d2056be26af49103b13a8d5e57fe4dff
https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/examples/converter/src/controllers/about.py#L34-L39
238,935
roboogle/gtkmvc3
gtkmvco/examples/converter/src/controllers/about.py
AboutCtrl.on_scroll
def on_scroll(self): """Called to scroll text""" try: sw = self.view['sw_scroller'] except KeyError: return False # destroyed! vadj = sw.get_vadjustment() if vadj is None: return False val = vadj.get_value() # is scrolling ...
python
def on_scroll(self): """Called to scroll text""" try: sw = self.view['sw_scroller'] except KeyError: return False # destroyed! vadj = sw.get_vadjustment() if vadj is None: return False val = vadj.get_value() # is scrolling ...
[ "def", "on_scroll", "(", "self", ")", ":", "try", ":", "sw", "=", "self", ".", "view", "[", "'sw_scroller'", "]", "except", "KeyError", ":", "return", "False", "# destroyed! ", "vadj", "=", "sw", ".", "get_vadjustment", "(", ")", "if", "vadj", "is...
Called to scroll text
[ "Called", "to", "scroll", "text" ]
63405fd8d2056be26af49103b13a8d5e57fe4dff
https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/examples/converter/src/controllers/about.py#L50-L66
238,936
GearPlug/paymentsos-python
paymentsos/tokens.py
Token.create_token
def create_token(self, *, holder_name, card_number, credit_card_cvv, expiration_date, token_type='credit_card', identity_document=None, billing_address=None, additional_details=None): """ When creating a Token, remember to use the public-key header instead of the private-key header,...
python
def create_token(self, *, holder_name, card_number, credit_card_cvv, expiration_date, token_type='credit_card', identity_document=None, billing_address=None, additional_details=None): """ When creating a Token, remember to use the public-key header instead of the private-key header,...
[ "def", "create_token", "(", "self", ",", "*", ",", "holder_name", ",", "card_number", ",", "credit_card_cvv", ",", "expiration_date", ",", "token_type", "=", "'credit_card'", ",", "identity_document", "=", "None", ",", "billing_address", "=", "None", ",", "addit...
When creating a Token, remember to use the public-key header instead of the private-key header, and do not include the app-id header. Args: holder_name: Name of the credit card holder. card_number: Credit card number. credit_card_cvv: The CVV number on the card (3 or...
[ "When", "creating", "a", "Token", "remember", "to", "use", "the", "public", "-", "key", "header", "instead", "of", "the", "private", "-", "key", "header", "and", "do", "not", "include", "the", "app", "-", "id", "header", "." ]
2f32ba83ae890c96799b71d49fc6740bc1081f89
https://github.com/GearPlug/paymentsos-python/blob/2f32ba83ae890c96799b71d49fc6740bc1081f89/paymentsos/tokens.py#L6-L38
238,937
GearPlug/paymentsos-python
paymentsos/tokens.py
Token.retrieve_token
def retrieve_token(self, token): """ Retrieve Token details for a specific Token. Args: token: The identifier of the token. Returns: """ headers = self.client._get_private_headers() endpoint = '/tokens/{}'.format(token) return self.client._...
python
def retrieve_token(self, token): """ Retrieve Token details for a specific Token. Args: token: The identifier of the token. Returns: """ headers = self.client._get_private_headers() endpoint = '/tokens/{}'.format(token) return self.client._...
[ "def", "retrieve_token", "(", "self", ",", "token", ")", ":", "headers", "=", "self", ".", "client", ".", "_get_private_headers", "(", ")", "endpoint", "=", "'/tokens/{}'", ".", "format", "(", "token", ")", "return", "self", ".", "client", ".", "_get", "...
Retrieve Token details for a specific Token. Args: token: The identifier of the token. Returns:
[ "Retrieve", "Token", "details", "for", "a", "specific", "Token", "." ]
2f32ba83ae890c96799b71d49fc6740bc1081f89
https://github.com/GearPlug/paymentsos-python/blob/2f32ba83ae890c96799b71d49fc6740bc1081f89/paymentsos/tokens.py#L40-L53
238,938
JukeboxPipeline/jukebox-core
src/jukeboxcore/gui/djitemdata.py
prj_created_data
def prj_created_data(project, role): """Return the data for created :param project: the project that holds the data :type project: :class:`jukeboxcore.djadapter.models.Project` :param role: item data role :type role: QtCore.Qt.ItemDataRole :returns: data for the created :rtype: depending on...
python
def prj_created_data(project, role): """Return the data for created :param project: the project that holds the data :type project: :class:`jukeboxcore.djadapter.models.Project` :param role: item data role :type role: QtCore.Qt.ItemDataRole :returns: data for the created :rtype: depending on...
[ "def", "prj_created_data", "(", "project", ",", "role", ")", ":", "if", "role", "==", "QtCore", ".", "Qt", ".", "DisplayRole", ":", "return", "project", ".", "date_created", ".", "isoformat", "(", "' '", ")" ]
Return the data for created :param project: the project that holds the data :type project: :class:`jukeboxcore.djadapter.models.Project` :param role: item data role :type role: QtCore.Qt.ItemDataRole :returns: data for the created :rtype: depending on role :raises: None
[ "Return", "the", "data", "for", "created" ]
bac2280ca49940355270e4b69400ce9976ab2e6f
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/djitemdata.py#L53-L65
238,939
JukeboxPipeline/jukebox-core
src/jukeboxcore/gui/djitemdata.py
prj_fps_data
def prj_fps_data(project, role): """Return the data for fps :param project: the project that holds the data :type project: :class:`jukeboxcore.djadapter.models.Project` :param role: item data role :type role: QtCore.Qt.ItemDataRole :returns: data for the fps :rtype: depending on role :r...
python
def prj_fps_data(project, role): """Return the data for fps :param project: the project that holds the data :type project: :class:`jukeboxcore.djadapter.models.Project` :param role: item data role :type role: QtCore.Qt.ItemDataRole :returns: data for the fps :rtype: depending on role :r...
[ "def", "prj_fps_data", "(", "project", ",", "role", ")", ":", "if", "role", "==", "QtCore", ".", "Qt", ".", "DisplayRole", ":", "return", "str", "(", "project", ".", "framerate", ")" ]
Return the data for fps :param project: the project that holds the data :type project: :class:`jukeboxcore.djadapter.models.Project` :param role: item data role :type role: QtCore.Qt.ItemDataRole :returns: data for the fps :rtype: depending on role :raises: None
[ "Return", "the", "data", "for", "fps" ]
bac2280ca49940355270e4b69400ce9976ab2e6f
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/djitemdata.py#L83-L95
238,940
JukeboxPipeline/jukebox-core
src/jukeboxcore/gui/djitemdata.py
prj_resolution_data
def prj_resolution_data(project, role): """Return the data for resolution :param project: the project that holds the data :type project: :class:`jukeboxcore.djadapter.models.Project` :param role: item data role :type role: QtCore.Qt.ItemDataRole :returns: data for the resolution :rtype: dep...
python
def prj_resolution_data(project, role): """Return the data for resolution :param project: the project that holds the data :type project: :class:`jukeboxcore.djadapter.models.Project` :param role: item data role :type role: QtCore.Qt.ItemDataRole :returns: data for the resolution :rtype: dep...
[ "def", "prj_resolution_data", "(", "project", ",", "role", ")", ":", "if", "role", "==", "QtCore", ".", "Qt", ".", "DisplayRole", ":", "return", "'%s x %s'", "%", "(", "project", ".", "resx", ",", "project", ".", "resy", ")" ]
Return the data for resolution :param project: the project that holds the data :type project: :class:`jukeboxcore.djadapter.models.Project` :param role: item data role :type role: QtCore.Qt.ItemDataRole :returns: data for the resolution :rtype: depending on role :raises: None
[ "Return", "the", "data", "for", "resolution" ]
bac2280ca49940355270e4b69400ce9976ab2e6f
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/djitemdata.py#L98-L110
238,941
JukeboxPipeline/jukebox-core
src/jukeboxcore/gui/djitemdata.py
shot_duration_data
def shot_duration_data(shot, role): """Return the data for duration :param shot: the shot that holds the data :type shot: :class:`jukeboxcore.djadapter.models.Shot` :param role: item data role :type role: QtCore.Qt.ItemDataRole :returns: data for the duration :rtype: depending on role :...
python
def shot_duration_data(shot, role): """Return the data for duration :param shot: the shot that holds the data :type shot: :class:`jukeboxcore.djadapter.models.Shot` :param role: item data role :type role: QtCore.Qt.ItemDataRole :returns: data for the duration :rtype: depending on role :...
[ "def", "shot_duration_data", "(", "shot", ",", "role", ")", ":", "if", "role", "==", "QtCore", ".", "Qt", ".", "DisplayRole", ":", "return", "str", "(", "shot", ".", "duration", ")" ]
Return the data for duration :param shot: the shot that holds the data :type shot: :class:`jukeboxcore.djadapter.models.Shot` :param role: item data role :type role: QtCore.Qt.ItemDataRole :returns: data for the duration :rtype: depending on role :raises: None
[ "Return", "the", "data", "for", "duration" ]
bac2280ca49940355270e4b69400ce9976ab2e6f
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/djitemdata.py#L312-L324
238,942
JukeboxPipeline/jukebox-core
src/jukeboxcore/gui/djitemdata.py
shot_start_data
def shot_start_data(shot, role): """Return the data for startframe :param shot: the shot that holds the data :type shot: :class:`jukeboxcore.djadapter.models.Shot` :param role: item data role :type role: QtCore.Qt.ItemDataRole :returns: data for the start :rtype: depending on role :rais...
python
def shot_start_data(shot, role): """Return the data for startframe :param shot: the shot that holds the data :type shot: :class:`jukeboxcore.djadapter.models.Shot` :param role: item data role :type role: QtCore.Qt.ItemDataRole :returns: data for the start :rtype: depending on role :rais...
[ "def", "shot_start_data", "(", "shot", ",", "role", ")", ":", "if", "role", "==", "QtCore", ".", "Qt", ".", "DisplayRole", ":", "return", "str", "(", "shot", ".", "startframe", ")" ]
Return the data for startframe :param shot: the shot that holds the data :type shot: :class:`jukeboxcore.djadapter.models.Shot` :param role: item data role :type role: QtCore.Qt.ItemDataRole :returns: data for the start :rtype: depending on role :raises: None
[ "Return", "the", "data", "for", "startframe" ]
bac2280ca49940355270e4b69400ce9976ab2e6f
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/djitemdata.py#L327-L339
238,943
JukeboxPipeline/jukebox-core
src/jukeboxcore/gui/djitemdata.py
shot_end_data
def shot_end_data(shot, role): """Return the data for endframe :param shot: the shot that holds the data :type shot: :class:`jukeboxcore.djadapter.models.Shot` :param role: item data role :type role: QtCore.Qt.ItemDataRole :returns: data for the end :rtype: depending on role :raises: No...
python
def shot_end_data(shot, role): """Return the data for endframe :param shot: the shot that holds the data :type shot: :class:`jukeboxcore.djadapter.models.Shot` :param role: item data role :type role: QtCore.Qt.ItemDataRole :returns: data for the end :rtype: depending on role :raises: No...
[ "def", "shot_end_data", "(", "shot", ",", "role", ")", ":", "if", "role", "==", "QtCore", ".", "Qt", ".", "DisplayRole", ":", "return", "str", "(", "shot", ".", "endframe", ")" ]
Return the data for endframe :param shot: the shot that holds the data :type shot: :class:`jukeboxcore.djadapter.models.Shot` :param role: item data role :type role: QtCore.Qt.ItemDataRole :returns: data for the end :rtype: depending on role :raises: None
[ "Return", "the", "data", "for", "endframe" ]
bac2280ca49940355270e4b69400ce9976ab2e6f
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/djitemdata.py#L342-L354
238,944
JukeboxPipeline/jukebox-core
src/jukeboxcore/gui/djitemdata.py
note_content_data
def note_content_data(note, role): """Return the data for content :param note: the note that holds the data :type note: :class:`jukeboxcore.djadapter.models.Note` :param role: item data role :type role: QtCore.Qt.ItemDataRole :returns: data for the created date :rtype: depending on role ...
python
def note_content_data(note, role): """Return the data for content :param note: the note that holds the data :type note: :class:`jukeboxcore.djadapter.models.Note` :param role: item data role :type role: QtCore.Qt.ItemDataRole :returns: data for the created date :rtype: depending on role ...
[ "def", "note_content_data", "(", "note", ",", "role", ")", ":", "if", "role", "==", "QtCore", ".", "Qt", ".", "DisplayRole", "or", "role", "==", "QtCore", ".", "Qt", ".", "EditRole", ":", "return", "note", ".", "content" ]
Return the data for content :param note: the note that holds the data :type note: :class:`jukeboxcore.djadapter.models.Note` :param role: item data role :type role: QtCore.Qt.ItemDataRole :returns: data for the created date :rtype: depending on role :raises: None
[ "Return", "the", "data", "for", "content" ]
bac2280ca49940355270e4b69400ce9976ab2e6f
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/djitemdata.py#L801-L813
238,945
roboogle/gtkmvc3
gtkmvco/gtkmvc3/adapters/default.py
remove_adapter
def remove_adapter(widget_class, flavour=None): """Removes the given widget class information from the default set of adapters. If widget_class had been previously added by using add_adapter, the added adapter will be removed, restoring possibly previusly existing adapter(s). Notice that this funct...
python
def remove_adapter(widget_class, flavour=None): """Removes the given widget class information from the default set of adapters. If widget_class had been previously added by using add_adapter, the added adapter will be removed, restoring possibly previusly existing adapter(s). Notice that this funct...
[ "def", "remove_adapter", "(", "widget_class", ",", "flavour", "=", "None", ")", ":", "for", "it", ",", "tu", "in", "enumerate", "(", "__def_adapter", ")", ":", "if", "(", "widget_class", "==", "tu", "[", "WIDGET", "]", "and", "flavour", "==", "tu", "["...
Removes the given widget class information from the default set of adapters. If widget_class had been previously added by using add_adapter, the added adapter will be removed, restoring possibly previusly existing adapter(s). Notice that this function will remove only *one* adapter about given wige...
[ "Removes", "the", "given", "widget", "class", "information", "from", "the", "default", "set", "of", "adapters", "." ]
63405fd8d2056be26af49103b13a8d5e57fe4dff
https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/gtkmvc3/adapters/default.py#L106-L126
238,946
pip-services3-python/pip-services3-commons-python
pip_services3_commons/run/Parameters.py
Parameters.get
def get(self, key): """ Gets a map element specified by its key. The key can be defined using dot notation and allows to recursively access elements of elements. :param key: a key of the element to get. :return: the value of the map element. """ if key ...
python
def get(self, key): """ Gets a map element specified by its key. The key can be defined using dot notation and allows to recursively access elements of elements. :param key: a key of the element to get. :return: the value of the map element. """ if key ...
[ "def", "get", "(", "self", ",", "key", ")", ":", "if", "key", "==", "None", "or", "key", "==", "''", ":", "return", "None", "elif", "key", ".", "find", "(", "'.'", ")", ">", "0", ":", "return", "RecursiveObjectReader", ".", "get_property", "(", "se...
Gets a map element specified by its key. The key can be defined using dot notation and allows to recursively access elements of elements. :param key: a key of the element to get. :return: the value of the map element.
[ "Gets", "a", "map", "element", "specified", "by", "its", "key", "." ]
22cbbb3e91e49717f65c083d36147fdb07ba9e3b
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/run/Parameters.py#L37-L53
238,947
pip-services3-python/pip-services3-commons-python
pip_services3_commons/run/Parameters.py
Parameters.put
def put(self, key, value): """ Puts a new value into map element specified by its key. The key can be defined using dot notation and allows to recursively access elements of elements. :param key: a key of the element to put. :param value: a new value for map element. ...
python
def put(self, key, value): """ Puts a new value into map element specified by its key. The key can be defined using dot notation and allows to recursively access elements of elements. :param key: a key of the element to put. :param value: a new value for map element. ...
[ "def", "put", "(", "self", ",", "key", ",", "value", ")", ":", "if", "key", "==", "None", "or", "key", "==", "''", ":", "return", "None", "elif", "key", ".", "find", "(", "'.'", ")", ">", "0", ":", "RecursiveObjectWriter", ".", "set_property", "(",...
Puts a new value into map element specified by its key. The key can be defined using dot notation and allows to recursively access elements of elements. :param key: a key of the element to put. :param value: a new value for map element.
[ "Puts", "a", "new", "value", "into", "map", "element", "specified", "by", "its", "key", "." ]
22cbbb3e91e49717f65c083d36147fdb07ba9e3b
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/run/Parameters.py#L55-L73
238,948
pip-services3-python/pip-services3-commons-python
pip_services3_commons/run/Parameters.py
Parameters.get_as_nullable_parameters
def get_as_nullable_parameters(self, key): """ Converts map element into an Parameters or returns null if conversion is not possible. :param key: a key of element to get. :return: Parameters value of the element or null if conversion is not supported. """ value = self.g...
python
def get_as_nullable_parameters(self, key): """ Converts map element into an Parameters or returns null if conversion is not possible. :param key: a key of element to get. :return: Parameters value of the element or null if conversion is not supported. """ value = self.g...
[ "def", "get_as_nullable_parameters", "(", "self", ",", "key", ")", ":", "value", "=", "self", ".", "get_as_nullable_map", "(", "key", ")", "return", "Parameters", "(", "value", ")", "if", "value", "!=", "None", "else", "None" ]
Converts map element into an Parameters or returns null if conversion is not possible. :param key: a key of element to get. :return: Parameters value of the element or null if conversion is not supported.
[ "Converts", "map", "element", "into", "an", "Parameters", "or", "returns", "null", "if", "conversion", "is", "not", "possible", "." ]
22cbbb3e91e49717f65c083d36147fdb07ba9e3b
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/run/Parameters.py#L75-L84
238,949
pip-services3-python/pip-services3-commons-python
pip_services3_commons/run/Parameters.py
Parameters.get_as_parameters_with_default
def get_as_parameters_with_default(self, key, default_value): """ Converts map element into an Parameters or returns default value if conversion is not possible. :param key: a key of element to get. :param default_value: the default value :return: Parameters value of the eleme...
python
def get_as_parameters_with_default(self, key, default_value): """ Converts map element into an Parameters or returns default value if conversion is not possible. :param key: a key of element to get. :param default_value: the default value :return: Parameters value of the eleme...
[ "def", "get_as_parameters_with_default", "(", "self", ",", "key", ",", "default_value", ")", ":", "result", "=", "self", ".", "get_as_nullable_parameters", "(", "key", ")", "return", "result", "if", "result", "!=", "None", "else", "default_value" ]
Converts map element into an Parameters or returns default value if conversion is not possible. :param key: a key of element to get. :param default_value: the default value :return: Parameters value of the element or default value if conversion is not supported.
[ "Converts", "map", "element", "into", "an", "Parameters", "or", "returns", "default", "value", "if", "conversion", "is", "not", "possible", "." ]
22cbbb3e91e49717f65c083d36147fdb07ba9e3b
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/run/Parameters.py#L97-L108
238,950
pip-services3-python/pip-services3-commons-python
pip_services3_commons/run/Parameters.py
Parameters.override
def override(self, parameters, recursive = False): """ Overrides parameters with new values from specified Parameters and returns a new Parameters object. :param parameters: Parameters with parameters to override the current values. :param recursive: (optional) true to perform deep cop...
python
def override(self, parameters, recursive = False): """ Overrides parameters with new values from specified Parameters and returns a new Parameters object. :param parameters: Parameters with parameters to override the current values. :param recursive: (optional) true to perform deep cop...
[ "def", "override", "(", "self", ",", "parameters", ",", "recursive", "=", "False", ")", ":", "result", "=", "Parameters", "(", ")", "if", "recursive", ":", "RecursiveObjectWriter", ".", "copy_properties", "(", "result", ",", "self", ")", "RecursiveObjectWriter...
Overrides parameters with new values from specified Parameters and returns a new Parameters object. :param parameters: Parameters with parameters to override the current values. :param recursive: (optional) true to perform deep copy, and false for shallow copy. Default: false :return: a new P...
[ "Overrides", "parameters", "with", "new", "values", "from", "specified", "Parameters", "and", "returns", "a", "new", "Parameters", "object", "." ]
22cbbb3e91e49717f65c083d36147fdb07ba9e3b
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/run/Parameters.py#L123-L142
238,951
pip-services3-python/pip-services3-commons-python
pip_services3_commons/run/Parameters.py
Parameters.set_defaults
def set_defaults(self, default_values, recursive = False): """ Set default values from specified Parameters and returns a new Parameters object. :param default_values: Parameters with default parameter values. :param recursive: (optional) true to perform deep copy, and false for shallo...
python
def set_defaults(self, default_values, recursive = False): """ Set default values from specified Parameters and returns a new Parameters object. :param default_values: Parameters with default parameter values. :param recursive: (optional) true to perform deep copy, and false for shallo...
[ "def", "set_defaults", "(", "self", ",", "default_values", ",", "recursive", "=", "False", ")", ":", "result", "=", "Parameters", "(", ")", "if", "recursive", ":", "RecursiveObjectWriter", ".", "copy_properties", "(", "result", ",", "default_values", ")", "Rec...
Set default values from specified Parameters and returns a new Parameters object. :param default_values: Parameters with default parameter values. :param recursive: (optional) true to perform deep copy, and false for shallow copy. Default: false :return: a new Parameters object.
[ "Set", "default", "values", "from", "specified", "Parameters", "and", "returns", "a", "new", "Parameters", "object", "." ]
22cbbb3e91e49717f65c083d36147fdb07ba9e3b
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/run/Parameters.py#L144-L163
238,952
pip-services3-python/pip-services3-commons-python
pip_services3_commons/run/Parameters.py
Parameters.pick
def pick(self, *props): """ Picks select parameters from this Parameters and returns them as a new Parameters object. :param props: keys to be picked and copied over to new Parameters. :return: a new Parameters object. """ result = Parameters() for prop in props...
python
def pick(self, *props): """ Picks select parameters from this Parameters and returns them as a new Parameters object. :param props: keys to be picked and copied over to new Parameters. :return: a new Parameters object. """ result = Parameters() for prop in props...
[ "def", "pick", "(", "self", ",", "*", "props", ")", ":", "result", "=", "Parameters", "(", ")", "for", "prop", "in", "props", ":", "if", "self", ".", "contains_key", "(", "prop", ")", ":", "result", ".", "put", "(", "prop", ",", "self", ".", "get...
Picks select parameters from this Parameters and returns them as a new Parameters object. :param props: keys to be picked and copied over to new Parameters. :return: a new Parameters object.
[ "Picks", "select", "parameters", "from", "this", "Parameters", "and", "returns", "them", "as", "a", "new", "Parameters", "object", "." ]
22cbbb3e91e49717f65c083d36147fdb07ba9e3b
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/run/Parameters.py#L176-L188
238,953
pip-services3-python/pip-services3-commons-python
pip_services3_commons/run/Parameters.py
Parameters.omit
def omit(self, *props): """ Omits selected parameters from this Parameters and returns the rest as a new Parameters object. :param props: keys to be omitted from copying over to new Parameters. :return: a new Parameters object. """ result = Parameters(self) for ...
python
def omit(self, *props): """ Omits selected parameters from this Parameters and returns the rest as a new Parameters object. :param props: keys to be omitted from copying over to new Parameters. :return: a new Parameters object. """ result = Parameters(self) for ...
[ "def", "omit", "(", "self", ",", "*", "props", ")", ":", "result", "=", "Parameters", "(", "self", ")", "for", "prop", "in", "props", ":", "del", "result", "[", "prop", "]", "return", "result" ]
Omits selected parameters from this Parameters and returns the rest as a new Parameters object. :param props: keys to be omitted from copying over to new Parameters. :return: a new Parameters object.
[ "Omits", "selected", "parameters", "from", "this", "Parameters", "and", "returns", "the", "rest", "as", "a", "new", "Parameters", "object", "." ]
22cbbb3e91e49717f65c083d36147fdb07ba9e3b
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/run/Parameters.py#L190-L201
238,954
pip-services3-python/pip-services3-commons-python
pip_services3_commons/run/Parameters.py
Parameters.from_value
def from_value(value): """ Creates a new Parameters object filled with key-value pairs from specified object. :param value: an object with key-value pairs used to initialize a new Parameters. :return: a new Parameters object. """ map = value if isinstance(value, dict) e...
python
def from_value(value): """ Creates a new Parameters object filled with key-value pairs from specified object. :param value: an object with key-value pairs used to initialize a new Parameters. :return: a new Parameters object. """ map = value if isinstance(value, dict) e...
[ "def", "from_value", "(", "value", ")", ":", "map", "=", "value", "if", "isinstance", "(", "value", ",", "dict", ")", "else", "RecursiveObjectReader", ".", "get_properties", "(", "value", ")", "return", "Parameters", "(", "map", ")" ]
Creates a new Parameters object filled with key-value pairs from specified object. :param value: an object with key-value pairs used to initialize a new Parameters. :return: a new Parameters object.
[ "Creates", "a", "new", "Parameters", "object", "filled", "with", "key", "-", "value", "pairs", "from", "specified", "object", "." ]
22cbbb3e91e49717f65c083d36147fdb07ba9e3b
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/run/Parameters.py#L212-L221
238,955
pip-services3-python/pip-services3-commons-python
pip_services3_commons/run/Parameters.py
Parameters.from_config
def from_config(config): """ Creates new Parameters from ConfigMap object. :param config: a ConfigParams that contain parameters. :return: a new Parameters object. """ result = Parameters() if config == None or len(config) == 0: return resul...
python
def from_config(config): """ Creates new Parameters from ConfigMap object. :param config: a ConfigParams that contain parameters. :return: a new Parameters object. """ result = Parameters() if config == None or len(config) == 0: return resul...
[ "def", "from_config", "(", "config", ")", ":", "result", "=", "Parameters", "(", ")", "if", "config", "==", "None", "or", "len", "(", "config", ")", "==", "0", ":", "return", "result", "for", "(", "key", ",", "value", ")", "in", "config", ".", "ite...
Creates new Parameters from ConfigMap object. :param config: a ConfigParams that contain parameters. :return: a new Parameters object.
[ "Creates", "new", "Parameters", "from", "ConfigMap", "object", "." ]
22cbbb3e91e49717f65c083d36147fdb07ba9e3b
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/run/Parameters.py#L261-L277
238,956
pip-services3-python/pip-services3-commons-python
pip_services3_commons/run/Executor.py
Executor.execute
def execute(correlation_id, components, args = None): """ Executes multiple components. To be executed components must implement [[IExecutable]] interface. If they don't the call to this method has no effect. :param correlation_id: (optional) transaction id to trace execution t...
python
def execute(correlation_id, components, args = None): """ Executes multiple components. To be executed components must implement [[IExecutable]] interface. If they don't the call to this method has no effect. :param correlation_id: (optional) transaction id to trace execution t...
[ "def", "execute", "(", "correlation_id", ",", "components", ",", "args", "=", "None", ")", ":", "results", "=", "[", "]", "if", "components", "==", "None", ":", "return", "args", "=", "args", "if", "args", "!=", "None", "else", "Parameters", "(", ")", ...
Executes multiple components. To be executed components must implement [[IExecutable]] interface. If they don't the call to this method has no effect. :param correlation_id: (optional) transaction id to trace execution through call chain. :param components: a list of components that a...
[ "Executes", "multiple", "components", "." ]
22cbbb3e91e49717f65c083d36147fdb07ba9e3b
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/run/Executor.py#L41-L66
238,957
mrstephenneal/looptools
looptools/timer.py
Timer.decorator
def decorator(func): """A function timer decorator.""" def function_timer(*args, **kwargs): """A nested function for timing other functions.""" # Capture start time start = time.time() # Execute function with arguments value = func(*args, **k...
python
def decorator(func): """A function timer decorator.""" def function_timer(*args, **kwargs): """A nested function for timing other functions.""" # Capture start time start = time.time() # Execute function with arguments value = func(*args, **k...
[ "def", "decorator", "(", "func", ")", ":", "def", "function_timer", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "\"\"\"A nested function for timing other functions.\"\"\"", "# Capture start time", "start", "=", "time", ".", "time", "(", ")", "# Execute fu...
A function timer decorator.
[ "A", "function", "timer", "decorator", "." ]
c4ef88d78e0fb672d09a18de0aa0edd31fd4db72
https://github.com/mrstephenneal/looptools/blob/c4ef88d78e0fb672d09a18de0aa0edd31fd4db72/looptools/timer.py#L37-L60
238,958
zkbt/the-friendly-stars
thefriendlystars/finders.py
Finder.populateImagesFromSurveys
def populateImagesFromSurveys(self, surveys=dss2 + twomass): ''' Load images from archives. ''' # what's the coordinate center? coordinatetosearch = '{0.ra.deg} {0.dec.deg}'.format(self.center) # query sky view for those images paths = astroquery.skyview.SkyView...
python
def populateImagesFromSurveys(self, surveys=dss2 + twomass): ''' Load images from archives. ''' # what's the coordinate center? coordinatetosearch = '{0.ra.deg} {0.dec.deg}'.format(self.center) # query sky view for those images paths = astroquery.skyview.SkyView...
[ "def", "populateImagesFromSurveys", "(", "self", ",", "surveys", "=", "dss2", "+", "twomass", ")", ":", "# what's the coordinate center?", "coordinatetosearch", "=", "'{0.ra.deg} {0.dec.deg}'", ".", "format", "(", "self", ".", "center", ")", "# query sky view for those ...
Load images from archives.
[ "Load", "images", "from", "archives", "." ]
50d3f979e79e63c66629065c75595696dc79802e
https://github.com/zkbt/the-friendly-stars/blob/50d3f979e79e63c66629065c75595696dc79802e/thefriendlystars/finders.py#L26-L41
238,959
genialis/django-priority-batch
src/django_priority_batch/prioritized_batcher.py
PrioritizedBatcher.global_instance
def global_instance(cls): """Return a per-thread global batcher instance.""" try: return GLOBAL_BATCHER.instance except AttributeError: instance = PrioritizedBatcher( **getattr(settings, 'PRIORITIZED_BATCHER', {}) ) GLOBAL_BATCHER....
python
def global_instance(cls): """Return a per-thread global batcher instance.""" try: return GLOBAL_BATCHER.instance except AttributeError: instance = PrioritizedBatcher( **getattr(settings, 'PRIORITIZED_BATCHER', {}) ) GLOBAL_BATCHER....
[ "def", "global_instance", "(", "cls", ")", ":", "try", ":", "return", "GLOBAL_BATCHER", ".", "instance", "except", "AttributeError", ":", "instance", "=", "PrioritizedBatcher", "(", "*", "*", "getattr", "(", "settings", ",", "'PRIORITIZED_BATCHER'", ",", "{", ...
Return a per-thread global batcher instance.
[ "Return", "a", "per", "-", "thread", "global", "batcher", "instance", "." ]
63da74ef7348a67b7e31a131f295f51511495f30
https://github.com/genialis/django-priority-batch/blob/63da74ef7348a67b7e31a131f295f51511495f30/src/django_priority_batch/prioritized_batcher.py#L33-L43
238,960
genialis/django-priority-batch
src/django_priority_batch/prioritized_batcher.py
PrioritizedBatcher.commit
def commit(self): """Commit a batch.""" assert self.batch is not None, "No active batch, call start() first" logger.debug("Comitting batch from %d sources...", len(self.batch)) # Determine item priority. by_priority = [] for name in self.batch.keys(): priori...
python
def commit(self): """Commit a batch.""" assert self.batch is not None, "No active batch, call start() first" logger.debug("Comitting batch from %d sources...", len(self.batch)) # Determine item priority. by_priority = [] for name in self.batch.keys(): priori...
[ "def", "commit", "(", "self", ")", ":", "assert", "self", ".", "batch", "is", "not", "None", ",", "\"No active batch, call start() first\"", "logger", ".", "debug", "(", "\"Comitting batch from %d sources...\"", ",", "len", "(", "self", ".", "batch", ")", ")", ...
Commit a batch.
[ "Commit", "a", "batch", "." ]
63da74ef7348a67b7e31a131f295f51511495f30
https://github.com/genialis/django-priority-batch/blob/63da74ef7348a67b7e31a131f295f51511495f30/src/django_priority_batch/prioritized_batcher.py#L57-L85
238,961
genialis/django-priority-batch
src/django_priority_batch/prioritized_batcher.py
PrioritizedBatcher.add
def add(self, name, handler, group_by=None, aggregator=None): """Add a new handler to the current batch.""" assert self.batch is not None, "No active batch, call start() first" items = self.batch.setdefault(name, collections.OrderedDict()) if group_by is None: # None is spec...
python
def add(self, name, handler, group_by=None, aggregator=None): """Add a new handler to the current batch.""" assert self.batch is not None, "No active batch, call start() first" items = self.batch.setdefault(name, collections.OrderedDict()) if group_by is None: # None is spec...
[ "def", "add", "(", "self", ",", "name", ",", "handler", ",", "group_by", "=", "None", ",", "aggregator", "=", "None", ")", ":", "assert", "self", ".", "batch", "is", "not", "None", ",", "\"No active batch, call start() first\"", "items", "=", "self", ".", ...
Add a new handler to the current batch.
[ "Add", "a", "new", "handler", "to", "the", "current", "batch", "." ]
63da74ef7348a67b7e31a131f295f51511495f30
https://github.com/genialis/django-priority-batch/blob/63da74ef7348a67b7e31a131f295f51511495f30/src/django_priority_batch/prioritized_batcher.py#L93-L106
238,962
realestate-com-au/dashmat
dashmat/core_modules/splunk/splunk-sdk-1.3.0/splunklib/searchcommands/logging.py
configure
def configure(name, path=None): """ Configure logging and return a logger and the location of its logging configuration file. This function expects: + A Splunk app directory structure:: <app-root> bin ... default ... local ...
python
def configure(name, path=None): """ Configure logging and return a logger and the location of its logging configuration file. This function expects: + A Splunk app directory structure:: <app-root> bin ... default ... local ...
[ "def", "configure", "(", "name", ",", "path", "=", "None", ")", ":", "app_directory", "=", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "realpath", "(", "sys", ".", "argv", "[", "0", "]",...
Configure logging and return a logger and the location of its logging configuration file. This function expects: + A Splunk app directory structure:: <app-root> bin ... default ... local ... + The current wor...
[ "Configure", "logging", "and", "return", "a", "logger", "and", "the", "location", "of", "its", "logging", "configuration", "file", "." ]
433886e52698f0ddb9956f087b76041966c3bcd1
https://github.com/realestate-com-au/dashmat/blob/433886e52698f0ddb9956f087b76041966c3bcd1/dashmat/core_modules/splunk/splunk-sdk-1.3.0/splunklib/searchcommands/logging.py#L23-L119
238,963
mikeboers/sitetools
sitetools/utils.py
expand_user
def expand_user(path, user=None): """Roughly the same as os.path.expanduser, but you can pass a default user.""" def _replace(m): m_user = m.group(1) or user return pwd.getpwnam(m_user).pw_dir if m_user else pwd.getpwuid(os.getuid()).pw_dir return re.sub(r'~(\w*)', _replace, path)
python
def expand_user(path, user=None): """Roughly the same as os.path.expanduser, but you can pass a default user.""" def _replace(m): m_user = m.group(1) or user return pwd.getpwnam(m_user).pw_dir if m_user else pwd.getpwuid(os.getuid()).pw_dir return re.sub(r'~(\w*)', _replace, path)
[ "def", "expand_user", "(", "path", ",", "user", "=", "None", ")", ":", "def", "_replace", "(", "m", ")", ":", "m_user", "=", "m", ".", "group", "(", "1", ")", "or", "user", "return", "pwd", ".", "getpwnam", "(", "m_user", ")", ".", "pw_dir", "if"...
Roughly the same as os.path.expanduser, but you can pass a default user.
[ "Roughly", "the", "same", "as", "os", ".", "path", ".", "expanduser", "but", "you", "can", "pass", "a", "default", "user", "." ]
1ec4eea6902b4a276f868a711b783dd965c123b7
https://github.com/mikeboers/sitetools/blob/1ec4eea6902b4a276f868a711b783dd965c123b7/sitetools/utils.py#L23-L30
238,964
mikeboers/sitetools
sitetools/utils.py
unique_list
def unique_list(input_, key=lambda x:x): """Return the unique elements from the input, in order.""" seen = set() output = [] for x in input_: keyx = key(x) if keyx not in seen: seen.add(keyx) output.append(x) return output
python
def unique_list(input_, key=lambda x:x): """Return the unique elements from the input, in order.""" seen = set() output = [] for x in input_: keyx = key(x) if keyx not in seen: seen.add(keyx) output.append(x) return output
[ "def", "unique_list", "(", "input_", ",", "key", "=", "lambda", "x", ":", "x", ")", ":", "seen", "=", "set", "(", ")", "output", "=", "[", "]", "for", "x", "in", "input_", ":", "keyx", "=", "key", "(", "x", ")", "if", "keyx", "not", "in", "se...
Return the unique elements from the input, in order.
[ "Return", "the", "unique", "elements", "from", "the", "input", "in", "order", "." ]
1ec4eea6902b4a276f868a711b783dd965c123b7
https://github.com/mikeboers/sitetools/blob/1ec4eea6902b4a276f868a711b783dd965c123b7/sitetools/utils.py#L33-L42
238,965
mikeboers/sitetools
sitetools/utils.py
get_environ_list
def get_environ_list(name, default=None): """Return the split colon-delimited list from an environment variable. Returns an empty list if the variable didn't exist. """ packed = os.environ.get(name) if packed is not None: return packed.split(':') elif default is not None: retur...
python
def get_environ_list(name, default=None): """Return the split colon-delimited list from an environment variable. Returns an empty list if the variable didn't exist. """ packed = os.environ.get(name) if packed is not None: return packed.split(':') elif default is not None: retur...
[ "def", "get_environ_list", "(", "name", ",", "default", "=", "None", ")", ":", "packed", "=", "os", ".", "environ", ".", "get", "(", "name", ")", "if", "packed", "is", "not", "None", ":", "return", "packed", ".", "split", "(", "':'", ")", "elif", "...
Return the split colon-delimited list from an environment variable. Returns an empty list if the variable didn't exist.
[ "Return", "the", "split", "colon", "-", "delimited", "list", "from", "an", "environment", "variable", "." ]
1ec4eea6902b4a276f868a711b783dd965c123b7
https://github.com/mikeboers/sitetools/blob/1ec4eea6902b4a276f868a711b783dd965c123b7/sitetools/utils.py#L45-L57
238,966
Phelimb/ga4gh-mongo
ga4ghmongo/schema/models/variants.py
is_indel
def is_indel(reference_bases, alternate_bases): """ Return whether or not the variant is an INDEL """ if len(reference_bases) > 1: return True for alt in alternate_bases: if alt is None: return True elif len(alt) != len(reference_bases): return True return...
python
def is_indel(reference_bases, alternate_bases): """ Return whether or not the variant is an INDEL """ if len(reference_bases) > 1: return True for alt in alternate_bases: if alt is None: return True elif len(alt) != len(reference_bases): return True return...
[ "def", "is_indel", "(", "reference_bases", ",", "alternate_bases", ")", ":", "if", "len", "(", "reference_bases", ")", ">", "1", ":", "return", "True", "for", "alt", "in", "alternate_bases", ":", "if", "alt", "is", "None", ":", "return", "True", "elif", ...
Return whether or not the variant is an INDEL
[ "Return", "whether", "or", "not", "the", "variant", "is", "an", "INDEL" ]
5f5a3e1922be0e0d13af1874fad6eed5418ee761
https://github.com/Phelimb/ga4gh-mongo/blob/5f5a3e1922be0e0d13af1874fad6eed5418ee761/ga4ghmongo/schema/models/variants.py#L268-L277
238,967
Phelimb/ga4gh-mongo
ga4ghmongo/schema/models/variants.py
is_snp
def is_snp(reference_bases, alternate_bases): """ Return whether or not the variant is a SNP """ if len(reference_bases) > 1: return False for alt in alternate_bases: if alt is None: return False if alt not in ['A', 'C', 'G', 'T', 'N', '*']: return False r...
python
def is_snp(reference_bases, alternate_bases): """ Return whether or not the variant is a SNP """ if len(reference_bases) > 1: return False for alt in alternate_bases: if alt is None: return False if alt not in ['A', 'C', 'G', 'T', 'N', '*']: return False r...
[ "def", "is_snp", "(", "reference_bases", ",", "alternate_bases", ")", ":", "if", "len", "(", "reference_bases", ")", ">", "1", ":", "return", "False", "for", "alt", "in", "alternate_bases", ":", "if", "alt", "is", "None", ":", "return", "False", "if", "a...
Return whether or not the variant is a SNP
[ "Return", "whether", "or", "not", "the", "variant", "is", "a", "SNP" ]
5f5a3e1922be0e0d13af1874fad6eed5418ee761
https://github.com/Phelimb/ga4gh-mongo/blob/5f5a3e1922be0e0d13af1874fad6eed5418ee761/ga4ghmongo/schema/models/variants.py#L280-L289
238,968
Phelimb/ga4gh-mongo
ga4ghmongo/schema/models/variants.py
is_deletion
def is_deletion(reference_bases, alternate_bases): """ Return whether or not the INDEL is a deletion """ # if multiple alts, it is unclear if we have a transition if len(alternate_bases) > 1: return False if is_indel(reference_bases, alternate_bases): # just one alt allele alt_a...
python
def is_deletion(reference_bases, alternate_bases): """ Return whether or not the INDEL is a deletion """ # if multiple alts, it is unclear if we have a transition if len(alternate_bases) > 1: return False if is_indel(reference_bases, alternate_bases): # just one alt allele alt_a...
[ "def", "is_deletion", "(", "reference_bases", ",", "alternate_bases", ")", ":", "# if multiple alts, it is unclear if we have a transition", "if", "len", "(", "alternate_bases", ")", ">", "1", ":", "return", "False", "if", "is_indel", "(", "reference_bases", ",", "alt...
Return whether or not the INDEL is a deletion
[ "Return", "whether", "or", "not", "the", "INDEL", "is", "a", "deletion" ]
5f5a3e1922be0e0d13af1874fad6eed5418ee761
https://github.com/Phelimb/ga4gh-mongo/blob/5f5a3e1922be0e0d13af1874fad6eed5418ee761/ga4ghmongo/schema/models/variants.py#L292-L308
238,969
Phelimb/ga4gh-mongo
ga4ghmongo/schema/models/variants.py
Variant.overlapping
def overlapping(self, other): """Do these variants overlap in the reference""" return ( other.start in self.ref_range) or ( self.start in other.ref_range)
python
def overlapping(self, other): """Do these variants overlap in the reference""" return ( other.start in self.ref_range) or ( self.start in other.ref_range)
[ "def", "overlapping", "(", "self", ",", "other", ")", ":", "return", "(", "other", ".", "start", "in", "self", ".", "ref_range", ")", "or", "(", "self", ".", "start", "in", "other", ".", "ref_range", ")" ]
Do these variants overlap in the reference
[ "Do", "these", "variants", "overlap", "in", "the", "reference" ]
5f5a3e1922be0e0d13af1874fad6eed5418ee761
https://github.com/Phelimb/ga4gh-mongo/blob/5f5a3e1922be0e0d13af1874fad6eed5418ee761/ga4ghmongo/schema/models/variants.py#L468-L472
238,970
dmonroy/schema-migrations
schema_migrations/__init__.py
MigrationController.parse_pgurl
def parse_pgurl(self, url): """ Given a Postgres url, return a dict with keys for user, password, host, port, and database. """ parsed = urlsplit(url) return { 'user': parsed.username, 'password': parsed.password, 'database': parsed.pa...
python
def parse_pgurl(self, url): """ Given a Postgres url, return a dict with keys for user, password, host, port, and database. """ parsed = urlsplit(url) return { 'user': parsed.username, 'password': parsed.password, 'database': parsed.pa...
[ "def", "parse_pgurl", "(", "self", ",", "url", ")", ":", "parsed", "=", "urlsplit", "(", "url", ")", "return", "{", "'user'", ":", "parsed", ".", "username", ",", "'password'", ":", "parsed", ".", "password", ",", "'database'", ":", "parsed", ".", "pat...
Given a Postgres url, return a dict with keys for user, password, host, port, and database.
[ "Given", "a", "Postgres", "url", "return", "a", "dict", "with", "keys", "for", "user", "password", "host", "port", "and", "database", "." ]
c70624818776029230bfe6438c121fcbcfde2f26
https://github.com/dmonroy/schema-migrations/blob/c70624818776029230bfe6438c121fcbcfde2f26/schema_migrations/__init__.py#L219-L232
238,971
roboogle/gtkmvc3
gtkmvco/examples/userman/ctrl.py
ExampleController.value_change
def value_change(self, model, name, info): """The model is changed and the view must be updated""" msg = self.model.get_message(info.new) self.view.set_msg(msg) return
python
def value_change(self, model, name, info): """The model is changed and the view must be updated""" msg = self.model.get_message(info.new) self.view.set_msg(msg) return
[ "def", "value_change", "(", "self", ",", "model", ",", "name", ",", "info", ")", ":", "msg", "=", "self", ".", "model", ".", "get_message", "(", "info", ".", "new", ")", "self", ".", "view", ".", "set_msg", "(", "msg", ")", "return" ]
The model is changed and the view must be updated
[ "The", "model", "is", "changed", "and", "the", "view", "must", "be", "updated" ]
63405fd8d2056be26af49103b13a8d5e57fe4dff
https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/examples/userman/ctrl.py#L28-L33
238,972
JukeboxPipeline/jukebox-core
src/jukeboxcore/addons/configer/configer.py
ConfigerWin.reset_current_row
def reset_current_row(self, *args, **kwargs): """Reset the selected rows value to its default value :returns: None :rtype: None :raises: None """ i = self.configobj_treev.currentIndex() m = self.configobj_treev.model() m.restore_default(i)
python
def reset_current_row(self, *args, **kwargs): """Reset the selected rows value to its default value :returns: None :rtype: None :raises: None """ i = self.configobj_treev.currentIndex() m = self.configobj_treev.model() m.restore_default(i)
[ "def", "reset_current_row", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "i", "=", "self", ".", "configobj_treev", ".", "currentIndex", "(", ")", "m", "=", "self", ".", "configobj_treev", ".", "model", "(", ")", "m", ".", "restor...
Reset the selected rows value to its default value :returns: None :rtype: None :raises: None
[ "Reset", "the", "selected", "rows", "value", "to", "its", "default", "value" ]
bac2280ca49940355270e4b69400ce9976ab2e6f
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/addons/configer/configer.py#L53-L62
238,973
JukeboxPipeline/jukebox-core
src/jukeboxcore/addons/configer/configer.py
ConfigerWin.get_configs
def get_configs(self): """Load all config files and return the configobjs :returns: a list of configobjs :raises: None It always loads the coreconfig. Then it looks for all configs inside the PLUGIN_CONFIG_DIR. It will find the corresponding spec of the plugins. ...
python
def get_configs(self): """Load all config files and return the configobjs :returns: a list of configobjs :raises: None It always loads the coreconfig. Then it looks for all configs inside the PLUGIN_CONFIG_DIR. It will find the corresponding spec of the plugins. ...
[ "def", "get_configs", "(", "self", ")", ":", "# all loaded configs are stored in confs", "confs", "=", "[", "]", "# always load core config. it is not part of the plugin configs", "try", ":", "confs", ".", "append", "(", "iniconf", ".", "get_core_config", "(", ")", ")",...
Load all config files and return the configobjs :returns: a list of configobjs :raises: None It always loads the coreconfig. Then it looks for all configs inside the PLUGIN_CONFIG_DIR. It will find the corresponding spec of the plugins. If there is a spec, but no ini, i...
[ "Load", "all", "config", "files", "and", "return", "the", "configobjs" ]
bac2280ca49940355270e4b69400ce9976ab2e6f
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/addons/configer/configer.py#L64-L124
238,974
JukeboxPipeline/jukebox-core
src/jukeboxcore/addons/configer/configer.py
ConfigerWin.set_inifile
def set_inifile(self, current, previous): """Set the configobj to the current index of the files_lv This is a slot for the currentChanged signal :param current: the modelindex of a inifilesmodel that should be set for the configobj_treev :type current: QModelIndex :param previo...
python
def set_inifile(self, current, previous): """Set the configobj to the current index of the files_lv This is a slot for the currentChanged signal :param current: the modelindex of a inifilesmodel that should be set for the configobj_treev :type current: QModelIndex :param previo...
[ "def", "set_inifile", "(", "self", ",", "current", ",", "previous", ")", ":", "c", "=", "self", ".", "inimodel", ".", "data", "(", "current", ",", "self", ".", "inimodel", ".", "confobjRole", ")", "self", ".", "confobjmodel", "=", "ConfigObjModel", "(", ...
Set the configobj to the current index of the files_lv This is a slot for the currentChanged signal :param current: the modelindex of a inifilesmodel that should be set for the configobj_treev :type current: QModelIndex :param previous: the previous selected index :type previou...
[ "Set", "the", "configobj", "to", "the", "current", "index", "of", "the", "files_lv" ]
bac2280ca49940355270e4b69400ce9976ab2e6f
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/addons/configer/configer.py#L141-L157
238,975
JukeboxPipeline/jukebox-core
src/jukeboxcore/addons/configer/configer.py
ConfigerWin.iniedited
def iniedited(self, *args, **kwargs): """Set the current index of inimodel to modified :returns: None :rtype: None :raises: None """ self.inimodel.set_index_edited(self.files_lv.currentIndex(), True)
python
def iniedited(self, *args, **kwargs): """Set the current index of inimodel to modified :returns: None :rtype: None :raises: None """ self.inimodel.set_index_edited(self.files_lv.currentIndex(), True)
[ "def", "iniedited", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "inimodel", ".", "set_index_edited", "(", "self", ".", "files_lv", ".", "currentIndex", "(", ")", ",", "True", ")" ]
Set the current index of inimodel to modified :returns: None :rtype: None :raises: None
[ "Set", "the", "current", "index", "of", "inimodel", "to", "modified" ]
bac2280ca49940355270e4b69400ce9976ab2e6f
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/addons/configer/configer.py#L159-L166
238,976
JukeboxPipeline/jukebox-core
src/jukeboxcore/addons/configer/configer.py
ConfigerWin.closeEvent
def closeEvent(self, event): """Handles closing of the window. If configs were edited, ask user to continue. :param event: the close event :type event: QCloseEvent :returns: None :rtype: None :raises: None """ if self.inimodel.get_edited(): r ...
python
def closeEvent(self, event): """Handles closing of the window. If configs were edited, ask user to continue. :param event: the close event :type event: QCloseEvent :returns: None :rtype: None :raises: None """ if self.inimodel.get_edited(): r ...
[ "def", "closeEvent", "(", "self", ",", "event", ")", ":", "if", "self", ".", "inimodel", ".", "get_edited", "(", ")", ":", "r", "=", "self", ".", "doc_modified_prompt", "(", ")", "if", "r", "==", "QtGui", ".", "QMessageBox", ".", "Yes", ":", "event",...
Handles closing of the window. If configs were edited, ask user to continue. :param event: the close event :type event: QCloseEvent :returns: None :rtype: None :raises: None
[ "Handles", "closing", "of", "the", "window", ".", "If", "configs", "were", "edited", "ask", "user", "to", "continue", "." ]
bac2280ca49940355270e4b69400ce9976ab2e6f
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/addons/configer/configer.py#L168-L184
238,977
JukeboxPipeline/jukebox-core
src/jukeboxcore/addons/configer/configer.py
ConfigerWin.doc_modified_prompt
def doc_modified_prompt(self, ): """Create a message box, that asks the user to continue although files have been modified :returns: value of the standard button of qmessagebox that has been pressed. Either Yes or Cancel. :rtype: QtGui.QMessageBox.StandardButton :raises: None ""...
python
def doc_modified_prompt(self, ): """Create a message box, that asks the user to continue although files have been modified :returns: value of the standard button of qmessagebox that has been pressed. Either Yes or Cancel. :rtype: QtGui.QMessageBox.StandardButton :raises: None ""...
[ "def", "doc_modified_prompt", "(", "self", ",", ")", ":", "msgbox", "=", "QtGui", ".", "QMessageBox", "(", ")", "msgbox", ".", "setWindowTitle", "(", "\"Discard changes?\"", ")", "msgbox", ".", "setText", "(", "\"Documents have been modified.\"", ")", "msgbox", ...
Create a message box, that asks the user to continue although files have been modified :returns: value of the standard button of qmessagebox that has been pressed. Either Yes or Cancel. :rtype: QtGui.QMessageBox.StandardButton :raises: None
[ "Create", "a", "message", "box", "that", "asks", "the", "user", "to", "continue", "although", "files", "have", "been", "modified" ]
bac2280ca49940355270e4b69400ce9976ab2e6f
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/addons/configer/configer.py#L186-L200
238,978
JukeboxPipeline/jukebox-core
src/jukeboxcore/addons/configer/configer.py
ConfigerWin.save_current_config
def save_current_config(self, ): """Saves the currently displayed config :returns: None :rtype: None :raises: None This resets the edited status of the file to False. Also asks the user to continue if config is invalid. """ # check if all configs valida...
python
def save_current_config(self, ): """Saves the currently displayed config :returns: None :rtype: None :raises: None This resets the edited status of the file to False. Also asks the user to continue if config is invalid. """ # check if all configs valida...
[ "def", "save_current_config", "(", "self", ",", ")", ":", "# check if all configs validate correctly", "btn", "=", "None", "for", "row", "in", "range", "(", "self", ".", "inimodel", ".", "rowCount", "(", ")", ")", ":", "i", "=", "self", ".", "inimodel", "....
Saves the currently displayed config :returns: None :rtype: None :raises: None This resets the edited status of the file to False. Also asks the user to continue if config is invalid.
[ "Saves", "the", "currently", "displayed", "config" ]
bac2280ca49940355270e4b69400ce9976ab2e6f
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/addons/configer/configer.py#L218-L243
238,979
mikicz/arca
arca/backend/venv.py
VenvBackend.get_virtualenv_path
def get_virtualenv_path(self, requirements_option: RequirementsOptions, requirements_hash: Optional[str]) -> Path: """ Returns the path to the virtualenv the current state of the repository. """ if requirements_option == RequirementsOptions.no_requirements: venv_name = "no_re...
python
def get_virtualenv_path(self, requirements_option: RequirementsOptions, requirements_hash: Optional[str]) -> Path: """ Returns the path to the virtualenv the current state of the repository. """ if requirements_option == RequirementsOptions.no_requirements: venv_name = "no_re...
[ "def", "get_virtualenv_path", "(", "self", ",", "requirements_option", ":", "RequirementsOptions", ",", "requirements_hash", ":", "Optional", "[", "str", "]", ")", "->", "Path", ":", "if", "requirements_option", "==", "RequirementsOptions", ".", "no_requirements", "...
Returns the path to the virtualenv the current state of the repository.
[ "Returns", "the", "path", "to", "the", "virtualenv", "the", "current", "state", "of", "the", "repository", "." ]
e67fdc00be473ecf8ec16d024e1a3f2c47ca882c
https://github.com/mikicz/arca/blob/e67fdc00be473ecf8ec16d024e1a3f2c47ca882c/arca/backend/venv.py#L25-L34
238,980
mikicz/arca
arca/backend/venv.py
VenvBackend.get_or_create_environment
def get_or_create_environment(self, repo: str, branch: str, git_repo: Repo, repo_path: Path) -> str: """ Handles the requirements in the target repository, returns a path to a executable of the virtualenv. """ return str(self.get_or_create_venv(repo_path).resolve() / "bin" / "python")
python
def get_or_create_environment(self, repo: str, branch: str, git_repo: Repo, repo_path: Path) -> str: """ Handles the requirements in the target repository, returns a path to a executable of the virtualenv. """ return str(self.get_or_create_venv(repo_path).resolve() / "bin" / "python")
[ "def", "get_or_create_environment", "(", "self", ",", "repo", ":", "str", ",", "branch", ":", "str", ",", "git_repo", ":", "Repo", ",", "repo_path", ":", "Path", ")", "->", "str", ":", "return", "str", "(", "self", ".", "get_or_create_venv", "(", "repo_p...
Handles the requirements in the target repository, returns a path to a executable of the virtualenv.
[ "Handles", "the", "requirements", "in", "the", "target", "repository", "returns", "a", "path", "to", "a", "executable", "of", "the", "virtualenv", "." ]
e67fdc00be473ecf8ec16d024e1a3f2c47ca882c
https://github.com/mikicz/arca/blob/e67fdc00be473ecf8ec16d024e1a3f2c47ca882c/arca/backend/venv.py#L117-L120
238,981
humilis/humilis-lambdautils
lambdautils/utils.py
annotate_mapper
def annotate_mapper(**decargs): """Add input and output watermarks to processed events.""" def decorator(func): """Annotate events with entry and/or exit timestamps.""" def wrapper(event, *args, **kwargs): """Add enter and exit annotations to the processed event.""" funcn...
python
def annotate_mapper(**decargs): """Add input and output watermarks to processed events.""" def decorator(func): """Annotate events with entry and/or exit timestamps.""" def wrapper(event, *args, **kwargs): """Add enter and exit annotations to the processed event.""" funcn...
[ "def", "annotate_mapper", "(", "*", "*", "decargs", ")", ":", "def", "decorator", "(", "func", ")", ":", "\"\"\"Annotate events with entry and/or exit timestamps.\"\"\"", "def", "wrapper", "(", "event", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "\"\...
Add input and output watermarks to processed events.
[ "Add", "input", "and", "output", "watermarks", "to", "processed", "events", "." ]
58f75eb5ace23523c283708d56a9193181ea7e8e
https://github.com/humilis/humilis-lambdautils/blob/58f75eb5ace23523c283708d56a9193181ea7e8e/lambdautils/utils.py#L63-L79
238,982
humilis/humilis-lambdautils
lambdautils/utils.py
annotate_filter
def annotate_filter(**decargs): """Add input and output watermarks to filtered events.""" def decorator(func): """Annotate events with entry and/or exit timestamps.""" def wrapper(event, *args, **kwargs): """Add enter and exit annotations to the processed event.""" funcna...
python
def annotate_filter(**decargs): """Add input and output watermarks to filtered events.""" def decorator(func): """Annotate events with entry and/or exit timestamps.""" def wrapper(event, *args, **kwargs): """Add enter and exit annotations to the processed event.""" funcna...
[ "def", "annotate_filter", "(", "*", "*", "decargs", ")", ":", "def", "decorator", "(", "func", ")", ":", "\"\"\"Annotate events with entry and/or exit timestamps.\"\"\"", "def", "wrapper", "(", "event", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "\"\...
Add input and output watermarks to filtered events.
[ "Add", "input", "and", "output", "watermarks", "to", "filtered", "events", "." ]
58f75eb5ace23523c283708d56a9193181ea7e8e
https://github.com/humilis/humilis-lambdautils/blob/58f75eb5ace23523c283708d56a9193181ea7e8e/lambdautils/utils.py#L82-L97
238,983
humilis/humilis-lambdautils
lambdautils/utils.py
_error_repr
def _error_repr(error): """A compact unique representation of an error.""" error_repr = repr(error) if len(error_repr) > 200: error_repr = hash(type(error)) return error_repr
python
def _error_repr(error): """A compact unique representation of an error.""" error_repr = repr(error) if len(error_repr) > 200: error_repr = hash(type(error)) return error_repr
[ "def", "_error_repr", "(", "error", ")", ":", "error_repr", "=", "repr", "(", "error", ")", "if", "len", "(", "error_repr", ")", ">", "200", ":", "error_repr", "=", "hash", "(", "type", "(", "error", ")", ")", "return", "error_repr" ]
A compact unique representation of an error.
[ "A", "compact", "unique", "representation", "of", "an", "error", "." ]
58f75eb5ace23523c283708d56a9193181ea7e8e
https://github.com/humilis/humilis-lambdautils/blob/58f75eb5ace23523c283708d56a9193181ea7e8e/lambdautils/utils.py#L105-L110
238,984
humilis/humilis-lambdautils
lambdautils/utils.py
annotation_has_expired
def annotation_has_expired(event, key, timeout): """Check if an event error has expired.""" anns = get_annotations(event, key) if anns: return (time.time() - anns[0]["ts"]) > timeout else: return False
python
def annotation_has_expired(event, key, timeout): """Check if an event error has expired.""" anns = get_annotations(event, key) if anns: return (time.time() - anns[0]["ts"]) > timeout else: return False
[ "def", "annotation_has_expired", "(", "event", ",", "key", ",", "timeout", ")", ":", "anns", "=", "get_annotations", "(", "event", ",", "key", ")", "if", "anns", ":", "return", "(", "time", ".", "time", "(", ")", "-", "anns", "[", "0", "]", "[", "\...
Check if an event error has expired.
[ "Check", "if", "an", "event", "error", "has", "expired", "." ]
58f75eb5ace23523c283708d56a9193181ea7e8e
https://github.com/humilis/humilis-lambdautils/blob/58f75eb5ace23523c283708d56a9193181ea7e8e/lambdautils/utils.py#L113-L119
238,985
humilis/humilis-lambdautils
lambdautils/utils.py
replace_event_annotations
def replace_event_annotations(event, newanns): """Replace event annotations with the provided ones.""" _humilis = event.get("_humilis", {}) if not _humilis: event["_humilis"] = {"annotation": newanns} else: event["_humilis"]["annotation"] = newanns
python
def replace_event_annotations(event, newanns): """Replace event annotations with the provided ones.""" _humilis = event.get("_humilis", {}) if not _humilis: event["_humilis"] = {"annotation": newanns} else: event["_humilis"]["annotation"] = newanns
[ "def", "replace_event_annotations", "(", "event", ",", "newanns", ")", ":", "_humilis", "=", "event", ".", "get", "(", "\"_humilis\"", ",", "{", "}", ")", "if", "not", "_humilis", ":", "event", "[", "\"_humilis\"", "]", "=", "{", "\"annotation\"", ":", "...
Replace event annotations with the provided ones.
[ "Replace", "event", "annotations", "with", "the", "provided", "ones", "." ]
58f75eb5ace23523c283708d56a9193181ea7e8e
https://github.com/humilis/humilis-lambdautils/blob/58f75eb5ace23523c283708d56a9193181ea7e8e/lambdautils/utils.py#L127-L133
238,986
humilis/humilis-lambdautils
lambdautils/utils.py
annotate_event
def annotate_event(ev, key, ts=None, namespace=None, **kwargs): """Add an annotation to an event.""" ann = {} if ts is None: ts = time.time() ann["ts"] = ts ann["key"] = key if namespace is None and "HUMILIS_ENVIRONMENT" in os.environ: namespace = "{}:{}:{}".format( o...
python
def annotate_event(ev, key, ts=None, namespace=None, **kwargs): """Add an annotation to an event.""" ann = {} if ts is None: ts = time.time() ann["ts"] = ts ann["key"] = key if namespace is None and "HUMILIS_ENVIRONMENT" in os.environ: namespace = "{}:{}:{}".format( o...
[ "def", "annotate_event", "(", "ev", ",", "key", ",", "ts", "=", "None", ",", "namespace", "=", "None", ",", "*", "*", "kwargs", ")", ":", "ann", "=", "{", "}", "if", "ts", "is", "None", ":", "ts", "=", "time", ".", "time", "(", ")", "ann", "[...
Add an annotation to an event.
[ "Add", "an", "annotation", "to", "an", "event", "." ]
58f75eb5ace23523c283708d56a9193181ea7e8e
https://github.com/humilis/humilis-lambdautils/blob/58f75eb5ace23523c283708d56a9193181ea7e8e/lambdautils/utils.py#L136-L161
238,987
humilis/humilis-lambdautils
lambdautils/utils.py
get_annotations
def get_annotations(event, key, namespace=None, matchfunc=None): """Produce the list of annotations for a given key.""" if matchfunc is None: matchfunc = _is_equal if isinstance(key, Exception): key = _error_repr(key) return [ann for ann in event.get("_humilis", {}).get("annotation", [])...
python
def get_annotations(event, key, namespace=None, matchfunc=None): """Produce the list of annotations for a given key.""" if matchfunc is None: matchfunc = _is_equal if isinstance(key, Exception): key = _error_repr(key) return [ann for ann in event.get("_humilis", {}).get("annotation", [])...
[ "def", "get_annotations", "(", "event", ",", "key", ",", "namespace", "=", "None", ",", "matchfunc", "=", "None", ")", ":", "if", "matchfunc", "is", "None", ":", "matchfunc", "=", "_is_equal", "if", "isinstance", "(", "key", ",", "Exception", ")", ":", ...
Produce the list of annotations for a given key.
[ "Produce", "the", "list", "of", "annotations", "for", "a", "given", "key", "." ]
58f75eb5ace23523c283708d56a9193181ea7e8e
https://github.com/humilis/humilis-lambdautils/blob/58f75eb5ace23523c283708d56a9193181ea7e8e/lambdautils/utils.py#L176-L184
238,988
humilis/humilis-lambdautils
lambdautils/utils.py
delete_annotations
def delete_annotations(event, key, namespace=None, matchfunc=None): """Delete all event annotations with a matching key.""" if matchfunc is None: matchfunc = _is_equal if isinstance(key, Exception): key = _error_repr(key) newanns = [ann for ann in event.get("_humilis", {}).get("annotatio...
python
def delete_annotations(event, key, namespace=None, matchfunc=None): """Delete all event annotations with a matching key.""" if matchfunc is None: matchfunc = _is_equal if isinstance(key, Exception): key = _error_repr(key) newanns = [ann for ann in event.get("_humilis", {}).get("annotatio...
[ "def", "delete_annotations", "(", "event", ",", "key", ",", "namespace", "=", "None", ",", "matchfunc", "=", "None", ")", ":", "if", "matchfunc", "is", "None", ":", "matchfunc", "=", "_is_equal", "if", "isinstance", "(", "key", ",", "Exception", ")", ":"...
Delete all event annotations with a matching key.
[ "Delete", "all", "event", "annotations", "with", "a", "matching", "key", "." ]
58f75eb5ace23523c283708d56a9193181ea7e8e
https://github.com/humilis/humilis-lambdautils/blob/58f75eb5ace23523c283708d56a9193181ea7e8e/lambdautils/utils.py#L187-L196
238,989
humilis/humilis-lambdautils
lambdautils/utils.py
get_function_annotations
def get_function_annotations(event, funcname, type=None, namespace=None): """Produce a list of function annotations in in this event.""" if type: postfix = "|" + type else: postfix = "|.+" def matchfunc(key, annkey): """Check if the provider regex matches an annotation key.""" ...
python
def get_function_annotations(event, funcname, type=None, namespace=None): """Produce a list of function annotations in in this event.""" if type: postfix = "|" + type else: postfix = "|.+" def matchfunc(key, annkey): """Check if the provider regex matches an annotation key.""" ...
[ "def", "get_function_annotations", "(", "event", ",", "funcname", ",", "type", "=", "None", ",", "namespace", "=", "None", ")", ":", "if", "type", ":", "postfix", "=", "\"|\"", "+", "type", "else", ":", "postfix", "=", "\"|.+\"", "def", "matchfunc", "(",...
Produce a list of function annotations in in this event.
[ "Produce", "a", "list", "of", "function", "annotations", "in", "in", "this", "event", "." ]
58f75eb5ace23523c283708d56a9193181ea7e8e
https://github.com/humilis/humilis-lambdautils/blob/58f75eb5ace23523c283708d56a9193181ea7e8e/lambdautils/utils.py#L199-L211
238,990
pri22296/botify
botify/botify.py
Botify.add_task
def add_task(self, keywords, context, rule): """Map a function to a list of keywords Parameters ---------- keywords : iterable of str sequence of strings which should trigger the given function context : Context A Context object created using desired func...
python
def add_task(self, keywords, context, rule): """Map a function to a list of keywords Parameters ---------- keywords : iterable of str sequence of strings which should trigger the given function context : Context A Context object created using desired func...
[ "def", "add_task", "(", "self", ",", "keywords", ",", "context", ",", "rule", ")", ":", "for", "keyword", "in", "keywords", ":", "self", ".", "_tasks", "[", "keyword", "]", "=", "{", "'context'", ":", "context", ",", "'rule'", ":", "rule", "}" ]
Map a function to a list of keywords Parameters ---------- keywords : iterable of str sequence of strings which should trigger the given function context : Context A Context object created using desired function rule : tuple A tuple of integer...
[ "Map", "a", "function", "to", "a", "list", "of", "keywords" ]
c3ff022f4c7314e508ffaa3ce1da1ef1e784afb2
https://github.com/pri22296/botify/blob/c3ff022f4c7314e508ffaa3ce1da1ef1e784afb2/botify/botify.py#L73-L87
238,991
pri22296/botify
botify/botify.py
Botify.add_modifier
def add_modifier(self, modifier, keywords, relative_pos, action, parameter=None): """Modify existing tasks based on presence of a keyword. Parameters ---------- modifier : str A string value which would trigger the given Modifier. keywords : iter...
python
def add_modifier(self, modifier, keywords, relative_pos, action, parameter=None): """Modify existing tasks based on presence of a keyword. Parameters ---------- modifier : str A string value which would trigger the given Modifier. keywords : iter...
[ "def", "add_modifier", "(", "self", ",", "modifier", ",", "keywords", ",", "relative_pos", ",", "action", ",", "parameter", "=", "None", ")", ":", "if", "relative_pos", "==", "0", ":", "raise", "ValueError", "(", "\"relative_pos cannot be 0\"", ")", "modifier_...
Modify existing tasks based on presence of a keyword. Parameters ---------- modifier : str A string value which would trigger the given Modifier. keywords : iterable of str sequence of strings which are keywords for some task, which has to be modified...
[ "Modify", "existing", "tasks", "based", "on", "presence", "of", "a", "keyword", "." ]
c3ff022f4c7314e508ffaa3ce1da1ef1e784afb2
https://github.com/pri22296/botify/blob/c3ff022f4c7314e508ffaa3ce1da1ef1e784afb2/botify/botify.py#L89-L120
238,992
pri22296/botify
botify/botify.py
Botify.parse
def parse(self, text): """Parse the string `text` and return a tuple of left over Data fields. Parameters ---------- text : str A string to be parsed Returns ------- result : tuple A tuple of left over Data after processing """ ...
python
def parse(self, text): """Parse the string `text` and return a tuple of left over Data fields. Parameters ---------- text : str A string to be parsed Returns ------- result : tuple A tuple of left over Data after processing """ ...
[ "def", "parse", "(", "self", ",", "text", ")", ":", "self", ".", "_parsed_list", "=", "[", "]", "self", ".", "_most_recent_report", "=", "[", "]", "self", ".", "_token_list", "=", "text", ".", "lower", "(", ")", ".", "split", "(", ")", "modifier_inde...
Parse the string `text` and return a tuple of left over Data fields. Parameters ---------- text : str A string to be parsed Returns ------- result : tuple A tuple of left over Data after processing
[ "Parse", "the", "string", "text", "and", "return", "a", "tuple", "of", "left", "over", "Data", "fields", "." ]
c3ff022f4c7314e508ffaa3ce1da1ef1e784afb2
https://github.com/pri22296/botify/blob/c3ff022f4c7314e508ffaa3ce1da1ef1e784afb2/botify/botify.py#L122-L155
238,993
racker/python-twisted-service-registry-client
txServiceRegistry/client.py
ResponseReceiver.connectionLost
def connectionLost(self, reason): """ Called when the response body has been completely delivered. @param reason: Either a twisted.web.client.ResponseDone exception or a twisted.web.http.PotentialDataLoss exception. """ self.remaining.reset() try: res...
python
def connectionLost(self, reason): """ Called when the response body has been completely delivered. @param reason: Either a twisted.web.client.ResponseDone exception or a twisted.web.http.PotentialDataLoss exception. """ self.remaining.reset() try: res...
[ "def", "connectionLost", "(", "self", ",", "reason", ")", ":", "self", ".", "remaining", ".", "reset", "(", ")", "try", ":", "result", "=", "json", ".", "load", "(", "self", ".", "remaining", ")", "except", "Exception", ",", "e", ":", "self", ".", ...
Called when the response body has been completely delivered. @param reason: Either a twisted.web.client.ResponseDone exception or a twisted.web.http.PotentialDataLoss exception.
[ "Called", "when", "the", "response", "body", "has", "been", "completely", "delivered", "." ]
72adfce04c609d72f09ee2f21e9d31be12aefd80
https://github.com/racker/python-twisted-service-registry-client/blob/72adfce04c609d72f09ee2f21e9d31be12aefd80/txServiceRegistry/client.py#L71-L90
238,994
racker/python-twisted-service-registry-client
txServiceRegistry/client.py
BaseClient.request
def request(self, method, path, options=None, payload=None, heartbeater=None, retry_count=0): """ Make a request to the Service Registry API. @param method: HTTP method ('POST', 'GET', etc.). ...
python
def request(self, method, path, options=None, payload=None, heartbeater=None, retry_count=0): """ Make a request to the Service Registry API. @param method: HTTP method ('POST', 'GET', etc.). ...
[ "def", "request", "(", "self", ",", "method", ",", "path", ",", "options", "=", "None", ",", "payload", "=", "None", ",", "heartbeater", "=", "None", ",", "retry_count", "=", "0", ")", ":", "def", "_request", "(", "authHeaders", ",", "options", ",", ...
Make a request to the Service Registry API. @param method: HTTP method ('POST', 'GET', etc.). @type method: C{str} @param path: Path to be appended to base URL ('/sessions', etc.). @type path: C{str} @param options: Options to be encoded as query parameters in the URL. @t...
[ "Make", "a", "request", "to", "the", "Service", "Registry", "API", "." ]
72adfce04c609d72f09ee2f21e9d31be12aefd80
https://github.com/racker/python-twisted-service-registry-client/blob/72adfce04c609d72f09ee2f21e9d31be12aefd80/txServiceRegistry/client.py#L149-L194
238,995
rackerlabs/txkazoo
txkazoo/recipe/partitioner.py
_SetPartitionerWrapper._initialized
def _initialized(self, partitioner): """Store the partitioner and reset the internal state. Now that we successfully got an actual :class:`kazoo.recipe.partitioner.SetPartitioner` object, we store it and reset our internal ``_state`` to ``None``, causing the ``state`` property t...
python
def _initialized(self, partitioner): """Store the partitioner and reset the internal state. Now that we successfully got an actual :class:`kazoo.recipe.partitioner.SetPartitioner` object, we store it and reset our internal ``_state`` to ``None``, causing the ``state`` property t...
[ "def", "_initialized", "(", "self", ",", "partitioner", ")", ":", "self", ".", "_partitioner", "=", "partitioner", "self", ".", "_thimble", "=", "Thimble", "(", "self", ".", "reactor", ",", "self", ".", "pool", ",", "partitioner", ",", "_blocking_partitioner...
Store the partitioner and reset the internal state. Now that we successfully got an actual :class:`kazoo.recipe.partitioner.SetPartitioner` object, we store it and reset our internal ``_state`` to ``None``, causing the ``state`` property to defer to the partitioner's state.
[ "Store", "the", "partitioner", "and", "reset", "the", "internal", "state", "." ]
a0989138cc08df7acd1d410f7e48708553839f46
https://github.com/rackerlabs/txkazoo/blob/a0989138cc08df7acd1d410f7e48708553839f46/txkazoo/recipe/partitioner.py#L53-L66
238,996
mikicz/arca
arca/backend/vagrant.py
VagrantBackend.inject_arca
def inject_arca(self, arca): """ Apart from the usual validation stuff it also creates log file for this instance. """ super().inject_arca(arca) import vagrant self.log_path = Path(self._arca.base_dir) / "logs" / (str(uuid4()) + ".log") self.log_path.parent.mkdir(exist_...
python
def inject_arca(self, arca): """ Apart from the usual validation stuff it also creates log file for this instance. """ super().inject_arca(arca) import vagrant self.log_path = Path(self._arca.base_dir) / "logs" / (str(uuid4()) + ".log") self.log_path.parent.mkdir(exist_...
[ "def", "inject_arca", "(", "self", ",", "arca", ")", ":", "super", "(", ")", ".", "inject_arca", "(", "arca", ")", "import", "vagrant", "self", ".", "log_path", "=", "Path", "(", "self", ".", "_arca", ".", "base_dir", ")", "/", "\"logs\"", "/", "(", ...
Apart from the usual validation stuff it also creates log file for this instance.
[ "Apart", "from", "the", "usual", "validation", "stuff", "it", "also", "creates", "log", "file", "for", "this", "instance", "." ]
e67fdc00be473ecf8ec16d024e1a3f2c47ca882c
https://github.com/mikicz/arca/blob/e67fdc00be473ecf8ec16d024e1a3f2c47ca882c/arca/backend/vagrant.py#L74-L85
238,997
mikicz/arca
arca/backend/vagrant.py
VagrantBackend.init_vagrant
def init_vagrant(self, vagrant_file): """ Creates a Vagrantfile in the target dir, with only the base image pulled. Copies the runner script to the directory so it's accessible from the VM. """ if self.inherit_image: image_name, image_tag = str(self.inherit_image).split("...
python
def init_vagrant(self, vagrant_file): """ Creates a Vagrantfile in the target dir, with only the base image pulled. Copies the runner script to the directory so it's accessible from the VM. """ if self.inherit_image: image_name, image_tag = str(self.inherit_image).split("...
[ "def", "init_vagrant", "(", "self", ",", "vagrant_file", ")", ":", "if", "self", ".", "inherit_image", ":", "image_name", ",", "image_tag", "=", "str", "(", "self", ".", "inherit_image", ")", ".", "split", "(", "\":\"", ")", "else", ":", "image_name", "=...
Creates a Vagrantfile in the target dir, with only the base image pulled. Copies the runner script to the directory so it's accessible from the VM.
[ "Creates", "a", "Vagrantfile", "in", "the", "target", "dir", "with", "only", "the", "base", "image", "pulled", ".", "Copies", "the", "runner", "script", "to", "the", "directory", "so", "it", "s", "accessible", "from", "the", "VM", "." ]
e67fdc00be473ecf8ec16d024e1a3f2c47ca882c
https://github.com/mikicz/arca/blob/e67fdc00be473ecf8ec16d024e1a3f2c47ca882c/arca/backend/vagrant.py#L113-L145
238,998
mikicz/arca
arca/backend/vagrant.py
VagrantBackend.fabric_task
def fabric_task(self): """ Returns a fabric task which executes the script in the Vagrant VM """ from fabric import api @api.task def run_script(container_name, definition_filename, image_name, image_tag, repository, timeout): """ Sequence to run inside the VM. ...
python
def fabric_task(self): """ Returns a fabric task which executes the script in the Vagrant VM """ from fabric import api @api.task def run_script(container_name, definition_filename, image_name, image_tag, repository, timeout): """ Sequence to run inside the VM. ...
[ "def", "fabric_task", "(", "self", ")", ":", "from", "fabric", "import", "api", "@", "api", ".", "task", "def", "run_script", "(", "container_name", ",", "definition_filename", ",", "image_name", ",", "image_tag", ",", "repository", ",", "timeout", ")", ":",...
Returns a fabric task which executes the script in the Vagrant VM
[ "Returns", "a", "fabric", "task", "which", "executes", "the", "script", "in", "the", "Vagrant", "VM" ]
e67fdc00be473ecf8ec16d024e1a3f2c47ca882c
https://github.com/mikicz/arca/blob/e67fdc00be473ecf8ec16d024e1a3f2c47ca882c/arca/backend/vagrant.py#L148-L200
238,999
mikicz/arca
arca/backend/vagrant.py
VagrantBackend.ensure_vm_running
def ensure_vm_running(self, vm_location): """ Gets or creates a Vagrantfile in ``vm_location`` and calls ``vagrant up`` if the VM is not running. """ import vagrant if self.vagrant is None: vagrant_file = vm_location / "Vagrantfile" if not vagrant_file.exists(): ...
python
def ensure_vm_running(self, vm_location): """ Gets or creates a Vagrantfile in ``vm_location`` and calls ``vagrant up`` if the VM is not running. """ import vagrant if self.vagrant is None: vagrant_file = vm_location / "Vagrantfile" if not vagrant_file.exists(): ...
[ "def", "ensure_vm_running", "(", "self", ",", "vm_location", ")", ":", "import", "vagrant", "if", "self", ".", "vagrant", "is", "None", ":", "vagrant_file", "=", "vm_location", "/", "\"Vagrantfile\"", "if", "not", "vagrant_file", ".", "exists", "(", ")", ":"...
Gets or creates a Vagrantfile in ``vm_location`` and calls ``vagrant up`` if the VM is not running.
[ "Gets", "or", "creates", "a", "Vagrantfile", "in", "vm_location", "and", "calls", "vagrant", "up", "if", "the", "VM", "is", "not", "running", "." ]
e67fdc00be473ecf8ec16d024e1a3f2c47ca882c
https://github.com/mikicz/arca/blob/e67fdc00be473ecf8ec16d024e1a3f2c47ca882c/arca/backend/vagrant.py#L202-L224