partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
valid
log_entity_deletion
Logs an entity creation
gadget/__init__.py
def log_entity_deletion(entity, params=None): """Logs an entity creation """ p = {'entity': entity} if params: p['params'] = params _log(TYPE_CODES.DELETE, p)
def log_entity_deletion(entity, params=None): """Logs an entity creation """ p = {'entity': entity} if params: p['params'] = params _log(TYPE_CODES.DELETE, p)
[ "Logs", "an", "entity", "creation" ]
getslash/gadget-python
python
https://github.com/getslash/gadget-python/blob/ff22506f41798c6e11a117b2c1a27f62d8b7b9ad/gadget/__init__.py#L53-L59
[ "def", "log_entity_deletion", "(", "entity", ",", "params", "=", "None", ")", ":", "p", "=", "{", "'entity'", ":", "entity", "}", "if", "params", ":", "p", "[", "'params'", "]", "=", "params", "_log", "(", "TYPE_CODES", ".", "DELETE", ",", "p", ")" ]
ff22506f41798c6e11a117b2c1a27f62d8b7b9ad
valid
log_operation
Logs an operation done on an entity, possibly with other arguments
gadget/__init__.py
def log_operation(entities, operation_name, params=None): """Logs an operation done on an entity, possibly with other arguments """ if isinstance(entities, (list, tuple)): entities = list(entities) else: entities = [entities] p = {'name': operation_name, 'on': entities} if param...
def log_operation(entities, operation_name, params=None): """Logs an operation done on an entity, possibly with other arguments """ if isinstance(entities, (list, tuple)): entities = list(entities) else: entities = [entities] p = {'name': operation_name, 'on': entities} if param...
[ "Logs", "an", "operation", "done", "on", "an", "entity", "possibly", "with", "other", "arguments" ]
getslash/gadget-python
python
https://github.com/getslash/gadget-python/blob/ff22506f41798c6e11a117b2c1a27f62d8b7b9ad/gadget/__init__.py#L62-L73
[ "def", "log_operation", "(", "entities", ",", "operation_name", ",", "params", "=", "None", ")", ":", "if", "isinstance", "(", "entities", ",", "(", "list", ",", "tuple", ")", ")", ":", "entities", "=", "list", "(", "entities", ")", "else", ":", "entit...
ff22506f41798c6e11a117b2c1a27f62d8b7b9ad
valid
log_state
Logs a new state of an entity
gadget/__init__.py
def log_state(entity, state): """Logs a new state of an entity """ p = {'on': entity, 'state': state} _log(TYPE_CODES.STATE, p)
def log_state(entity, state): """Logs a new state of an entity """ p = {'on': entity, 'state': state} _log(TYPE_CODES.STATE, p)
[ "Logs", "a", "new", "state", "of", "an", "entity" ]
getslash/gadget-python
python
https://github.com/getslash/gadget-python/blob/ff22506f41798c6e11a117b2c1a27f62d8b7b9ad/gadget/__init__.py#L76-L80
[ "def", "log_state", "(", "entity", ",", "state", ")", ":", "p", "=", "{", "'on'", ":", "entity", ",", "'state'", ":", "state", "}", "_log", "(", "TYPE_CODES", ".", "STATE", ",", "p", ")" ]
ff22506f41798c6e11a117b2c1a27f62d8b7b9ad
valid
log_update
Logs an update done on an entity
gadget/__init__.py
def log_update(entity, update): """Logs an update done on an entity """ p = {'on': entity, 'update': update} _log(TYPE_CODES.UPDATE, p)
def log_update(entity, update): """Logs an update done on an entity """ p = {'on': entity, 'update': update} _log(TYPE_CODES.UPDATE, p)
[ "Logs", "an", "update", "done", "on", "an", "entity" ]
getslash/gadget-python
python
https://github.com/getslash/gadget-python/blob/ff22506f41798c6e11a117b2c1a27f62d8b7b9ad/gadget/__init__.py#L82-L86
[ "def", "log_update", "(", "entity", ",", "update", ")", ":", "p", "=", "{", "'on'", ":", "entity", ",", "'update'", ":", "update", "}", "_log", "(", "TYPE_CODES", ".", "UPDATE", ",", "p", ")" ]
ff22506f41798c6e11a117b2c1a27f62d8b7b9ad
valid
log_error
Logs an error
gadget/__init__.py
def log_error(error, result): """Logs an error """ p = {'error': error, 'result':result} _log(TYPE_CODES.ERROR, p)
def log_error(error, result): """Logs an error """ p = {'error': error, 'result':result} _log(TYPE_CODES.ERROR, p)
[ "Logs", "an", "error" ]
getslash/gadget-python
python
https://github.com/getslash/gadget-python/blob/ff22506f41798c6e11a117b2c1a27f62d8b7b9ad/gadget/__init__.py#L89-L93
[ "def", "log_error", "(", "error", ",", "result", ")", ":", "p", "=", "{", "'error'", ":", "error", ",", "'result'", ":", "result", "}", "_log", "(", "TYPE_CODES", ".", "ERROR", ",", "p", ")" ]
ff22506f41798c6e11a117b2c1a27f62d8b7b9ad
valid
dict_cursor
Decorator that provides a dictionary cursor to the calling function Adds the cursor as the second argument to the calling functions Requires that the function being decorated is an instance of a class or object that yields a cursor from a get_cursor(cursor_type=CursorType.DICT) coroutine or provides such ...
cauldron/sql.py
def dict_cursor(func): """ Decorator that provides a dictionary cursor to the calling function Adds the cursor as the second argument to the calling functions Requires that the function being decorated is an instance of a class or object that yields a cursor from a get_cursor(cursor_type=CursorTyp...
def dict_cursor(func): """ Decorator that provides a dictionary cursor to the calling function Adds the cursor as the second argument to the calling functions Requires that the function being decorated is an instance of a class or object that yields a cursor from a get_cursor(cursor_type=CursorTyp...
[ "Decorator", "that", "provides", "a", "dictionary", "cursor", "to", "the", "calling", "function" ]
nerandell/cauldron
python
https://github.com/nerandell/cauldron/blob/d363bac763781bb2da18debfa0fdd4be28288b92/cauldron/sql.py#L14-L33
[ "def", "dict_cursor", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "wrapper", "(", "cls", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "with", "(", "yield", "from", "cls", ".", "get_cursor", "(", "_CursorType", ".", "DICT",...
d363bac763781bb2da18debfa0fdd4be28288b92
valid
cursor
Decorator that provides a cursor to the calling function Adds the cursor as the second argument to the calling functions Requires that the function being decorated is an instance of a class or object that yields a cursor from a get_cursor() coroutine or provides such an object as the first argument in...
cauldron/sql.py
def cursor(func): """ Decorator that provides a cursor to the calling function Adds the cursor as the second argument to the calling functions Requires that the function being decorated is an instance of a class or object that yields a cursor from a get_cursor() coroutine or provides such an objec...
def cursor(func): """ Decorator that provides a cursor to the calling function Adds the cursor as the second argument to the calling functions Requires that the function being decorated is an instance of a class or object that yields a cursor from a get_cursor() coroutine or provides such an objec...
[ "Decorator", "that", "provides", "a", "cursor", "to", "the", "calling", "function" ]
nerandell/cauldron
python
https://github.com/nerandell/cauldron/blob/d363bac763781bb2da18debfa0fdd4be28288b92/cauldron/sql.py#L36-L55
[ "def", "cursor", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "wrapper", "(", "cls", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "with", "(", "yield", "from", "cls", ".", "get_cursor", "(", ")", ")", "as", "c", ":", ...
d363bac763781bb2da18debfa0fdd4be28288b92
valid
nt_cursor
Decorator that provides a namedtuple cursor to the calling function Adds the cursor as the second argument to the calling functions Requires that the function being decorated is an instance of a class or object that yields a cursor from a get_cursor(cursor_type=CursorType.NAMEDTUPLE) coroutine or provides...
cauldron/sql.py
def nt_cursor(func): """ Decorator that provides a namedtuple cursor to the calling function Adds the cursor as the second argument to the calling functions Requires that the function being decorated is an instance of a class or object that yields a cursor from a get_cursor(cursor_type=CursorType....
def nt_cursor(func): """ Decorator that provides a namedtuple cursor to the calling function Adds the cursor as the second argument to the calling functions Requires that the function being decorated is an instance of a class or object that yields a cursor from a get_cursor(cursor_type=CursorType....
[ "Decorator", "that", "provides", "a", "namedtuple", "cursor", "to", "the", "calling", "function" ]
nerandell/cauldron
python
https://github.com/nerandell/cauldron/blob/d363bac763781bb2da18debfa0fdd4be28288b92/cauldron/sql.py#L58-L77
[ "def", "nt_cursor", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "wrapper", "(", "cls", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "with", "(", "yield", "from", "cls", ".", "get_cursor", "(", "_CursorType", ".", "NAMEDTUP...
d363bac763781bb2da18debfa0fdd4be28288b92
valid
transaction
Provides a transacted cursor which will run in autocommit=false mode For any exception the transaction will be rolled back. Requires that the function being decorated is an instance of a class or object that yields a cursor from a get_cursor(cursor_type=CursorType.NAMEDTUPLE) coroutine or provides such an ...
cauldron/sql.py
def transaction(func): """ Provides a transacted cursor which will run in autocommit=false mode For any exception the transaction will be rolled back. Requires that the function being decorated is an instance of a class or object that yields a cursor from a get_cursor(cursor_type=CursorType.NAMEDTU...
def transaction(func): """ Provides a transacted cursor which will run in autocommit=false mode For any exception the transaction will be rolled back. Requires that the function being decorated is an instance of a class or object that yields a cursor from a get_cursor(cursor_type=CursorType.NAMEDTU...
[ "Provides", "a", "transacted", "cursor", "which", "will", "run", "in", "autocommit", "=", "false", "mode" ]
nerandell/cauldron
python
https://github.com/nerandell/cauldron/blob/d363bac763781bb2da18debfa0fdd4be28288b92/cauldron/sql.py#L80-L105
[ "def", "transaction", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "wrapper", "(", "cls", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "with", "(", "yield", "from", "cls", ".", "get_cursor", "(", "_CursorType", ".", "NAMEDT...
d363bac763781bb2da18debfa0fdd4be28288b92
valid
PostgresStore.connect
Sets connection parameters For more information on the parameters that is accepts, see : http://www.postgresql.org/docs/9.2/static/libpq-connect.html
cauldron/sql.py
def connect(cls, database: str, user: str, password: str, host: str, port: int, *, use_pool: bool=True, enable_ssl: bool=False, minsize=1, maxsize=50, keepalives_idle=5, keepalives_interval=4, echo=False, **kwargs): """ Sets connection parameters For more informat...
def connect(cls, database: str, user: str, password: str, host: str, port: int, *, use_pool: bool=True, enable_ssl: bool=False, minsize=1, maxsize=50, keepalives_idle=5, keepalives_interval=4, echo=False, **kwargs): """ Sets connection parameters For more informat...
[ "Sets", "connection", "parameters", "For", "more", "information", "on", "the", "parameters", "that", "is", "accepts", "see", ":", "http", ":", "//", "www", ".", "postgresql", ".", "org", "/", "docs", "/", "9", ".", "2", "/", "static", "/", "libpq", "-"...
nerandell/cauldron
python
https://github.com/nerandell/cauldron/blob/d363bac763781bb2da18debfa0fdd4be28288b92/cauldron/sql.py#L130-L150
[ "def", "connect", "(", "cls", ",", "database", ":", "str", ",", "user", ":", "str", ",", "password", ":", "str", ",", "host", ":", "str", ",", "port", ":", "int", ",", "*", ",", "use_pool", ":", "bool", "=", "True", ",", "enable_ssl", ":", "bool"...
d363bac763781bb2da18debfa0fdd4be28288b92
valid
PostgresStore.get_pool
Yields: existing db connection pool
cauldron/sql.py
def get_pool(cls) -> Pool: """ Yields: existing db connection pool """ if len(cls._connection_params) < 5: raise ConnectionError('Please call SQLStore.connect before calling this method') if not cls._pool: cls._pool = yield from create_pool(**c...
def get_pool(cls) -> Pool: """ Yields: existing db connection pool """ if len(cls._connection_params) < 5: raise ConnectionError('Please call SQLStore.connect before calling this method') if not cls._pool: cls._pool = yield from create_pool(**c...
[ "Yields", ":", "existing", "db", "connection", "pool" ]
nerandell/cauldron
python
https://github.com/nerandell/cauldron/blob/d363bac763781bb2da18debfa0fdd4be28288b92/cauldron/sql.py#L161-L170
[ "def", "get_pool", "(", "cls", ")", "->", "Pool", ":", "if", "len", "(", "cls", ".", "_connection_params", ")", "<", "5", ":", "raise", "ConnectionError", "(", "'Please call SQLStore.connect before calling this method'", ")", "if", "not", "cls", ".", "_pool", ...
d363bac763781bb2da18debfa0fdd4be28288b92
valid
PostgresStore.get_cursor
Yields: new client-side cursor from existing db connection pool
cauldron/sql.py
def get_cursor(cls, cursor_type=_CursorType.PLAIN) -> Cursor: """ Yields: new client-side cursor from existing db connection pool """ _cur = None if cls._use_pool: _connection_source = yield from cls.get_pool() else: _connection_source ...
def get_cursor(cls, cursor_type=_CursorType.PLAIN) -> Cursor: """ Yields: new client-side cursor from existing db connection pool """ _cur = None if cls._use_pool: _connection_source = yield from cls.get_pool() else: _connection_source ...
[ "Yields", ":", "new", "client", "-", "side", "cursor", "from", "existing", "db", "connection", "pool" ]
nerandell/cauldron
python
https://github.com/nerandell/cauldron/blob/d363bac763781bb2da18debfa0fdd4be28288b92/cauldron/sql.py#L174-L195
[ "def", "get_cursor", "(", "cls", ",", "cursor_type", "=", "_CursorType", ".", "PLAIN", ")", "->", "Cursor", ":", "_cur", "=", "None", "if", "cls", ".", "_use_pool", ":", "_connection_source", "=", "yield", "from", "cls", ".", "get_pool", "(", ")", "else"...
d363bac763781bb2da18debfa0fdd4be28288b92
valid
PostgresStore.count
gives the number of records in the table Args: table: a string indicating the name of the table Returns: an integer indicating the number of records in the table
cauldron/sql.py
def count(cls, cur, table:str, where_keys: list=None): """ gives the number of records in the table Args: table: a string indicating the name of the table Returns: an integer indicating the number of records in the table """ if where_keys: ...
def count(cls, cur, table:str, where_keys: list=None): """ gives the number of records in the table Args: table: a string indicating the name of the table Returns: an integer indicating the number of records in the table """ if where_keys: ...
[ "gives", "the", "number", "of", "records", "in", "the", "table" ]
nerandell/cauldron
python
https://github.com/nerandell/cauldron/blob/d363bac763781bb2da18debfa0fdd4be28288b92/cauldron/sql.py#L200-L221
[ "def", "count", "(", "cls", ",", "cur", ",", "table", ":", "str", ",", "where_keys", ":", "list", "=", "None", ")", ":", "if", "where_keys", ":", "where_clause", ",", "values", "=", "cls", ".", "_get_where_clause_with_values", "(", "where_keys", ")", "qu...
d363bac763781bb2da18debfa0fdd4be28288b92
valid
PostgresStore.insert
Creates an insert statement with only chosen fields Args: table: a string indicating the name of the table values: a dict of fields and values to be inserted Returns: A 'Record' object with table columns as properties
cauldron/sql.py
def insert(cls, cur, table: str, values: dict): """ Creates an insert statement with only chosen fields Args: table: a string indicating the name of the table values: a dict of fields and values to be inserted Returns: A 'Record' object with table co...
def insert(cls, cur, table: str, values: dict): """ Creates an insert statement with only chosen fields Args: table: a string indicating the name of the table values: a dict of fields and values to be inserted Returns: A 'Record' object with table co...
[ "Creates", "an", "insert", "statement", "with", "only", "chosen", "fields" ]
nerandell/cauldron
python
https://github.com/nerandell/cauldron/blob/d363bac763781bb2da18debfa0fdd4be28288b92/cauldron/sql.py#L226-L242
[ "def", "insert", "(", "cls", ",", "cur", ",", "table", ":", "str", ",", "values", ":", "dict", ")", ":", "keys", "=", "cls", ".", "_COMMA", ".", "join", "(", "values", ".", "keys", "(", ")", ")", "value_place_holder", "=", "cls", ".", "_PLACEHOLDER...
d363bac763781bb2da18debfa0fdd4be28288b92
valid
PostgresStore.update
Creates an update query with only chosen fields Supports only a single field where clause Args: table: a string indicating the name of the table values: a dict of fields and values to be inserted where_keys: list of dictionary example of where keys: [{'na...
cauldron/sql.py
def update(cls, cur, table: str, values: dict, where_keys: list) -> tuple: """ Creates an update query with only chosen fields Supports only a single field where clause Args: table: a string indicating the name of the table values: a dict of fields and values to ...
def update(cls, cur, table: str, values: dict, where_keys: list) -> tuple: """ Creates an update query with only chosen fields Supports only a single field where clause Args: table: a string indicating the name of the table values: a dict of fields and values to ...
[ "Creates", "an", "update", "query", "with", "only", "chosen", "fields", "Supports", "only", "a", "single", "field", "where", "clause" ]
nerandell/cauldron
python
https://github.com/nerandell/cauldron/blob/d363bac763781bb2da18debfa0fdd4be28288b92/cauldron/sql.py#L247-L269
[ "def", "update", "(", "cls", ",", "cur", ",", "table", ":", "str", ",", "values", ":", "dict", ",", "where_keys", ":", "list", ")", "->", "tuple", ":", "keys", "=", "cls", ".", "_COMMA", ".", "join", "(", "values", ".", "keys", "(", ")", ")", "...
d363bac763781bb2da18debfa0fdd4be28288b92
valid
PostgresStore.delete
Creates a delete query with where keys Supports multiple where clause with and or or both Args: table: a string indicating the name of the table where_keys: list of dictionary example of where keys: [{'name':('>', 'cip'),'url':('=', 'cip.com'},{'type':{'<=', 'manufac...
cauldron/sql.py
def delete(cls, cur, table: str, where_keys: list): """ Creates a delete query with where keys Supports multiple where clause with and or or both Args: table: a string indicating the name of the table where_keys: list of dictionary example of where ke...
def delete(cls, cur, table: str, where_keys: list): """ Creates a delete query with where keys Supports multiple where clause with and or or both Args: table: a string indicating the name of the table where_keys: list of dictionary example of where ke...
[ "Creates", "a", "delete", "query", "with", "where", "keys", "Supports", "multiple", "where", "clause", "with", "and", "or", "or", "both" ]
nerandell/cauldron
python
https://github.com/nerandell/cauldron/blob/d363bac763781bb2da18debfa0fdd4be28288b92/cauldron/sql.py#L285-L304
[ "def", "delete", "(", "cls", ",", "cur", ",", "table", ":", "str", ",", "where_keys", ":", "list", ")", ":", "where_clause", ",", "values", "=", "cls", ".", "_get_where_clause_with_values", "(", "where_keys", ")", "query", "=", "cls", ".", "_delete_query",...
d363bac763781bb2da18debfa0fdd4be28288b92
valid
PostgresStore.select
Creates a select query for selective columns with where keys Supports multiple where claus with and or or both Args: table: a string indicating the name of the table order_by: a string indicating column name to order the results on columns: list of columns to select ...
cauldron/sql.py
def select(cls, cur, table: str, order_by: str, columns: list=None, where_keys: list=None, limit=100, offset=0): """ Creates a select query for selective columns with where keys Supports multiple where claus with and or or both Args: table: a string indicating...
def select(cls, cur, table: str, order_by: str, columns: list=None, where_keys: list=None, limit=100, offset=0): """ Creates a select query for selective columns with where keys Supports multiple where claus with and or or both Args: table: a string indicating...
[ "Creates", "a", "select", "query", "for", "selective", "columns", "with", "where", "keys", "Supports", "multiple", "where", "claus", "with", "and", "or", "or", "both" ]
nerandell/cauldron
python
https://github.com/nerandell/cauldron/blob/d363bac763781bb2da18debfa0fdd4be28288b92/cauldron/sql.py#L309-L351
[ "def", "select", "(", "cls", ",", "cur", ",", "table", ":", "str", ",", "order_by", ":", "str", ",", "columns", ":", "list", "=", "None", ",", "where_keys", ":", "list", "=", "None", ",", "limit", "=", "100", ",", "offset", "=", "0", ")", ":", ...
d363bac763781bb2da18debfa0fdd4be28288b92
valid
PostgresStore.raw_sql
Run a raw sql query Args: query : query string to execute values : tuple of values to be used with the query Returns: result of query as list of named tuple
cauldron/sql.py
def raw_sql(cls, cur, query: str, values: tuple): """ Run a raw sql query Args: query : query string to execute values : tuple of values to be used with the query Returns: result of query as list of named tuple """ yield from cur.exe...
def raw_sql(cls, cur, query: str, values: tuple): """ Run a raw sql query Args: query : query string to execute values : tuple of values to be used with the query Returns: result of query as list of named tuple """ yield from cur.exe...
[ "Run", "a", "raw", "sql", "query" ]
nerandell/cauldron
python
https://github.com/nerandell/cauldron/blob/d363bac763781bb2da18debfa0fdd4be28288b92/cauldron/sql.py#L356-L369
[ "def", "raw_sql", "(", "cls", ",", "cur", ",", "query", ":", "str", ",", "values", ":", "tuple", ")", ":", "yield", "from", "cur", ".", "execute", "(", "query", ",", "values", ")", "return", "(", "yield", "from", "cur", ".", "fetchall", "(", ")", ...
d363bac763781bb2da18debfa0fdd4be28288b92
valid
serialize_text
This method is used to append content of the `text` argument to the `out` argument. Depending on how many lines in the text, a padding can be added to all lines except the first one. Concatenation result is appended to the `out` argument.
src/magic_repr/__init__.py
def serialize_text(out, text): """This method is used to append content of the `text` argument to the `out` argument. Depending on how many lines in the text, a padding can be added to all lines except the first one. Concatenation result is appended to the `out` argument. """ padding =...
def serialize_text(out, text): """This method is used to append content of the `text` argument to the `out` argument. Depending on how many lines in the text, a padding can be added to all lines except the first one. Concatenation result is appended to the `out` argument. """ padding =...
[ "This", "method", "is", "used", "to", "append", "content", "of", "the", "text", "argument", "to", "the", "out", "argument", "." ]
svetlyak40wt/python-repr
python
https://github.com/svetlyak40wt/python-repr/blob/49e358e77b97d74f29f4977ea009ab2d64c254e8/src/magic_repr/__init__.py#L62-L78
[ "def", "serialize_text", "(", "out", ",", "text", ")", ":", "padding", "=", "len", "(", "out", ")", "# we need to add padding to all lines", "# except the first one", "add_padding", "=", "padding_adder", "(", "padding", ")", "text", "=", "add_padding", "(", "text"...
49e358e77b97d74f29f4977ea009ab2d64c254e8
valid
serialize_list
This method is used to serialize list of text pieces like ["some=u'Another'", "blah=124"] Depending on how many lines are in these items, they are concatenated in row or as a column. Concatenation result is appended to the `out` argument.
src/magic_repr/__init__.py
def serialize_list(out, lst, delimiter=u'', max_length=20): """This method is used to serialize list of text pieces like ["some=u'Another'", "blah=124"] Depending on how many lines are in these items, they are concatenated in row or as a column. Concatenation result is appended to the `out` argum...
def serialize_list(out, lst, delimiter=u'', max_length=20): """This method is used to serialize list of text pieces like ["some=u'Another'", "blah=124"] Depending on how many lines are in these items, they are concatenated in row or as a column. Concatenation result is appended to the `out` argum...
[ "This", "method", "is", "used", "to", "serialize", "list", "of", "text", "pieces", "like", "[", "some", "=", "u", "Another", "blah", "=", "124", "]" ]
svetlyak40wt/python-repr
python
https://github.com/svetlyak40wt/python-repr/blob/49e358e77b97d74f29f4977ea009ab2d64c254e8/src/magic_repr/__init__.py#L81-L113
[ "def", "serialize_list", "(", "out", ",", "lst", ",", "delimiter", "=", "u''", ",", "max_length", "=", "20", ")", ":", "have_multiline_items", "=", "any", "(", "map", "(", "is_multiline", ",", "lst", ")", ")", "result_will_be_too_long", "=", "sum", "(", ...
49e358e77b97d74f29f4977ea009ab2d64c254e8
valid
format_value
This function should return unicode representation of the value
src/magic_repr/__init__.py
def format_value(value): """This function should return unicode representation of the value """ value_id = id(value) if value_id in recursion_breaker.processed: return u'<recursion>' recursion_breaker.processed.add(value_id) try: if isinstance(value, six.binary_type): ...
def format_value(value): """This function should return unicode representation of the value """ value_id = id(value) if value_id in recursion_breaker.processed: return u'<recursion>' recursion_breaker.processed.add(value_id) try: if isinstance(value, six.binary_type): ...
[ "This", "function", "should", "return", "unicode", "representation", "of", "the", "value" ]
svetlyak40wt/python-repr
python
https://github.com/svetlyak40wt/python-repr/blob/49e358e77b97d74f29f4977ea009ab2d64c254e8/src/magic_repr/__init__.py#L125-L177
[ "def", "format_value", "(", "value", ")", ":", "value_id", "=", "id", "(", "value", ")", "if", "value_id", "in", "recursion_breaker", ".", "processed", ":", "return", "u'<recursion>'", "recursion_breaker", ".", "processed", ".", "add", "(", "value_id", ")", ...
49e358e77b97d74f29f4977ea009ab2d64c254e8
valid
make_repr
Returns __repr__ method which returns ASCII representaion of the object with given fields. Without arguments, ``make_repr`` generates a method which outputs all object's non-protected (non-undercored) arguments which are not callables. Accepts ``*args``, which should be a names of object's att...
src/magic_repr/__init__.py
def make_repr(*args, **kwargs): """Returns __repr__ method which returns ASCII representaion of the object with given fields. Without arguments, ``make_repr`` generates a method which outputs all object's non-protected (non-undercored) arguments which are not callables. Accepts ``*args``, whic...
def make_repr(*args, **kwargs): """Returns __repr__ method which returns ASCII representaion of the object with given fields. Without arguments, ``make_repr`` generates a method which outputs all object's non-protected (non-undercored) arguments which are not callables. Accepts ``*args``, whic...
[ "Returns", "__repr__", "method", "which", "returns", "ASCII", "representaion", "of", "the", "object", "with", "given", "fields", "." ]
svetlyak40wt/python-repr
python
https://github.com/svetlyak40wt/python-repr/blob/49e358e77b97d74f29f4977ea009ab2d64c254e8/src/magic_repr/__init__.py#L180-L255
[ "def", "make_repr", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "def", "method", "(", "self", ")", ":", "cls_name", "=", "self", ".", "__class__", ".", "__name__", "if", "args", ":", "field_names", "=", "args", "else", ":", "def", "undercore...
49e358e77b97d74f29f4977ea009ab2d64c254e8
valid
RedisCache.connect
Setup a connection pool :param host: Redis host :param port: Redis port :param loop: Event loop
cauldron/redis_cache.py
def connect(self, host, port, minsize=5, maxsize=10, loop=asyncio.get_event_loop()): """ Setup a connection pool :param host: Redis host :param port: Redis port :param loop: Event loop """ self._pool = yield from aioredis.create_pool((host, port), minsize=minsize,...
def connect(self, host, port, minsize=5, maxsize=10, loop=asyncio.get_event_loop()): """ Setup a connection pool :param host: Redis host :param port: Redis port :param loop: Event loop """ self._pool = yield from aioredis.create_pool((host, port), minsize=minsize,...
[ "Setup", "a", "connection", "pool", ":", "param", "host", ":", "Redis", "host", ":", "param", "port", ":", "Redis", "port", ":", "param", "loop", ":", "Event", "loop" ]
nerandell/cauldron
python
https://github.com/nerandell/cauldron/blob/d363bac763781bb2da18debfa0fdd4be28288b92/cauldron/redis_cache.py#L9-L16
[ "def", "connect", "(", "self", ",", "host", ",", "port", ",", "minsize", "=", "5", ",", "maxsize", "=", "10", ",", "loop", "=", "asyncio", ".", "get_event_loop", "(", ")", ")", ":", "self", ".", "_pool", "=", "yield", "from", "aioredis", ".", "crea...
d363bac763781bb2da18debfa0fdd4be28288b92
valid
RedisCache.set_key
Set a key in a cache. :param key: Key name :param value: Value :param namespace : Namespace to associate the key with :param expire: expiration :return:
cauldron/redis_cache.py
def set_key(self, key, value, namespace=None, expire=0): """ Set a key in a cache. :param key: Key name :param value: Value :param namespace : Namespace to associate the key with :param expire: expiration :return: """ with (yield from self._pool) a...
def set_key(self, key, value, namespace=None, expire=0): """ Set a key in a cache. :param key: Key name :param value: Value :param namespace : Namespace to associate the key with :param expire: expiration :return: """ with (yield from self._pool) a...
[ "Set", "a", "key", "in", "a", "cache", ".", ":", "param", "key", ":", "Key", "name", ":", "param", "value", ":", "Value", ":", "param", "namespace", ":", "Namespace", "to", "associate", "the", "key", "with", ":", "param", "expire", ":", "expiration", ...
nerandell/cauldron
python
https://github.com/nerandell/cauldron/blob/d363bac763781bb2da18debfa0fdd4be28288b92/cauldron/redis_cache.py#L18-L30
[ "def", "set_key", "(", "self", ",", "key", ",", "value", ",", "namespace", "=", "None", ",", "expire", "=", "0", ")", ":", "with", "(", "yield", "from", "self", ".", "_pool", ")", "as", "redis", ":", "if", "namespace", "is", "not", "None", ":", "...
d363bac763781bb2da18debfa0fdd4be28288b92
valid
traverse
Helper function to traverse an element tree rooted at element, yielding nodes matching the query.
drill.py
def traverse(element, query, deep=False): """ Helper function to traverse an element tree rooted at element, yielding nodes matching the query. """ # Grab the next part of the query (it will be chopped from the front each iteration). part = query[0] if not part: # If the part is blank, w...
def traverse(element, query, deep=False): """ Helper function to traverse an element tree rooted at element, yielding nodes matching the query. """ # Grab the next part of the query (it will be chopped from the front each iteration). part = query[0] if not part: # If the part is blank, w...
[ "Helper", "function", "to", "traverse", "an", "element", "tree", "rooted", "at", "element", "yielding", "nodes", "matching", "the", "query", "." ]
dcwatson/drill
python
https://github.com/dcwatson/drill/blob/b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b/drill.py#L88-L115
[ "def", "traverse", "(", "element", ",", "query", ",", "deep", "=", "False", ")", ":", "# Grab the next part of the query (it will be chopped from the front each iteration).", "part", "=", "query", "[", "0", "]", "if", "not", "part", ":", "# If the part is blank, we enco...
b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b
valid
parse_query
Given a simplified XPath query string, returns an array of normalized query parts.
drill.py
def parse_query(query): """ Given a simplified XPath query string, returns an array of normalized query parts. """ parts = query.split('/') norm = [] for p in parts: p = p.strip() if p: norm.append(p) elif '' not in norm: norm.append('') return...
def parse_query(query): """ Given a simplified XPath query string, returns an array of normalized query parts. """ parts = query.split('/') norm = [] for p in parts: p = p.strip() if p: norm.append(p) elif '' not in norm: norm.append('') return...
[ "Given", "a", "simplified", "XPath", "query", "string", "returns", "an", "array", "of", "normalized", "query", "parts", "." ]
dcwatson/drill
python
https://github.com/dcwatson/drill/blob/b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b/drill.py#L118-L130
[ "def", "parse_query", "(", "query", ")", ":", "parts", "=", "query", ".", "split", "(", "'/'", ")", "norm", "=", "[", "]", "for", "p", "in", "parts", ":", "p", "=", "p", ".", "strip", "(", ")", "if", "p", ":", "norm", ".", "append", "(", "p",...
b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b
valid
parse
:param url_or_path: A file-like object, a filesystem path, a URL, or a string containing XML :rtype: :class:`XmlElement`
drill.py
def parse(url_or_path, encoding=None, handler_class=DrillHandler): """ :param url_or_path: A file-like object, a filesystem path, a URL, or a string containing XML :rtype: :class:`XmlElement` """ handler = handler_class() parser = expat.ParserCreate(encoding) parser.buffer_text = 1 parse...
def parse(url_or_path, encoding=None, handler_class=DrillHandler): """ :param url_or_path: A file-like object, a filesystem path, a URL, or a string containing XML :rtype: :class:`XmlElement` """ handler = handler_class() parser = expat.ParserCreate(encoding) parser.buffer_text = 1 parse...
[ ":", "param", "url_or_path", ":", "A", "file", "-", "like", "object", "a", "filesystem", "path", "a", "URL", "or", "a", "string", "containing", "XML", ":", "rtype", ":", ":", "class", ":", "XmlElement" ]
dcwatson/drill
python
https://github.com/dcwatson/drill/blob/b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b/drill.py#L548-L576
[ "def", "parse", "(", "url_or_path", ",", "encoding", "=", "None", ",", "handler_class", "=", "DrillHandler", ")", ":", "handler", "=", "handler_class", "(", ")", "parser", "=", "expat", ".", "ParserCreate", "(", "encoding", ")", "parser", ".", "buffer_text",...
b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b
valid
iterparse
:param filelike: A file-like object with a ``read`` method :returns: An iterator yielding :class:`XmlElement` objects
drill.py
def iterparse(filelike, encoding=None, handler_class=DrillHandler, xpath=None): """ :param filelike: A file-like object with a ``read`` method :returns: An iterator yielding :class:`XmlElement` objects """ parser = expat.ParserCreate(encoding) elem_iter = DrillElementIterator(filelike, parser) ...
def iterparse(filelike, encoding=None, handler_class=DrillHandler, xpath=None): """ :param filelike: A file-like object with a ``read`` method :returns: An iterator yielding :class:`XmlElement` objects """ parser = expat.ParserCreate(encoding) elem_iter = DrillElementIterator(filelike, parser) ...
[ ":", "param", "filelike", ":", "A", "file", "-", "like", "object", "with", "a", "read", "method", ":", "returns", ":", "An", "iterator", "yielding", ":", "class", ":", "XmlElement", "objects" ]
dcwatson/drill
python
https://github.com/dcwatson/drill/blob/b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b/drill.py#L605-L617
[ "def", "iterparse", "(", "filelike", ",", "encoding", "=", "None", ",", "handler_class", "=", "DrillHandler", ",", "xpath", "=", "None", ")", ":", "parser", "=", "expat", ".", "ParserCreate", "(", "encoding", ")", "elem_iter", "=", "DrillElementIterator", "(...
b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b
valid
XmlElement.write
Writes an XML representation of this node (including descendants) to the specified file-like object. :param writer: An :class:`XmlWriter` instance to write this node to
drill.py
def write(self, writer): """ Writes an XML representation of this node (including descendants) to the specified file-like object. :param writer: An :class:`XmlWriter` instance to write this node to """ multiline = bool(self._children) newline_start = multiline and not bo...
def write(self, writer): """ Writes an XML representation of this node (including descendants) to the specified file-like object. :param writer: An :class:`XmlWriter` instance to write this node to """ multiline = bool(self._children) newline_start = multiline and not bo...
[ "Writes", "an", "XML", "representation", "of", "this", "node", "(", "including", "descendants", ")", "to", "the", "specified", "file", "-", "like", "object", "." ]
dcwatson/drill
python
https://github.com/dcwatson/drill/blob/b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b/drill.py#L223-L236
[ "def", "write", "(", "self", ",", "writer", ")", ":", "multiline", "=", "bool", "(", "self", ".", "_children", ")", "newline_start", "=", "multiline", "and", "not", "bool", "(", "self", ".", "data", ")", "writer", ".", "start", "(", "self", ".", "tag...
b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b
valid
XmlElement.xml
Returns an XML representation of this node (including descendants). This method automatically creates an :class:`XmlWriter` instance internally to handle the writing. :param **kwargs: Any named arguments are passed along to the :class:`XmlWriter` constructor
drill.py
def xml(self, **kwargs): """ Returns an XML representation of this node (including descendants). This method automatically creates an :class:`XmlWriter` instance internally to handle the writing. :param **kwargs: Any named arguments are passed along to the :class:`XmlWriter` constructor...
def xml(self, **kwargs): """ Returns an XML representation of this node (including descendants). This method automatically creates an :class:`XmlWriter` instance internally to handle the writing. :param **kwargs: Any named arguments are passed along to the :class:`XmlWriter` constructor...
[ "Returns", "an", "XML", "representation", "of", "this", "node", "(", "including", "descendants", ")", ".", "This", "method", "automatically", "creates", "an", ":", "class", ":", "XmlWriter", "instance", "internally", "to", "handle", "the", "writing", "." ]
dcwatson/drill
python
https://github.com/dcwatson/drill/blob/b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b/drill.py#L238-L248
[ "def", "xml", "(", "self", ",", "*", "*", "kwargs", ")", ":", "s", "=", "bytes_io", "(", ")", "writer", "=", "XmlWriter", "(", "s", ",", "*", "*", "kwargs", ")", "self", ".", "write", "(", "writer", ")", "return", "s", ".", "getvalue", "(", ")"...
b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b
valid
XmlElement.append
Called when the parser detects a start tag (child element) while in this node. Internally creates an :class:`XmlElement` and adds it to the end of this node's children. :param name: The tag name to add :param attrs: Attributes for the new tag :param data: CDATA for the new tag :...
drill.py
def append(self, name, attrs=None, data=None): """ Called when the parser detects a start tag (child element) while in this node. Internally creates an :class:`XmlElement` and adds it to the end of this node's children. :param name: The tag name to add :param attrs: Attributes f...
def append(self, name, attrs=None, data=None): """ Called when the parser detects a start tag (child element) while in this node. Internally creates an :class:`XmlElement` and adds it to the end of this node's children. :param name: The tag name to add :param attrs: Attributes f...
[ "Called", "when", "the", "parser", "detects", "a", "start", "tag", "(", "child", "element", ")", "while", "in", "this", "node", ".", "Internally", "creates", "an", ":", "class", ":", "XmlElement", "and", "adds", "it", "to", "the", "end", "of", "this", ...
dcwatson/drill
python
https://github.com/dcwatson/drill/blob/b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b/drill.py#L259-L272
[ "def", "append", "(", "self", ",", "name", ",", "attrs", "=", "None", ",", "data", "=", "None", ")", ":", "elem", "=", "self", ".", "__class__", "(", "name", ",", "attrs", ",", "data", ",", "parent", "=", "self", ",", "index", "=", "len", "(", ...
b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b
valid
XmlElement.insert
Inserts a new element as a child of this element, before the specified index or sibling. :param before: An :class:`XmlElement` or a numeric index to insert the new node before :param name: The tag name to add :param attrs: Attributes for the new tag :param data: CDATA for the new tag ...
drill.py
def insert(self, before, name, attrs=None, data=None): """ Inserts a new element as a child of this element, before the specified index or sibling. :param before: An :class:`XmlElement` or a numeric index to insert the new node before :param name: The tag name to add :param attr...
def insert(self, before, name, attrs=None, data=None): """ Inserts a new element as a child of this element, before the specified index or sibling. :param before: An :class:`XmlElement` or a numeric index to insert the new node before :param name: The tag name to add :param attr...
[ "Inserts", "a", "new", "element", "as", "a", "child", "of", "this", "element", "before", "the", "specified", "index", "or", "sibling", "." ]
dcwatson/drill
python
https://github.com/dcwatson/drill/blob/b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b/drill.py#L274-L296
[ "def", "insert", "(", "self", ",", "before", ",", "name", ",", "attrs", "=", "None", ",", "data", "=", "None", ")", ":", "if", "isinstance", "(", "before", ",", "self", ".", "__class__", ")", ":", "if", "before", ".", "parent", "!=", "self", ":", ...
b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b
valid
XmlElement.items
A generator yielding ``(key, value)`` attribute pairs, sorted by key name.
drill.py
def items(self): """ A generator yielding ``(key, value)`` attribute pairs, sorted by key name. """ for key in sorted(self.attrs): yield key, self.attrs[key]
def items(self): """ A generator yielding ``(key, value)`` attribute pairs, sorted by key name. """ for key in sorted(self.attrs): yield key, self.attrs[key]
[ "A", "generator", "yielding", "(", "key", "value", ")", "attribute", "pairs", "sorted", "by", "key", "name", "." ]
dcwatson/drill
python
https://github.com/dcwatson/drill/blob/b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b/drill.py#L307-L312
[ "def", "items", "(", "self", ")", ":", "for", "key", "in", "sorted", "(", "self", ".", "attrs", ")", ":", "yield", "key", ",", "self", ".", "attrs", "[", "key", "]" ]
b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b
valid
XmlElement.children
A generator yielding children of this node. :param name: If specified, only consider elements with this tag name :param reverse: If ``True``, children will be yielded in reverse declaration order
drill.py
def children(self, name=None, reverse=False): """ A generator yielding children of this node. :param name: If specified, only consider elements with this tag name :param reverse: If ``True``, children will be yielded in reverse declaration order """ elems = self._childre...
def children(self, name=None, reverse=False): """ A generator yielding children of this node. :param name: If specified, only consider elements with this tag name :param reverse: If ``True``, children will be yielded in reverse declaration order """ elems = self._childre...
[ "A", "generator", "yielding", "children", "of", "this", "node", "." ]
dcwatson/drill
python
https://github.com/dcwatson/drill/blob/b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b/drill.py#L314-L326
[ "def", "children", "(", "self", ",", "name", "=", "None", ",", "reverse", "=", "False", ")", ":", "elems", "=", "self", ".", "_children", "if", "reverse", ":", "elems", "=", "reversed", "(", "elems", ")", "for", "elem", "in", "elems", ":", "if", "n...
b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b
valid
XmlElement._match
Helper function to determine if this node matches the given predicate.
drill.py
def _match(self, pred): """ Helper function to determine if this node matches the given predicate. """ if not pred: return True # Strip off the [ and ] pred = pred[1:-1] if pred.startswith('@'): # An attribute predicate checks the existence...
def _match(self, pred): """ Helper function to determine if this node matches the given predicate. """ if not pred: return True # Strip off the [ and ] pred = pred[1:-1] if pred.startswith('@'): # An attribute predicate checks the existence...
[ "Helper", "function", "to", "determine", "if", "this", "node", "matches", "the", "given", "predicate", "." ]
dcwatson/drill
python
https://github.com/dcwatson/drill/blob/b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b/drill.py#L328-L375
[ "def", "_match", "(", "self", ",", "pred", ")", ":", "if", "not", "pred", ":", "return", "True", "# Strip off the [ and ]", "pred", "=", "pred", "[", "1", ":", "-", "1", "]", "if", "pred", ".", "startswith", "(", "'@'", ")", ":", "# An attribute predic...
b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b
valid
XmlElement.path
Returns a canonical path to this element, relative to the root node. :param include_root: If ``True``, include the root node in the path. Defaults to ``False``.
drill.py
def path(self, include_root=False): """ Returns a canonical path to this element, relative to the root node. :param include_root: If ``True``, include the root node in the path. Defaults to ``False``. """ path = '%s[%d]' % (self.tagname, self.index or 0) p = self.parent ...
def path(self, include_root=False): """ Returns a canonical path to this element, relative to the root node. :param include_root: If ``True``, include the root node in the path. Defaults to ``False``. """ path = '%s[%d]' % (self.tagname, self.index or 0) p = self.parent ...
[ "Returns", "a", "canonical", "path", "to", "this", "element", "relative", "to", "the", "root", "node", "." ]
dcwatson/drill
python
https://github.com/dcwatson/drill/blob/b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b/drill.py#L377-L389
[ "def", "path", "(", "self", ",", "include_root", "=", "False", ")", ":", "path", "=", "'%s[%d]'", "%", "(", "self", ".", "tagname", ",", "self", ".", "index", "or", "0", ")", "p", "=", "self", ".", "parent", "while", "p", "is", "not", "None", ":"...
b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b
valid
XmlElement.iter
Recursively find any descendants of this node with the given tag name. If a tag name is omitted, this will yield every descendant node. :param name: If specified, only consider elements with this tag name :returns: A generator yielding descendants of this node
drill.py
def iter(self, name=None): """ Recursively find any descendants of this node with the given tag name. If a tag name is omitted, this will yield every descendant node. :param name: If specified, only consider elements with this tag name :returns: A generator yielding descendants ...
def iter(self, name=None): """ Recursively find any descendants of this node with the given tag name. If a tag name is omitted, this will yield every descendant node. :param name: If specified, only consider elements with this tag name :returns: A generator yielding descendants ...
[ "Recursively", "find", "any", "descendants", "of", "this", "node", "with", "the", "given", "tag", "name", ".", "If", "a", "tag", "name", "is", "omitted", "this", "will", "yield", "every", "descendant", "node", "." ]
dcwatson/drill
python
https://github.com/dcwatson/drill/blob/b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b/drill.py#L401-L413
[ "def", "iter", "(", "self", ",", "name", "=", "None", ")", ":", "for", "c", "in", "self", ".", "_children", ":", "if", "name", "is", "None", "or", "c", ".", "tagname", "==", "name", ":", "yield", "c", "for", "gc", "in", "c", ".", "find", "(", ...
b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b
valid
XmlElement.last
Returns the last child of this node. :param name: If specified, only consider elements with this tag name :rtype: :class:`XmlElement`
drill.py
def last(self, name=None): """ Returns the last child of this node. :param name: If specified, only consider elements with this tag name :rtype: :class:`XmlElement` """ for c in self.children(name, reverse=True): return c
def last(self, name=None): """ Returns the last child of this node. :param name: If specified, only consider elements with this tag name :rtype: :class:`XmlElement` """ for c in self.children(name, reverse=True): return c
[ "Returns", "the", "last", "child", "of", "this", "node", "." ]
dcwatson/drill
python
https://github.com/dcwatson/drill/blob/b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b/drill.py#L425-L433
[ "def", "last", "(", "self", ",", "name", "=", "None", ")", ":", "for", "c", "in", "self", ".", "children", "(", "name", ",", "reverse", "=", "True", ")", ":", "return", "c" ]
b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b
valid
XmlElement.parents
Yields all parents of this element, back to the root element. :param name: If specified, only consider elements with this tag name
drill.py
def parents(self, name=None): """ Yields all parents of this element, back to the root element. :param name: If specified, only consider elements with this tag name """ p = self.parent while p is not None: if name is None or p.tagname == name: ...
def parents(self, name=None): """ Yields all parents of this element, back to the root element. :param name: If specified, only consider elements with this tag name """ p = self.parent while p is not None: if name is None or p.tagname == name: ...
[ "Yields", "all", "parents", "of", "this", "element", "back", "to", "the", "root", "element", "." ]
dcwatson/drill
python
https://github.com/dcwatson/drill/blob/b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b/drill.py#L435-L445
[ "def", "parents", "(", "self", ",", "name", "=", "None", ")", ":", "p", "=", "self", ".", "parent", "while", "p", "is", "not", "None", ":", "if", "name", "is", "None", "or", "p", ".", "tagname", "==", "name", ":", "yield", "p", "p", "=", "p", ...
b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b
valid
XmlElement.siblings
Yields all siblings of this node (not including the node itself). :param name: If specified, only consider elements with this tag name
drill.py
def siblings(self, name=None): """ Yields all siblings of this node (not including the node itself). :param name: If specified, only consider elements with this tag name """ if self.parent and self.index: for c in self.parent._children: if c.index != ...
def siblings(self, name=None): """ Yields all siblings of this node (not including the node itself). :param name: If specified, only consider elements with this tag name """ if self.parent and self.index: for c in self.parent._children: if c.index != ...
[ "Yields", "all", "siblings", "of", "this", "node", "(", "not", "including", "the", "node", "itself", ")", "." ]
dcwatson/drill
python
https://github.com/dcwatson/drill/blob/b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b/drill.py#L447-L456
[ "def", "siblings", "(", "self", ",", "name", "=", "None", ")", ":", "if", "self", ".", "parent", "and", "self", ".", "index", ":", "for", "c", "in", "self", ".", "parent", ".", "_children", ":", "if", "c", ".", "index", "!=", "self", ".", "index"...
b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b
valid
XmlElement.next
Returns the next sibling of this node. :param name: If specified, only consider elements with this tag name :rtype: :class:`XmlElement`
drill.py
def next(self, name=None): """ Returns the next sibling of this node. :param name: If specified, only consider elements with this tag name :rtype: :class:`XmlElement` """ if self.parent is None or self.index is None: return None for idx in xrange(self...
def next(self, name=None): """ Returns the next sibling of this node. :param name: If specified, only consider elements with this tag name :rtype: :class:`XmlElement` """ if self.parent is None or self.index is None: return None for idx in xrange(self...
[ "Returns", "the", "next", "sibling", "of", "this", "node", "." ]
dcwatson/drill
python
https://github.com/dcwatson/drill/blob/b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b/drill.py#L458-L469
[ "def", "next", "(", "self", ",", "name", "=", "None", ")", ":", "if", "self", ".", "parent", "is", "None", "or", "self", ".", "index", "is", "None", ":", "return", "None", "for", "idx", "in", "xrange", "(", "self", ".", "index", "+", "1", ",", ...
b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b
valid
XmlElement.prev
Returns the previous sibling of this node. :param name: If specified, only consider elements with this tag name :rtype: :class:`XmlElement`
drill.py
def prev(self, name=None): """ Returns the previous sibling of this node. :param name: If specified, only consider elements with this tag name :rtype: :class:`XmlElement` """ if self.parent is None or self.index is None: return None for idx in xrange(...
def prev(self, name=None): """ Returns the previous sibling of this node. :param name: If specified, only consider elements with this tag name :rtype: :class:`XmlElement` """ if self.parent is None or self.index is None: return None for idx in xrange(...
[ "Returns", "the", "previous", "sibling", "of", "this", "node", "." ]
dcwatson/drill
python
https://github.com/dcwatson/drill/blob/b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b/drill.py#L471-L482
[ "def", "prev", "(", "self", ",", "name", "=", "None", ")", ":", "if", "self", ".", "parent", "is", "None", "or", "self", ".", "index", "is", "None", ":", "return", "None", "for", "idx", "in", "xrange", "(", "self", ".", "index", "-", "1", ",", ...
b8a30ec0fd5b5bf55154bd44c1c75f5f5945691b
valid
WebObsResultsParser.get_observations
Parses the HTML table into a list of dictionaries, each of which represents a single observation.
pyaavso/parsers/webobs.py
def get_observations(self): """ Parses the HTML table into a list of dictionaries, each of which represents a single observation. """ if self.empty: return [] rows = list(self.tbody) observations = [] for row_observation, row_details in zip(row...
def get_observations(self): """ Parses the HTML table into a list of dictionaries, each of which represents a single observation. """ if self.empty: return [] rows = list(self.tbody) observations = [] for row_observation, row_details in zip(row...
[ "Parses", "the", "HTML", "table", "into", "a", "list", "of", "dictionaries", "each", "of", "which", "represents", "a", "single", "observation", "." ]
zsiciarz/pyaavso
python
https://github.com/zsiciarz/pyaavso/blob/d3b9eb17bcecc6652841606802b5713fd6083cc1/pyaavso/parsers/webobs.py#L34-L56
[ "def", "get_observations", "(", "self", ")", ":", "if", "self", ".", "empty", ":", "return", "[", "]", "rows", "=", "list", "(", "self", ".", "tbody", ")", "observations", "=", "[", "]", "for", "row_observation", ",", "row_details", "in", "zip", "(", ...
d3b9eb17bcecc6652841606802b5713fd6083cc1
valid
get_cache_key
Calculates cache key based on `args` and `kwargs`. `args` and `kwargs` must be instances of hashable types.
skd_tools/decorators.py
def get_cache_key(prefix, *args, **kwargs): """ Calculates cache key based on `args` and `kwargs`. `args` and `kwargs` must be instances of hashable types. """ hash_args_kwargs = hash(tuple(kwargs.iteritems()) + args) return '{}_{}'.format(prefix, hash_args_kwargs)
def get_cache_key(prefix, *args, **kwargs): """ Calculates cache key based on `args` and `kwargs`. `args` and `kwargs` must be instances of hashable types. """ hash_args_kwargs = hash(tuple(kwargs.iteritems()) + args) return '{}_{}'.format(prefix, hash_args_kwargs)
[ "Calculates", "cache", "key", "based", "on", "args", "and", "kwargs", ".", "args", "and", "kwargs", "must", "be", "instances", "of", "hashable", "types", "." ]
steelkiwi/django-skd-tools
python
https://github.com/steelkiwi/django-skd-tools/blob/422dc3e49f12739a500302e4c494379684e9dc50/skd_tools/decorators.py#L8-L14
[ "def", "get_cache_key", "(", "prefix", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "hash_args_kwargs", "=", "hash", "(", "tuple", "(", "kwargs", ".", "iteritems", "(", ")", ")", "+", "args", ")", "return", "'{}_{}'", ".", "format", "(", "pre...
422dc3e49f12739a500302e4c494379684e9dc50
valid
cache_method
Cache result of function execution into the `self` object (mostly useful in models). Calculate cache key based on `args` and `kwargs` of the function (except `self`).
skd_tools/decorators.py
def cache_method(func=None, prefix=''): """ Cache result of function execution into the `self` object (mostly useful in models). Calculate cache key based on `args` and `kwargs` of the function (except `self`). """ def decorator(func): @wraps(func) def wrapper(self, *args, **kwargs):...
def cache_method(func=None, prefix=''): """ Cache result of function execution into the `self` object (mostly useful in models). Calculate cache key based on `args` and `kwargs` of the function (except `self`). """ def decorator(func): @wraps(func) def wrapper(self, *args, **kwargs):...
[ "Cache", "result", "of", "function", "execution", "into", "the", "self", "object", "(", "mostly", "useful", "in", "models", ")", ".", "Calculate", "cache", "key", "based", "on", "args", "and", "kwargs", "of", "the", "function", "(", "except", "self", ")", ...
steelkiwi/django-skd-tools
python
https://github.com/steelkiwi/django-skd-tools/blob/422dc3e49f12739a500302e4c494379684e9dc50/skd_tools/decorators.py#L17-L34
[ "def", "cache_method", "(", "func", "=", "None", ",", "prefix", "=", "''", ")", ":", "def", "decorator", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "wrapper", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", ...
422dc3e49f12739a500302e4c494379684e9dc50
valid
cache_func
Cache result of function execution into the django cache backend. Calculate cache key based on `prefix`, `args` and `kwargs` of the function. For using like object method set `method=True`.
skd_tools/decorators.py
def cache_func(prefix, method=False): """ Cache result of function execution into the django cache backend. Calculate cache key based on `prefix`, `args` and `kwargs` of the function. For using like object method set `method=True`. """ def decorator(func): @wraps(func) def wrappe...
def cache_func(prefix, method=False): """ Cache result of function execution into the django cache backend. Calculate cache key based on `prefix`, `args` and `kwargs` of the function. For using like object method set `method=True`. """ def decorator(func): @wraps(func) def wrappe...
[ "Cache", "result", "of", "function", "execution", "into", "the", "django", "cache", "backend", ".", "Calculate", "cache", "key", "based", "on", "prefix", "args", "and", "kwargs", "of", "the", "function", ".", "For", "using", "like", "object", "method", "set"...
steelkiwi/django-skd-tools
python
https://github.com/steelkiwi/django-skd-tools/blob/422dc3e49f12739a500302e4c494379684e9dc50/skd_tools/decorators.py#L37-L56
[ "def", "cache_func", "(", "prefix", ",", "method", "=", "False", ")", ":", "def", "decorator", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "cache_args", "=", "args", ...
422dc3e49f12739a500302e4c494379684e9dc50
valid
get_or_default
Wrapper around Django's ORM `get` functionality. Wrap anything that raises ObjectDoesNotExist exception and provide the default value if necessary. `default` by default is None. `default` can be any callable, if it is callable it will be called when ObjectDoesNotExist exception will be raised.
skd_tools/decorators.py
def get_or_default(func=None, default=None): """ Wrapper around Django's ORM `get` functionality. Wrap anything that raises ObjectDoesNotExist exception and provide the default value if necessary. `default` by default is None. `default` can be any callable, if it is callable it will be called wh...
def get_or_default(func=None, default=None): """ Wrapper around Django's ORM `get` functionality. Wrap anything that raises ObjectDoesNotExist exception and provide the default value if necessary. `default` by default is None. `default` can be any callable, if it is callable it will be called wh...
[ "Wrapper", "around", "Django", "s", "ORM", "get", "functionality", ".", "Wrap", "anything", "that", "raises", "ObjectDoesNotExist", "exception", "and", "provide", "the", "default", "value", "if", "necessary", ".", "default", "by", "default", "is", "None", ".", ...
steelkiwi/django-skd-tools
python
https://github.com/steelkiwi/django-skd-tools/blob/422dc3e49f12739a500302e4c494379684e9dc50/skd_tools/decorators.py#L59-L82
[ "def", "get_or_default", "(", "func", "=", "None", ",", "default", "=", "None", ")", ":", "def", "decorator", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":"...
422dc3e49f12739a500302e4c494379684e9dc50
valid
_get_column_nums_from_args
Turn column inputs from user into list of simple numbers. Inputs can be: - individual number: 1 - range: 1-3 - comma separated list: 1,2,3,4-6
csvcat/main.py
def _get_column_nums_from_args(columns): """Turn column inputs from user into list of simple numbers. Inputs can be: - individual number: 1 - range: 1-3 - comma separated list: 1,2,3,4-6 """ nums = [] for c in columns: for p in c.split(','): p = p.strip() ...
def _get_column_nums_from_args(columns): """Turn column inputs from user into list of simple numbers. Inputs can be: - individual number: 1 - range: 1-3 - comma separated list: 1,2,3,4-6 """ nums = [] for c in columns: for p in c.split(','): p = p.strip() ...
[ "Turn", "column", "inputs", "from", "user", "into", "list", "of", "simple", "numbers", "." ]
dhellmann/csvcat
python
https://github.com/dhellmann/csvcat/blob/d08c0df3af2b1cec739521e6d5bb2b1ad868c591/csvcat/main.py#L12-L41
[ "def", "_get_column_nums_from_args", "(", "columns", ")", ":", "nums", "=", "[", "]", "for", "c", "in", "columns", ":", "for", "p", "in", "c", ".", "split", "(", "','", ")", ":", "p", "=", "p", ".", "strip", "(", ")", "try", ":", "c", "=", "int...
d08c0df3af2b1cec739521e6d5bb2b1ad868c591
valid
_get_printable_columns
Return only the part of the row which should be printed.
csvcat/main.py
def _get_printable_columns(columns, row): """Return only the part of the row which should be printed. """ if not columns: return row # Extract the column values, in the order specified. return tuple(row[c] for c in columns)
def _get_printable_columns(columns, row): """Return only the part of the row which should be printed. """ if not columns: return row # Extract the column values, in the order specified. return tuple(row[c] for c in columns)
[ "Return", "only", "the", "part", "of", "the", "row", "which", "should", "be", "printed", "." ]
dhellmann/csvcat
python
https://github.com/dhellmann/csvcat/blob/d08c0df3af2b1cec739521e6d5bb2b1ad868c591/csvcat/main.py#L44-L51
[ "def", "_get_printable_columns", "(", "columns", ",", "row", ")", ":", "if", "not", "columns", ":", "return", "row", "# Extract the column values, in the order specified.", "return", "tuple", "(", "row", "[", "c", "]", "for", "c", "in", "columns", ")" ]
d08c0df3af2b1cec739521e6d5bb2b1ad868c591
valid
VisualFormatWriter.writerow
Writes a single observation to the output file. If the ``observation_data`` parameter is a dictionary, it is converted to a list to keep a consisted field order (as described in format specification). Otherwise it is assumed that the data is a raw record ready to be written to file. ...
pyaavso/formats/visual.py
def writerow(self, observation_data): """ Writes a single observation to the output file. If the ``observation_data`` parameter is a dictionary, it is converted to a list to keep a consisted field order (as described in format specification). Otherwise it is assumed that the dat...
def writerow(self, observation_data): """ Writes a single observation to the output file. If the ``observation_data`` parameter is a dictionary, it is converted to a list to keep a consisted field order (as described in format specification). Otherwise it is assumed that the dat...
[ "Writes", "a", "single", "observation", "to", "the", "output", "file", "." ]
zsiciarz/pyaavso
python
https://github.com/zsiciarz/pyaavso/blob/d3b9eb17bcecc6652841606802b5713fd6083cc1/pyaavso/formats/visual.py#L65-L80
[ "def", "writerow", "(", "self", ",", "observation_data", ")", ":", "if", "isinstance", "(", "observation_data", ",", "(", "list", ",", "tuple", ")", ")", ":", "row", "=", "observation_data", "else", ":", "row", "=", "self", ".", "dict_to_row", "(", "obse...
d3b9eb17bcecc6652841606802b5713fd6083cc1
valid
VisualFormatWriter.dict_to_row
Takes a dictionary of observation data and converts it to a list of fields according to AAVSO visual format specification. :param cls: current class :param observation_data: a single observation as a dictionary
pyaavso/formats/visual.py
def dict_to_row(cls, observation_data): """ Takes a dictionary of observation data and converts it to a list of fields according to AAVSO visual format specification. :param cls: current class :param observation_data: a single observation as a dictionary """ row ...
def dict_to_row(cls, observation_data): """ Takes a dictionary of observation data and converts it to a list of fields according to AAVSO visual format specification. :param cls: current class :param observation_data: a single observation as a dictionary """ row ...
[ "Takes", "a", "dictionary", "of", "observation", "data", "and", "converts", "it", "to", "a", "list", "of", "fields", "according", "to", "AAVSO", "visual", "format", "specification", "." ]
zsiciarz/pyaavso
python
https://github.com/zsiciarz/pyaavso/blob/d3b9eb17bcecc6652841606802b5713fd6083cc1/pyaavso/formats/visual.py#L83-L115
[ "def", "dict_to_row", "(", "cls", ",", "observation_data", ")", ":", "row", "=", "[", "]", "row", ".", "append", "(", "observation_data", "[", "'name'", "]", ")", "row", ".", "append", "(", "observation_data", "[", "'date'", "]", ")", "row", ".", "appe...
d3b9eb17bcecc6652841606802b5713fd6083cc1
valid
VisualFormatReader.row_to_dict
Converts a raw input record to a dictionary of observation data. :param cls: current class :param row: a single observation as a list or tuple
pyaavso/formats/visual.py
def row_to_dict(cls, row): """ Converts a raw input record to a dictionary of observation data. :param cls: current class :param row: a single observation as a list or tuple """ comment_code = row[3] if comment_code.lower() == 'na': comment_code = '' ...
def row_to_dict(cls, row): """ Converts a raw input record to a dictionary of observation data. :param cls: current class :param row: a single observation as a list or tuple """ comment_code = row[3] if comment_code.lower() == 'na': comment_code = '' ...
[ "Converts", "a", "raw", "input", "record", "to", "a", "dictionary", "of", "observation", "data", "." ]
zsiciarz/pyaavso
python
https://github.com/zsiciarz/pyaavso/blob/d3b9eb17bcecc6652841606802b5713fd6083cc1/pyaavso/formats/visual.py#L194-L225
[ "def", "row_to_dict", "(", "cls", ",", "row", ")", ":", "comment_code", "=", "row", "[", "3", "]", "if", "comment_code", ".", "lower", "(", ")", "==", "'na'", ":", "comment_code", "=", "''", "comp1", "=", "row", "[", "4", "]", "if", "comp1", ".", ...
d3b9eb17bcecc6652841606802b5713fd6083cc1
valid
get_default_tag
Get the name of the view function used to prevent having to set the tag manually for every endpoint
flask_canonical/canonical_logger.py
def get_default_tag(app): '''Get the name of the view function used to prevent having to set the tag manually for every endpoint''' view_func = get_view_function(app, request.path, request.method) if view_func: return view_func.__name__
def get_default_tag(app): '''Get the name of the view function used to prevent having to set the tag manually for every endpoint''' view_func = get_view_function(app, request.path, request.method) if view_func: return view_func.__name__
[ "Get", "the", "name", "of", "the", "view", "function", "used", "to", "prevent", "having", "to", "set", "the", "tag", "manually", "for", "every", "endpoint" ]
megacool/flask-canonical
python
https://github.com/megacool/flask-canonical/blob/384c10205a1f5eefe859b3ae3c3152327bd4e7b7/flask_canonical/canonical_logger.py#L152-L157
[ "def", "get_default_tag", "(", "app", ")", ":", "view_func", "=", "get_view_function", "(", "app", ",", "request", ".", "path", ",", "request", ".", "method", ")", "if", "view_func", ":", "return", "view_func", ".", "__name__" ]
384c10205a1f5eefe859b3ae3c3152327bd4e7b7
valid
get_view_function
Match a url and return the view and arguments it will be called with, or None if there is no view. Creds: http://stackoverflow.com/a/38488506
flask_canonical/canonical_logger.py
def get_view_function(app, url, method): """Match a url and return the view and arguments it will be called with, or None if there is no view. Creds: http://stackoverflow.com/a/38488506 """ # pylint: disable=too-many-return-statements adapter = app.create_url_adapter(request) try: ...
def get_view_function(app, url, method): """Match a url and return the view and arguments it will be called with, or None if there is no view. Creds: http://stackoverflow.com/a/38488506 """ # pylint: disable=too-many-return-statements adapter = app.create_url_adapter(request) try: ...
[ "Match", "a", "url", "and", "return", "the", "view", "and", "arguments", "it", "will", "be", "called", "with", "or", "None", "if", "there", "is", "no", "view", ".", "Creds", ":", "http", ":", "//", "stackoverflow", ".", "com", "/", "a", "/", "3848850...
megacool/flask-canonical
python
https://github.com/megacool/flask-canonical/blob/384c10205a1f5eefe859b3ae3c3152327bd4e7b7/flask_canonical/canonical_logger.py#L160-L182
[ "def", "get_view_function", "(", "app", ",", "url", ",", "method", ")", ":", "# pylint: disable=too-many-return-statements", "adapter", "=", "app", ".", "create_url_adapter", "(", "request", ")", "try", ":", "match", "=", "adapter", ".", "match", "(", "url", "...
384c10205a1f5eefe859b3ae3c3152327bd4e7b7
valid
download_observations
Downloads all variable star observations by a given observer. Performs a series of HTTP requests to AAVSO's WebObs search and downloads the results page by page. Each page is then passed to :py:class:`~pyaavso.parsers.webobs.WebObsResultsParser` and parse results are added to the final observation list...
pyaavso/utils.py
def download_observations(observer_code): """ Downloads all variable star observations by a given observer. Performs a series of HTTP requests to AAVSO's WebObs search and downloads the results page by page. Each page is then passed to :py:class:`~pyaavso.parsers.webobs.WebObsResultsParser` and par...
def download_observations(observer_code): """ Downloads all variable star observations by a given observer. Performs a series of HTTP requests to AAVSO's WebObs search and downloads the results page by page. Each page is then passed to :py:class:`~pyaavso.parsers.webobs.WebObsResultsParser` and par...
[ "Downloads", "all", "variable", "star", "observations", "by", "a", "given", "observer", "." ]
zsiciarz/pyaavso
python
https://github.com/zsiciarz/pyaavso/blob/d3b9eb17bcecc6652841606802b5713fd6083cc1/pyaavso/utils.py#L13-L39
[ "def", "download_observations", "(", "observer_code", ")", ":", "page_number", "=", "1", "observations", "=", "[", "]", "while", "True", ":", "logger", ".", "info", "(", "'Downloading page %d...'", ",", "page_number", ")", "response", "=", "requests", ".", "ge...
d3b9eb17bcecc6652841606802b5713fd6083cc1
valid
get_random_filename
Generates random filename for uploading file using uuid4 hashes You need to define UPLOADS_ROOT in your django settings something like this UPLOADS_ROOT = rel(MEDIA_ROOT, 'uploads')
skd_tools/utils.py
def get_random_filename(instance, filename): """ Generates random filename for uploading file using uuid4 hashes You need to define UPLOADS_ROOT in your django settings something like this UPLOADS_ROOT = rel(MEDIA_ROOT, 'uploads') """ folder = settings.UPLOADS_ROOT ext = filename.split(...
def get_random_filename(instance, filename): """ Generates random filename for uploading file using uuid4 hashes You need to define UPLOADS_ROOT in your django settings something like this UPLOADS_ROOT = rel(MEDIA_ROOT, 'uploads') """ folder = settings.UPLOADS_ROOT ext = filename.split(...
[ "Generates", "random", "filename", "for", "uploading", "file", "using", "uuid4", "hashes", "You", "need", "to", "define", "UPLOADS_ROOT", "in", "your", "django", "settings", "something", "like", "this", "UPLOADS_ROOT", "=", "rel", "(", "MEDIA_ROOT", "uploads", "...
steelkiwi/django-skd-tools
python
https://github.com/steelkiwi/django-skd-tools/blob/422dc3e49f12739a500302e4c494379684e9dc50/skd_tools/utils.py#L10-L20
[ "def", "get_random_filename", "(", "instance", ",", "filename", ")", ":", "folder", "=", "settings", ".", "UPLOADS_ROOT", "ext", "=", "filename", ".", "split", "(", "'.'", ")", "[", "-", "1", "]", "filename", "=", "'{}.{}'", ".", "format", "(", "str", ...
422dc3e49f12739a500302e4c494379684e9dc50
valid
image_path
Generates likely unique image path using md5 hashes
skd_tools/utils.py
def image_path(instance, filename): """Generates likely unique image path using md5 hashes""" filename, ext = os.path.splitext(filename.lower()) instance_id_hash = hashlib.md5(str(instance.id)).hexdigest() filename_hash = ''.join(random.sample(hashlib.md5(filename.encode('utf-8')).hexdigest(), 8)) r...
def image_path(instance, filename): """Generates likely unique image path using md5 hashes""" filename, ext = os.path.splitext(filename.lower()) instance_id_hash = hashlib.md5(str(instance.id)).hexdigest() filename_hash = ''.join(random.sample(hashlib.md5(filename.encode('utf-8')).hexdigest(), 8)) r...
[ "Generates", "likely", "unique", "image", "path", "using", "md5", "hashes" ]
steelkiwi/django-skd-tools
python
https://github.com/steelkiwi/django-skd-tools/blob/422dc3e49f12739a500302e4c494379684e9dc50/skd_tools/utils.py#L23-L28
[ "def", "image_path", "(", "instance", ",", "filename", ")", ":", "filename", ",", "ext", "=", "os", ".", "path", ".", "splitext", "(", "filename", ".", "lower", "(", ")", ")", "instance_id_hash", "=", "hashlib", ".", "md5", "(", "str", "(", "instance",...
422dc3e49f12739a500302e4c494379684e9dc50
valid
get_ltd_product_urls
Get URLs for LSST the Docs (LTD) products from the LTD Keeper API. Parameters ---------- session : `aiohttp.ClientSession` Your application's aiohttp client session. See http://aiohttp.readthedocs.io/en/stable/client.html. Returns ------- product_urls : `list` List of p...
lsstprojectmeta/ltd.py
async def get_ltd_product_urls(session): """Get URLs for LSST the Docs (LTD) products from the LTD Keeper API. Parameters ---------- session : `aiohttp.ClientSession` Your application's aiohttp client session. See http://aiohttp.readthedocs.io/en/stable/client.html. Returns ---...
async def get_ltd_product_urls(session): """Get URLs for LSST the Docs (LTD) products from the LTD Keeper API. Parameters ---------- session : `aiohttp.ClientSession` Your application's aiohttp client session. See http://aiohttp.readthedocs.io/en/stable/client.html. Returns ---...
[ "Get", "URLs", "for", "LSST", "the", "Docs", "(", "LTD", ")", "products", "from", "the", "LTD", "Keeper", "API", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/ltd.py#L7-L25
[ "async", "def", "get_ltd_product_urls", "(", "session", ")", ":", "product_url", "=", "'https://keeper.lsst.codes/products/'", "async", "with", "session", ".", "get", "(", "product_url", ")", "as", "response", ":", "data", "=", "await", "response", ".", "json", ...
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
get_ltd_product
Get the product resource (JSON document) from the LSST the Docs API. Parameters ---------- session : `aiohttp.ClientSession` Your application's aiohttp client session. See http://aiohttp.readthedocs.io/en/stable/client.html. slug : `str`, optional Slug identfying the product. Th...
lsstprojectmeta/ltd.py
async def get_ltd_product(session, slug=None, url=None): """Get the product resource (JSON document) from the LSST the Docs API. Parameters ---------- session : `aiohttp.ClientSession` Your application's aiohttp client session. See http://aiohttp.readthedocs.io/en/stable/client.html. ...
async def get_ltd_product(session, slug=None, url=None): """Get the product resource (JSON document) from the LSST the Docs API. Parameters ---------- session : `aiohttp.ClientSession` Your application's aiohttp client session. See http://aiohttp.readthedocs.io/en/stable/client.html. ...
[ "Get", "the", "product", "resource", "(", "JSON", "document", ")", "from", "the", "LSST", "the", "Docs", "API", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/ltd.py#L28-L58
[ "async", "def", "get_ltd_product", "(", "session", ",", "slug", "=", "None", ",", "url", "=", "None", ")", ":", "if", "url", "is", "None", ":", "url", "=", "'https://keeper.lsst.codes/products/{}'", ".", "format", "(", "slug", ")", "async", "with", "sessio...
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
process_lander_page
Extract, transform, and load metadata from Lander-based projects. Parameters ---------- session : `aiohttp.ClientSession` Your application's aiohttp client session. See http://aiohttp.readthedocs.io/en/stable/client.html. github_api_token : `str` A GitHub personal API token. See...
lsstprojectmeta/lsstdocument/lander.py
async def process_lander_page(session, github_api_token, ltd_product_data, mongo_collection=None): """Extract, transform, and load metadata from Lander-based projects. Parameters ---------- session : `aiohttp.ClientSession` Your application's aiohttp client session...
async def process_lander_page(session, github_api_token, ltd_product_data, mongo_collection=None): """Extract, transform, and load metadata from Lander-based projects. Parameters ---------- session : `aiohttp.ClientSession` Your application's aiohttp client session...
[ "Extract", "transform", "and", "load", "metadata", "from", "Lander", "-", "based", "projects", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/lsstdocument/lander.py#L16-L72
[ "async", "def", "process_lander_page", "(", "session", ",", "github_api_token", ",", "ltd_product_data", ",", "mongo_collection", "=", "None", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "__name__", ")", "# Try to download metadata.jsonld from the Landing...
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
_upload_to_mongodb
Upsert the technote resource into the projectmeta MongoDB collection. Parameters ---------- collection : `motor.motor_asyncio.AsyncIOMotorCollection` The MongoDB collection. jsonld : `dict` The JSON-LD document that represents the document resource.
lsstprojectmeta/lsstdocument/lander.py
async def _upload_to_mongodb(collection, jsonld): """Upsert the technote resource into the projectmeta MongoDB collection. Parameters ---------- collection : `motor.motor_asyncio.AsyncIOMotorCollection` The MongoDB collection. jsonld : `dict` The JSON-LD document that represents the...
async def _upload_to_mongodb(collection, jsonld): """Upsert the technote resource into the projectmeta MongoDB collection. Parameters ---------- collection : `motor.motor_asyncio.AsyncIOMotorCollection` The MongoDB collection. jsonld : `dict` The JSON-LD document that represents the...
[ "Upsert", "the", "technote", "resource", "into", "the", "projectmeta", "MongoDB", "collection", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/lsstdocument/lander.py#L75-L91
[ "async", "def", "_upload_to_mongodb", "(", "collection", ",", "jsonld", ")", ":", "document", "=", "{", "'data'", ":", "jsonld", "}", "query", "=", "{", "'data.reportNumber'", ":", "jsonld", "[", "'reportNumber'", "]", "}", "await", "collection", ".", "updat...
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
json_doc_to_xml
Converts a Open511 JSON document to XML. lang: the appropriate language code Takes a dict deserialized from JSON, returns an lxml Element. Accepts only the full root-level JSON object from an Open511 response.
open511/converter/o5xml.py
def json_doc_to_xml(json_obj, lang='en', custom_namespace=None): """Converts a Open511 JSON document to XML. lang: the appropriate language code Takes a dict deserialized from JSON, returns an lxml Element. Accepts only the full root-level JSON object from an Open511 response.""" if 'meta' not in...
def json_doc_to_xml(json_obj, lang='en', custom_namespace=None): """Converts a Open511 JSON document to XML. lang: the appropriate language code Takes a dict deserialized from JSON, returns an lxml Element. Accepts only the full root-level JSON object from an Open511 response.""" if 'meta' not in...
[ "Converts", "a", "Open511", "JSON", "document", "to", "XML", "." ]
open511/open511
python
https://github.com/open511/open511/blob/3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8/open511/converter/o5xml.py#L18-L41
[ "def", "json_doc_to_xml", "(", "json_obj", ",", "lang", "=", "'en'", ",", "custom_namespace", "=", "None", ")", ":", "if", "'meta'", "not", "in", "json_obj", ":", "raise", "Exception", "(", "\"This function requires a conforming Open511 JSON document with a 'meta' secti...
3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8
valid
json_struct_to_xml
Converts a Open511 JSON fragment to XML. Takes a dict deserialized from JSON, returns an lxml Element. This won't provide a conforming document if you pass in a full JSON document; it's for translating little fragments, and is mostly used internally.
open511/converter/o5xml.py
def json_struct_to_xml(json_obj, root, custom_namespace=None): """Converts a Open511 JSON fragment to XML. Takes a dict deserialized from JSON, returns an lxml Element. This won't provide a conforming document if you pass in a full JSON document; it's for translating little fragments, and is mostly us...
def json_struct_to_xml(json_obj, root, custom_namespace=None): """Converts a Open511 JSON fragment to XML. Takes a dict deserialized from JSON, returns an lxml Element. This won't provide a conforming document if you pass in a full JSON document; it's for translating little fragments, and is mostly us...
[ "Converts", "a", "Open511", "JSON", "fragment", "to", "XML", "." ]
open511/open511
python
https://github.com/open511/open511/blob/3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8/open511/converter/o5xml.py#L43-L91
[ "def", "json_struct_to_xml", "(", "json_obj", ",", "root", ",", "custom_namespace", "=", "None", ")", ":", "if", "isinstance", "(", "root", ",", "(", "str", ",", "unicode", ")", ")", ":", "if", "root", ".", "startswith", "(", "'!'", ")", ":", "root", ...
3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8
valid
geojson_to_gml
Given a dict deserialized from a GeoJSON object, returns an lxml Element of the corresponding GML geometry.
open511/converter/o5xml.py
def geojson_to_gml(gj, set_srs=True): """Given a dict deserialized from a GeoJSON object, returns an lxml Element of the corresponding GML geometry.""" tag = G(gj['type']) if set_srs: tag.set('srsName', 'urn:ogc:def:crs:EPSG::4326') if gj['type'] == 'Point': tag.append(G.pos(_revers...
def geojson_to_gml(gj, set_srs=True): """Given a dict deserialized from a GeoJSON object, returns an lxml Element of the corresponding GML geometry.""" tag = G(gj['type']) if set_srs: tag.set('srsName', 'urn:ogc:def:crs:EPSG::4326') if gj['type'] == 'Point': tag.append(G.pos(_revers...
[ "Given", "a", "dict", "deserialized", "from", "a", "GeoJSON", "object", "returns", "an", "lxml", "Element", "of", "the", "corresponding", "GML", "geometry", "." ]
open511/open511
python
https://github.com/open511/open511/blob/3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8/open511/converter/o5xml.py#L116-L146
[ "def", "geojson_to_gml", "(", "gj", ",", "set_srs", "=", "True", ")", ":", "tag", "=", "G", "(", "gj", "[", "'type'", "]", ")", "if", "set_srs", ":", "tag", ".", "set", "(", "'srsName'", ",", "'urn:ogc:def:crs:EPSG::4326'", ")", "if", "gj", "[", "'ty...
3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8
valid
geom_to_xml_element
Transform a GEOS or OGR geometry object into an lxml Element for the GML geometry.
open511/converter/o5xml.py
def geom_to_xml_element(geom): """Transform a GEOS or OGR geometry object into an lxml Element for the GML geometry.""" if geom.srs.srid != 4326: raise NotImplementedError("Only WGS 84 lat/long geometries (SRID 4326) are supported.") # GeoJSON output is far more standard than GML, so go through ...
def geom_to_xml_element(geom): """Transform a GEOS or OGR geometry object into an lxml Element for the GML geometry.""" if geom.srs.srid != 4326: raise NotImplementedError("Only WGS 84 lat/long geometries (SRID 4326) are supported.") # GeoJSON output is far more standard than GML, so go through ...
[ "Transform", "a", "GEOS", "or", "OGR", "geometry", "object", "into", "an", "lxml", "Element", "for", "the", "GML", "geometry", "." ]
open511/open511
python
https://github.com/open511/open511/blob/3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8/open511/converter/o5xml.py#L148-L154
[ "def", "geom_to_xml_element", "(", "geom", ")", ":", "if", "geom", ".", "srs", ".", "srid", "!=", "4326", ":", "raise", "NotImplementedError", "(", "\"Only WGS 84 lat/long geometries (SRID 4326) are supported.\"", ")", "# GeoJSON output is far more standard than GML, so go th...
3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8
valid
remove_comments
Delete latex comments from TeX source. Parameters ---------- tex_source : str TeX source content. Returns ------- tex_source : str TeX source without comments.
lsstprojectmeta/tex/normalizer.py
def remove_comments(tex_source): """Delete latex comments from TeX source. Parameters ---------- tex_source : str TeX source content. Returns ------- tex_source : str TeX source without comments. """ # Expression via http://stackoverflow.com/a/13365453 return re...
def remove_comments(tex_source): """Delete latex comments from TeX source. Parameters ---------- tex_source : str TeX source content. Returns ------- tex_source : str TeX source without comments. """ # Expression via http://stackoverflow.com/a/13365453 return re...
[ "Delete", "latex", "comments", "from", "TeX", "source", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/normalizer.py#L25-L39
[ "def", "remove_comments", "(", "tex_source", ")", ":", "# Expression via http://stackoverflow.com/a/13365453", "return", "re", ".", "sub", "(", "r'(?<!\\\\)%.*$'", ",", "r''", ",", "tex_source", ",", "flags", "=", "re", ".", "M", ")" ]
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
read_tex_file
r"""Read a TeX file, automatically processing and normalizing it (including other input files, removing comments, and deleting trailing whitespace). Parameters ---------- root_filepath : `str` Filepath to a TeX file. root_dir : `str` Root directory of the TeX project. This only ...
lsstprojectmeta/tex/normalizer.py
def read_tex_file(root_filepath, root_dir=None): r"""Read a TeX file, automatically processing and normalizing it (including other input files, removing comments, and deleting trailing whitespace). Parameters ---------- root_filepath : `str` Filepath to a TeX file. root_dir : `str` ...
def read_tex_file(root_filepath, root_dir=None): r"""Read a TeX file, automatically processing and normalizing it (including other input files, removing comments, and deleting trailing whitespace). Parameters ---------- root_filepath : `str` Filepath to a TeX file. root_dir : `str` ...
[ "r", "Read", "a", "TeX", "file", "automatically", "processing", "and", "normalizing", "it", "(", "including", "other", "input", "files", "removing", "comments", "and", "deleting", "trailing", "whitespace", ")", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/normalizer.py#L59-L88
[ "def", "read_tex_file", "(", "root_filepath", ",", "root_dir", "=", "None", ")", ":", "with", "open", "(", "root_filepath", ",", "'r'", ")", "as", "f", ":", "tex_source", "=", "f", ".", "read", "(", ")", "if", "root_dir", "is", "None", ":", "root_dir",...
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
process_inputs
r"""Insert referenced TeX file contents (from ``\input`` and ``\include`` commands) into the source. Parameters ---------- tex_source : `str` TeX source where referenced source files will be found and inserted. root_dir : `str`, optional Name of the directory containing the TeX pro...
lsstprojectmeta/tex/normalizer.py
def process_inputs(tex_source, root_dir=None): r"""Insert referenced TeX file contents (from ``\input`` and ``\include`` commands) into the source. Parameters ---------- tex_source : `str` TeX source where referenced source files will be found and inserted. root_dir : `str`, optional ...
def process_inputs(tex_source, root_dir=None): r"""Insert referenced TeX file contents (from ``\input`` and ``\include`` commands) into the source. Parameters ---------- tex_source : `str` TeX source where referenced source files will be found and inserted. root_dir : `str`, optional ...
[ "r", "Insert", "referenced", "TeX", "file", "contents", "(", "from", "\\", "input", "and", "\\", "include", "commands", ")", "into", "the", "source", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/normalizer.py#L91-L135
[ "def", "process_inputs", "(", "tex_source", ",", "root_dir", "=", "None", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "__name__", ")", "def", "_sub_line", "(", "match", ")", ":", "\"\"\"Function to be used with re.sub to inline files for each match.\"\"...
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
replace_macros
r"""Replace macros in the TeX source with their content. Parameters ---------- tex_source : `str` TeX source content. macros : `dict` Keys are macro names (including leading ``\``) and values are the content (as `str`) of the macros. See `lsstprojectmeta.tex.scraper.get_...
lsstprojectmeta/tex/normalizer.py
def replace_macros(tex_source, macros): r"""Replace macros in the TeX source with their content. Parameters ---------- tex_source : `str` TeX source content. macros : `dict` Keys are macro names (including leading ``\``) and values are the content (as `str`) of the macros. S...
def replace_macros(tex_source, macros): r"""Replace macros in the TeX source with their content. Parameters ---------- tex_source : `str` TeX source content. macros : `dict` Keys are macro names (including leading ``\``) and values are the content (as `str`) of the macros. S...
[ "r", "Replace", "macros", "in", "the", "TeX", "source", "with", "their", "content", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/normalizer.py#L138-L180
[ "def", "replace_macros", "(", "tex_source", ",", "macros", ")", ":", "for", "macro_name", ",", "macro_content", "in", "macros", ".", "items", "(", ")", ":", "# '\\\\?' suffix matches an optional trailing '\\' that might be used", "# for spacing.", "pattern", "=", "re", ...
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
ensure_format
Ensures that the provided document is an lxml Element or json dict.
open511/converter/__init__.py
def ensure_format(doc, format): """ Ensures that the provided document is an lxml Element or json dict. """ assert format in ('xml', 'json') if getattr(doc, 'tag', None) == 'open511': if format == 'json': return xml_to_json(doc) elif isinstance(doc, dict) and 'meta' in doc: ...
def ensure_format(doc, format): """ Ensures that the provided document is an lxml Element or json dict. """ assert format in ('xml', 'json') if getattr(doc, 'tag', None) == 'open511': if format == 'json': return xml_to_json(doc) elif isinstance(doc, dict) and 'meta' in doc: ...
[ "Ensures", "that", "the", "provided", "document", "is", "an", "lxml", "Element", "or", "json", "dict", "." ]
open511/open511
python
https://github.com/open511/open511/blob/3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8/open511/converter/__init__.py#L26-L39
[ "def", "ensure_format", "(", "doc", ",", "format", ")", ":", "assert", "format", "in", "(", "'xml'", ",", "'json'", ")", "if", "getattr", "(", "doc", ",", "'tag'", ",", "None", ")", "==", "'open511'", ":", "if", "format", "==", "'json'", ":", "return...
3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8
valid
open511_convert
Convert an Open511 document between formats. input_doc - either an lxml open511 Element or a deserialized JSON dict output_format - short string name of a valid output format, as listed above
open511/converter/__init__.py
def open511_convert(input_doc, output_format, serialize=True, **kwargs): """ Convert an Open511 document between formats. input_doc - either an lxml open511 Element or a deserialized JSON dict output_format - short string name of a valid output format, as listed above """ try: output_fo...
def open511_convert(input_doc, output_format, serialize=True, **kwargs): """ Convert an Open511 document between formats. input_doc - either an lxml open511 Element or a deserialized JSON dict output_format - short string name of a valid output format, as listed above """ try: output_fo...
[ "Convert", "an", "Open511", "document", "between", "formats", ".", "input_doc", "-", "either", "an", "lxml", "open511", "Element", "or", "a", "deserialized", "JSON", "dict", "output_format", "-", "short", "string", "name", "of", "a", "valid", "output", "format...
open511/open511
python
https://github.com/open511/open511/blob/3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8/open511/converter/__init__.py#L42-L59
[ "def", "open511_convert", "(", "input_doc", ",", "output_format", ",", "serialize", "=", "True", ",", "*", "*", "kwargs", ")", ":", "try", ":", "output_format_info", "=", "FORMATS", "[", "output_format", "]", "except", "KeyError", ":", "raise", "ValueError", ...
3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8
valid
LsstLatexDoc.read
Construct an `LsstLatexDoc` instance by reading and parsing the LaTeX source. Parameters ---------- root_tex_path : `str` Path to the LaTeX source on the filesystem. For multi-file LaTeX projects this should be the path to the root document. Notes ...
lsstprojectmeta/tex/lsstdoc.py
def read(cls, root_tex_path): """Construct an `LsstLatexDoc` instance by reading and parsing the LaTeX source. Parameters ---------- root_tex_path : `str` Path to the LaTeX source on the filesystem. For multi-file LaTeX projects this should be the path to...
def read(cls, root_tex_path): """Construct an `LsstLatexDoc` instance by reading and parsing the LaTeX source. Parameters ---------- root_tex_path : `str` Path to the LaTeX source on the filesystem. For multi-file LaTeX projects this should be the path to...
[ "Construct", "an", "LsstLatexDoc", "instance", "by", "reading", "and", "parsing", "the", "LaTeX", "source", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/lsstdoc.py#L48-L73
[ "def", "read", "(", "cls", ",", "root_tex_path", ")", ":", "# Read and normalize the TeX source, replacing macros with content", "root_dir", "=", "os", ".", "path", ".", "dirname", "(", "root_tex_path", ")", "tex_source", "=", "read_tex_file", "(", "root_tex_path", ")...
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
LsstLatexDoc.html_title
HTML5-formatted document title (`str`).
lsstprojectmeta/tex/lsstdoc.py
def html_title(self): """HTML5-formatted document title (`str`).""" return self.format_title(format='html5', deparagraph=True, mathjax=False, smart=True)
def html_title(self): """HTML5-formatted document title (`str`).""" return self.format_title(format='html5', deparagraph=True, mathjax=False, smart=True)
[ "HTML5", "-", "formatted", "document", "title", "(", "str", ")", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/lsstdoc.py#L81-L84
[ "def", "html_title", "(", "self", ")", ":", "return", "self", ".", "format_title", "(", "format", "=", "'html5'", ",", "deparagraph", "=", "True", ",", "mathjax", "=", "False", ",", "smart", "=", "True", ")" ]
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
LsstLatexDoc.html_short_title
HTML5-formatted document short title (`str`).
lsstprojectmeta/tex/lsstdoc.py
def html_short_title(self): """HTML5-formatted document short title (`str`).""" return self.format_short_title(format='html5', deparagraph=True, mathjax=False, smart=True)
def html_short_title(self): """HTML5-formatted document short title (`str`).""" return self.format_short_title(format='html5', deparagraph=True, mathjax=False, smart=True)
[ "HTML5", "-", "formatted", "document", "short", "title", "(", "str", ")", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/lsstdoc.py#L101-L104
[ "def", "html_short_title", "(", "self", ")", ":", "return", "self", ".", "format_short_title", "(", "format", "=", "'html5'", ",", "deparagraph", "=", "True", ",", "mathjax", "=", "False", ",", "smart", "=", "True", ")" ]
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
LsstLatexDoc.html_authors
HTML5-formatted authors (`list` of `str`).
lsstprojectmeta/tex/lsstdoc.py
def html_authors(self): """HTML5-formatted authors (`list` of `str`).""" return self.format_authors(format='html5', deparagraph=True, mathjax=False, smart=True)
def html_authors(self): """HTML5-formatted authors (`list` of `str`).""" return self.format_authors(format='html5', deparagraph=True, mathjax=False, smart=True)
[ "HTML5", "-", "formatted", "authors", "(", "list", "of", "str", ")", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/lsstdoc.py#L121-L124
[ "def", "html_authors", "(", "self", ")", ":", "return", "self", ".", "format_authors", "(", "format", "=", "'html5'", ",", "deparagraph", "=", "True", ",", "mathjax", "=", "False", ",", "smart", "=", "True", ")" ]
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
LsstLatexDoc.html_abstract
HTML5-formatted document abstract (`str`).
lsstprojectmeta/tex/lsstdoc.py
def html_abstract(self): """HTML5-formatted document abstract (`str`).""" return self.format_abstract(format='html5', deparagraph=False, mathjax=False, smart=True)
def html_abstract(self): """HTML5-formatted document abstract (`str`).""" return self.format_abstract(format='html5', deparagraph=False, mathjax=False, smart=True)
[ "HTML5", "-", "formatted", "document", "abstract", "(", "str", ")", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/lsstdoc.py#L141-L144
[ "def", "html_abstract", "(", "self", ")", ":", "return", "self", ".", "format_abstract", "(", "format", "=", "'html5'", ",", "deparagraph", "=", "False", ",", "mathjax", "=", "False", ",", "smart", "=", "True", ")" ]
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
LsstLatexDoc.is_draft
Document is a draft if ``'lsstdoc'`` is included in the documentclass options (`bool`).
lsstprojectmeta/tex/lsstdoc.py
def is_draft(self): """Document is a draft if ``'lsstdoc'`` is included in the documentclass options (`bool`). """ if not hasattr(self, '_document_options'): self._parse_documentclass() if 'lsstdraft' in self._document_options: return True else: ...
def is_draft(self): """Document is a draft if ``'lsstdoc'`` is included in the documentclass options (`bool`). """ if not hasattr(self, '_document_options'): self._parse_documentclass() if 'lsstdraft' in self._document_options: return True else: ...
[ "Document", "is", "a", "draft", "if", "lsstdoc", "is", "included", "in", "the", "documentclass", "options", "(", "bool", ")", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/lsstdoc.py#L185-L195
[ "def", "is_draft", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_document_options'", ")", ":", "self", ".", "_parse_documentclass", "(", ")", "if", "'lsstdraft'", "in", "self", ".", "_document_options", ":", "return", "True", "else", ...
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
LsstLatexDoc.format_content
Get the document content in the specified markup format. Parameters ---------- format : `str`, optional Output format (such as ``'html5'`` or ``'plain'``). mathjax : `bool`, optional Allow pandoc to use MathJax math markup. smart : `True`, optional ...
lsstprojectmeta/tex/lsstdoc.py
def format_content(self, format='plain', mathjax=False, smart=True, extra_args=None): """Get the document content in the specified markup format. Parameters ---------- format : `str`, optional Output format (such as ``'html5'`` or ``'plain'``). ...
def format_content(self, format='plain', mathjax=False, smart=True, extra_args=None): """Get the document content in the specified markup format. Parameters ---------- format : `str`, optional Output format (such as ``'html5'`` or ``'plain'``). ...
[ "Get", "the", "document", "content", "in", "the", "specified", "markup", "format", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/lsstdoc.py#L254-L280
[ "def", "format_content", "(", "self", ",", "format", "=", "'plain'", ",", "mathjax", "=", "False", ",", "smart", "=", "True", ",", "extra_args", "=", "None", ")", ":", "output_text", "=", "convert_lsstdoc_tex", "(", "self", ".", "_tex", ",", "format", ",...
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
LsstLatexDoc.format_title
Get the document title in the specified markup format. Parameters ---------- format : `str`, optional Output format (such as ``'html5'`` or ``'plain'``). deparagraph : `bool`, optional Remove the paragraph tags from single paragraph content. mathjax : `bo...
lsstprojectmeta/tex/lsstdoc.py
def format_title(self, format='html5', deparagraph=True, mathjax=False, smart=True, extra_args=None): """Get the document title in the specified markup format. Parameters ---------- format : `str`, optional Output format (such as ``'html5'`` or ``'plain'...
def format_title(self, format='html5', deparagraph=True, mathjax=False, smart=True, extra_args=None): """Get the document title in the specified markup format. Parameters ---------- format : `str`, optional Output format (such as ``'html5'`` or ``'plain'...
[ "Get", "the", "document", "title", "in", "the", "specified", "markup", "format", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/lsstdoc.py#L282-L315
[ "def", "format_title", "(", "self", ",", "format", "=", "'html5'", ",", "deparagraph", "=", "True", ",", "mathjax", "=", "False", ",", "smart", "=", "True", ",", "extra_args", "=", "None", ")", ":", "if", "self", ".", "title", "is", "None", ":", "ret...
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
LsstLatexDoc.format_short_title
Get the document short title in the specified markup format. Parameters ---------- format : `str`, optional Output format (such as ``'html5'`` or ``'plain'``). deparagraph : `bool`, optional Remove the paragraph tags from single paragraph content. mathjax...
lsstprojectmeta/tex/lsstdoc.py
def format_short_title(self, format='html5', deparagraph=True, mathjax=False, smart=True, extra_args=None): """Get the document short title in the specified markup format. Parameters ---------- format : `str`, optional Output format (such as ``'htm...
def format_short_title(self, format='html5', deparagraph=True, mathjax=False, smart=True, extra_args=None): """Get the document short title in the specified markup format. Parameters ---------- format : `str`, optional Output format (such as ``'htm...
[ "Get", "the", "document", "short", "title", "in", "the", "specified", "markup", "format", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/lsstdoc.py#L317-L350
[ "def", "format_short_title", "(", "self", ",", "format", "=", "'html5'", ",", "deparagraph", "=", "True", ",", "mathjax", "=", "False", ",", "smart", "=", "True", ",", "extra_args", "=", "None", ")", ":", "if", "self", ".", "short_title", "is", "None", ...
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
LsstLatexDoc.format_abstract
Get the document abstract in the specified markup format. Parameters ---------- format : `str`, optional Output format (such as ``'html5'`` or ``'plain'``). deparagraph : `bool`, optional Remove the paragraph tags from single paragraph content. mathjax : ...
lsstprojectmeta/tex/lsstdoc.py
def format_abstract(self, format='html5', deparagraph=False, mathjax=False, smart=True, extra_args=None): """Get the document abstract in the specified markup format. Parameters ---------- format : `str`, optional Output format (such as ``'html5'`` or...
def format_abstract(self, format='html5', deparagraph=False, mathjax=False, smart=True, extra_args=None): """Get the document abstract in the specified markup format. Parameters ---------- format : `str`, optional Output format (such as ``'html5'`` or...
[ "Get", "the", "document", "abstract", "in", "the", "specified", "markup", "format", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/lsstdoc.py#L352-L387
[ "def", "format_abstract", "(", "self", ",", "format", "=", "'html5'", ",", "deparagraph", "=", "False", ",", "mathjax", "=", "False", ",", "smart", "=", "True", ",", "extra_args", "=", "None", ")", ":", "if", "self", ".", "abstract", "is", "None", ":",...
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
LsstLatexDoc.format_authors
Get the document authors in the specified markup format. Parameters ---------- format : `str`, optional Output format (such as ``'html5'`` or ``'plain'``). deparagraph : `bool`, optional Remove the paragraph tags from single paragraph content. mathjax : `...
lsstprojectmeta/tex/lsstdoc.py
def format_authors(self, format='html5', deparagraph=True, mathjax=False, smart=True, extra_args=None): """Get the document authors in the specified markup format. Parameters ---------- format : `str`, optional Output format (such as ``'html5'`` or ``'...
def format_authors(self, format='html5', deparagraph=True, mathjax=False, smart=True, extra_args=None): """Get the document authors in the specified markup format. Parameters ---------- format : `str`, optional Output format (such as ``'html5'`` or ``'...
[ "Get", "the", "document", "authors", "in", "the", "specified", "markup", "format", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/lsstdoc.py#L389-L423
[ "def", "format_authors", "(", "self", ",", "format", "=", "'html5'", ",", "deparagraph", "=", "True", ",", "mathjax", "=", "False", ",", "smart", "=", "True", ",", "extra_args", "=", "None", ")", ":", "formatted_authors", "=", "[", "]", "for", "latex_aut...
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
LsstLatexDoc._parse_documentclass
Parse documentclass options. Sets the the ``_document_options`` attribute.
lsstprojectmeta/tex/lsstdoc.py
def _parse_documentclass(self): """Parse documentclass options. Sets the the ``_document_options`` attribute. """ command = LatexCommand( 'documentclass', {'name': 'options', 'required': False, 'bracket': '['}, {'name': 'class_name', 'required': True,...
def _parse_documentclass(self): """Parse documentclass options. Sets the the ``_document_options`` attribute. """ command = LatexCommand( 'documentclass', {'name': 'options', 'required': False, 'bracket': '['}, {'name': 'class_name', 'required': True,...
[ "Parse", "documentclass", "options", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/lsstdoc.py#L425-L446
[ "def", "_parse_documentclass", "(", "self", ")", ":", "command", "=", "LatexCommand", "(", "'documentclass'", ",", "{", "'name'", ":", "'options'", ",", "'required'", ":", "False", ",", "'bracket'", ":", "'['", "}", ",", "{", "'name'", ":", "'class_name'", ...
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
LsstLatexDoc._parse_title
Parse the title from TeX source. Sets these attributes: - ``_title`` - ``_short_title``
lsstprojectmeta/tex/lsstdoc.py
def _parse_title(self): """Parse the title from TeX source. Sets these attributes: - ``_title`` - ``_short_title`` """ command = LatexCommand( 'title', {'name': 'short_title', 'required': False, 'bracket': '['}, {'name': 'long_title',...
def _parse_title(self): """Parse the title from TeX source. Sets these attributes: - ``_title`` - ``_short_title`` """ command = LatexCommand( 'title', {'name': 'short_title', 'required': False, 'bracket': '['}, {'name': 'long_title',...
[ "Parse", "the", "title", "from", "TeX", "source", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/lsstdoc.py#L448-L473
[ "def", "_parse_title", "(", "self", ")", ":", "command", "=", "LatexCommand", "(", "'title'", ",", "{", "'name'", ":", "'short_title'", ",", "'required'", ":", "False", ",", "'bracket'", ":", "'['", "}", ",", "{", "'name'", ":", "'long_title'", ",", "'re...
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
LsstLatexDoc._parse_doc_ref
Parse the document handle. Sets the ``_series``, ``_serial``, and ``_handle`` attributes.
lsstprojectmeta/tex/lsstdoc.py
def _parse_doc_ref(self): """Parse the document handle. Sets the ``_series``, ``_serial``, and ``_handle`` attributes. """ command = LatexCommand( 'setDocRef', {'name': 'handle', 'required': True, 'bracket': '{'}) try: parsed = next(command.pa...
def _parse_doc_ref(self): """Parse the document handle. Sets the ``_series``, ``_serial``, and ``_handle`` attributes. """ command = LatexCommand( 'setDocRef', {'name': 'handle', 'required': True, 'bracket': '{'}) try: parsed = next(command.pa...
[ "Parse", "the", "document", "handle", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/lsstdoc.py#L475-L499
[ "def", "_parse_doc_ref", "(", "self", ")", ":", "command", "=", "LatexCommand", "(", "'setDocRef'", ",", "{", "'name'", ":", "'handle'", ",", "'required'", ":", "True", ",", "'bracket'", ":", "'{'", "}", ")", "try", ":", "parsed", "=", "next", "(", "co...
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
LsstLatexDoc._parse_author
r"""Parse the author from TeX source. Sets the ``_authors`` attribute. Goal is to parse:: \author{ A.~Author, B.~Author, and C.~Author} Into:: ['A. Author', 'B. Author', 'C. Author']
lsstprojectmeta/tex/lsstdoc.py
def _parse_author(self): r"""Parse the author from TeX source. Sets the ``_authors`` attribute. Goal is to parse:: \author{ A.~Author, B.~Author, and C.~Author} Into:: ['A. Author', 'B. Author', 'C. Author'] "...
def _parse_author(self): r"""Parse the author from TeX source. Sets the ``_authors`` attribute. Goal is to parse:: \author{ A.~Author, B.~Author, and C.~Author} Into:: ['A. Author', 'B. Author', 'C. Author'] "...
[ "r", "Parse", "the", "author", "from", "TeX", "source", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/lsstdoc.py#L501-L548
[ "def", "_parse_author", "(", "self", ")", ":", "command", "=", "LatexCommand", "(", "'author'", ",", "{", "'name'", ":", "'authors'", ",", "'required'", ":", "True", ",", "'bracket'", ":", "'{'", "}", ")", "try", ":", "parsed", "=", "next", "(", "comma...
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
LsstLatexDoc._parse_abstract
Parse the abstract from the TeX source. Sets the ``_abstract`` attribute.
lsstprojectmeta/tex/lsstdoc.py
def _parse_abstract(self): """Parse the abstract from the TeX source. Sets the ``_abstract`` attribute. """ command = LatexCommand( 'setDocAbstract', {'name': 'abstract', 'required': True, 'bracket': '{'}) try: parsed = next(command.parse(self...
def _parse_abstract(self): """Parse the abstract from the TeX source. Sets the ``_abstract`` attribute. """ command = LatexCommand( 'setDocAbstract', {'name': 'abstract', 'required': True, 'bracket': '{'}) try: parsed = next(command.parse(self...
[ "Parse", "the", "abstract", "from", "the", "TeX", "source", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/lsstdoc.py#L550-L573
[ "def", "_parse_abstract", "(", "self", ")", ":", "command", "=", "LatexCommand", "(", "'setDocAbstract'", ",", "{", "'name'", ":", "'abstract'", ",", "'required'", ":", "True", ",", "'bracket'", ":", "'{'", "}", ")", "try", ":", "parsed", "=", "next", "(...
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
LsstLatexDoc._prep_snippet_for_pandoc
Process a LaTeX snippet of content for better transformation with pandoc. Currently runs the CitationLinker to convert BibTeX citations to href links.
lsstprojectmeta/tex/lsstdoc.py
def _prep_snippet_for_pandoc(self, latex_text): """Process a LaTeX snippet of content for better transformation with pandoc. Currently runs the CitationLinker to convert BibTeX citations to href links. """ replace_cite = CitationLinker(self.bib_db) latex_text = r...
def _prep_snippet_for_pandoc(self, latex_text): """Process a LaTeX snippet of content for better transformation with pandoc. Currently runs the CitationLinker to convert BibTeX citations to href links. """ replace_cite = CitationLinker(self.bib_db) latex_text = r...
[ "Process", "a", "LaTeX", "snippet", "of", "content", "for", "better", "transformation", "with", "pandoc", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/lsstdoc.py#L575-L584
[ "def", "_prep_snippet_for_pandoc", "(", "self", ",", "latex_text", ")", ":", "replace_cite", "=", "CitationLinker", "(", "self", ".", "bib_db", ")", "latex_text", "=", "replace_cite", "(", "latex_text", ")", "return", "latex_text" ]
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
LsstLatexDoc._load_bib_db
r"""Load the BibTeX bibliography referenced by the document. This method triggered by the `bib_db` attribute and populates the `_bib_db` private attribute. The ``\bibliography`` command is parsed to identify the bibliographies referenced by the document.
lsstprojectmeta/tex/lsstdoc.py
def _load_bib_db(self): r"""Load the BibTeX bibliography referenced by the document. This method triggered by the `bib_db` attribute and populates the `_bib_db` private attribute. The ``\bibliography`` command is parsed to identify the bibliographies referenced by the document....
def _load_bib_db(self): r"""Load the BibTeX bibliography referenced by the document. This method triggered by the `bib_db` attribute and populates the `_bib_db` private attribute. The ``\bibliography`` command is parsed to identify the bibliographies referenced by the document....
[ "r", "Load", "the", "BibTeX", "bibliography", "referenced", "by", "the", "document", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/lsstdoc.py#L586-L631
[ "def", "_load_bib_db", "(", "self", ")", ":", "# Get the names of custom bibtex files by parsing the", "# \\bibliography command and filtering out the default lsstdoc", "# bibliographies.", "command", "=", "LatexCommand", "(", "'bibliography'", ",", "{", "'name'", ":", "'bib_name...
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
LsstLatexDoc._parse_revision_date
r"""Parse the ``\date`` command, falling back to getting the most recent Git commit date and the current datetime. Result is available from the `revision_datetime` attribute.
lsstprojectmeta/tex/lsstdoc.py
def _parse_revision_date(self): r"""Parse the ``\date`` command, falling back to getting the most recent Git commit date and the current datetime. Result is available from the `revision_datetime` attribute. """ doc_datetime = None # First try to parse the \date command ...
def _parse_revision_date(self): r"""Parse the ``\date`` command, falling back to getting the most recent Git commit date and the current datetime. Result is available from the `revision_datetime` attribute. """ doc_datetime = None # First try to parse the \date command ...
[ "r", "Parse", "the", "\\", "date", "command", "falling", "back", "to", "getting", "the", "most", "recent", "Git", "commit", "date", "and", "the", "current", "datetime", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/lsstdoc.py#L633-L689
[ "def", "_parse_revision_date", "(", "self", ")", ":", "doc_datetime", "=", "None", "# First try to parse the \\date command in the latex.", "# \\date is ignored for draft documents.", "if", "not", "self", ".", "is_draft", ":", "date_command", "=", "LatexCommand", "(", "'dat...
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
LsstLatexDoc.build_jsonld
Create a JSON-LD representation of this LSST LaTeX document. Parameters ---------- url : `str`, optional URL where this document is published to the web. Prefer the LSST the Docs URL if possible. Example: ``'https://ldm-151.lsst.io'``. code_url : `str...
lsstprojectmeta/tex/lsstdoc.py
def build_jsonld(self, url=None, code_url=None, ci_url=None, readme_url=None, license_id=None): """Create a JSON-LD representation of this LSST LaTeX document. Parameters ---------- url : `str`, optional URL where this document is published to the web. P...
def build_jsonld(self, url=None, code_url=None, ci_url=None, readme_url=None, license_id=None): """Create a JSON-LD representation of this LSST LaTeX document. Parameters ---------- url : `str`, optional URL where this document is published to the web. P...
[ "Create", "a", "JSON", "-", "LD", "representation", "of", "this", "LSST", "LaTeX", "document", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/lsstdoc.py#L691-L768
[ "def", "build_jsonld", "(", "self", ",", "url", "=", "None", ",", "code_url", "=", "None", ",", "ci_url", "=", "None", ",", "readme_url", "=", "None", ",", "license_id", "=", "None", ")", ":", "jsonld", "=", "{", "'@context'", ":", "[", "\"https://raw....
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
PostgresDB.rename
Renames an existing database.
pydba/postgres.py
def rename(self, from_name, to_name): """Renames an existing database.""" log.info('renaming database from %s to %s' % (from_name, to_name)) self._run_stmt('alter database %s rename to %s' % (from_name, to_name))
def rename(self, from_name, to_name): """Renames an existing database.""" log.info('renaming database from %s to %s' % (from_name, to_name)) self._run_stmt('alter database %s rename to %s' % (from_name, to_name))
[ "Renames", "an", "existing", "database", "." ]
drkjam/pydba
python
https://github.com/drkjam/pydba/blob/986c4b1315d6b128947c3bc3494513d8e5380ff0/pydba/postgres.py#L148-L151
[ "def", "rename", "(", "self", ",", "from_name", ",", "to_name", ")", ":", "log", ".", "info", "(", "'renaming database from %s to %s'", "%", "(", "from_name", ",", "to_name", ")", ")", "self", ".", "_run_stmt", "(", "'alter database %s rename to %s'", "%", "("...
986c4b1315d6b128947c3bc3494513d8e5380ff0
valid
PostgresDB.connections
Returns a list of existing connections to the named database.
pydba/postgres.py
def connections(self, name): """Returns a list of existing connections to the named database.""" stmt = """ select {fields} from pg_stat_activity where datname = {datname!r} and pid <> pg_backend_pid() """.format(fields=', '.join(CONNECTION_FIELDS), datname=name) ...
def connections(self, name): """Returns a list of existing connections to the named database.""" stmt = """ select {fields} from pg_stat_activity where datname = {datname!r} and pid <> pg_backend_pid() """.format(fields=', '.join(CONNECTION_FIELDS), datname=name) ...
[ "Returns", "a", "list", "of", "existing", "connections", "to", "the", "named", "database", "." ]
drkjam/pydba
python
https://github.com/drkjam/pydba/blob/986c4b1315d6b128947c3bc3494513d8e5380ff0/pydba/postgres.py#L153-L159
[ "def", "connections", "(", "self", ",", "name", ")", ":", "stmt", "=", "\"\"\"\n select {fields} from pg_stat_activity\n where datname = {datname!r} and pid <> pg_backend_pid()\n \"\"\"", ".", "format", "(", "fields", "=", "', '", ".", "join", "(", ...
986c4b1315d6b128947c3bc3494513d8e5380ff0
valid
PostgresDB.available
Returns True if database server is running, False otherwise.
pydba/postgres.py
def available(self, timeout=5): """Returns True if database server is running, False otherwise.""" host = self._connect_args['host'] port = self._connect_args['port'] try: sock = socket.create_connection((host, port), timeout=timeout) sock.close() retu...
def available(self, timeout=5): """Returns True if database server is running, False otherwise.""" host = self._connect_args['host'] port = self._connect_args['port'] try: sock = socket.create_connection((host, port), timeout=timeout) sock.close() retu...
[ "Returns", "True", "if", "database", "server", "is", "running", "False", "otherwise", "." ]
drkjam/pydba
python
https://github.com/drkjam/pydba/blob/986c4b1315d6b128947c3bc3494513d8e5380ff0/pydba/postgres.py#L170-L180
[ "def", "available", "(", "self", ",", "timeout", "=", "5", ")", ":", "host", "=", "self", ".", "_connect_args", "[", "'host'", "]", "port", "=", "self", ".", "_connect_args", "[", "'port'", "]", "try", ":", "sock", "=", "socket", ".", "create_connectio...
986c4b1315d6b128947c3bc3494513d8e5380ff0
valid
PostgresDB.dump
Saves the state of a database to a file. Parameters ---------- name: str the database to be backed up. filename: str path to a file where database backup will be written.
pydba/postgres.py
def dump(self, name, filename): """ Saves the state of a database to a file. Parameters ---------- name: str the database to be backed up. filename: str path to a file where database backup will be written. """ if not self.exists(n...
def dump(self, name, filename): """ Saves the state of a database to a file. Parameters ---------- name: str the database to be backed up. filename: str path to a file where database backup will be written. """ if not self.exists(n...
[ "Saves", "the", "state", "of", "a", "database", "to", "a", "file", "." ]
drkjam/pydba
python
https://github.com/drkjam/pydba/blob/986c4b1315d6b128947c3bc3494513d8e5380ff0/pydba/postgres.py#L182-L197
[ "def", "dump", "(", "self", ",", "name", ",", "filename", ")", ":", "if", "not", "self", ".", "exists", "(", "name", ")", ":", "raise", "DatabaseError", "(", "'database %s does not exist!'", ")", "log", ".", "info", "(", "'dumping %s to %s'", "%", "(", "...
986c4b1315d6b128947c3bc3494513d8e5380ff0
valid
PostgresDB.restore
Loads state of a backup file to a database. Note ---- If database name does not exist, it will be created. Parameters ---------- name: str the database to which backup will be restored. filename: str path to a file contain a postgres data...
pydba/postgres.py
def restore(self, name, filename): """ Loads state of a backup file to a database. Note ---- If database name does not exist, it will be created. Parameters ---------- name: str the database to which backup will be restored. filename:...
def restore(self, name, filename): """ Loads state of a backup file to a database. Note ---- If database name does not exist, it will be created. Parameters ---------- name: str the database to which backup will be restored. filename:...
[ "Loads", "state", "of", "a", "backup", "file", "to", "a", "database", "." ]
drkjam/pydba
python
https://github.com/drkjam/pydba/blob/986c4b1315d6b128947c3bc3494513d8e5380ff0/pydba/postgres.py#L199-L219
[ "def", "restore", "(", "self", ",", "name", ",", "filename", ")", ":", "if", "not", "self", ".", "exists", "(", "name", ")", ":", "self", ".", "create", "(", "name", ")", "else", ":", "log", ".", "warn", "(", "'overwriting contents of database %s'", "%...
986c4b1315d6b128947c3bc3494513d8e5380ff0
valid
PostgresDB.connection_dsn
Provides a connection string for database. Parameters ---------- name: str, optional an override database name for the connection string. Returns ------- str: the connection string (e.g. 'dbname=db1 user=user1 host=localhost port=5432')
pydba/postgres.py
def connection_dsn(self, name=None): """ Provides a connection string for database. Parameters ---------- name: str, optional an override database name for the connection string. Returns ------- str: the connection string (e.g. 'dbname=db1 us...
def connection_dsn(self, name=None): """ Provides a connection string for database. Parameters ---------- name: str, optional an override database name for the connection string. Returns ------- str: the connection string (e.g. 'dbname=db1 us...
[ "Provides", "a", "connection", "string", "for", "database", "." ]
drkjam/pydba
python
https://github.com/drkjam/pydba/blob/986c4b1315d6b128947c3bc3494513d8e5380ff0/pydba/postgres.py#L243-L256
[ "def", "connection_dsn", "(", "self", ",", "name", "=", "None", ")", ":", "return", "' '", ".", "join", "(", "\"%s=%s\"", "%", "(", "param", ",", "value", ")", "for", "param", ",", "value", "in", "self", ".", "_connect_options", "(", "name", ")", ")"...
986c4b1315d6b128947c3bc3494513d8e5380ff0
valid
PostgresDB.connection_url
Provides a connection string for database as a sqlalchemy compatible URL. NB - this doesn't include special arguments related to SSL connectivity (which are outside the scope of the connection URL format). Parameters ---------- name: str, optional an override databa...
pydba/postgres.py
def connection_url(self, name=None): """ Provides a connection string for database as a sqlalchemy compatible URL. NB - this doesn't include special arguments related to SSL connectivity (which are outside the scope of the connection URL format). Parameters ---------- ...
def connection_url(self, name=None): """ Provides a connection string for database as a sqlalchemy compatible URL. NB - this doesn't include special arguments related to SSL connectivity (which are outside the scope of the connection URL format). Parameters ---------- ...
[ "Provides", "a", "connection", "string", "for", "database", "as", "a", "sqlalchemy", "compatible", "URL", "." ]
drkjam/pydba
python
https://github.com/drkjam/pydba/blob/986c4b1315d6b128947c3bc3494513d8e5380ff0/pydba/postgres.py#L258-L274
[ "def", "connection_url", "(", "self", ",", "name", "=", "None", ")", ":", "return", "'postgresql://{user}@{host}:{port}/{dbname}'", ".", "format", "(", "*", "*", "{", "k", ":", "v", "for", "k", ",", "v", "in", "self", ".", "_connect_options", "(", "name", ...
986c4b1315d6b128947c3bc3494513d8e5380ff0
valid
PostgresDB.shell
Connects the database client shell to the database. Parameters ---------- expect_module: str the database to which backup will be restored.
pydba/postgres.py
def shell(self, expect=pexpect): """ Connects the database client shell to the database. Parameters ---------- expect_module: str the database to which backup will be restored. """ dsn = self.connection_dsn() log.debug('connection string: %s' ...
def shell(self, expect=pexpect): """ Connects the database client shell to the database. Parameters ---------- expect_module: str the database to which backup will be restored. """ dsn = self.connection_dsn() log.debug('connection string: %s' ...
[ "Connects", "the", "database", "client", "shell", "to", "the", "database", "." ]
drkjam/pydba
python
https://github.com/drkjam/pydba/blob/986c4b1315d6b128947c3bc3494513d8e5380ff0/pydba/postgres.py#L276-L291
[ "def", "shell", "(", "self", ",", "expect", "=", "pexpect", ")", ":", "dsn", "=", "self", ".", "connection_dsn", "(", ")", "log", ".", "debug", "(", "'connection string: %s'", "%", "dsn", ")", "child", "=", "expect", ".", "spawn", "(", "'psql \"%s\"'", ...
986c4b1315d6b128947c3bc3494513d8e5380ff0
valid
PostgresDB.settings
Returns settings from the server.
pydba/postgres.py
def settings(self): """Returns settings from the server.""" stmt = "select {fields} from pg_settings".format(fields=', '.join(SETTINGS_FIELDS)) settings = [] for row in self._iter_results(stmt): row['setting'] = self._vartype_map[row['vartype']](row['setting']) se...
def settings(self): """Returns settings from the server.""" stmt = "select {fields} from pg_settings".format(fields=', '.join(SETTINGS_FIELDS)) settings = [] for row in self._iter_results(stmt): row['setting'] = self._vartype_map[row['vartype']](row['setting']) se...
[ "Returns", "settings", "from", "the", "server", "." ]
drkjam/pydba
python
https://github.com/drkjam/pydba/blob/986c4b1315d6b128947c3bc3494513d8e5380ff0/pydba/postgres.py#L293-L300
[ "def", "settings", "(", "self", ")", ":", "stmt", "=", "\"select {fields} from pg_settings\"", ".", "format", "(", "fields", "=", "', '", ".", "join", "(", "SETTINGS_FIELDS", ")", ")", "settings", "=", "[", "]", "for", "row", "in", "self", ".", "_iter_resu...
986c4b1315d6b128947c3bc3494513d8e5380ff0