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
55,300
CivicSpleen/ambry
ambry/library/search_backends/whoosh_backend.py
_init_index
def _init_index(root_dir, schema, index_name): """ Creates new index or opens existing. Args: root_dir (str): root dir where to find or create index. schema (whoosh.fields.Schema): schema of the index to create or open. index_name (str): name of the index. Returns: tuple ((...
python
def _init_index(root_dir, schema, index_name): """ Creates new index or opens existing. Args: root_dir (str): root dir where to find or create index. schema (whoosh.fields.Schema): schema of the index to create or open. index_name (str): name of the index. Returns: tuple ((...
[ "def", "_init_index", "(", "root_dir", ",", "schema", ",", "index_name", ")", ":", "index_dir", "=", "os", ".", "path", ".", "join", "(", "root_dir", ",", "index_name", ")", "try", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "index_dir", ...
Creates new index or opens existing. Args: root_dir (str): root dir where to find or create index. schema (whoosh.fields.Schema): schema of the index to create or open. index_name (str): name of the index. Returns: tuple ((whoosh.index.FileIndex, str)): first element is index, ...
[ "Creates", "new", "index", "or", "opens", "existing", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/search_backends/whoosh_backend.py#L410-L431
55,301
CivicSpleen/ambry
ambry/library/search_backends/whoosh_backend.py
DatasetWhooshIndex.reset
def reset(self): """ Resets index by removing index directory. """ if os.path.exists(self.index_dir): rmtree(self.index_dir) self.index = None
python
def reset(self): """ Resets index by removing index directory. """ if os.path.exists(self.index_dir): rmtree(self.index_dir) self.index = None
[ "def", "reset", "(", "self", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "self", ".", "index_dir", ")", ":", "rmtree", "(", "self", ".", "index_dir", ")", "self", ".", "index", "=", "None" ]
Resets index by removing index directory.
[ "Resets", "index", "by", "removing", "index", "directory", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/search_backends/whoosh_backend.py#L54-L58
55,302
CivicSpleen/ambry
ambry/library/search_backends/whoosh_backend.py
DatasetWhooshIndex._get_generic_schema
def _get_generic_schema(self): """ Returns whoosh's generic schema of the dataset. """ schema = Schema( vid=ID(stored=True, unique=True), # Object id title=NGRAMWORDS(), keywords=KEYWORD, # Lists of coverage identifiers, ISO time values and GVIDs, source names, sour...
python
def _get_generic_schema(self): """ Returns whoosh's generic schema of the dataset. """ schema = Schema( vid=ID(stored=True, unique=True), # Object id title=NGRAMWORDS(), keywords=KEYWORD, # Lists of coverage identifiers, ISO time values and GVIDs, source names, sour...
[ "def", "_get_generic_schema", "(", "self", ")", ":", "schema", "=", "Schema", "(", "vid", "=", "ID", "(", "stored", "=", "True", ",", "unique", "=", "True", ")", ",", "# Object id", "title", "=", "NGRAMWORDS", "(", ")", ",", "keywords", "=", "KEYWORD",...
Returns whoosh's generic schema of the dataset.
[ "Returns", "whoosh", "s", "generic", "schema", "of", "the", "dataset", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/search_backends/whoosh_backend.py#L145-L152
55,303
CivicSpleen/ambry
ambry/library/search_backends/whoosh_backend.py
IdentifierWhooshIndex.search
def search(self, search_phrase, limit=None): """ Finds identifier by search phrase. """ self._parsed_query = search_phrase schema = self._get_generic_schema() parser = QueryParser('name', schema=schema) query = parser.parse(search_phrase) class PosSizeWeighting(scoring.W...
python
def search(self, search_phrase, limit=None): """ Finds identifier by search phrase. """ self._parsed_query = search_phrase schema = self._get_generic_schema() parser = QueryParser('name', schema=schema) query = parser.parse(search_phrase) class PosSizeWeighting(scoring.W...
[ "def", "search", "(", "self", ",", "search_phrase", ",", "limit", "=", "None", ")", ":", "self", ".", "_parsed_query", "=", "search_phrase", "schema", "=", "self", ".", "_get_generic_schema", "(", ")", "parser", "=", "QueryParser", "(", "'name'", ",", "sch...
Finds identifier by search phrase.
[ "Finds", "identifier", "by", "search", "phrase", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/search_backends/whoosh_backend.py#L186-L221
55,304
CivicSpleen/ambry
ambry/library/search_backends/whoosh_backend.py
IdentifierWhooshIndex._get_generic_schema
def _get_generic_schema(self): """ Returns whoosh's generic schema. """ schema = Schema( identifier=ID(stored=True), # Partition versioned id type=ID(stored=True), name=NGRAM(phrase=True, stored=True, minsize=2, maxsize=8)) return schema
python
def _get_generic_schema(self): """ Returns whoosh's generic schema. """ schema = Schema( identifier=ID(stored=True), # Partition versioned id type=ID(stored=True), name=NGRAM(phrase=True, stored=True, minsize=2, maxsize=8)) return schema
[ "def", "_get_generic_schema", "(", "self", ")", ":", "schema", "=", "Schema", "(", "identifier", "=", "ID", "(", "stored", "=", "True", ")", ",", "# Partition versioned id", "type", "=", "ID", "(", "stored", "=", "True", ")", ",", "name", "=", "NGRAM", ...
Returns whoosh's generic schema.
[ "Returns", "whoosh", "s", "generic", "schema", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/search_backends/whoosh_backend.py#L231-L237
55,305
CivicSpleen/ambry
ambry/library/search_backends/whoosh_backend.py
PartitionWhooshIndex.all
def all(self): """ Returns list with all indexed partitions. """ partitions = [] for partition in self.index.searcher().documents(): partitions.append( PartitionSearchResult(dataset_vid=partition['dataset_vid'], vid=partition['vid'], score=1)) return partition...
python
def all(self): """ Returns list with all indexed partitions. """ partitions = [] for partition in self.index.searcher().documents(): partitions.append( PartitionSearchResult(dataset_vid=partition['dataset_vid'], vid=partition['vid'], score=1)) return partition...
[ "def", "all", "(", "self", ")", ":", "partitions", "=", "[", "]", "for", "partition", "in", "self", ".", "index", ".", "searcher", "(", ")", ".", "documents", "(", ")", ":", "partitions", ".", "append", "(", "PartitionSearchResult", "(", "dataset_vid", ...
Returns list with all indexed partitions.
[ "Returns", "list", "with", "all", "indexed", "partitions", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/search_backends/whoosh_backend.py#L270-L276
55,306
CivicSpleen/ambry
ambry/library/search_backends/whoosh_backend.py
PartitionWhooshIndex._make_query_from_terms
def _make_query_from_terms(self, terms): """ returns a FTS query for partition created from decomposed search terms. args: terms (dict or str): returns: str containing fts query. """ expanded_terms = self._expand_terms(terms) cterms = '' ...
python
def _make_query_from_terms(self, terms): """ returns a FTS query for partition created from decomposed search terms. args: terms (dict or str): returns: str containing fts query. """ expanded_terms = self._expand_terms(terms) cterms = '' ...
[ "def", "_make_query_from_terms", "(", "self", ",", "terms", ")", ":", "expanded_terms", "=", "self", ".", "_expand_terms", "(", "terms", ")", "cterms", "=", "''", "if", "expanded_terms", "[", "'doc'", "]", ":", "cterms", "=", "self", ".", "backend", ".", ...
returns a FTS query for partition created from decomposed search terms. args: terms (dict or str): returns: str containing fts query.
[ "returns", "a", "FTS", "query", "for", "partition", "created", "from", "decomposed", "search", "terms", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/search_backends/whoosh_backend.py#L308-L341
55,307
CivicSpleen/ambry
ambry/library/search_backends/whoosh_backend.py
PartitionWhooshIndex._from_to_as_term
def _from_to_as_term(self, frm, to): """ Turns from and to into the query format. Args: frm (str): from year to (str): to year Returns: FTS query str with years range. """ # The wackiness with the conversion to int and str, and adding ' ', ...
python
def _from_to_as_term(self, frm, to): """ Turns from and to into the query format. Args: frm (str): from year to (str): to year Returns: FTS query str with years range. """ # The wackiness with the conversion to int and str, and adding ' ', ...
[ "def", "_from_to_as_term", "(", "self", ",", "frm", ",", "to", ")", ":", "# The wackiness with the conversion to int and str, and adding ' ', is because there", "# can't be a space between the 'TO' and the brackets in the time range", "# when one end is open", "from_year", "=", "''", ...
Turns from and to into the query format. Args: frm (str): from year to (str): to year Returns: FTS query str with years range.
[ "Turns", "from", "and", "to", "into", "the", "query", "format", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/search_backends/whoosh_backend.py#L343-L376
55,308
andreafioraldi/angrdbg
angrdbg/memory_8.py
SimSymbolicDbgMemory.copy
def copy(self, _): """ Return a copy of the SimMemory. """ #l.debug("Copying %d bytes of memory with id %s." % (len(self.mem), self.id)) c = SimSymbolicDbgMemory( mem=self.mem.branch(), memory_id=self.id, endness=self.endness, abstr...
python
def copy(self, _): """ Return a copy of the SimMemory. """ #l.debug("Copying %d bytes of memory with id %s." % (len(self.mem), self.id)) c = SimSymbolicDbgMemory( mem=self.mem.branch(), memory_id=self.id, endness=self.endness, abstr...
[ "def", "copy", "(", "self", ",", "_", ")", ":", "#l.debug(\"Copying %d bytes of memory with id %s.\" % (len(self.mem), self.id))", "c", "=", "SimSymbolicDbgMemory", "(", "mem", "=", "self", ".", "mem", ".", "branch", "(", ")", ",", "memory_id", "=", "self", ".", ...
Return a copy of the SimMemory.
[ "Return", "a", "copy", "of", "the", "SimMemory", "." ]
939b20fb9b341aee695d2db12142b1eddc5b555a
https://github.com/andreafioraldi/angrdbg/blob/939b20fb9b341aee695d2db12142b1eddc5b555a/angrdbg/memory_8.py#L74-L90
55,309
CivicSpleen/ambry
ambry/pands.py
AmbrySeries.column
def column(self): """Return the ambry column""" from ambry.orm.exc import NotFoundError if not hasattr(self, 'partition'): return None if not self.name: return None try: try: return self.partition.column(self.name) ...
python
def column(self): """Return the ambry column""" from ambry.orm.exc import NotFoundError if not hasattr(self, 'partition'): return None if not self.name: return None try: try: return self.partition.column(self.name) ...
[ "def", "column", "(", "self", ")", ":", "from", "ambry", ".", "orm", ".", "exc", "import", "NotFoundError", "if", "not", "hasattr", "(", "self", ",", "'partition'", ")", ":", "return", "None", "if", "not", "self", ".", "name", ":", "return", "None", ...
Return the ambry column
[ "Return", "the", "ambry", "column" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/pands.py#L27-L43
55,310
spotify/ulogger
ulogger/syslog.py
get_handler
def get_handler(progname, address=None, proto=None, facility=None, fmt=None, datefmt=None, **_): """Helper function to create a Syslog handler. See `ulogger.syslog.SyslogHandlerBuilder` for arguments and supported keyword arguments. Returns: (obj): Instance of `logging.SysLogHa...
python
def get_handler(progname, address=None, proto=None, facility=None, fmt=None, datefmt=None, **_): """Helper function to create a Syslog handler. See `ulogger.syslog.SyslogHandlerBuilder` for arguments and supported keyword arguments. Returns: (obj): Instance of `logging.SysLogHa...
[ "def", "get_handler", "(", "progname", ",", "address", "=", "None", ",", "proto", "=", "None", ",", "facility", "=", "None", ",", "fmt", "=", "None", ",", "datefmt", "=", "None", ",", "*", "*", "_", ")", ":", "builder", "=", "SyslogHandlerBuilder", "...
Helper function to create a Syslog handler. See `ulogger.syslog.SyslogHandlerBuilder` for arguments and supported keyword arguments. Returns: (obj): Instance of `logging.SysLogHandler`
[ "Helper", "function", "to", "create", "a", "Syslog", "handler", "." ]
c59ced69e55b400e9c7a3688145fe3e8cb89db13
https://github.com/spotify/ulogger/blob/c59ced69e55b400e9c7a3688145fe3e8cb89db13/ulogger/syslog.py#L141-L154
55,311
project-ncl/pnc-cli
pnc_cli/swagger_client/models/target_repository_rest.py
TargetRepositoryRest.repository_type
def repository_type(self, repository_type): """ Sets the repository_type of this TargetRepositoryRest. :param repository_type: The repository_type of this TargetRepositoryRest. :type: str """ allowed_values = ["MAVEN", "NPM", "COCOA_POD", "GENERIC_PROXY"] if repo...
python
def repository_type(self, repository_type): """ Sets the repository_type of this TargetRepositoryRest. :param repository_type: The repository_type of this TargetRepositoryRest. :type: str """ allowed_values = ["MAVEN", "NPM", "COCOA_POD", "GENERIC_PROXY"] if repo...
[ "def", "repository_type", "(", "self", ",", "repository_type", ")", ":", "allowed_values", "=", "[", "\"MAVEN\"", ",", "\"NPM\"", ",", "\"COCOA_POD\"", ",", "\"GENERIC_PROXY\"", "]", "if", "repository_type", "not", "in", "allowed_values", ":", "raise", "ValueError...
Sets the repository_type of this TargetRepositoryRest. :param repository_type: The repository_type of this TargetRepositoryRest. :type: str
[ "Sets", "the", "repository_type", "of", "this", "TargetRepositoryRest", "." ]
3dc149bf84928f60a8044ac50b58bbaddd451902
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/swagger_client/models/target_repository_rest.py#L150-L164
55,312
CivicSpleen/ambry
ambry/bundle/concurrent.py
worker
def worker(inqueue, outqueue, initializer=None, initargs=(), maxtasks=None): """ Custom worker for bundle operations :param inqueue: :param outqueue: :param initializer: :param initargs: :param maxtasks: :return: """ from ambry.library import new_library from ambry.run import ge...
python
def worker(inqueue, outqueue, initializer=None, initargs=(), maxtasks=None): """ Custom worker for bundle operations :param inqueue: :param outqueue: :param initializer: :param initargs: :param maxtasks: :return: """ from ambry.library import new_library from ambry.run import ge...
[ "def", "worker", "(", "inqueue", ",", "outqueue", ",", "initializer", "=", "None", ",", "initargs", "=", "(", ")", ",", "maxtasks", "=", "None", ")", ":", "from", "ambry", ".", "library", "import", "new_library", "from", "ambry", ".", "run", "import", ...
Custom worker for bundle operations :param inqueue: :param outqueue: :param initializer: :param initargs: :param maxtasks: :return:
[ "Custom", "worker", "for", "bundle", "operations" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/concurrent.py#L19-L102
55,313
CivicSpleen/ambry
ambry/bundle/concurrent.py
init_library
def init_library(database_dsn, accounts_password, limited_run = False): """Child initializer, setup in Library.process_pool""" import os import signal # Have the child processes ignore the keyboard interrupt, and other signals. Instead, the parent will # catch these, and clean up the children. ...
python
def init_library(database_dsn, accounts_password, limited_run = False): """Child initializer, setup in Library.process_pool""" import os import signal # Have the child processes ignore the keyboard interrupt, and other signals. Instead, the parent will # catch these, and clean up the children. ...
[ "def", "init_library", "(", "database_dsn", ",", "accounts_password", ",", "limited_run", "=", "False", ")", ":", "import", "os", "import", "signal", "# Have the child processes ignore the keyboard interrupt, and other signals. Instead, the parent will", "# catch these, and clean u...
Child initializer, setup in Library.process_pool
[ "Child", "initializer", "setup", "in", "Library", ".", "process_pool" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/concurrent.py#L137-L151
55,314
CivicSpleen/ambry
ambry/bundle/concurrent.py
unify_mp
def unify_mp(b, partition_name): """Unify all of the segment partitions for a parent partition, then run stats on the MPR file""" with b.progress.start('coalesce_mp',0,message="MP coalesce {}".format(partition_name)) as ps: r = b.unify_partition(partition_name, None, ps) return r
python
def unify_mp(b, partition_name): """Unify all of the segment partitions for a parent partition, then run stats on the MPR file""" with b.progress.start('coalesce_mp',0,message="MP coalesce {}".format(partition_name)) as ps: r = b.unify_partition(partition_name, None, ps) return r
[ "def", "unify_mp", "(", "b", ",", "partition_name", ")", ":", "with", "b", ".", "progress", ".", "start", "(", "'coalesce_mp'", ",", "0", ",", "message", "=", "\"MP coalesce {}\"", ".", "format", "(", "partition_name", ")", ")", "as", "ps", ":", "r", "...
Unify all of the segment partitions for a parent partition, then run stats on the MPR file
[ "Unify", "all", "of", "the", "segment", "partitions", "for", "a", "parent", "partition", "then", "run", "stats", "on", "the", "MPR", "file" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/concurrent.py#L166-L172
55,315
CivicSpleen/ambry
ambry/library/filesystem.py
LibraryFilesystem._compose
def _compose(self, name, args, mkdir=True): """Get a named filesystem entry, and extend it into a path with additional path arguments""" from os.path import normpath from ambry.dbexceptions import ConfigurationError root = p = self._config.filesystem[name].format(root=self._root...
python
def _compose(self, name, args, mkdir=True): """Get a named filesystem entry, and extend it into a path with additional path arguments""" from os.path import normpath from ambry.dbexceptions import ConfigurationError root = p = self._config.filesystem[name].format(root=self._root...
[ "def", "_compose", "(", "self", ",", "name", ",", "args", ",", "mkdir", "=", "True", ")", ":", "from", "os", ".", "path", "import", "normpath", "from", "ambry", ".", "dbexceptions", "import", "ConfigurationError", "root", "=", "p", "=", "self", ".", "_...
Get a named filesystem entry, and extend it into a path with additional path arguments
[ "Get", "a", "named", "filesystem", "entry", "and", "extend", "it", "into", "a", "path", "with", "additional", "path", "arguments" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/filesystem.py#L23-L44
55,316
CivicSpleen/ambry
ambry/library/filesystem.py
LibraryFilesystem.compose
def compose(self, name, *args): """Compose, but don't create base directory""" return self._compose(name, args, mkdir=False)
python
def compose(self, name, *args): """Compose, but don't create base directory""" return self._compose(name, args, mkdir=False)
[ "def", "compose", "(", "self", ",", "name", ",", "*", "args", ")", ":", "return", "self", ".", "_compose", "(", "name", ",", "args", ",", "mkdir", "=", "False", ")" ]
Compose, but don't create base directory
[ "Compose", "but", "don", "t", "create", "base", "directory" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/filesystem.py#L46-L49
55,317
CivicSpleen/ambry
ambry/library/filesystem.py
LibraryFilesystem.database_dsn
def database_dsn(self): """Substitute the root dir into the database DSN, for Sqlite""" if not self._config.library.database: return 'sqlite:///{root}/library.db'.format(root=self._root) return self._config.library.database.format(root=self._root)
python
def database_dsn(self): """Substitute the root dir into the database DSN, for Sqlite""" if not self._config.library.database: return 'sqlite:///{root}/library.db'.format(root=self._root) return self._config.library.database.format(root=self._root)
[ "def", "database_dsn", "(", "self", ")", ":", "if", "not", "self", ".", "_config", ".", "library", ".", "database", ":", "return", "'sqlite:///{root}/library.db'", ".", "format", "(", "root", "=", "self", ".", "_root", ")", "return", "self", ".", "_config"...
Substitute the root dir into the database DSN, for Sqlite
[ "Substitute", "the", "root", "dir", "into", "the", "database", "DSN", "for", "Sqlite" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/filesystem.py#L86-L92
55,318
CivicSpleen/ambry
ambry/etl/pipeline.py
make_table_map
def make_table_map(table, headers): """Create a function to map from rows with the structure of the headers to the structure of the table.""" header_parts = {} for i, h in enumerate(headers): header_parts[h] = 'row[{}]'.format(i) body_code = 'lambda row: [{}]'.format(','.join(header_parts.get(...
python
def make_table_map(table, headers): """Create a function to map from rows with the structure of the headers to the structure of the table.""" header_parts = {} for i, h in enumerate(headers): header_parts[h] = 'row[{}]'.format(i) body_code = 'lambda row: [{}]'.format(','.join(header_parts.get(...
[ "def", "make_table_map", "(", "table", ",", "headers", ")", ":", "header_parts", "=", "{", "}", "for", "i", ",", "h", "in", "enumerate", "(", "headers", ")", ":", "header_parts", "[", "h", "]", "=", "'row[{}]'", ".", "format", "(", "i", ")", "body_co...
Create a function to map from rows with the structure of the headers to the structure of the table.
[ "Create", "a", "function", "to", "map", "from", "rows", "with", "the", "structure", "of", "the", "headers", "to", "the", "structure", "of", "the", "table", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/etl/pipeline.py#L1718-L1729
55,319
CivicSpleen/ambry
ambry/etl/pipeline.py
augment_pipeline
def augment_pipeline(pl, head_pipe=None, tail_pipe=None): """ Augment the pipeline by adding a new pipe section to each stage that has one or more pipes. Can be used for debugging :param pl: :param DebugPipe: :return: """ for k, v in iteritems(pl): if v and len(v) > 0: ...
python
def augment_pipeline(pl, head_pipe=None, tail_pipe=None): """ Augment the pipeline by adding a new pipe section to each stage that has one or more pipes. Can be used for debugging :param pl: :param DebugPipe: :return: """ for k, v in iteritems(pl): if v and len(v) > 0: ...
[ "def", "augment_pipeline", "(", "pl", ",", "head_pipe", "=", "None", ",", "tail_pipe", "=", "None", ")", ":", "for", "k", ",", "v", "in", "iteritems", "(", "pl", ")", ":", "if", "v", "and", "len", "(", "v", ")", ">", "0", ":", "if", "head_pipe", ...
Augment the pipeline by adding a new pipe section to each stage that has one or more pipes. Can be used for debugging :param pl: :param DebugPipe: :return:
[ "Augment", "the", "pipeline", "by", "adding", "a", "new", "pipe", "section", "to", "each", "stage", "that", "has", "one", "or", "more", "pipes", ".", "Can", "be", "used", "for", "debugging" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/etl/pipeline.py#L2386-L2401
55,320
CivicSpleen/ambry
ambry/etl/pipeline.py
ReplaceWithDestHeader.process_header
def process_header(self, headers): """Ignore the incomming header and replace it with the destination header""" return [c.name for c in self.source.dest_table.columns][1:]
python
def process_header(self, headers): """Ignore the incomming header and replace it with the destination header""" return [c.name for c in self.source.dest_table.columns][1:]
[ "def", "process_header", "(", "self", ",", "headers", ")", ":", "return", "[", "c", ".", "name", "for", "c", "in", "self", ".", "source", ".", "dest_table", ".", "columns", "]", "[", "1", ":", "]" ]
Ignore the incomming header and replace it with the destination header
[ "Ignore", "the", "incomming", "header", "and", "replace", "it", "with", "the", "destination", "header" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/etl/pipeline.py#L858-L861
55,321
CivicSpleen/ambry
ambry/etl/pipeline.py
WriteToPartition.rate
def rate(self): """Report the insertion rate in records per second""" end = self._end_time if self._end_time else time.time() return self._count / (end - self._start_time)
python
def rate(self): """Report the insertion rate in records per second""" end = self._end_time if self._end_time else time.time() return self._count / (end - self._start_time)
[ "def", "rate", "(", "self", ")", ":", "end", "=", "self", ".", "_end_time", "if", "self", ".", "_end_time", "else", "time", ".", "time", "(", ")", "return", "self", ".", "_count", "/", "(", "end", "-", "self", ".", "_start_time", ")" ]
Report the insertion rate in records per second
[ "Report", "the", "insertion", "rate", "in", "records", "per", "second" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/etl/pipeline.py#L1980-L1985
55,322
CivicSpleen/ambry
ambry/etl/pipeline.py
Pipeline._subset
def _subset(self, subset): """Return a new pipeline with a subset of the sections""" pl = Pipeline(bundle=self.bundle) for group_name, pl_segment in iteritems(self): if group_name not in subset: continue pl[group_name] = pl_segment return pl
python
def _subset(self, subset): """Return a new pipeline with a subset of the sections""" pl = Pipeline(bundle=self.bundle) for group_name, pl_segment in iteritems(self): if group_name not in subset: continue pl[group_name] = pl_segment return pl
[ "def", "_subset", "(", "self", ",", "subset", ")", ":", "pl", "=", "Pipeline", "(", "bundle", "=", "self", ".", "bundle", ")", "for", "group_name", ",", "pl_segment", "in", "iteritems", "(", "self", ")", ":", "if", "group_name", "not", "in", "subset", ...
Return a new pipeline with a subset of the sections
[ "Return", "a", "new", "pipeline", "with", "a", "subset", "of", "the", "sections" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/etl/pipeline.py#L2097-L2104
55,323
CivicSpleen/ambry
ambry/etl/pipeline.py
Pipeline.configure
def configure(self, pipe_config): """Configure from a dict""" # Create a context for evaluating the code for each pipeline. This removes the need # to qualify the class names with the module import ambry.etl import sys # ambry.build comes from ambry.bundle.files.PythonSo...
python
def configure(self, pipe_config): """Configure from a dict""" # Create a context for evaluating the code for each pipeline. This removes the need # to qualify the class names with the module import ambry.etl import sys # ambry.build comes from ambry.bundle.files.PythonSo...
[ "def", "configure", "(", "self", ",", "pipe_config", ")", ":", "# Create a context for evaluating the code for each pipeline. This removes the need", "# to qualify the class names with the module", "import", "ambry", ".", "etl", "import", "sys", "# ambry.build comes from ambry.bundle...
Configure from a dict
[ "Configure", "from", "a", "dict" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/etl/pipeline.py#L2106-L2179
55,324
CivicSpleen/ambry
ambry/etl/pipeline.py
Pipeline.replace
def replace(self, repl_class, replacement, target_segment_name=None): """Replace a pipe segment, specified by its class, with another segment""" for segment_name, pipes in iteritems(self): if target_segment_name and segment_name != target_segment_name: raise Exception() ...
python
def replace(self, repl_class, replacement, target_segment_name=None): """Replace a pipe segment, specified by its class, with another segment""" for segment_name, pipes in iteritems(self): if target_segment_name and segment_name != target_segment_name: raise Exception() ...
[ "def", "replace", "(", "self", ",", "repl_class", ",", "replacement", ",", "target_segment_name", "=", "None", ")", ":", "for", "segment_name", ",", "pipes", "in", "iteritems", "(", "self", ")", ":", "if", "target_segment_name", "and", "segment_name", "!=", ...
Replace a pipe segment, specified by its class, with another segment
[ "Replace", "a", "pipe", "segment", "specified", "by", "its", "class", "with", "another", "segment" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/etl/pipeline.py#L2181-L2200
55,325
CivicSpleen/ambry
ambry/mprlib/backends/postgresql.py
PostgreSQLBackend.install
def install(self, connection, partition, table_name=None, columns=None, materialize=False, logger=None): """ Creates FDW or materialize view for given partition. Args: connection: connection to postgresql partition (orm.Partition): materialize (boolea...
python
def install(self, connection, partition, table_name=None, columns=None, materialize=False, logger=None): """ Creates FDW or materialize view for given partition. Args: connection: connection to postgresql partition (orm.Partition): materialize (boolea...
[ "def", "install", "(", "self", ",", "connection", ",", "partition", ",", "table_name", "=", "None", ",", "columns", "=", "None", ",", "materialize", "=", "False", ",", "logger", "=", "None", ")", ":", "partition", ".", "localize", "(", ")", "self", "."...
Creates FDW or materialize view for given partition. Args: connection: connection to postgresql partition (orm.Partition): materialize (boolean): if True, create read-only table. If False create virtual table. Returns: str: name of the created table.
[ "Creates", "FDW", "or", "materialize", "view", "for", "given", "partition", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/mprlib/backends/postgresql.py#L26-L70
55,326
CivicSpleen/ambry
ambry/mprlib/backends/postgresql.py
PostgreSQLBackend.close
def close(self): """ Closes connection to database. """ if getattr(self, '_connection', None): logger.debug('Closing postgresql connection.') self._connection.close() self._connection = None if getattr(self, '_engine', None): self._engine.dispose()
python
def close(self): """ Closes connection to database. """ if getattr(self, '_connection', None): logger.debug('Closing postgresql connection.') self._connection.close() self._connection = None if getattr(self, '_engine', None): self._engine.dispose()
[ "def", "close", "(", "self", ")", ":", "if", "getattr", "(", "self", ",", "'_connection'", ",", "None", ")", ":", "logger", ".", "debug", "(", "'Closing postgresql connection.'", ")", "self", ".", "_connection", ".", "close", "(", ")", "self", ".", "_con...
Closes connection to database.
[ "Closes", "connection", "to", "database", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/mprlib/backends/postgresql.py#L104-L111
55,327
CivicSpleen/ambry
ambry/mprlib/backends/postgresql.py
PostgreSQLBackend._get_mpr_table
def _get_mpr_table(self, connection, partition): """ Returns name of the postgres table who stores mpr data. Args: connection: connection to postgres db who stores mpr data. partition (orm.Partition): Returns: str: Raises: MissingTableEr...
python
def _get_mpr_table(self, connection, partition): """ Returns name of the postgres table who stores mpr data. Args: connection: connection to postgres db who stores mpr data. partition (orm.Partition): Returns: str: Raises: MissingTableEr...
[ "def", "_get_mpr_table", "(", "self", ",", "connection", ",", "partition", ")", ":", "# TODO: This is the first candidate for optimization. Add field to partition", "# with table name and update it while table creation.", "# Optimized version.", "#", "# return partition.mpr_table or rais...
Returns name of the postgres table who stores mpr data. Args: connection: connection to postgres db who stores mpr data. partition (orm.Partition): Returns: str: Raises: MissingTableError: if partition table not found in the db.
[ "Returns", "name", "of", "the", "postgres", "table", "who", "stores", "mpr", "data", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/mprlib/backends/postgresql.py#L139-L183
55,328
CivicSpleen/ambry
ambry/mprlib/backends/postgresql.py
PostgreSQLBackend._add_partition
def _add_partition(self, connection, partition): """ Creates FDW for the partition. Args: connection: partition (orm.Partition): """ logger.debug('Creating foreign table for partition.\n partition: {}'.format(partition.name)) with connection.cursor() ...
python
def _add_partition(self, connection, partition): """ Creates FDW for the partition. Args: connection: partition (orm.Partition): """ logger.debug('Creating foreign table for partition.\n partition: {}'.format(partition.name)) with connection.cursor() ...
[ "def", "_add_partition", "(", "self", ",", "connection", ",", "partition", ")", ":", "logger", ".", "debug", "(", "'Creating foreign table for partition.\\n partition: {}'", ".", "format", "(", "partition", ".", "name", ")", ")", "with", "connection", ".", "cur...
Creates FDW for the partition. Args: connection: partition (orm.Partition):
[ "Creates", "FDW", "for", "the", "partition", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/mprlib/backends/postgresql.py#L185-L195
55,329
CivicSpleen/ambry
ambry/mprlib/backends/postgresql.py
PostgreSQLBackend._get_connection
def _get_connection(self): """ Returns connection to the postgres database. Returns: connection to postgres database who stores mpr data. """ if not getattr(self, '_connection', None): logger.debug( 'Creating new connection.\n dsn: {}' ...
python
def _get_connection(self): """ Returns connection to the postgres database. Returns: connection to postgres database who stores mpr data. """ if not getattr(self, '_connection', None): logger.debug( 'Creating new connection.\n dsn: {}' ...
[ "def", "_get_connection", "(", "self", ")", ":", "if", "not", "getattr", "(", "self", ",", "'_connection'", ",", "None", ")", ":", "logger", ".", "debug", "(", "'Creating new connection.\\n dsn: {}'", ".", "format", "(", "self", ".", "_dsn", ")", ")", "d...
Returns connection to the postgres database. Returns: connection to postgres database who stores mpr data.
[ "Returns", "connection", "to", "the", "postgres", "database", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/mprlib/backends/postgresql.py#L197-L219
55,330
CivicSpleen/ambry
ambry/mprlib/backends/postgresql.py
PostgreSQLBackend._execute
def _execute(self, connection, query, fetch=True): """ Executes given query and returns result. Args: connection: connection to postgres database who stores mpr data. query (str): sql query fetch (boolean, optional): if True, fetch query result and return it. If Fals...
python
def _execute(self, connection, query, fetch=True): """ Executes given query and returns result. Args: connection: connection to postgres database who stores mpr data. query (str): sql query fetch (boolean, optional): if True, fetch query result and return it. If Fals...
[ "def", "_execute", "(", "self", ",", "connection", ",", "query", ",", "fetch", "=", "True", ")", ":", "# execute query", "with", "connection", ".", "cursor", "(", ")", "as", "cursor", ":", "cursor", ".", "execute", "(", "query", ")", "if", "fetch", ":"...
Executes given query and returns result. Args: connection: connection to postgres database who stores mpr data. query (str): sql query fetch (boolean, optional): if True, fetch query result and return it. If False, do not fetch. Returns: iterable with qu...
[ "Executes", "given", "query", "and", "returns", "result", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/mprlib/backends/postgresql.py#L221-L239
55,331
trickvi/economics
economics/cpi.py
CPI.get
def get(self, date=datetime.date.today(), country=None): """ Get the CPI value for a specific time. Defaults to today. This uses the closest method internally but sets limit to one day. """ if not country: country = self.country if country == "all": ...
python
def get(self, date=datetime.date.today(), country=None): """ Get the CPI value for a specific time. Defaults to today. This uses the closest method internally but sets limit to one day. """ if not country: country = self.country if country == "all": ...
[ "def", "get", "(", "self", ",", "date", "=", "datetime", ".", "date", ".", "today", "(", ")", ",", "country", "=", "None", ")", ":", "if", "not", "country", ":", "country", "=", "self", ".", "country", "if", "country", "==", "\"all\"", ":", "raise"...
Get the CPI value for a specific time. Defaults to today. This uses the closest method internally but sets limit to one day.
[ "Get", "the", "CPI", "value", "for", "a", "specific", "time", ".", "Defaults", "to", "today", ".", "This", "uses", "the", "closest", "method", "internally", "but", "sets", "limit", "to", "one", "day", "." ]
18da5ce7169472ca1ba6022272a389b933f76edd
https://github.com/trickvi/economics/blob/18da5ce7169472ca1ba6022272a389b933f76edd/economics/cpi.py#L69-L86
55,332
SmartTeleMax/iktomi
iktomi/web/reverse.py
Reverse.as_url
def as_url(self): ''' Reverse object converted to `web.URL`. If Reverse is bound to env: * try to build relative URL, * use current domain name, port and scheme as default ''' if '' in self._scope: return self._finalize().as_url if no...
python
def as_url(self): ''' Reverse object converted to `web.URL`. If Reverse is bound to env: * try to build relative URL, * use current domain name, port and scheme as default ''' if '' in self._scope: return self._finalize().as_url if no...
[ "def", "as_url", "(", "self", ")", ":", "if", "''", "in", "self", ".", "_scope", ":", "return", "self", ".", "_finalize", "(", ")", ".", "as_url", "if", "not", "self", ".", "_is_endpoint", ":", "raise", "UrlBuildingError", "(", "'Not an endpoint {}'", "....
Reverse object converted to `web.URL`. If Reverse is bound to env: * try to build relative URL, * use current domain name, port and scheme as default
[ "Reverse", "object", "converted", "to", "web", ".", "URL", "." ]
80bc0f1408d63efe7f5844367d1f6efba44b35f2
https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/web/reverse.py#L258-L306
55,333
SmartTeleMax/iktomi
iktomi/web/url.py
URL.from_url
def from_url(cls, url, show_host=True): '''Parse string and get URL instance''' # url must be idna-encoded and url-quotted if six.PY2: if isinstance(url, six.text_type): url = url.encode('utf-8') parsed = urlparse(url) netloc = parsed.netloc.d...
python
def from_url(cls, url, show_host=True): '''Parse string and get URL instance''' # url must be idna-encoded and url-quotted if six.PY2: if isinstance(url, six.text_type): url = url.encode('utf-8') parsed = urlparse(url) netloc = parsed.netloc.d...
[ "def", "from_url", "(", "cls", ",", "url", ",", "show_host", "=", "True", ")", ":", "# url must be idna-encoded and url-quotted", "if", "six", ".", "PY2", ":", "if", "isinstance", "(", "url", ",", "six", ".", "text_type", ")", ":", "url", "=", "url", "."...
Parse string and get URL instance
[ "Parse", "string", "and", "get", "URL", "instance" ]
80bc0f1408d63efe7f5844367d1f6efba44b35f2
https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/web/url.py#L123-L148
55,334
SmartTeleMax/iktomi
iktomi/web/url.py
URL.qs_set
def qs_set(self, *args, **kwargs): '''Set values in QuerySet MultiDict''' if args and kwargs: raise TypeError('Use positional args or keyword args not both') query = self.query.copy() if args: mdict = MultiDict(args[0]) for k in mdict.keys(): ...
python
def qs_set(self, *args, **kwargs): '''Set values in QuerySet MultiDict''' if args and kwargs: raise TypeError('Use positional args or keyword args not both') query = self.query.copy() if args: mdict = MultiDict(args[0]) for k in mdict.keys(): ...
[ "def", "qs_set", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "args", "and", "kwargs", ":", "raise", "TypeError", "(", "'Use positional args or keyword args not both'", ")", "query", "=", "self", ".", "query", ".", "copy", "(", ...
Set values in QuerySet MultiDict
[ "Set", "values", "in", "QuerySet", "MultiDict" ]
80bc0f1408d63efe7f5844367d1f6efba44b35f2
https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/web/url.py#L164-L179
55,335
SmartTeleMax/iktomi
iktomi/web/url.py
URL.qs_add
def qs_add(self, *args, **kwargs): '''Add value to QuerySet MultiDict''' query = self.query.copy() if args: mdict = MultiDict(args[0]) for k, v in mdict.items(): query.add(k, v) for k, v in kwargs.items(): query.add(k, v) return...
python
def qs_add(self, *args, **kwargs): '''Add value to QuerySet MultiDict''' query = self.query.copy() if args: mdict = MultiDict(args[0]) for k, v in mdict.items(): query.add(k, v) for k, v in kwargs.items(): query.add(k, v) return...
[ "def", "qs_add", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "query", "=", "self", ".", "query", ".", "copy", "(", ")", "if", "args", ":", "mdict", "=", "MultiDict", "(", "args", "[", "0", "]", ")", "for", "k", ",", "v",...
Add value to QuerySet MultiDict
[ "Add", "value", "to", "QuerySet", "MultiDict" ]
80bc0f1408d63efe7f5844367d1f6efba44b35f2
https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/web/url.py#L181-L190
55,336
SmartTeleMax/iktomi
iktomi/web/url.py
URL.qs_delete
def qs_delete(self, *keys): '''Delete value from QuerySet MultiDict''' query = self.query.copy() for key in set(keys): try: del query[key] except KeyError: pass return self._copy(query=query)
python
def qs_delete(self, *keys): '''Delete value from QuerySet MultiDict''' query = self.query.copy() for key in set(keys): try: del query[key] except KeyError: pass return self._copy(query=query)
[ "def", "qs_delete", "(", "self", ",", "*", "keys", ")", ":", "query", "=", "self", ".", "query", ".", "copy", "(", ")", "for", "key", "in", "set", "(", "keys", ")", ":", "try", ":", "del", "query", "[", "key", "]", "except", "KeyError", ":", "p...
Delete value from QuerySet MultiDict
[ "Delete", "value", "from", "QuerySet", "MultiDict" ]
80bc0f1408d63efe7f5844367d1f6efba44b35f2
https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/web/url.py#L196-L204
55,337
SmartTeleMax/iktomi
iktomi/web/url.py
URL.qs_get
def qs_get(self, key, default=None): '''Get a value from QuerySet MultiDict''' return self.query.get(key, default=default)
python
def qs_get(self, key, default=None): '''Get a value from QuerySet MultiDict''' return self.query.get(key, default=default)
[ "def", "qs_get", "(", "self", ",", "key", ",", "default", "=", "None", ")", ":", "return", "self", ".", "query", ".", "get", "(", "key", ",", "default", "=", "default", ")" ]
Get a value from QuerySet MultiDict
[ "Get", "a", "value", "from", "QuerySet", "MultiDict" ]
80bc0f1408d63efe7f5844367d1f6efba44b35f2
https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/web/url.py#L206-L208
55,338
CivicSpleen/ambry
ambry/jupyter.py
warehouse_query
def warehouse_query(line, cell): "my cell magic" from IPython import get_ipython parts = line.split() w_var_name = parts.pop(0) w = get_ipython().ev(w_var_name) w.query(cell).close()
python
def warehouse_query(line, cell): "my cell magic" from IPython import get_ipython parts = line.split() w_var_name = parts.pop(0) w = get_ipython().ev(w_var_name) w.query(cell).close()
[ "def", "warehouse_query", "(", "line", ",", "cell", ")", ":", "from", "IPython", "import", "get_ipython", "parts", "=", "line", ".", "split", "(", ")", "w_var_name", "=", "parts", ".", "pop", "(", "0", ")", "w", "=", "get_ipython", "(", ")", ".", "ev...
my cell magic
[ "my", "cell", "magic" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/jupyter.py#L12-L20
55,339
project-ncl/pnc-cli
pnc_cli/productreleases.py
list_product_releases
def list_product_releases(page_size=200, page_index=0, sort="", q=""): """ List all ProductReleases """ data = list_product_releases_raw(page_size, page_index, sort, q) if data: return utils.format_json_list(data)
python
def list_product_releases(page_size=200, page_index=0, sort="", q=""): """ List all ProductReleases """ data = list_product_releases_raw(page_size, page_index, sort, q) if data: return utils.format_json_list(data)
[ "def", "list_product_releases", "(", "page_size", "=", "200", ",", "page_index", "=", "0", ",", "sort", "=", "\"\"", ",", "q", "=", "\"\"", ")", ":", "data", "=", "list_product_releases_raw", "(", "page_size", ",", "page_index", ",", "sort", ",", "q", ")...
List all ProductReleases
[ "List", "all", "ProductReleases" ]
3dc149bf84928f60a8044ac50b58bbaddd451902
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/productreleases.py#L22-L28
55,340
project-ncl/pnc-cli
pnc_cli/productreleases.py
update_release
def update_release(id, **kwargs): """ Update an existing ProductRelease with new information """ data = update_release_raw(id, **kwargs) if data: return utils.format_json(data)
python
def update_release(id, **kwargs): """ Update an existing ProductRelease with new information """ data = update_release_raw(id, **kwargs) if data: return utils.format_json(data)
[ "def", "update_release", "(", "id", ",", "*", "*", "kwargs", ")", ":", "data", "=", "update_release_raw", "(", "id", ",", "*", "*", "kwargs", ")", "if", "data", ":", "return", "utils", ".", "format_json", "(", "data", ")" ]
Update an existing ProductRelease with new information
[ "Update", "an", "existing", "ProductRelease", "with", "new", "information" ]
3dc149bf84928f60a8044ac50b58bbaddd451902
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/productreleases.py#L118-L124
55,341
cosven/feeluown-core
fuocore/library.py
Library.get
def get(self, identifier): """get provider by id""" for provider in self._providers: if provider.identifier == identifier: return provider return None
python
def get(self, identifier): """get provider by id""" for provider in self._providers: if provider.identifier == identifier: return provider return None
[ "def", "get", "(", "self", ",", "identifier", ")", ":", "for", "provider", "in", "self", ".", "_providers", ":", "if", "provider", ".", "identifier", "==", "identifier", ":", "return", "provider", "return", "None" ]
get provider by id
[ "get", "provider", "by", "id" ]
62dc64638f62971b16be0a75c0b8c7ae2999869e
https://github.com/cosven/feeluown-core/blob/62dc64638f62971b16be0a75c0b8c7ae2999869e/fuocore/library.py#L29-L34
55,342
cosven/feeluown-core
fuocore/library.py
Library.list_song_standby
def list_song_standby(self, song, onlyone=True): """try to list all valid standby Search a song in all providers. The typical usage scenario is when a song is not available in one provider, we can try to acquire it from other providers. Standby choosing strategy: search from al...
python
def list_song_standby(self, song, onlyone=True): """try to list all valid standby Search a song in all providers. The typical usage scenario is when a song is not available in one provider, we can try to acquire it from other providers. Standby choosing strategy: search from al...
[ "def", "list_song_standby", "(", "self", ",", "song", ",", "onlyone", "=", "True", ")", ":", "def", "get_score", "(", "standby", ")", ":", "score", "=", "1", "# 分数占比关系:", "# title + album > artist", "# artist > title > album", "if", "song", ".", "artists_name", ...
try to list all valid standby Search a song in all providers. The typical usage scenario is when a song is not available in one provider, we can try to acquire it from other providers. Standby choosing strategy: search from all providers, select two song from each provide. Thos...
[ "try", "to", "list", "all", "valid", "standby" ]
62dc64638f62971b16be0a75c0b8c7ae2999869e
https://github.com/cosven/feeluown-core/blob/62dc64638f62971b16be0a75c0b8c7ae2999869e/fuocore/library.py#L59-L112
55,343
CivicSpleen/ambry
ambry/util/packages.py
import_class_by_string
def import_class_by_string(name): """Return a class by importing its module from a fully qualified string.""" components = name.split('.') clazz = components.pop() mod = __import__('.'.join(components)) components += [clazz] for comp in components[1:]: mod = getattr(mod, comp) retu...
python
def import_class_by_string(name): """Return a class by importing its module from a fully qualified string.""" components = name.split('.') clazz = components.pop() mod = __import__('.'.join(components)) components += [clazz] for comp in components[1:]: mod = getattr(mod, comp) retu...
[ "def", "import_class_by_string", "(", "name", ")", ":", "components", "=", "name", ".", "split", "(", "'.'", ")", "clazz", "=", "components", ".", "pop", "(", ")", "mod", "=", "__import__", "(", "'.'", ".", "join", "(", "components", ")", ")", "compone...
Return a class by importing its module from a fully qualified string.
[ "Return", "a", "class", "by", "importing", "its", "module", "from", "a", "fully", "qualified", "string", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/util/packages.py#L43-L53
55,344
andreafioraldi/angrdbg
angrdbg/memory_7.py
SimSymbolicDbgMemory.get_unconstrained_bytes
def get_unconstrained_bytes(self, name, bits, source=None, key=None, inspect=True, events=True, **kwargs): """ Get some consecutive unconstrained bytes. :param name: Name of the unconstrained variable :param bits: Size of the unconstrained variable :param source: Where those byt...
python
def get_unconstrained_bytes(self, name, bits, source=None, key=None, inspect=True, events=True, **kwargs): """ Get some consecutive unconstrained bytes. :param name: Name of the unconstrained variable :param bits: Size of the unconstrained variable :param source: Where those byt...
[ "def", "get_unconstrained_bytes", "(", "self", ",", "name", ",", "bits", ",", "source", "=", "None", ",", "key", "=", "None", ",", "inspect", "=", "True", ",", "events", "=", "True", ",", "*", "*", "kwargs", ")", ":", "if", "(", "self", ".", "categ...
Get some consecutive unconstrained bytes. :param name: Name of the unconstrained variable :param bits: Size of the unconstrained variable :param source: Where those bytes are read from. Currently it is only used in under-constrained symbolic execution so that we can track th...
[ "Get", "some", "consecutive", "unconstrained", "bytes", "." ]
939b20fb9b341aee695d2db12142b1eddc5b555a
https://github.com/andreafioraldi/angrdbg/blob/939b20fb9b341aee695d2db12142b1eddc5b555a/angrdbg/memory_7.py#L1019-L1043
55,345
project-ncl/pnc-cli
pnc_cli/swagger_client/models/build_configuration_rest.py
BuildConfigurationRest.build_type
def build_type(self, build_type): """ Sets the build_type of this BuildConfigurationRest. :param build_type: The build_type of this BuildConfigurationRest. :type: str """ allowed_values = ["MVN", "NPM"] if build_type not in allowed_values: raise Value...
python
def build_type(self, build_type): """ Sets the build_type of this BuildConfigurationRest. :param build_type: The build_type of this BuildConfigurationRest. :type: str """ allowed_values = ["MVN", "NPM"] if build_type not in allowed_values: raise Value...
[ "def", "build_type", "(", "self", ",", "build_type", ")", ":", "allowed_values", "=", "[", "\"MVN\"", ",", "\"NPM\"", "]", "if", "build_type", "not", "in", "allowed_values", ":", "raise", "ValueError", "(", "\"Invalid value for `build_type` ({0}), must be one of {1}\"...
Sets the build_type of this BuildConfigurationRest. :param build_type: The build_type of this BuildConfigurationRest. :type: str
[ "Sets", "the", "build_type", "of", "this", "BuildConfigurationRest", "." ]
3dc149bf84928f60a8044ac50b58bbaddd451902
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/swagger_client/models/build_configuration_rest.py#L347-L361
55,346
twisted/epsilon
epsilon/hotfixes/trial_assertwarns.py
failUnlessWarns
def failUnlessWarns(self, category, message, filename, f, *args, **kwargs): """ Fail if the given function doesn't generate the specified warning when called. It calls the function, checks the warning, and forwards the result of the function if everything is fine. @param category...
python
def failUnlessWarns(self, category, message, filename, f, *args, **kwargs): """ Fail if the given function doesn't generate the specified warning when called. It calls the function, checks the warning, and forwards the result of the function if everything is fine. @param category...
[ "def", "failUnlessWarns", "(", "self", ",", "category", ",", "message", ",", "filename", ",", "f", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "warningsShown", "=", "[", "]", "def", "warnExplicit", "(", "*", "args", ")", ":", "warningsShown", ...
Fail if the given function doesn't generate the specified warning when called. It calls the function, checks the warning, and forwards the result of the function if everything is fine. @param category: the category of the warning to check. @param message: the output message of the warning to check. ...
[ "Fail", "if", "the", "given", "function", "doesn", "t", "generate", "the", "specified", "warning", "when", "called", ".", "It", "calls", "the", "function", "checks", "the", "warning", "and", "forwards", "the", "result", "of", "the", "function", "if", "everyt...
e85fa985a41983ef06e1d3bb26639181e1f78b24
https://github.com/twisted/epsilon/blob/e85fa985a41983ef06e1d3bb26639181e1f78b24/epsilon/hotfixes/trial_assertwarns.py#L8-L57
55,347
SmartTeleMax/iktomi
iktomi/web/core.py
cases.cases
def cases(self, env, data): '''Calls each nested handler until one of them returns nonzero result. If any handler returns `None`, it is interpreted as "request does not match, the handler has nothing to do with it and `web.cases` should try to call the next handler".''' for ha...
python
def cases(self, env, data): '''Calls each nested handler until one of them returns nonzero result. If any handler returns `None`, it is interpreted as "request does not match, the handler has nothing to do with it and `web.cases` should try to call the next handler".''' for ha...
[ "def", "cases", "(", "self", ",", "env", ",", "data", ")", ":", "for", "handler", "in", "self", ".", "handlers", ":", "env", ".", "_push", "(", ")", "data", ".", "_push", "(", ")", "try", ":", "result", "=", "handler", "(", "env", ",", "data", ...
Calls each nested handler until one of them returns nonzero result. If any handler returns `None`, it is interpreted as "request does not match, the handler has nothing to do with it and `web.cases` should try to call the next handler".
[ "Calls", "each", "nested", "handler", "until", "one", "of", "them", "returns", "nonzero", "result", "." ]
80bc0f1408d63efe7f5844367d1f6efba44b35f2
https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/web/core.py#L123-L138
55,348
mithro/python-datetime-tz
datetime_tz/update_win32tz_map.py
create_win32tz_map
def create_win32tz_map(windows_zones_xml): """Creates a map between Windows and Olson timezone names. Args: windows_zones_xml: The CLDR XML mapping. Yields: (win32_name, olson_name, comment) """ coming_comment = None win32_name = None territory = None parser = genshi.input.XMLParser(StringIO(w...
python
def create_win32tz_map(windows_zones_xml): """Creates a map between Windows and Olson timezone names. Args: windows_zones_xml: The CLDR XML mapping. Yields: (win32_name, olson_name, comment) """ coming_comment = None win32_name = None territory = None parser = genshi.input.XMLParser(StringIO(w...
[ "def", "create_win32tz_map", "(", "windows_zones_xml", ")", ":", "coming_comment", "=", "None", "win32_name", "=", "None", "territory", "=", "None", "parser", "=", "genshi", ".", "input", ".", "XMLParser", "(", "StringIO", "(", "windows_zones_xml", ")", ")", "...
Creates a map between Windows and Olson timezone names. Args: windows_zones_xml: The CLDR XML mapping. Yields: (win32_name, olson_name, comment)
[ "Creates", "a", "map", "between", "Windows", "and", "Olson", "timezone", "names", "." ]
3c682d003f8b28e39f0c096773e471aeb68e6bbb
https://github.com/mithro/python-datetime-tz/blob/3c682d003f8b28e39f0c096773e471aeb68e6bbb/datetime_tz/update_win32tz_map.py#L57-L92
55,349
mithro/python-datetime-tz
datetime_tz/update_win32tz_map.py
update_stored_win32tz_map
def update_stored_win32tz_map(): """Downloads the cldr win32 timezone map and stores it in win32tz_map.py.""" windows_zones_xml = download_cldr_win32tz_map_xml() source_hash = hashlib.md5(windows_zones_xml).hexdigest() if hasattr(windows_zones_xml, "decode"): windows_zones_xml = windows_zones_xml.decode("u...
python
def update_stored_win32tz_map(): """Downloads the cldr win32 timezone map and stores it in win32tz_map.py.""" windows_zones_xml = download_cldr_win32tz_map_xml() source_hash = hashlib.md5(windows_zones_xml).hexdigest() if hasattr(windows_zones_xml, "decode"): windows_zones_xml = windows_zones_xml.decode("u...
[ "def", "update_stored_win32tz_map", "(", ")", ":", "windows_zones_xml", "=", "download_cldr_win32tz_map_xml", "(", ")", "source_hash", "=", "hashlib", ".", "md5", "(", "windows_zones_xml", ")", ".", "hexdigest", "(", ")", "if", "hasattr", "(", "windows_zones_xml", ...
Downloads the cldr win32 timezone map and stores it in win32tz_map.py.
[ "Downloads", "the", "cldr", "win32", "timezone", "map", "and", "stores", "it", "in", "win32tz_map", ".", "py", "." ]
3c682d003f8b28e39f0c096773e471aeb68e6bbb
https://github.com/mithro/python-datetime-tz/blob/3c682d003f8b28e39f0c096773e471aeb68e6bbb/datetime_tz/update_win32tz_map.py#L95-L134
55,350
andreafioraldi/angrdbg
angrdbg/page_7.py
SimDbgMemory.load_objects
def load_objects(self, addr, num_bytes, ret_on_segv=False): """ Load memory objects from paged memory. :param addr: Address to start loading. :param num_bytes: Number of bytes to load. :param bool ret_on_segv: True if you want load_bytes to return directly when a SIGSEV is trigg...
python
def load_objects(self, addr, num_bytes, ret_on_segv=False): """ Load memory objects from paged memory. :param addr: Address to start loading. :param num_bytes: Number of bytes to load. :param bool ret_on_segv: True if you want load_bytes to return directly when a SIGSEV is trigg...
[ "def", "load_objects", "(", "self", ",", "addr", ",", "num_bytes", ",", "ret_on_segv", "=", "False", ")", ":", "result", "=", "[", "]", "end", "=", "addr", "+", "num_bytes", "for", "page_addr", "in", "self", ".", "_containing_pages", "(", "addr", ",", ...
Load memory objects from paged memory. :param addr: Address to start loading. :param num_bytes: Number of bytes to load. :param bool ret_on_segv: True if you want load_bytes to return directly when a SIGSEV is triggered, otherwise a SimSegfaultError will be rais...
[ "Load", "memory", "objects", "from", "paged", "memory", "." ]
939b20fb9b341aee695d2db12142b1eddc5b555a
https://github.com/andreafioraldi/angrdbg/blob/939b20fb9b341aee695d2db12142b1eddc5b555a/angrdbg/page_7.py#L247-L284
55,351
andreafioraldi/angrdbg
angrdbg/page_7.py
SimDbgMemory.permissions
def permissions(self, addr, permissions=None): """ Returns the permissions for a page at address `addr`. If optional argument permissions is given, set page permissions to that prior to returning permissions. """ if self.state.solver.symbolic(addr): raise SimMemoryE...
python
def permissions(self, addr, permissions=None): """ Returns the permissions for a page at address `addr`. If optional argument permissions is given, set page permissions to that prior to returning permissions. """ if self.state.solver.symbolic(addr): raise SimMemoryE...
[ "def", "permissions", "(", "self", ",", "addr", ",", "permissions", "=", "None", ")", ":", "if", "self", ".", "state", ".", "solver", ".", "symbolic", "(", "addr", ")", ":", "raise", "SimMemoryError", "(", "\"page permissions cannot currently be looked up for sy...
Returns the permissions for a page at address `addr`. If optional argument permissions is given, set page permissions to that prior to returning permissions.
[ "Returns", "the", "permissions", "for", "a", "page", "at", "address", "addr", "." ]
939b20fb9b341aee695d2db12142b1eddc5b555a
https://github.com/andreafioraldi/angrdbg/blob/939b20fb9b341aee695d2db12142b1eddc5b555a/angrdbg/page_7.py#L875-L908
55,352
CivicSpleen/ambry
ambry/bundle/process.py
call_interval
def call_interval(freq, **kwargs): """Decorator for the CallInterval wrapper""" def wrapper(f): return CallInterval(f, freq, **kwargs) return wrapper
python
def call_interval(freq, **kwargs): """Decorator for the CallInterval wrapper""" def wrapper(f): return CallInterval(f, freq, **kwargs) return wrapper
[ "def", "call_interval", "(", "freq", ",", "*", "*", "kwargs", ")", ":", "def", "wrapper", "(", "f", ")", ":", "return", "CallInterval", "(", "f", ",", "freq", ",", "*", "*", "kwargs", ")", "return", "wrapper" ]
Decorator for the CallInterval wrapper
[ "Decorator", "for", "the", "CallInterval", "wrapper" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/process.py#L431-L436
55,353
CivicSpleen/ambry
ambry/bundle/process.py
ProgressSection.add
def add(self, *args, **kwargs): """Add a new record to the section""" if self.start and self.start.state == 'done' and kwargs.get('log_action') != 'done': raise ProgressLoggingError("Can't add -- process section is done") self.augment_args(args, kwargs) kwargs['log_action'...
python
def add(self, *args, **kwargs): """Add a new record to the section""" if self.start and self.start.state == 'done' and kwargs.get('log_action') != 'done': raise ProgressLoggingError("Can't add -- process section is done") self.augment_args(args, kwargs) kwargs['log_action'...
[ "def", "add", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "start", "and", "self", ".", "start", ".", "state", "==", "'done'", "and", "kwargs", ".", "get", "(", "'log_action'", ")", "!=", "'done'", ":", "ra...
Add a new record to the section
[ "Add", "a", "new", "record", "to", "the", "section" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/process.py#L111-L133
55,354
CivicSpleen/ambry
ambry/bundle/process.py
ProgressSection.update
def update(self, *args, **kwargs): """Update the last section record""" self.augment_args(args, kwargs) kwargs['log_action'] = kwargs.get('log_action', 'update') if not self.rec: return self.add(**kwargs) else: for k, v in kwargs.items(): ...
python
def update(self, *args, **kwargs): """Update the last section record""" self.augment_args(args, kwargs) kwargs['log_action'] = kwargs.get('log_action', 'update') if not self.rec: return self.add(**kwargs) else: for k, v in kwargs.items(): ...
[ "def", "update", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "augment_args", "(", "args", ",", "kwargs", ")", "kwargs", "[", "'log_action'", "]", "=", "kwargs", ".", "get", "(", "'log_action'", ",", "'update'", ")",...
Update the last section record
[ "Update", "the", "last", "section", "record" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/process.py#L135-L157
55,355
CivicSpleen/ambry
ambry/bundle/process.py
ProgressSection.add_update
def add_update(self, *args, **kwargs): """A records is added, then on subsequent calls, updated""" if not self._ai_rec_id: self._ai_rec_id = self.add(*args, **kwargs) else: au_save = self._ai_rec_id self.update(*args, **kwargs) self._ai_rec_id = a...
python
def add_update(self, *args, **kwargs): """A records is added, then on subsequent calls, updated""" if not self._ai_rec_id: self._ai_rec_id = self.add(*args, **kwargs) else: au_save = self._ai_rec_id self.update(*args, **kwargs) self._ai_rec_id = a...
[ "def", "add_update", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "self", ".", "_ai_rec_id", ":", "self", ".", "_ai_rec_id", "=", "self", ".", "add", "(", "*", "args", ",", "*", "*", "kwargs", ")", "else", ":", ...
A records is added, then on subsequent calls, updated
[ "A", "records", "is", "added", "then", "on", "subsequent", "calls", "updated" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/process.py#L159-L169
55,356
CivicSpleen/ambry
ambry/bundle/process.py
ProgressSection.update_done
def update_done(self, *args, **kwargs): """Clear out the previous update""" kwargs['state'] = 'done' self.update(*args, **kwargs) self.rec = None
python
def update_done(self, *args, **kwargs): """Clear out the previous update""" kwargs['state'] = 'done' self.update(*args, **kwargs) self.rec = None
[ "def", "update_done", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'state'", "]", "=", "'done'", "self", ".", "update", "(", "*", "args", ",", "*", "*", "kwargs", ")", "self", ".", "rec", "=", "None" ]
Clear out the previous update
[ "Clear", "out", "the", "previous", "update" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/process.py#L171-L175
55,357
CivicSpleen/ambry
ambry/bundle/process.py
ProgressSection.done
def done(self, *args, **kwargs): """Mark the whole ProgressSection as done""" kwargs['state'] = 'done' pr_id = self.add(*args, log_action='done', **kwargs) self._session.query(Process).filter(Process.group == self._group).update({Process.state: 'done'}) self.start.state = 'done'...
python
def done(self, *args, **kwargs): """Mark the whole ProgressSection as done""" kwargs['state'] = 'done' pr_id = self.add(*args, log_action='done', **kwargs) self._session.query(Process).filter(Process.group == self._group).update({Process.state: 'done'}) self.start.state = 'done'...
[ "def", "done", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'state'", "]", "=", "'done'", "pr_id", "=", "self", ".", "add", "(", "*", "args", ",", "log_action", "=", "'done'", ",", "*", "*", "kwargs", ")", "...
Mark the whole ProgressSection as done
[ "Mark", "the", "whole", "ProgressSection", "as", "done" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/process.py#L177-L186
55,358
CivicSpleen/ambry
ambry/bundle/process.py
ProcessLogger.start
def start(self, phase, stage, **kwargs): """Start a new routine, stage or phase""" return ProgressSection(self, self._session, phase, stage, self._logger, **kwargs)
python
def start(self, phase, stage, **kwargs): """Start a new routine, stage or phase""" return ProgressSection(self, self._session, phase, stage, self._logger, **kwargs)
[ "def", "start", "(", "self", ",", "phase", ",", "stage", ",", "*", "*", "kwargs", ")", ":", "return", "ProgressSection", "(", "self", ",", "self", ".", "_session", ",", "phase", ",", "stage", ",", "self", ".", "_logger", ",", "*", "*", "kwargs", ")...
Start a new routine, stage or phase
[ "Start", "a", "new", "routine", "stage", "or", "phase" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/process.py#L258-L260
55,359
CivicSpleen/ambry
ambry/bundle/process.py
ProcessLogger.clean
def clean(self): """Delete all of the records""" # Deleting seems to be really weird and unrelable. self._session \ .query(Process) \ .filter(Process.d_vid == self._d_vid) \ .delete(synchronize_session='fetch') for r in self.records: self...
python
def clean(self): """Delete all of the records""" # Deleting seems to be really weird and unrelable. self._session \ .query(Process) \ .filter(Process.d_vid == self._d_vid) \ .delete(synchronize_session='fetch') for r in self.records: self...
[ "def", "clean", "(", "self", ")", ":", "# Deleting seems to be really weird and unrelable.", "self", ".", "_session", ".", "query", "(", "Process", ")", ".", "filter", "(", "Process", ".", "d_vid", "==", "self", ".", "_d_vid", ")", ".", "delete", "(", "synch...
Delete all of the records
[ "Delete", "all", "of", "the", "records" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/process.py#L293-L305
55,360
CivicSpleen/ambry
ambry/bundle/process.py
ProcessLogger.build
def build(self): """Access build configuration values as attributes. See self.process for a usage example""" from ambry.orm.config import BuildConfigGroupAccessor # It is a lightweight object, so no need to cache return BuildConfigGroupAccessor(self.dataset, 'buildstate', se...
python
def build(self): """Access build configuration values as attributes. See self.process for a usage example""" from ambry.orm.config import BuildConfigGroupAccessor # It is a lightweight object, so no need to cache return BuildConfigGroupAccessor(self.dataset, 'buildstate', se...
[ "def", "build", "(", "self", ")", ":", "from", "ambry", ".", "orm", ".", "config", "import", "BuildConfigGroupAccessor", "# It is a lightweight object, so no need to cache", "return", "BuildConfigGroupAccessor", "(", "self", ".", "dataset", ",", "'buildstate'", ",", "...
Access build configuration values as attributes. See self.process for a usage example
[ "Access", "build", "configuration", "values", "as", "attributes", ".", "See", "self", ".", "process", "for", "a", "usage", "example" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/process.py#L319-L325
55,361
project-ncl/pnc-cli
pnc_cli/swagger_client/models/build_environment_rest.py
BuildEnvironmentRest.system_image_type
def system_image_type(self, system_image_type): """ Sets the system_image_type of this BuildEnvironmentRest. :param system_image_type: The system_image_type of this BuildEnvironmentRest. :type: str """ allowed_values = ["DOCKER_IMAGE", "VIRTUAL_MACHINE_RAW", "VIRTUAL_MAC...
python
def system_image_type(self, system_image_type): """ Sets the system_image_type of this BuildEnvironmentRest. :param system_image_type: The system_image_type of this BuildEnvironmentRest. :type: str """ allowed_values = ["DOCKER_IMAGE", "VIRTUAL_MACHINE_RAW", "VIRTUAL_MAC...
[ "def", "system_image_type", "(", "self", ",", "system_image_type", ")", ":", "allowed_values", "=", "[", "\"DOCKER_IMAGE\"", ",", "\"VIRTUAL_MACHINE_RAW\"", ",", "\"VIRTUAL_MACHINE_QCOW2\"", ",", "\"LOCAL_WORKSPACE\"", "]", "if", "system_image_type", "not", "in", "allow...
Sets the system_image_type of this BuildEnvironmentRest. :param system_image_type: The system_image_type of this BuildEnvironmentRest. :type: str
[ "Sets", "the", "system_image_type", "of", "this", "BuildEnvironmentRest", "." ]
3dc149bf84928f60a8044ac50b58bbaddd451902
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/swagger_client/models/build_environment_rest.py#L228-L242
55,362
CivicSpleen/ambry
ambry/metadata/schema.py
ExtDoc.group_by_source
def group_by_source(self): """Return a dict of all of the docs, with the source associated with the doc as a key""" from collections import defaultdict docs = defaultdict(list) for k, v in self.items(): if 'source' in v: docs[v.source].append(dict(v.i...
python
def group_by_source(self): """Return a dict of all of the docs, with the source associated with the doc as a key""" from collections import defaultdict docs = defaultdict(list) for k, v in self.items(): if 'source' in v: docs[v.source].append(dict(v.i...
[ "def", "group_by_source", "(", "self", ")", ":", "from", "collections", "import", "defaultdict", "docs", "=", "defaultdict", "(", "list", ")", "for", "k", ",", "v", "in", "self", ".", "items", "(", ")", ":", "if", "'source'", "in", "v", ":", "docs", ...
Return a dict of all of the docs, with the source associated with the doc as a key
[ "Return", "a", "dict", "of", "all", "of", "the", "docs", "with", "the", "source", "associated", "with", "the", "doc", "as", "a", "key" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/metadata/schema.py#L88-L98
55,363
twisted/epsilon
epsilon/hotfixes/filepath_copyTo.py
FilePath.preauthChild
def preauthChild(self, path): """ Use me if `path' might have slashes in it, but you know they're safe. (NOT slashes at the beginning. It still needs to be a _child_). """ newpath = abspath(joinpath(self.path, normpath(path))) if not newpath.startswith(self.path): ...
python
def preauthChild(self, path): """ Use me if `path' might have slashes in it, but you know they're safe. (NOT slashes at the beginning. It still needs to be a _child_). """ newpath = abspath(joinpath(self.path, normpath(path))) if not newpath.startswith(self.path): ...
[ "def", "preauthChild", "(", "self", ",", "path", ")", ":", "newpath", "=", "abspath", "(", "joinpath", "(", "self", ".", "path", ",", "normpath", "(", "path", ")", ")", ")", "if", "not", "newpath", ".", "startswith", "(", "self", ".", "path", ")", ...
Use me if `path' might have slashes in it, but you know they're safe. (NOT slashes at the beginning. It still needs to be a _child_).
[ "Use", "me", "if", "path", "might", "have", "slashes", "in", "it", "but", "you", "know", "they", "re", "safe", "." ]
e85fa985a41983ef06e1d3bb26639181e1f78b24
https://github.com/twisted/epsilon/blob/e85fa985a41983ef06e1d3bb26639181e1f78b24/epsilon/hotfixes/filepath_copyTo.py#L96-L105
55,364
twisted/epsilon
epsilon/hotfixes/filepath_copyTo.py
FilePath.childSearchPreauth
def childSearchPreauth(self, *paths): """Return my first existing child with a name in 'paths'. paths is expected to be a list of *pre-secured* path fragments; in most cases this will be specified by a system administrator and not an arbitrary user. If no appropriately-named ch...
python
def childSearchPreauth(self, *paths): """Return my first existing child with a name in 'paths'. paths is expected to be a list of *pre-secured* path fragments; in most cases this will be specified by a system administrator and not an arbitrary user. If no appropriately-named ch...
[ "def", "childSearchPreauth", "(", "self", ",", "*", "paths", ")", ":", "p", "=", "self", ".", "path", "for", "child", "in", "paths", ":", "jp", "=", "joinpath", "(", "p", ",", "child", ")", "if", "exists", "(", "jp", ")", ":", "return", "self", "...
Return my first existing child with a name in 'paths'. paths is expected to be a list of *pre-secured* path fragments; in most cases this will be specified by a system administrator and not an arbitrary user. If no appropriately-named children exist, this will return None.
[ "Return", "my", "first", "existing", "child", "with", "a", "name", "in", "paths", "." ]
e85fa985a41983ef06e1d3bb26639181e1f78b24
https://github.com/twisted/epsilon/blob/e85fa985a41983ef06e1d3bb26639181e1f78b24/epsilon/hotfixes/filepath_copyTo.py#L107-L120
55,365
twisted/epsilon
epsilon/hotfixes/filepath_copyTo.py
FilePath.siblingExtensionSearch
def siblingExtensionSearch(self, *exts): """Attempt to return a path with my name, given multiple possible extensions. Each extension in exts will be tested and the first path which exists will be returned. If no path exists, None will be returned. If '' is in exts, then if th...
python
def siblingExtensionSearch(self, *exts): """Attempt to return a path with my name, given multiple possible extensions. Each extension in exts will be tested and the first path which exists will be returned. If no path exists, None will be returned. If '' is in exts, then if th...
[ "def", "siblingExtensionSearch", "(", "self", ",", "*", "exts", ")", ":", "p", "=", "self", ".", "path", "for", "ext", "in", "exts", ":", "if", "not", "ext", "and", "self", ".", "exists", "(", ")", ":", "return", "self", "if", "ext", "==", "'*'", ...
Attempt to return a path with my name, given multiple possible extensions. Each extension in exts will be tested and the first path which exists will be returned. If no path exists, None will be returned. If '' is in exts, then if the file referred to by this path exists, 'self' will ...
[ "Attempt", "to", "return", "a", "path", "with", "my", "name", "given", "multiple", "possible", "extensions", "." ]
e85fa985a41983ef06e1d3bb26639181e1f78b24
https://github.com/twisted/epsilon/blob/e85fa985a41983ef06e1d3bb26639181e1f78b24/epsilon/hotfixes/filepath_copyTo.py#L122-L145
55,366
twisted/epsilon
epsilon/hotfixes/filepath_copyTo.py
FilePath.globChildren
def globChildren(self, pattern): """ Assuming I am representing a directory, return a list of FilePaths representing my children that match the given pattern. """ import glob path = self.path[-1] == '/' and self.path + pattern or slash.join([self.path, pattern]) ...
python
def globChildren(self, pattern): """ Assuming I am representing a directory, return a list of FilePaths representing my children that match the given pattern. """ import glob path = self.path[-1] == '/' and self.path + pattern or slash.join([self.path, pattern]) ...
[ "def", "globChildren", "(", "self", ",", "pattern", ")", ":", "import", "glob", "path", "=", "self", ".", "path", "[", "-", "1", "]", "==", "'/'", "and", "self", ".", "path", "+", "pattern", "or", "slash", ".", "join", "(", "[", "self", ".", "pat...
Assuming I am representing a directory, return a list of FilePaths representing my children that match the given pattern.
[ "Assuming", "I", "am", "representing", "a", "directory", "return", "a", "list", "of", "FilePaths", "representing", "my", "children", "that", "match", "the", "given", "pattern", "." ]
e85fa985a41983ef06e1d3bb26639181e1f78b24
https://github.com/twisted/epsilon/blob/e85fa985a41983ef06e1d3bb26639181e1f78b24/epsilon/hotfixes/filepath_copyTo.py#L261-L269
55,367
twisted/epsilon
epsilon/hotfixes/filepath_copyTo.py
FilePath.create
def create(self): """Exclusively create a file, only if this file previously did not exist. """ fdint = os.open(self.path, (os.O_EXCL | os.O_CREAT | os.O_RDWR)) # XXX TODO: 'name' attribute of returned files is not ...
python
def create(self): """Exclusively create a file, only if this file previously did not exist. """ fdint = os.open(self.path, (os.O_EXCL | os.O_CREAT | os.O_RDWR)) # XXX TODO: 'name' attribute of returned files is not ...
[ "def", "create", "(", "self", ")", ":", "fdint", "=", "os", ".", "open", "(", "self", ".", "path", ",", "(", "os", ".", "O_EXCL", "|", "os", ".", "O_CREAT", "|", "os", ".", "O_RDWR", ")", ")", "# XXX TODO: 'name' attribute of returned files is not mutable ...
Exclusively create a file, only if this file previously did not exist.
[ "Exclusively", "create", "a", "file", "only", "if", "this", "file", "previously", "did", "not", "exist", "." ]
e85fa985a41983ef06e1d3bb26639181e1f78b24
https://github.com/twisted/epsilon/blob/e85fa985a41983ef06e1d3bb26639181e1f78b24/epsilon/hotfixes/filepath_copyTo.py#L301-L312
55,368
twisted/epsilon
epsilon/hotfixes/filepath_copyTo.py
FilePath.temporarySibling
def temporarySibling(self): """ Create a path naming a temporary sibling of this path in a secure fashion. """ sib = self.parent().child(_secureEnoughString() + self.basename()) sib.requireCreate() return sib
python
def temporarySibling(self): """ Create a path naming a temporary sibling of this path in a secure fashion. """ sib = self.parent().child(_secureEnoughString() + self.basename()) sib.requireCreate() return sib
[ "def", "temporarySibling", "(", "self", ")", ":", "sib", "=", "self", ".", "parent", "(", ")", ".", "child", "(", "_secureEnoughString", "(", ")", "+", "self", ".", "basename", "(", ")", ")", "sib", ".", "requireCreate", "(", ")", "return", "sib" ]
Create a path naming a temporary sibling of this path in a secure fashion.
[ "Create", "a", "path", "naming", "a", "temporary", "sibling", "of", "this", "path", "in", "a", "secure", "fashion", "." ]
e85fa985a41983ef06e1d3bb26639181e1f78b24
https://github.com/twisted/epsilon/blob/e85fa985a41983ef06e1d3bb26639181e1f78b24/epsilon/hotfixes/filepath_copyTo.py#L314-L320
55,369
twisted/epsilon
epsilon/scripts/benchmark.py
start
def start(): """ Start recording stats. Call this from a benchmark script when your setup is done. Call this at most once. @raise RuntimeError: Raised if the parent process responds with anything other than an acknowledgement of this message. """ os.write(BenchmarkProcess.BACKCHANNEL_OUT,...
python
def start(): """ Start recording stats. Call this from a benchmark script when your setup is done. Call this at most once. @raise RuntimeError: Raised if the parent process responds with anything other than an acknowledgement of this message. """ os.write(BenchmarkProcess.BACKCHANNEL_OUT,...
[ "def", "start", "(", ")", ":", "os", ".", "write", "(", "BenchmarkProcess", ".", "BACKCHANNEL_OUT", ",", "BenchmarkProcess", ".", "START", ")", "response", "=", "util", ".", "untilConcludes", "(", "os", ".", "read", ",", "BenchmarkProcess", ".", "BACKCHANNEL...
Start recording stats. Call this from a benchmark script when your setup is done. Call this at most once. @raise RuntimeError: Raised if the parent process responds with anything other than an acknowledgement of this message.
[ "Start", "recording", "stats", ".", "Call", "this", "from", "a", "benchmark", "script", "when", "your", "setup", "is", "done", ".", "Call", "this", "at", "most", "once", "." ]
e85fa985a41983ef06e1d3bb26639181e1f78b24
https://github.com/twisted/epsilon/blob/e85fa985a41983ef06e1d3bb26639181e1f78b24/epsilon/scripts/benchmark.py#L530-L542
55,370
twisted/epsilon
epsilon/scripts/benchmark.py
main
def main(): """ Run me with the filename of a benchmark script as an argument. I will time it and append the results to a file named output in the current working directory. """ name = sys.argv[1] path = filepath.FilePath('.stat').temporarySibling() path.makedirs() func = makeBenchm...
python
def main(): """ Run me with the filename of a benchmark script as an argument. I will time it and append the results to a file named output in the current working directory. """ name = sys.argv[1] path = filepath.FilePath('.stat').temporarySibling() path.makedirs() func = makeBenchm...
[ "def", "main", "(", ")", ":", "name", "=", "sys", ".", "argv", "[", "1", "]", "path", "=", "filepath", ".", "FilePath", "(", "'.stat'", ")", ".", "temporarySibling", "(", ")", "path", ".", "makedirs", "(", ")", "func", "=", "makeBenchmarkRunner", "("...
Run me with the filename of a benchmark script as an argument. I will time it and append the results to a file named output in the current working directory.
[ "Run", "me", "with", "the", "filename", "of", "a", "benchmark", "script", "as", "an", "argument", ".", "I", "will", "time", "it", "and", "append", "the", "results", "to", "a", "file", "named", "output", "in", "the", "current", "working", "directory", "."...
e85fa985a41983ef06e1d3bb26639181e1f78b24
https://github.com/twisted/epsilon/blob/e85fa985a41983ef06e1d3bb26639181e1f78b24/epsilon/scripts/benchmark.py#L563-L576
55,371
twisted/epsilon
epsilon/scripts/benchmark.py
BasicProcess.spawn
def spawn(cls, executable, args, path, env, spawnProcess=None): """ Run an executable with some arguments in the given working directory with the given environment variables. Returns a Deferred which fires with a two-tuple of (exit status, output list) if the process terminates ...
python
def spawn(cls, executable, args, path, env, spawnProcess=None): """ Run an executable with some arguments in the given working directory with the given environment variables. Returns a Deferred which fires with a two-tuple of (exit status, output list) if the process terminates ...
[ "def", "spawn", "(", "cls", ",", "executable", ",", "args", ",", "path", ",", "env", ",", "spawnProcess", "=", "None", ")", ":", "d", "=", "defer", ".", "Deferred", "(", ")", "proto", "=", "cls", "(", "d", ",", "filepath", ".", "FilePath", "(", "...
Run an executable with some arguments in the given working directory with the given environment variables. Returns a Deferred which fires with a two-tuple of (exit status, output list) if the process terminates without timing out or being killed by a signal. Otherwise, the Deferred err...
[ "Run", "an", "executable", "with", "some", "arguments", "in", "the", "given", "working", "directory", "with", "the", "given", "environment", "variables", "." ]
e85fa985a41983ef06e1d3bb26639181e1f78b24
https://github.com/twisted/epsilon/blob/e85fa985a41983ef06e1d3bb26639181e1f78b24/epsilon/scripts/benchmark.py#L166-L192
55,372
scholrly/orcid-python
orcid/rest.py
get
def get(orcid_id): """ Get an author based on an ORCID identifier. """ resp = requests.get(ORCID_PUBLIC_BASE_URL + unicode(orcid_id), headers=BASE_HEADERS) json_body = resp.json() return Author(json_body)
python
def get(orcid_id): """ Get an author based on an ORCID identifier. """ resp = requests.get(ORCID_PUBLIC_BASE_URL + unicode(orcid_id), headers=BASE_HEADERS) json_body = resp.json() return Author(json_body)
[ "def", "get", "(", "orcid_id", ")", ":", "resp", "=", "requests", ".", "get", "(", "ORCID_PUBLIC_BASE_URL", "+", "unicode", "(", "orcid_id", ")", ",", "headers", "=", "BASE_HEADERS", ")", "json_body", "=", "resp", ".", "json", "(", ")", "return", "Author...
Get an author based on an ORCID identifier.
[ "Get", "an", "author", "based", "on", "an", "ORCID", "identifier", "." ]
71311ca708689740e99d447716d6f22f1291f6f8
https://github.com/scholrly/orcid-python/blob/71311ca708689740e99d447716d6f22f1291f6f8/orcid/rest.py#L119-L126
55,373
project-ncl/pnc-cli
pnc_cli/products.py
create_product
def create_product(name, abbreviation, **kwargs): """ Create a new Product """ data = create_product_raw(name, abbreviation, **kwargs) if data: return utils.format_json(data)
python
def create_product(name, abbreviation, **kwargs): """ Create a new Product """ data = create_product_raw(name, abbreviation, **kwargs) if data: return utils.format_json(data)
[ "def", "create_product", "(", "name", ",", "abbreviation", ",", "*", "*", "kwargs", ")", ":", "data", "=", "create_product_raw", "(", "name", ",", "abbreviation", ",", "*", "*", "kwargs", ")", "if", "data", ":", "return", "utils", ".", "format_json", "("...
Create a new Product
[ "Create", "a", "new", "Product" ]
3dc149bf84928f60a8044ac50b58bbaddd451902
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/products.py#L28-L34
55,374
project-ncl/pnc-cli
pnc_cli/products.py
update_product
def update_product(product_id, **kwargs): """ Update a Product with new information """ content = update_product_raw(product_id, **kwargs) if content: return utils.format_json(content)
python
def update_product(product_id, **kwargs): """ Update a Product with new information """ content = update_product_raw(product_id, **kwargs) if content: return utils.format_json(content)
[ "def", "update_product", "(", "product_id", ",", "*", "*", "kwargs", ")", ":", "content", "=", "update_product_raw", "(", "product_id", ",", "*", "*", "kwargs", ")", "if", "content", ":", "return", "utils", ".", "format_json", "(", "content", ")" ]
Update a Product with new information
[ "Update", "a", "Product", "with", "new", "information" ]
3dc149bf84928f60a8044ac50b58bbaddd451902
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/products.py#L51-L57
55,375
project-ncl/pnc-cli
pnc_cli/products.py
get_product
def get_product(id=None, name=None): """ Get a specific Product by name or ID """ content = get_product_raw(id, name) if content: return utils.format_json(content)
python
def get_product(id=None, name=None): """ Get a specific Product by name or ID """ content = get_product_raw(id, name) if content: return utils.format_json(content)
[ "def", "get_product", "(", "id", "=", "None", ",", "name", "=", "None", ")", ":", "content", "=", "get_product_raw", "(", "id", ",", "name", ")", "if", "content", ":", "return", "utils", ".", "format_json", "(", "content", ")" ]
Get a specific Product by name or ID
[ "Get", "a", "specific", "Product", "by", "name", "or", "ID" ]
3dc149bf84928f60a8044ac50b58bbaddd451902
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/products.py#L74-L80
55,376
project-ncl/pnc-cli
pnc_cli/products.py
list_versions_for_product
def list_versions_for_product(id=None, name=None, page_size=200, page_index=0, sort='', q=''): """ List all ProductVersions for a given Product """ content = list_versions_for_product_raw(id, name, page_size, page_index, sort, q) if content: return utils.format_json_list(content)
python
def list_versions_for_product(id=None, name=None, page_size=200, page_index=0, sort='', q=''): """ List all ProductVersions for a given Product """ content = list_versions_for_product_raw(id, name, page_size, page_index, sort, q) if content: return utils.format_json_list(content)
[ "def", "list_versions_for_product", "(", "id", "=", "None", ",", "name", "=", "None", ",", "page_size", "=", "200", ",", "page_index", "=", "0", ",", "sort", "=", "''", ",", "q", "=", "''", ")", ":", "content", "=", "list_versions_for_product_raw", "(", ...
List all ProductVersions for a given Product
[ "List", "all", "ProductVersions", "for", "a", "given", "Product" ]
3dc149bf84928f60a8044ac50b58bbaddd451902
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/products.py#L97-L103
55,377
project-ncl/pnc-cli
pnc_cli/products.py
list_products
def list_products(page_size=200, page_index=0, sort="", q=""): """ List all Products """ content = list_products_raw(page_size, page_index, sort, q) if content: return utils.format_json_list(content)
python
def list_products(page_size=200, page_index=0, sort="", q=""): """ List all Products """ content = list_products_raw(page_size, page_index, sort, q) if content: return utils.format_json_list(content)
[ "def", "list_products", "(", "page_size", "=", "200", ",", "page_index", "=", "0", ",", "sort", "=", "\"\"", ",", "q", "=", "\"\"", ")", ":", "content", "=", "list_products_raw", "(", "page_size", ",", "page_index", ",", "sort", ",", "q", ")", "if", ...
List all Products
[ "List", "all", "Products" ]
3dc149bf84928f60a8044ac50b58bbaddd451902
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/products.py#L116-L122
55,378
CivicSpleen/ambry
ambry/util/geocoders.py
DstkGeocoder.geocode
def geocode(self): """A Generator that reads from the address generators and returns geocode results. The generator yields ( address, geocode_results, object) """ submit_set = [] data_map = {} for address, o in self.gen: submit_set.append(address) ...
python
def geocode(self): """A Generator that reads from the address generators and returns geocode results. The generator yields ( address, geocode_results, object) """ submit_set = [] data_map = {} for address, o in self.gen: submit_set.append(address) ...
[ "def", "geocode", "(", "self", ")", ":", "submit_set", "=", "[", "]", "data_map", "=", "{", "}", "for", "address", ",", "o", "in", "self", ".", "gen", ":", "submit_set", ".", "append", "(", "address", ")", "data_map", "[", "address", "]", "=", "o",...
A Generator that reads from the address generators and returns geocode results. The generator yields ( address, geocode_results, object)
[ "A", "Generator", "that", "reads", "from", "the", "address", "generators", "and", "returns", "geocode", "results", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/util/geocoders.py#L35-L64
55,379
CivicSpleen/ambry
ambry/orm/database.py
migrate
def migrate(connection, dsn): """ Collects all migrations and applies missed. Args: connection (sqlalchemy connection): """ all_migrations = _get_all_migrations() logger.debug('Collected migrations: {}'.format(all_migrations)) for version, modname in all_migrations: if _is_mis...
python
def migrate(connection, dsn): """ Collects all migrations and applies missed. Args: connection (sqlalchemy connection): """ all_migrations = _get_all_migrations() logger.debug('Collected migrations: {}'.format(all_migrations)) for version, modname in all_migrations: if _is_mis...
[ "def", "migrate", "(", "connection", ",", "dsn", ")", ":", "all_migrations", "=", "_get_all_migrations", "(", ")", "logger", ".", "debug", "(", "'Collected migrations: {}'", ".", "format", "(", "all_migrations", ")", ")", "for", "version", ",", "modname", "in"...
Collects all migrations and applies missed. Args: connection (sqlalchemy connection):
[ "Collects", "all", "migrations", "and", "applies", "missed", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/database.py#L835-L860
55,380
CivicSpleen/ambry
ambry/orm/database.py
get_stored_version
def get_stored_version(connection): """ Returns database version. Args: connection (sqlalchemy connection): Raises: Assuming user_version pragma (sqlite case) and user_version table (postgresql case) exist because they created with the database creation. Returns: int: version ...
python
def get_stored_version(connection): """ Returns database version. Args: connection (sqlalchemy connection): Raises: Assuming user_version pragma (sqlite case) and user_version table (postgresql case) exist because they created with the database creation. Returns: int: version ...
[ "def", "get_stored_version", "(", "connection", ")", ":", "if", "connection", ".", "engine", ".", "name", "==", "'sqlite'", ":", "version", "=", "connection", ".", "execute", "(", "'PRAGMA user_version'", ")", ".", "fetchone", "(", ")", "[", "0", "]", "if"...
Returns database version. Args: connection (sqlalchemy connection): Raises: Assuming user_version pragma (sqlite case) and user_version table (postgresql case) exist because they created with the database creation. Returns: int: version of the database.
[ "Returns", "database", "version", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/database.py#L897-L931
55,381
CivicSpleen/ambry
ambry/orm/database.py
_validate_version
def _validate_version(connection, dsn): """ Performs on-the-fly schema updates based on the models version. Raises: DatabaseError: if user uses old sqlite database. """ try: version = get_stored_version(connection) except VersionIsNotStored: logger.debug('Version not stored...
python
def _validate_version(connection, dsn): """ Performs on-the-fly schema updates based on the models version. Raises: DatabaseError: if user uses old sqlite database. """ try: version = get_stored_version(connection) except VersionIsNotStored: logger.debug('Version not stored...
[ "def", "_validate_version", "(", "connection", ",", "dsn", ")", ":", "try", ":", "version", "=", "get_stored_version", "(", "connection", ")", "except", "VersionIsNotStored", ":", "logger", ".", "debug", "(", "'Version not stored in the db: assuming new database creatio...
Performs on-the-fly schema updates based on the models version. Raises: DatabaseError: if user uses old sqlite database.
[ "Performs", "on", "-", "the", "-", "fly", "schema", "updates", "based", "on", "the", "models", "version", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/database.py#L934-L953
55,382
CivicSpleen/ambry
ambry/orm/database.py
_migration_required
def _migration_required(connection): """ Returns True if ambry models do not match to db tables. Otherwise returns False. """ stored_version = get_stored_version(connection) actual_version = SCHEMA_VERSION assert isinstance(stored_version, int) assert isinstance(actual_version, int) assert store...
python
def _migration_required(connection): """ Returns True if ambry models do not match to db tables. Otherwise returns False. """ stored_version = get_stored_version(connection) actual_version = SCHEMA_VERSION assert isinstance(stored_version, int) assert isinstance(actual_version, int) assert store...
[ "def", "_migration_required", "(", "connection", ")", ":", "stored_version", "=", "get_stored_version", "(", "connection", ")", "actual_version", "=", "SCHEMA_VERSION", "assert", "isinstance", "(", "stored_version", ",", "int", ")", "assert", "isinstance", "(", "act...
Returns True if ambry models do not match to db tables. Otherwise returns False.
[ "Returns", "True", "if", "ambry", "models", "do", "not", "match", "to", "db", "tables", ".", "Otherwise", "returns", "False", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/database.py#L956-L964
55,383
CivicSpleen/ambry
ambry/orm/database.py
_update_version
def _update_version(connection, version): """ Updates version in the db to the given version. Args: connection (sqlalchemy connection): sqlalchemy session where to update version. version (int): version of the migration. """ if connection.engine.name == 'sqlite': connection.exe...
python
def _update_version(connection, version): """ Updates version in the db to the given version. Args: connection (sqlalchemy connection): sqlalchemy session where to update version. version (int): version of the migration. """ if connection.engine.name == 'sqlite': connection.exe...
[ "def", "_update_version", "(", "connection", ",", "version", ")", ":", "if", "connection", ".", "engine", ".", "name", "==", "'sqlite'", ":", "connection", ".", "execute", "(", "'PRAGMA user_version = {}'", ".", "format", "(", "version", ")", ")", "elif", "c...
Updates version in the db to the given version. Args: connection (sqlalchemy connection): sqlalchemy session where to update version. version (int): version of the migration.
[ "Updates", "version", "in", "the", "db", "to", "the", "given", "version", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/database.py#L967-L997
55,384
CivicSpleen/ambry
ambry/orm/database.py
_get_all_migrations
def _get_all_migrations(): """ Returns sorted list of all migrations. Returns: list of (int, str) tuples: first elem of the tuple is migration number, second if module name. """ from . import migrations package = migrations prefix = package.__name__ + '.' all_migrations = [] f...
python
def _get_all_migrations(): """ Returns sorted list of all migrations. Returns: list of (int, str) tuples: first elem of the tuple is migration number, second if module name. """ from . import migrations package = migrations prefix = package.__name__ + '.' all_migrations = [] f...
[ "def", "_get_all_migrations", "(", ")", ":", "from", ".", "import", "migrations", "package", "=", "migrations", "prefix", "=", "package", ".", "__name__", "+", "'.'", "all_migrations", "=", "[", "]", "for", "importer", ",", "modname", ",", "ispkg", "in", "...
Returns sorted list of all migrations. Returns: list of (int, str) tuples: first elem of the tuple is migration number, second if module name.
[ "Returns", "sorted", "list", "of", "all", "migrations", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/database.py#L1013-L1030
55,385
CivicSpleen/ambry
ambry/orm/database.py
Database.create
def create(self): """Create the database from the base SQL.""" if not self.exists(): self._create_path() self.create_tables() return True return False
python
def create(self): """Create the database from the base SQL.""" if not self.exists(): self._create_path() self.create_tables() return True return False
[ "def", "create", "(", "self", ")", ":", "if", "not", "self", ".", "exists", "(", ")", ":", "self", ".", "_create_path", "(", ")", "self", ".", "create_tables", "(", ")", "return", "True", "return", "False" ]
Create the database from the base SQL.
[ "Create", "the", "database", "from", "the", "base", "SQL", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/database.py#L107-L115
55,386
CivicSpleen/ambry
ambry/orm/database.py
Database._create_path
def _create_path(self): """Create the path to hold the database, if one wwas specified.""" if self.driver == 'sqlite' and 'memory' not in self.dsn and self.dsn != 'sqlite://': dir_ = os.path.dirname(self.path) if dir_ and not os.path.exists(dir_): try: ...
python
def _create_path(self): """Create the path to hold the database, if one wwas specified.""" if self.driver == 'sqlite' and 'memory' not in self.dsn and self.dsn != 'sqlite://': dir_ = os.path.dirname(self.path) if dir_ and not os.path.exists(dir_): try: ...
[ "def", "_create_path", "(", "self", ")", ":", "if", "self", ".", "driver", "==", "'sqlite'", "and", "'memory'", "not", "in", "self", ".", "dsn", "and", "self", ".", "dsn", "!=", "'sqlite://'", ":", "dir_", "=", "os", ".", "path", ".", "dirname", "(",...
Create the path to hold the database, if one wwas specified.
[ "Create", "the", "path", "to", "hold", "the", "database", "if", "one", "wwas", "specified", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/database.py#L117-L133
55,387
CivicSpleen/ambry
ambry/orm/database.py
Database.exists
def exists(self): """Return True if the database exists, or for Sqlite, which will create the file on the first reference, the file has been initialized with the root config """ if self.driver == 'sqlite' and not os.path.exists(self.path): return False # init engine ...
python
def exists(self): """Return True if the database exists, or for Sqlite, which will create the file on the first reference, the file has been initialized with the root config """ if self.driver == 'sqlite' and not os.path.exists(self.path): return False # init engine ...
[ "def", "exists", "(", "self", ")", ":", "if", "self", ".", "driver", "==", "'sqlite'", "and", "not", "os", ".", "path", ".", "exists", "(", "self", ".", "path", ")", ":", "return", "False", "# init engine", "self", ".", "engine", "try", ":", "# Since...
Return True if the database exists, or for Sqlite, which will create the file on the first reference, the file has been initialized with the root config
[ "Return", "True", "if", "the", "database", "exists", "or", "for", "Sqlite", "which", "will", "create", "the", "file", "on", "the", "first", "reference", "the", "file", "has", "been", "initialized", "with", "the", "root", "config" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/database.py#L139-L162
55,388
CivicSpleen/ambry
ambry/orm/database.py
Database.engine
def engine(self): """return the SqlAlchemy engine for this database.""" if not self._engine: if 'postgres' in self.driver: if 'connect_args' not in self.engine_kwargs: self.engine_kwargs['connect_args'] = { 'application_name': '{...
python
def engine(self): """return the SqlAlchemy engine for this database.""" if not self._engine: if 'postgres' in self.driver: if 'connect_args' not in self.engine_kwargs: self.engine_kwargs['connect_args'] = { 'application_name': '{...
[ "def", "engine", "(", "self", ")", ":", "if", "not", "self", ".", "_engine", ":", "if", "'postgres'", "in", "self", ".", "driver", ":", "if", "'connect_args'", "not", "in", "self", ".", "engine_kwargs", ":", "self", ".", "engine_kwargs", "[", "'connect_a...
return the SqlAlchemy engine for this database.
[ "return", "the", "SqlAlchemy", "engine", "for", "this", "database", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/database.py#L165-L225
55,389
CivicSpleen/ambry
ambry/orm/database.py
Database.connection
def connection(self): """Return an SqlAlchemy connection.""" if not self._connection: logger.debug('Opening connection to: {}'.format(self.dsn)) self._connection = self.engine.connect() logger.debug('Opened connection to: {}'.format(self.dsn)) # logger.debug(...
python
def connection(self): """Return an SqlAlchemy connection.""" if not self._connection: logger.debug('Opening connection to: {}'.format(self.dsn)) self._connection = self.engine.connect() logger.debug('Opened connection to: {}'.format(self.dsn)) # logger.debug(...
[ "def", "connection", "(", "self", ")", ":", "if", "not", "self", ".", "_connection", ":", "logger", ".", "debug", "(", "'Opening connection to: {}'", ".", "format", "(", "self", ".", "dsn", ")", ")", "self", ".", "_connection", "=", "self", ".", "engine"...
Return an SqlAlchemy connection.
[ "Return", "an", "SqlAlchemy", "connection", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/database.py#L228-L236
55,390
CivicSpleen/ambry
ambry/orm/database.py
Database.session
def session(self): """Return a SqlAlchemy session.""" from sqlalchemy.orm import sessionmaker from sqlalchemy.event import listen if not self.Session: self.Session = sessionmaker(bind=self.engine) if not self._session: self._session = self.Session() ...
python
def session(self): """Return a SqlAlchemy session.""" from sqlalchemy.orm import sessionmaker from sqlalchemy.event import listen if not self.Session: self.Session = sessionmaker(bind=self.engine) if not self._session: self._session = self.Session() ...
[ "def", "session", "(", "self", ")", ":", "from", "sqlalchemy", ".", "orm", "import", "sessionmaker", "from", "sqlalchemy", ".", "event", "import", "listen", "if", "not", "self", ".", "Session", ":", "self", ".", "Session", "=", "sessionmaker", "(", "bind",...
Return a SqlAlchemy session.
[ "Return", "a", "SqlAlchemy", "session", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/database.py#L239-L259
55,391
CivicSpleen/ambry
ambry/orm/database.py
Database.metadata
def metadata(self): """Return an SqlAlchemy MetaData object, bound to the engine.""" from sqlalchemy import MetaData metadata = MetaData(bind=self.engine, schema=self._schema) metadata.reflect(self.engine) return metadata
python
def metadata(self): """Return an SqlAlchemy MetaData object, bound to the engine.""" from sqlalchemy import MetaData metadata = MetaData(bind=self.engine, schema=self._schema) metadata.reflect(self.engine) return metadata
[ "def", "metadata", "(", "self", ")", ":", "from", "sqlalchemy", "import", "MetaData", "metadata", "=", "MetaData", "(", "bind", "=", "self", ".", "engine", ",", "schema", "=", "self", ".", "_schema", ")", "metadata", ".", "reflect", "(", "self", ".", "...
Return an SqlAlchemy MetaData object, bound to the engine.
[ "Return", "an", "SqlAlchemy", "MetaData", "object", "bound", "to", "the", "engine", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/database.py#L362-L371
55,392
CivicSpleen/ambry
ambry/orm/database.py
Database._add_config_root
def _add_config_root(self): """ Adds the root dataset, which holds configuration values for the database. """ try: self.session.query(Dataset).filter_by(id=ROOT_CONFIG_NAME).one() self.close_session() except NoResultFound: o = Dataset( id=ROOT...
python
def _add_config_root(self): """ Adds the root dataset, which holds configuration values for the database. """ try: self.session.query(Dataset).filter_by(id=ROOT_CONFIG_NAME).one() self.close_session() except NoResultFound: o = Dataset( id=ROOT...
[ "def", "_add_config_root", "(", "self", ")", ":", "try", ":", "self", ".", "session", ".", "query", "(", "Dataset", ")", ".", "filter_by", "(", "id", "=", "ROOT_CONFIG_NAME", ")", ".", "one", "(", ")", "self", ".", "close_session", "(", ")", "except", ...
Adds the root dataset, which holds configuration values for the database.
[ "Adds", "the", "root", "dataset", "which", "holds", "configuration", "values", "for", "the", "database", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/database.py#L422-L442
55,393
CivicSpleen/ambry
ambry/orm/database.py
Database.new_dataset
def new_dataset(self, *args, **kwargs): """ Creates a new dataset :param args: Positional args passed to the Dataset constructor. :param kwargs: Keyword args passed to the Dataset constructor. :return: :class:`ambry.orm.Dataset` :raises: :class:`ambry.orm.ConflictError` if the ...
python
def new_dataset(self, *args, **kwargs): """ Creates a new dataset :param args: Positional args passed to the Dataset constructor. :param kwargs: Keyword args passed to the Dataset constructor. :return: :class:`ambry.orm.Dataset` :raises: :class:`ambry.orm.ConflictError` if the ...
[ "def", "new_dataset", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "ds", "=", "Dataset", "(", "*", "args", ",", "*", "*", "kwargs", ")", "try", ":", "self", ".", "session", ".", "add", "(", "ds", ")", "self", ".", "session"...
Creates a new dataset :param args: Positional args passed to the Dataset constructor. :param kwargs: Keyword args passed to the Dataset constructor. :return: :class:`ambry.orm.Dataset` :raises: :class:`ambry.orm.ConflictError` if the a Dataset records already exists with the given vid
[ "Creates", "a", "new", "dataset" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/database.py#L448-L467
55,394
CivicSpleen/ambry
ambry/orm/database.py
Database.root_dataset
def root_dataset(self): """Return the root dataset, which hold configuration values for the library""" ds = self.dataset(ROOT_CONFIG_NAME_V) ds._database = self return ds
python
def root_dataset(self): """Return the root dataset, which hold configuration values for the library""" ds = self.dataset(ROOT_CONFIG_NAME_V) ds._database = self return ds
[ "def", "root_dataset", "(", "self", ")", ":", "ds", "=", "self", ".", "dataset", "(", "ROOT_CONFIG_NAME_V", ")", "ds", ".", "_database", "=", "self", "return", "ds" ]
Return the root dataset, which hold configuration values for the library
[ "Return", "the", "root", "dataset", "which", "hold", "configuration", "values", "for", "the", "library" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/database.py#L470-L474
55,395
CivicSpleen/ambry
ambry/orm/database.py
Database.dataset
def dataset(self, ref, load_all=False, exception=True): """Return a dataset, given a vid or id :param ref: Vid or id for a dataset. If an id is provided, will it will return the one with the largest revision number :param load_all: Use a query that eagerly loads everything. :re...
python
def dataset(self, ref, load_all=False, exception=True): """Return a dataset, given a vid or id :param ref: Vid or id for a dataset. If an id is provided, will it will return the one with the largest revision number :param load_all: Use a query that eagerly loads everything. :re...
[ "def", "dataset", "(", "self", ",", "ref", ",", "load_all", "=", "False", ",", "exception", "=", "True", ")", ":", "ref", "=", "str", "(", "ref", ")", "try", ":", "ds", "=", "self", ".", "session", ".", "query", "(", "Dataset", ")", ".", "filter"...
Return a dataset, given a vid or id :param ref: Vid or id for a dataset. If an id is provided, will it will return the one with the largest revision number :param load_all: Use a query that eagerly loads everything. :return: :class:`ambry.orm.Dataset`
[ "Return", "a", "dataset", "given", "a", "vid", "or", "id" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/database.py#L482-L531
55,396
CivicSpleen/ambry
ambry/orm/database.py
BaseMigration.create_table
def create_table(table, connection, schema=None): """Create a single table, primarily used din migrations""" orig_schemas = {} # These schema shenanigans are almost certainly wrong. # But they are expedient. For Postgres, it puts the library # tables in the Library schema. We n...
python
def create_table(table, connection, schema=None): """Create a single table, primarily used din migrations""" orig_schemas = {} # These schema shenanigans are almost certainly wrong. # But they are expedient. For Postgres, it puts the library # tables in the Library schema. We n...
[ "def", "create_table", "(", "table", ",", "connection", ",", "schema", "=", "None", ")", ":", "orig_schemas", "=", "{", "}", "# These schema shenanigans are almost certainly wrong.", "# But they are expedient. For Postgres, it puts the library", "# tables in the Library schema. W...
Create a single table, primarily used din migrations
[ "Create", "a", "single", "table", "primarily", "used", "din", "migrations" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/database.py#L796-L819
55,397
SmartTeleMax/iktomi
iktomi/unstable/utils/functools.py
return_locals
def return_locals(func): '''Modifies decorated function to return its locals''' @functools.wraps(func) def wrap(*args, **kwargs): frames = [] def tracer(frame, event, arg): # pragma: no cover # coverage does not work in this function because the tracer # is deactiva...
python
def return_locals(func): '''Modifies decorated function to return its locals''' @functools.wraps(func) def wrap(*args, **kwargs): frames = [] def tracer(frame, event, arg): # pragma: no cover # coverage does not work in this function because the tracer # is deactiva...
[ "def", "return_locals", "(", "func", ")", ":", "@", "functools", ".", "wraps", "(", "func", ")", "def", "wrap", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "frames", "=", "[", "]", "def", "tracer", "(", "frame", ",", "event", ",", "arg",...
Modifies decorated function to return its locals
[ "Modifies", "decorated", "function", "to", "return", "its", "locals" ]
80bc0f1408d63efe7f5844367d1f6efba44b35f2
https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/unstable/utils/functools.py#L6-L38
55,398
project-ncl/pnc-cli
pnc_cli/generate_repo.py
generate_repo_list
def generate_repo_list(product_name=None, product_version=None, product_milestone=None): """ Generates list of artifacts for offline repository. """ if not validate_input_parameters(product_name, product_version, product_milestone): sys.exit(1) product_version = pnc_api.product_versions.get_...
python
def generate_repo_list(product_name=None, product_version=None, product_milestone=None): """ Generates list of artifacts for offline repository. """ if not validate_input_parameters(product_name, product_version, product_milestone): sys.exit(1) product_version = pnc_api.product_versions.get_...
[ "def", "generate_repo_list", "(", "product_name", "=", "None", ",", "product_version", "=", "None", ",", "product_milestone", "=", "None", ")", ":", "if", "not", "validate_input_parameters", "(", "product_name", ",", "product_version", ",", "product_milestone", ")",...
Generates list of artifacts for offline repository.
[ "Generates", "list", "of", "artifacts", "for", "offline", "repository", "." ]
3dc149bf84928f60a8044ac50b58bbaddd451902
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/generate_repo.py#L12-L35
55,399
twisted/epsilon
epsilon/hotfixes/delayedcall_seconds.py
DelayedCall.cancel
def cancel(self): """Unschedule this call @raise AlreadyCancelled: Raised if this call has already been unscheduled. @raise AlreadyCalled: Raised if this call has already been made. """ if self.cancelled: raise error.AlreadyCancelled elif self.called...
python
def cancel(self): """Unschedule this call @raise AlreadyCancelled: Raised if this call has already been unscheduled. @raise AlreadyCalled: Raised if this call has already been made. """ if self.cancelled: raise error.AlreadyCancelled elif self.called...
[ "def", "cancel", "(", "self", ")", ":", "if", "self", ".", "cancelled", ":", "raise", "error", ".", "AlreadyCancelled", "elif", "self", ".", "called", ":", "raise", "error", ".", "AlreadyCalled", "else", ":", "self", ".", "canceller", "(", "self", ")", ...
Unschedule this call @raise AlreadyCancelled: Raised if this call has already been unscheduled. @raise AlreadyCalled: Raised if this call has already been made.
[ "Unschedule", "this", "call" ]
e85fa985a41983ef06e1d3bb26639181e1f78b24
https://github.com/twisted/epsilon/blob/e85fa985a41983ef06e1d3bb26639181e1f78b24/epsilon/hotfixes/delayedcall_seconds.py#L38-L55